shish vor 11 Monaten
Ursprung
Commit
707d72de00

+ 0 - 96
app-hd/controllers/PurchaseController.php

@@ -1311,102 +1311,6 @@ class PurchaseController extends BaseController
     {
         //lqh 2021.6.25 运费固定返回0
         util::success(['sedCost' => 0]);
-        $post = Yii::$app->request->post();
-        $ghsId = $post['ghsId'] ?? 0;
-        //供货商
-        $ghsInfo = GhsClass::getById($ghsId);
-
-        if (empty($ghsInfo)) {
-            util::fail('没有找到供货商');
-        }
-        //花材信息
-        $productJson = $post['product'] ?? '';
-        // $productJson = '[{"productId":31993,"bigNum":1,"smallNum":0}]';
-        if (empty($productJson)) {
-            util::fail('请选择花材');
-        }
-        $productList = json_decode($productJson, true);
-        if (empty($productList)) {
-            util::fail('请选择花材25');
-        }
-
-        $productList = PurchaseClass::mergeItemInfo($productList);
-        $weight = 0;
-        $price = 0;
-        $productData = ProductClass::getProductMapData($productList);
-        $bigNum = 0;
-        foreach ($productList as $key => $val) {
-            $productId = $val['productId'];
-            $w = ProductClass::getWeight($val['productId'], $val['bigNum'], $val['smallNum']);
-            $bigNum += $val['bigNum'];
-            $weight = bcadd($w, $weight, 2);
-            $ratio = $productData[$productId]['ratio'] ?? 0;
-            //大小数量合并多少扎
-            $itemNum = ProductClass::mergeItemNum($val['bigNum'], $val['smallNum'], $ratio);
-            //售卖价格
-            $itemPrice = $productData[$productId]['price'] ?? 0;
-            //合计价格
-            $price = bcadd($price, bcmul($itemNum, $itemPrice, 2), 2);
-        }
-        $ghsShopId = $ghsInfo['shopId'] ?? 0;
-        $ghsSjId = $ghsInfo['sjId'] ?? 0;
-
-        $sendTime = $post['sendTime'] ?? '';
-        if (!empty($sendTime)) {
-            //配送时间不为空
-            // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
-            $sendTimeInt = strtotime($sendTime);
-            $now = time();
-            $diff = $sendTimeInt - $now;
-            //因服务器写入时间,改为至少提前6分钟
-            if ($diff <= 360) {
-                util::fail('配送时间至少提前6分钟');
-            }
-            $sendTime = date('Y-m-d H:i', strtotime($sendTime));
-        } else {
-            $sendTime = date('Y-m-d H:i', strtotime("+30 minute"));
-        }
-
-        //找供货商的客户信息,用里面的配送相关地址信息
-        $customId = $ghsInfo['customId'] ?? 0;
-        $customInfo = CustomClass::getById($customId);
-        if (empty($customInfo)) {
-            util::fail('没有找到客户');
-        }
-
-        //判断商家是否开启达达,若未开启,则使用自定义运费计算
-        $shopNo = ShopExpressClass::getShopNo($ghsSjId, $ghsShopId);
-        if (!$shopNo) {
-            //使用自定义运费
-            //util::fail('供货商暂未开通配送');
-            $cost = freight::getCost($ghsInfo['lat'], $ghsInfo['long'], $customInfo['lat'], $customInfo['long'], $weight);
-            util::success(['sedCost' => $cost]);
-        }
-        //组装订单信息
-        $info = [];
-        //发送放的商家信息,即供货商的相关信息
-        $info['sjId'] = $ghsSjId;
-        $info['shopId'] = $ghsShopId;
-        $info['actPrice'] = $price;//价格
-        $info['weight'] = $weight;
-        $info['orderSn'] = \common\components\orderSn::getGhsOrderSn();
-        $info['bigNum'] = $bigNum;
-
-        //配送地址,当前零售端的门店地址
-        $info['customName'] = $customInfo['name'] ?? '';
-        $info['customMobile'] = $customInfo['mobile'] ?? '';
-        $info['province'] = $customInfo['province'] ?? '';
-        $info['city'] = $customInfo['city'] ?? '';;
-        $info['address'] = $customInfo['address'] ?? '';;
-        $info['floor'] = $customInfo['floor'] ?? '';;
-        $info['fullAddress'] = $customInfo['fullAddress'] ?? '';;
-        $info['lat'] = $customInfo['lat'] ?? '';;
-        $info['long'] = $customInfo['long'] ?? '';;
-        $info['sendTime'] = $sendTime;
-
-        $res = DadaExpressServices::queryDeliverFee($info);
-        util::success(['sedCost' => $res['fee']]);
-
     }
 
 }

+ 7 - 1
biz-ghs/order/classes/OrderClass.php

@@ -782,7 +782,13 @@ class OrderClass extends BaseClass
     //添加订单 ssh 2019.12.5
     public static function addOrder($data)
     {
-        $orderSn = orderSn::getGhsOrderSn();
+        $shopId = $data['shopId'] ?? 0;
+        $mainId = $data['mainId'] ?? 0;
+        $ghsId = $data['ghsId'] ?? 0;
+        $customId = $data['customId'] ?? 0;
+        $snData = ['shopId' => $shopId, 'mainId' => $mainId, 'ghsId' => $ghsId, 'customId' => $customId];
+        $orderSn = orderSn::getGhsOrderSn($snData);
+
         $data['orderSn'] = $orderSn;
         $data['payStatus'] = self::PAY_STATUS_UN_PAY;
         $data['customId'] = isset($data['customId']) && !empty($data['customId']) ? $data['customId'] : 0;

+ 3 - 2
common/components/orderSn.php

@@ -95,13 +95,14 @@ class orderSn
     }
 
     //供货商订单号生成 ssh 2021.1.19
-    public static function getGhsOrderSn()
+    public static function getGhsOrderSn($params = [])
     {
         $prefix = 'XSD_CS';
         if (getenv('YII_ENV', 'local') == 'production') {
             $prefix = 'XSD';
         }
-        $respond = OrderSnClass::add(['id' => null]);
+        $params['id'] = null;
+        $respond = OrderSnClass::add($params);
         $id = $respond['id'] ?? 0;
         if (empty($id)) {
             util::fail('订单号没有生成');