Browse Source

券包调整

gorden 2 months ago
parent
commit
a20e6d0a2e

+ 2 - 0
app/admin/controller/coupon/CouponPacketController.php

@@ -379,6 +379,7 @@ class CouponPacketController extends Curd
         } catch (\Exception $e) {
             Db::rollBack();
 
+            dump($e->getMessage());
             return json_fail("发行失败");
         }
     }
@@ -417,6 +418,7 @@ class CouponPacketController extends Curd
                 CouponPacketSequence::insert($insertData);
             }
         } catch (\Exception $e) {
+            dump($e->getMessage());
             throw new BusinessException("发行失败");
         }
     }

+ 11 - 11
app/admin/controller/coupon/CouponPacketSequenceController.php

@@ -170,20 +170,20 @@ class CouponPacketSequenceController extends Curd
             }
         ])->where('coupon_packet_sequence_id', $packetSequenceId)
             ->first();
-        if(!empty($sequence->packet)){
-            if ($sequence->packet->join_coupon_packet_dept_id == 0){
+        if (!empty($sequence->packet)) {
+            if ($sequence->packet->join_coupon_packet_dept_id == 0) {
                 $sequence->packet->dept_name = '所有门店';
-            }else{
+            } else {
                 $sequence->packet->dept_nam = '';
-                $dept = SysDept::where('dept_id',$sequence->packet->join_coupon_packet_dept_id)->select('dept_id','dept_name')->first();
-                if (!empty($dept)){
+                $dept = SysDept::where('dept_id', $sequence->packet->join_coupon_packet_dept_id)->select('dept_id', 'dept_name')->first();
+                if (!empty($dept)) {
                     $sequence->packet->dept_name = $dept->dept_name;
                 }
             }
-            if (!empty($sequence->packet->join_coupon_packet_category_id)){
-                $category = SysCategory::where('category_id',$sequence->packet->join_coupon_packet_category_id)
+            if (!empty($sequence->packet->join_coupon_packet_category_id)) {
+                $category = SysCategory::where('category_id', $sequence->packet->join_coupon_packet_category_id)
                     ->first();
-                if (!empty($category->category_name)){
+                if (!empty($category->category_name)) {
                     $sequence->packet->category_name = $category->category_name;
                 }
             }
@@ -194,7 +194,7 @@ class CouponPacketSequenceController extends Curd
             if (isset($sequenceJson['coupons'])) {
                 $couponIds = array_keys($sequenceJson['coupons']);
                 $couponModel = Coupon::whereIn('coupon_id', $couponIds)
-                    ->select('coupon_id', 'coupon_name','coupon_classify','coupon_value','coupon_minimum_limit','coupon_category')
+                    ->select('coupon_id', 'coupon_name', 'coupon_classify', 'coupon_value', 'coupon_minimum_limit', 'coupon_category')
                     ->get()
                     ->toArray();
                 foreach ($couponModel as $coupon) {
@@ -204,8 +204,8 @@ class CouponPacketSequenceController extends Curd
                                 'id' => $key,
                                 'name' => $coupon['coupon_name'],
                                 'nbr' => $jsonCoupon['num'],
-                                'classify'=>$coupon['coupon_classify'],
-                                'info'=>CouponService::couponClassifyInfo($coupon['coupon_classify'],$coupon['coupon_category'],$coupon['coupon_value'],$coupon['coupon_minimum_limit'])
+                                'classify' => $coupon['coupon_classify'],
+                                'info' => CouponService::couponClassifyInfo($coupon['coupon_classify'], $coupon['coupon_category'], $coupon['coupon_value'], $coupon['coupon_minimum_limit'])
                             ];
                         }
                     }