Kirin 2 éve
szülő
commit
e557acc64b

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

@@ -166,7 +166,7 @@ class StoreOrderController
      */
     public function create(Request $request, $key)
     {
-        @file_put_contents('order.txt', '【1】' . time() . PHP_EOL, FILE_APPEND);
+//        @file_put_contents('order.txt', '【1】' . time() . PHP_EOL, FILE_APPEND);
         if (!$key) return app('json')->fail('参数错误!');
         $uid = $request->uid();
         if (StoreOrder::be(['order_id|unique' => $key, 'uid' => $uid, 'is_del' => 0]))
@@ -202,7 +202,7 @@ class StoreOrderController
             $isChannel = 2;
 
         $order = StoreOrder::cacheKeyCreateOrder($request->uid(), $key, $addressId, $payType, (int)$useIntegral, $couponId, $mark, $combinationId, $pinkId, $seckill_id, $bargainId, false, $isChannel, $shipping_type, $real_name, $phone, $storeId, $is_consumer);
-        @file_put_contents('order.txt', '【2】' . time() . PHP_EOL, FILE_APPEND);
+//        @file_put_contents('order.txt', '【2】' . time() . PHP_EOL, FILE_APPEND);
         if ($order === false) return app('json')->fail(StoreOrder::getErrorInfo('订单生成失败'));
         $orderId = $order['order_id'];
         $info = compact('orderId', 'key');
@@ -244,7 +244,7 @@ class StoreOrderController
                     }
                     break;
                 case 'yue':
-                    @file_put_contents('order.txt', '【3】' . time() . PHP_EOL, FILE_APPEND);
+//                    @file_put_contents('order.txt', '【3】' . time() . PHP_EOL, FILE_APPEND);
                     if (StoreOrder::yuePay($orderId, $request->uid(), $formId))
                         return app('json')->status('success', '余额支付成功', $info);
                     else {

+ 17 - 5
app/models/store/StoreOrder.php

@@ -713,7 +713,7 @@ class StoreOrder extends BaseModel
 
         $res1 = false !== User::bcDec($uid, 'now_money', $orderInfo['pay_price'], 'uid');
         $res2 = UserBill::expend('购买商品', $uid, 'now_money', 'pay_product', $orderInfo['pay_price'], $orderInfo['id'], $userInfo['now_money'], '余额支付' . floatval($orderInfo['pay_price']) . '元购买商品');
-        @file_put_contents('order.txt', '【4】' . time() . PHP_EOL, FILE_APPEND);
+//        @file_put_contents('order.txt', '【4】' . time() . PHP_EOL, FILE_APPEND);
         $res3 = self::paySuccess($order_id, 'yue', $formId);//余额支付成功
         try {
             PaymentRepositories::yuePayProduct($userInfo, $orderInfo);
@@ -855,9 +855,9 @@ class StoreOrder extends BaseModel
         $res2 = true;
         $user = User::where('uid', $order['uid'])->find();
         if (($order['suit'] > 0 || $order['is_bind'] > 0) && !$user['lock_spread'] && $user['spread_uid']) User::where('uid', $order['uid'])->update(['lock_spread' => 1]);
-        @file_put_contents('order.txt', '【6】' . time() . PHP_EOL, FILE_APPEND);
+//        @file_put_contents('order.txt', '【6】' . time() . PHP_EOL, FILE_APPEND);
         $res2 = $res2 && self::addSuit($order);
-        @file_put_contents('order.txt', '【7】' . time() . PHP_EOL, FILE_APPEND);
+//        @file_put_contents('order.txt', '【7】' . time() . PHP_EOL, FILE_APPEND);
         $res2 = $res2 && StoreOrder::sendSuit($order);
         @file_put_contents('order.txt', '【8】' . time() . PHP_EOL, FILE_APPEND);
         $res2 = $res2 && StoreOrder::sendGroupAward($order);
@@ -2498,7 +2498,7 @@ class StoreOrder extends BaseModel
         if (isset($order['combination_id']) && $order['combination_id']) return true;
         if (isset($order['seckill_id']) && $order['seckill_id']) return true;
         if (isset($order['bargain_id']) && $order['bargain_id']) return true;
-
+        @file_put_contents('order.txt', '【8.1】' . time() . PHP_EOL, FILE_APPEND);
         $userInfo = User::getUserInfo($order['uid']);
         $spread = User::getUserInfo($userInfo['spread_uid']);
 //        if (StoreOrder::where('uid', $order['uid'])->where('paid', 1)->where('refund_status', 0)->where('is_del', 0)->where('is_system_del', 0)
@@ -2529,8 +2529,10 @@ class StoreOrder extends BaseModel
                 }
             }
         }
