shish 1 年間 前
コミット
549f6365ac

+ 0 - 4
app-ghs/controllers/OrderController.php

@@ -1146,10 +1146,6 @@ class OrderController extends BaseController
             $hasTime = dict::getDict('order_pay_has_time');
             $totalTime = bcadd($time, $hasTime);
             $post['deadline'] = date("Y-m-d H:i:s", $totalTime);
-            echo "<pre>";
-            echo $hasPay;
-            print_r($post);
-            die;
             $return = OrderService::createFinishOrder($post, $custom, $hasPay);
             $transaction->commit();
 

+ 44 - 6
console/controllers/LiveOrderController.php

@@ -4,7 +4,10 @@ namespace console\controllers;
 
 use biz\shop\classes\ShopClass;
 use bizGhs\live\classes\LiveOrderClass;
+use bizGhs\live\classes\LiveOrderCustomClass;
 use common\components\noticeUtil;
+use bizGhs\custom\classes\CustomClass;
+use bizGhs\order\services\OrderService;
 use yii\console\Controller;
 use Yii;
 
@@ -34,21 +37,56 @@ class LiveOrderController extends Controller
             $transaction = $connection->beginTransaction();
             try {
 
-                $list = LiveOrderClass::getAllByCondition(['mainId' => $mainId,'switchOrder'=>0], null, '*', null, true);
+                $list = LiveOrderClass::getAllByCondition(['mainId' => $mainId,'switchOrder'=>0], null, '*');
                 if(empty($list)){
                     continue;
                 }
-                $arr = [];
-                foreach ($list as $live) {
-                    $addTime = $live->addTime;
+                $customInfo = CustomClass::getAllByCondition(['ownMainId'=>$mainId],null,'*','id');
+                $total = [];
+                $format = [];
+                foreach ($list as $key => $live) {
+                    $addTime = $live['addTime'];
+                    $orderSn = $live['orderSn'];
+                    $itemId = $live['itemId'];
+                    $ptItemId = $live['ptItemId'];
                     $date = date("Y-m-d", strtotime($addTime));
-                    $arr[$date] = 1;
+                    $customList = LiveOrderCustomClass::getAllByCondition(['orderSn'=>$orderSn],null,'*');
+                    if(empty($customList)){
+                        continue;
+                    }
+                    $total[$date] = 1;
+                    foreach($customList as $k => $v){
+                        $customId = $v['customId']??0;
+                        $num = $v['num']??0;
+                        $unitPrice = $v['unitPrice']??0;
+                        $currentCustom = $customInfo[$customId]??[];
+                        if(empty($currentCustom)){
+                            throw new \Exception("出现不存在的客户 customId:{$customId}");
+                        }
+                        $format[$customId][] =[
+                            'productId'=>$itemId,
+                            'bigNum'=>$num,
+                            'itemId'=>$ptItemId,
+                            'smallNum'=>0,
+                            'price'=>$unitPrice,
+                        ];
+                    }
                 }
-                if (count($arr) > 1) {
+                if (count($total) > 1) {
                     noticeUtil::push($name." mainId:{$mainId} live order 有记录不是同一天的", '15280215347');
                     continue;
                 }
 
+                print_r($format);die;
+
+
+                $hasPay = 2;
+                $customId = 0;
+                $custom = CustomClass::getCustom($customId);
+                $post = [];
+                $post['shopId'] =0;
+                OrderService::createFinishOrder($post, $custom, $hasPay);
+
                 //转换完了之后要清货位号!!!!!!!!!
 
                 $transaction->commit();