shish 5 jaren geleden
bovenliggende
commit
fc7d4ab0b9

+ 36 - 34
app-ghs/controllers/ExpressController.php

@@ -29,68 +29,70 @@ class ExpressController extends BaseController
     //配送费预估
     public function actionPreAddOrder()
     {
+        util::success(['fee' => 16.5]);
+
         $post = Yii::$app->request->post();
-        $expressId = $post['expressId']??0;
-        $ghsItemInfo = $post['itemInfo']??'';
-        if(empty($ghsItemInfo)){
+        $expressId = $post['expressId'] ?? 0;
+        $ghsItemInfo = $post['itemInfo'] ?? '';
+        if (empty($ghsItemInfo)) {
             util::fail('请选择花材');
         }
-        $ghsItemInfo = json_decode($ghsItemInfo,true); // [{productId:0,itemPrice:1,bigNum:1,smallNum:0}]
+        $ghsItemInfo = json_decode($ghsItemInfo, true); // [{productId:0,itemPrice:1,bigNum:1,smallNum:0}]
 
         //计算总价格,总重量
         $cargoInfo = ProductService::groupCargo($ghsItemInfo);
 
         $shop_order_id = time();
         $shop_no = ""; //与快递签约时的门店ID(应该是固定的)
-        $openid  = $this->admin['miniOpenId'];
+        $openid = $this->admin['miniOpenId'];
 
         //客户id
-        $customId = $post['customId']??0;
+        $customId = $post['customId'] ?? 0;
         //获取客户name
         $customInfo = CustomService::getCustomInfo($customId);
         CustomClass::valid($customInfo, $this->sjId);
 
         //当前门店的地址信息
         $shopInfo = ShopService::getById($this->shopId);
-        $sender  =[
-            'name'=>$shopInfo['shopName'],
-            'city'=>$shopInfo['city']??'',
-            'address'=>$shopInfo['address']??'',
-            'address_detail'=>$shopInfo['floor']??'',
-            'phone'=>$shopInfo['telephone']??'',
-            'lng'=>(float)$shopInfo['long']??'',
-            'lat'=>(float)$shopInfo['lat']??'',
-            'coordinate_type'=>0,
+        $sender = [
+            'name' => $shopInfo['shopName'],
+            'city' => $shopInfo['city'] ?? '',
+            'address' => $shopInfo['address'] ?? '',
+            'address_detail' => $shopInfo['floor'] ?? '',
+            'phone' => $shopInfo['telephone'] ?? '',
+            'lng' => (float)$shopInfo['long'] ?? '',
+            'lat' => (float)$shopInfo['lat'] ?? '',
+            'coordinate_type' => 0,
         ];
 
         $receiver = [
-            'name'=>$customInfo['name'],
-            'city'=>$post['receiveCity']??'',
-            'address'=>$post['receiveAddress']??'',
-            'address_detail'=>$post['receiveFloor']??'',
+            'name' => $customInfo['name'],
+            'city' => $post['receiveCity'] ?? '',
+            'address' => $post['receiveAddress'] ?? '',
+            'address_detail' => $post['receiveFloor'] ?? '',
             //'phone'=>$customInfo['mobile']??'199121223333',
-            'phone'=>'18030142050',
-            'lng'=>(float)$post['receiveLong']??'118.134343',
-            'lat'=>(float)$post['receiveLat']??'24.491566',
-            'coordinate_type'=>0,
+            'phone' => '18030142050',
+            'lng' => (float)$post['receiveLong'] ?? '118.134343',
+            'lat' => (float)$post['receiveLat'] ?? '24.491566',
+            'coordinate_type' => 0,
         ];
         $cargo = [
-            'goods_value'=>$cargoInfo['totalPrice'], //总价格  元
-            'goods_weight'=>$cargoInfo['totalWeight'], //总重量 kg
-            'cargo_first_class'=>'鲜花',
-            'cargo_second_class'=>'鲜花',
+            'goods_value' => $cargoInfo['totalPrice'], //总价格  元
+            'goods_weight' => $cargoInfo['totalWeight'], //总重量 kg
+            'cargo_first_class' => '鲜花',
+            'cargo_second_class' => '鲜花',
         ];
         $orderInfo = [
-            'is_direct_delivery'=>1,//设置应该为1,只能直拿直送
+            'is_direct_delivery' => 1,//设置应该为1,只能直拿直送
         ];
         $shop = [
-            'wxa_path'=>'/shop',
-            'img_url'=>'http://www.baidu.com/test.png',
-            'goods_name'=>'鲜花',
-            'goods_count'=>count($ghsItemInfo),
+            'wxa_path' => '/shop',
+            'img_url' => 'http://www.baidu.com/test.png',
+            'goods_name' => '鲜花',
+            'goods_count' => count($ghsItemInfo),
         ];
-        $res =  MiniExpressService::preAddOrder($expressId,$shop_no,$shop_order_id,$openid,$sender,$receiver,$cargo,$orderInfo,$shop);
-        util::success(['fee'=>$res['fee']]);
+        $res = MiniExpressService::preAddOrder($expressId, $shop_no, $shop_order_id, $openid, $sender, $receiver, $cargo, $orderInfo, $shop);
+        util::success(['fee' => $res['fee']]);
     }
 
     //

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

@@ -437,6 +437,7 @@ class OrderClass extends BaseClass
         $orderSn = $order['orderSn'];
         self::updateById($orderId, $upData);
 
+        //增加业绩
         StatYjClass::addYj($order);
 
         //增加已下单流程

+ 1 - 1
biz-ghs/order/classes/OrderSendClass.php

@@ -71,7 +71,7 @@ class OrderSendClass extends BaseClass
 
         OrderClass::updateByCondition(['orderSn' => $orderSn], ['currentFlow' => 1]);
 
-        //制单未开始
+        //配送未开始
         $nextId = $relation['deliver'] ?? 0;
         if (empty($nextId)) {
             util::fail('下单后没有找到下一步的流程ID');

+ 2 - 0
biz-ghs/stat/classes/StatYjClass.php

@@ -21,6 +21,7 @@ class StatYjClass extends BaseClass
         if (empty($list)) {
             return $data;
         }
+        $arr = [];
         foreach ($data['list'] as $key => $val) {
             $shopAdminId = $val['shopAdminId'];
             if (isset($arr[$shopAdminId]) == false) {
@@ -49,6 +50,7 @@ class StatYjClass extends BaseClass
         return $show;
     }
 
+    //增加业绩 shish 2021.3.20
     public static function addYj($order, $date = null)
     {
         $shopAdminId = $order['shopAdminId'] ?? 0;