hrjy 3 years ago
parent
commit
653f0a5a77

+ 1 - 1
app/api/controller/order/StoreOrderController.php

@@ -713,7 +713,7 @@ class StoreOrderController
         try {
         try {
             Db::startTrans();
             Db::startTrans();
             $order->save();
             $order->save();
-            StoreCouponUser::where('order_id', $order['order_id'])->update(['uid' => $data['uid']]);
+            StoreCouponUser::where('order_id', $order['order_id'])->where('uid', $request->uid())->update(['uid' => $data['uid']]);
             Db::commit();
             Db::commit();
             return app('json')->success('转赠成功');
             return app('json')->success('转赠成功');
         } catch (\Exception $e) {
         } catch (\Exception $e) {

+ 8 - 8
app/models/store/StoreOrder.php

@@ -857,10 +857,10 @@ class StoreOrder extends BaseModel
                 $order['status'] = 3;
                 $order['status'] = 3;
                 $order['use'] = 1;
                 $order['use'] = 1;
                 $order->save();
                 $order->save();
-                if ($user['spread_uid']) self::superior_push($user['spread_uid']);
+                if ($user['spread_uid']) self::superior_push($user['spread_uid'],$user['nickname']);
                 if ($user['level'] < 2) $user['level'] = 2;
                 if ($user['level'] < 2) $user['level'] = 2;
             }else if ($product['price'] == 399 and $product['cate_id'] == 2){
             }else if ($product['price'] == 399 and $product['cate_id'] == 2){
-                if ($user['spread_uid']) self::superior($user['spread_uid']);
+                if ($user['spread_uid']) self::superior($user['spread_uid'],$user['nickname']);
                 if ($user['level'] < 1) $user['level'] = 1;
                 if ($user['level'] < 1) $user['level'] = 1;
             }
             }
             $user->save();
             $user->save();
@@ -875,7 +875,7 @@ class StoreOrder extends BaseModel
      * @throws DbException
      * @throws DbException
      * @throws ModelNotFoundException
      * @throws ModelNotFoundException
      */
      */
-    public static function superior_push($uid)
+    public static function superior_push($uid,$nickname)
     {
     {
         $top1 = User::where('uid', $uid)->find(); // 一级上级
         $top1 = User::where('uid', $uid)->find(); // 一级上级
 
 
@@ -884,14 +884,14 @@ class StoreOrder extends BaseModel
             $top1['brokerage_price'] += 1200;//直推
             $top1['brokerage_price'] += 1200;//直推
             if ($top1['level'] == 2){
             if ($top1['level'] == 2){
                 $top1->save();
                 $top1->save();
-                UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', 1200, 0, $top1['brokerage_price'], '直推2999礼包奖励');
+                UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', 1200, 0, $top1['brokerage_price'], '用户'.$nickname.'购买礼包,直推2999礼包奖励');
             }
             }
         }
         }
         if ($top2) {
         if ($top2) {
             $top2['brokerage_price'] += 600;//间推
             $top2['brokerage_price'] += 600;//间推
             if ($top2['level'] == 2){
             if ($top2['level'] == 2){
                 $top2->save();
                 $top2->save();
-                UserBill::income('佣金', $top2['uid'], 'now_money', 'brokerage', 600, 0, $top2['brokerage_price'], '间推2999礼包奖励');
+                UserBill::income('佣金', $top2['uid'], 'now_money', 'brokerage', 600, 0, $top2['brokerage_price'], '用户'.$nickname.'购买礼包,间推2999礼包奖励');
             }
             }
         }
         }
 
 
@@ -906,7 +906,7 @@ class StoreOrder extends BaseModel
      * @throws DbException
      * @throws DbException
      * @throws ModelNotFoundException
      * @throws ModelNotFoundException
      */
      */
-    public static function superior($uid)
+    public static function superior($uid,$nickname)
     {
     {
         $top1 = User::where('uid', $uid)->find(); // 一级上级
         $top1 = User::where('uid', $uid)->find(); // 一级上级
         $price = 0;
         $price = 0;
@@ -926,13 +926,13 @@ class StoreOrder extends BaseModel
                         $top =   User::where('uid', $v)->find();
                         $top =   User::where('uid', $v)->find();
                         $top['brokerage_price'] += 90;
                         $top['brokerage_price'] += 90;
                         $top->save();
                         $top->save();
-                        UserBill::income('佣金', $top['uid'], 'now_money', 'brokerage', 90, 0, $top['brokerage_price'], '间推399礼包奖励');
+                        UserBill::income('佣金', $top['uid'], 'now_money', 'brokerage', 90, 0, $top['brokerage_price'], '用户'.$nickname.'购买礼包,间推399礼包奖励');
                     }
                     }
                 }
                 }
             }
             }
         }
         }
         $top1->save();
         $top1->save();
-        UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', $price, 0, $top1['brokerage_price'], '直推399礼包奖励');
+        UserBill::income('佣金', $top1['uid'], 'now_money', 'brokerage', $price, 0, $top1['brokerage_price'], '用户'.$nickname.'购买礼包,直推399礼包奖励');
 
 
     }
     }