+        @file_put_contents('order.txt', '【8.2】' . time() . PHP_EOL, FILE_APPEND);
         $res = true;
         $suit_recommend = sys_config('suit_recommend', 0, true);
+        @file_put_contents('order.txt', '【8.3】' . time() . PHP_EOL, FILE_APPEND);
         if ($spread) {
             //推荐奖
             $brokeragePrice = bcmul($suit_recommend, $suit - $suit_exit, 2);
@@ -2542,7 +2544,7 @@ class StoreOrder extends BaseModel
                 $spread['brokerage_price'] = bcadd($spread['brokerage_price'], $brokeragePrice, 2);
             }
         }
-
+        @file_put_contents('order.txt', '【8.4】' . time() . PHP_EOL, FILE_APPEND);
         $send = 0;
         $send_normal = 0;
         $layer = 1;
@@ -2553,10 +2555,12 @@ class StoreOrder extends BaseModel
         foreach ($layer_award as $v) {
             $layer_award_real[$v['layer']] = $v;
         }
+        @file_put_contents('order.txt', '【8.5】' . time() . PHP_EOL, FILE_APPEND);
         while ($spread) {
             $group_level = SystemGroupLevel::get($spread['group_level']);
             $award_level = SystemGroupLevel::get($spread['award_level']);
             $balance = $spread['brokerage_price'];
+            @file_put_contents('order.txt', '【8.6】' . time() . PHP_EOL, FILE_APPEND);
             if ($suit) {
                 $award_group = $group_level['suit_award'] ?? 0;
                 $award_award = $award_level['suit_award'] ?? 0;
@@ -2577,11 +2581,13 @@ class StoreOrder extends BaseModel
                         $send = $brokeragePrice;
                     }
                 }
+                @file_put_contents('order.txt', '【8.7】' . time() . PHP_EOL, FILE_APPEND);
                 if ($group_level['company_award'] > 0 || $award_level['company_award'] > 0 && !$company_award) {
                     $ratio = ($group_level['company_award'] > $award_level['company_award'] ? $group_level['company_award'] : $award_level['company_award']);
                     $spread_up = User::where('uid', $spread['spread_uid'])->find();
                     $group_levels = SystemGroupLevel::where('company_award', '>', 0)->column('id');
                     $award_levels = SystemAwardLevel::where('company_award', '>', 0)->column('id');
+                    @file_put_contents('order.txt', '【8.8】' . time() . PHP_EOL, FILE_APPEND);
                     while ($spread_up) {
                         if (in_array($spread_up['group_level'], $group_levels) || in_array($spread_up['award_level'], $award_levels)) {
                             $ratio -= 1;
@@ -2589,6 +2595,7 @@ class StoreOrder extends BaseModel
                         }
                         $spread_up = User::where('uid', $spread_up['uid'])->find();
                     }
+                    @file_put_contents('order.txt', '【8.9】' . time() . PHP_EOL, FILE_APPEND);
                     $c = [];
                     $p = [$spread['uid']];
                     while ($p) {
@@ -2609,6 +2616,7 @@ class StoreOrder extends BaseModel
                         }
                         $p = User::where('spread_uid', 'in', $p)->where('uid', 'not in', $child)->column('uid');
                     }
+                    @file_put_contents('order.txt', '【8.10】' . time() . PHP_EOL, FILE_APPEND);
                     $ratio += count(array_unique($c));
                     if ($ratio > 0) {
                         $op_award = bcmul($suit_price, bcdiv($ratio, 100, 4), 2);
@@ -2619,8 +2627,10 @@ class StoreOrder extends BaseModel
                             $balance = bcadd($balance, $op_award, 2);
                         }
                     }
+                    @file_put_contents('order.txt', '【8.11】' . time() . PHP_EOL, FILE_APPEND);
                     $company_award = true;
                 }
+                @file_put_contents('order.txt', '【8.12】' . time() . PHP_EOL, FILE_APPEND);
                 if ($group_level['operate_award'] > 0 || $award_level['operate_award'] > 0 && !$operate_award) {
                     $ratio = ($group_level['operate_award'] > $award_level['operate_award'] ? $group_level['operate_award'] : $award_level['operate_award']);
                     if ($ratio > 0) {
@@ -2634,6 +2644,7 @@ class StoreOrder extends BaseModel
                     }
                     $operate_award = true;
                 }
+                @file_put_contents('order.txt', '【8.13】' . time() . PHP_EOL, FILE_APPEND);
             }
             $lay_award = $layer_award_real[$layer] ?? null;
             if ($lay_award) {
@@ -2696,6 +2707,7 @@ class StoreOrder extends BaseModel
 //            }
             $spread = User::getUserInfo($spread['spread_uid']);
         }
+        @file_put_contents('order.txt', '【8.14】' . time() . PHP_EOL, FILE_APPEND);
         return $res;
     }