Bläddra i källkod

储值卡产品、订单

gorden 20 timmar sedan
förälder
incheckning
e5860a7b6d
1 ändrade filer med 22 tillägg och 0 borttagningar
  1. 22 0
      app/admin/service/goods/CardService.php

+ 22 - 0
app/admin/service/goods/CardService.php

@@ -4,6 +4,7 @@ namespace app\admin\service\goods;
 
 use app\common\Tree;
 use app\model\Appointment;
+use app\model\CardMain;
 use app\model\Coupon;
 use app\model\Goods;
 use app\model\GoodsComponent;
@@ -832,6 +833,27 @@ class CardService
             }
             if (!empty($extendJson['card_main_id'])) {
                 $data['card_main_id'] = $extendJson['card_main_id'];
+                $cardMain = CardMain::with('category')->where('card_main_id', $extendJson['card_main_id'])->first();
+                if (!empty($cardMain) && !empty($cardMain->card_main_valid_mode)) {
+                    $validTerm = '';
+                    if ($cardMain->card_main_valid_mode == 'LONG') {
+                        $validTerm = '长期有效';
+                    } else if ($cardMain->card_main_valid_mode == 'DAYS') {
+                        $validTerm = $cardMain->card_main_valid_days ? $cardMain->card_main_valid_days . '天' : 0;
+                    } else if ($cardMain->card_main_valid_mode == 'DATE') {
+                        $validTerm = date('Y/m/d', strtotime($cardMain->card_main_valid_begin)) . '-' . date('Y/m/d', strtotime($cardMain->card_main_valid_end));
+                    }
+                    $data['card'][] = [
+                        'card_main_name' => $cardMain->card_main_name,
+                        'card_main_category' => !empty($cardMain->category) ? $cardMain->category->category_name : '--',
+                        'card_main_classify' => $cardMain->card_main_classify,
+                        'card_main_status' => $cardMain->card_main_status,
+                        'card_main_amount' => $cardMain->card_main_amount,
+                        'card_main_added' => $cardMain->card_main_added,
+                        'valid_term' => $validTerm,
+                        'card_main_addtimes' => date('Y-m-d H:i:s', strtotime($cardMain->card_main_addtimes))
+                    ];
+                }
             }
 
             $data['express_json'] = [];