Browse Source

开单与订单列表

shish 5 years ago
parent
commit
0c57c959e2
2 changed files with 27 additions and 24 deletions
  1. 25 23
      app-ghs/controllers/OrderController.php
  2. 2 1
      sql.sql

+ 25 - 23
app-ghs/controllers/OrderController.php

@@ -87,6 +87,8 @@ class OrderController extends BaseController
         }
 
         $post['shopAdminId'] = $this->shopAdminId;
+        $shopAdmin = $this->shopAdmin;
+        $post['shopAdminName'] = $shopAdmin['adminName'] ?? '';
         $post['shopId'] = $shopId;
         $post['payWay'] = $this->isWx == true ? 0 : 1;
         $post['merchantId'] = $this->sjId;
@@ -249,30 +251,30 @@ class OrderController extends BaseController
     {
         //2021.3.28 接入达达
         $get = Yii::$app->request->get();
-        $orderId = $get['id']??0; //订单ID
-        $customId = $get['customId']??0;
-        if(!empty($customId)){
+        $orderId = $get['id'] ?? 0; //订单ID
+        $customId = $get['customId'] ?? 0;
+        if (!empty($customId)) {
             util::success(['sedCost' => 27]);
         }
-        $province = $get['province']??'';
-        $city = $get['city']??'';
-        $address = $get['address']??'';
-        $floor = $get['floor']??'';
-        $fullAddress = $province.$city.$address.$floor;
-        $sendTime = $get['sendTime']??'';
-        $lat = $get['lat']??'';
-        $lng = $get['long']??'';
-        if(empty($lat) || empty($lng) || empty($fullAddress)) {
+        $province = $get['province'] ?? '';
+        $city = $get['city'] ?? '';
+        $address = $get['address'] ?? '';
+        $floor = $get['floor'] ?? '';
+        $fullAddress = $province . $city . $address . $floor;
+        $sendTime = $get['sendTime'] ?? '';
+        $lat = $get['lat'] ?? '';
+        $lng = $get['long'] ?? '';
+        if (empty($lat) || empty($lng) || empty($fullAddress)) {
             util::fail('请选择配送地址');
         }
-        if(!empty($sendTime)){
+        if (!empty($sendTime)) {
             //配送时间不为空
             // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
             $sendTimeInt = strtotime($sendTime);
             $now = time();
             $diff = $sendTimeInt - $now;
             //因服务器写入时间,改为至少提前6分钟
-            if($diff <= 360){
+            if ($diff <= 360) {
                 util::fail('配送时间至少提前6分钟');
             }
         }
@@ -280,15 +282,15 @@ class OrderController extends BaseController
         $info = OrderClass::getOrderInfo($orderId);
         OrderClass::valid($info, $this->shopId);
         $expressAddInfo = [
-            'province'=>$province,
-            'city'=>$city,
-            'address'=>$address,
-            'floor'=>$floor,
-            'lat'=>$lat,
-            'long'=>$lng,
-            'sendTime'=>date('Y-m-d H:i', strtotime($sendTime)),
+            'province' => $province,
+            'city' => $city,
+            'address' => $address,
+            'floor' => $floor,
+            'lat' => $lat,
+            'long' => $lng,
+            'sendTime' => date('Y-m-d H:i', strtotime($sendTime)),
         ];
-        OrderClass::updateCustomExpressInfo($orderId,$expressAddInfo);
+        OrderClass::updateCustomExpressInfo($orderId, $expressAddInfo);
         //计算运费
         $info['province'] = $province;
         $info['city'] = $city;
@@ -318,7 +320,7 @@ class OrderController extends BaseController
         } catch (\Exception $exception) {
             $transaction->rollBack();
             Yii::info("发快递操作报错:" . $exception->getMessage());
-            util::fail('操作失败'. $exception->getMessage());
+            util::fail('操作失败' . $exception->getMessage());
         }
     }
 

+ 2 - 1
sql.sql

@@ -1970,4 +1970,5 @@ ALTER TABLE xhGhsCustom ADD rechargeAmount DECIMAL(9,2) NOT NULL DEFAULT '0.00'
 ALTER TABLE xhCustom ADD rechargeAmount DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值' AFTER `buyNum`;
 ALTER TABLE xhCustom DROP COLUMN totalRecharge;
 ALTER TABLE xhCustom CHANGE `rechargeAmount` `recharge` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值';
-ALTER TABLE xhGhsCustom CHANGE `rechargeAmount` `recharge` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值';
+ALTER TABLE xhGhsCustom CHANGE `rechargeAmount` `recharge` DECIMAL(9,2) NOT NULL DEFAULT '0.00' COMMENT '累计充值';
+ALTER TABLE xhGhsOrder ADD shopAdminName VARCHAR(100) NOT NULL DEFAULT '' COMMENT '员工名称' AFTER `shopAdminId`;