Browse Source

Merge branch 'master' of git.huaml.com:zhh/huahuibao

shizhongqi 11 tháng trước cách đây
mục cha
commit
7b1478e719

+ 34 - 24
app-ghs/controllers/IntraCityController.php

@@ -373,8 +373,10 @@ class IntraCityController extends BaseController
         if ($result['errcode'] === 0) {
             util::success($result, "查询成功");
         } else {
-            Yii::error("运费查询失败:" . json_encode($result));
-            util::fail('查询失败');
+            $errMsg = $result['errmsg'] ?? '';
+            $errCode = $result['errcode'] ?? '';
+            noticeUtil::push("运费查询失败了:" . $errMsg . ",编号:" . $errCode, '15280215347');
+            util::fail('查询失败,编号8911');
         }
     }
 
@@ -390,11 +392,11 @@ class IntraCityController extends BaseController
         util::checkRepeatCommit($adminId, 4);
 
         $orderId = intval($post['orderId']);
-        $order = OrderClass::getById($orderId);
+        $order = OrderClass::getById($orderId, true);
         if (empty($order)) {
             util::fail('没有找到订单');
         }
-        if ($order['mainId'] != $this->mainId) {
+        if ($order->mainId != $this->mainId) {
             util::fail('不是你的订单');
         }
         $packageNum = $post['packageNum'] ?? 0;
@@ -405,22 +407,26 @@ class IntraCityController extends BaseController
         if ($weight <= 0) {
             util::fail('请填写重量');
         }
-        $actPrice = $order['actPrice'] ?? 0;
+        $actPrice = $order->actPrice ?? 0;
         if ($actPrice <= 0) {
             util::fail('订单没有价格,不能发跑腿');
         }
-        if ($order['status'] != 2) {
+        if ($order->status != 2) {
             util::fail('待发货订单才能发跑腿,请刷新页面');
         }
         // 不能创建配送的几种配送状态
         $notCanCreateSendStatus = [-1, 3];
-        if (!in_array($order['sendStatus'], $notCanCreateSendStatus)) {
+        if (!in_array($order->sendStatus, $notCanCreateSendStatus)) {
             util::fail('不能叫跑腿,请刷新页面');
         }
-
-        $sn = $order['orderSn'];
+        $cgId = $order->purchaseId ?? 0;
+        $cgInfo = PurchaseClass::getById($cgId, true);
+        if (empty($cgInfo)) {
+            util::fail('没有采购信息');
+        }
+        $sn = $order->orderSn;
         $itemInfo = OrderItemClass::getByCondition(['orderSn' => $sn], null, 'id, name, cover, num');
-        $num = intval($order['itemNum']);
+        $num = intval($order->itemNum);
         $itemList[] = [
             'item_name' => '花材',
             'item_pic_url' => imgUtil::groupImg($itemInfo['cover']) . "?x-oss-process=image/resize,m_fill,h_130,w_130",
@@ -433,13 +439,13 @@ class IntraCityController extends BaseController
             util::fail('你还没有开通跑腿功能');
         }
 
-        $cgId = $order['purchaseId'] ?? 0;
+        $cgId = $order->purchaseId ?? 0;
         if (empty($cgId)) {
             util::fail('没有找到采购信息');
         }
 
         $miniOpenId = '';
-        $customShopAdminId = $order['customShopAdminId'] ?? 0;
+        $customShopAdminId = $order->customShopAdminId ?? 0;
         if (!empty($customShopAdminId)) {
             $customStaff = StaffClass::getById($customShopAdminId, true);
             $customStaffAdminId = $customStaff->adminId ?? '';
@@ -471,17 +477,17 @@ class IntraCityController extends BaseController
         $snData = ['shopId' => $shopId, 'mainId' => $mainId];
         $storeOrderId = orderSn::getGhsExpressSn($snData);
 
-        $sendNum = $order['sendNum'] ?? '';
-        $customName = $order['customName'] ?? '';
+        $sendNum = $order->sendNum ?? '';
+        $customName = $order->customName ?? '';
         if (empty($customName)) {
             util::fail('客户名称无效');
         }
-        $customMobile = $order['customMobile'] ?? '';
+        $customMobile = $order->customMobile ?? '';
         if (empty($customMobile)) {
             util::fail('客户手机号无效');
         }
-        $long = $order['long'] ?? '';
-        $lat = $order['lat'] ?? '';
+        $long = $order->long ?? '';
+        $lat = $order->lat ?? '';
         if (empty($long) || empty($lat)) {
             util::fail('客户地址无效');
         }
@@ -527,13 +533,17 @@ class IntraCityController extends BaseController
                 'orderSeq' => $result['order_seq'] ?? ''
             ];
             GhsExpressOrderClass::add($data);
-            $updateData = [
-                'sendDistance' => $data['distance'],
-                'sendStatus' => 0,
-                'deliveryId' => $data['deliveryId'],
-            ];
-            //更新订单状态为配送中
-            OrderClass::updateById($orderId, $updateData);
+            $sendDistance = $data['distance'] ?? 0;
+            $deliveryId = $data['deliveryId'] ?? '';
+            //更新订单配送状态
+            $order->sendDistance = $sendDistance;
+            $order->sendStatus = 0;
+            $order->deliveryId = $deliveryId;
+            $order->save();
+            $cgInfo->sendDistance = $sendDistance;
+            $cgInfo->sendStatus = 0;
+            $cgInfo->deliveryId = $deliveryId;
+            $cgInfo->save();
             util::success(['fee' => $data['fee']], '订单创建成功');
         } else {
             noticeUtil::push("批发 -- " . $this->mainId . ",订单创建失败:" . json_encode($result));

+ 53 - 0
app-hd/controllers/BookController.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace hd\controllers;
+
+use common\components\book;
+use common\components\util;
+use Yii;
+
+class BookController extends BaseController
+{
+
+    public $guestAccess = ['list', 'detail', 'jd-list'];
+
+    //教程列表 ssh 20211206
+    public function actionList()
+    {
+        $list = book::$list;
+        util::success(['list' => $list]);
+    }
+
+    //手册详情页 ssh 20211206
+    public function actionDetail()
+    {
+        $id = Yii::$app->request->get('id');
+        $data = book::$data;
+
+        $bookTitleList = book::$list;
+
+        //取出title
+        $titleData = [];
+        foreach ($bookTitleList as $bookList) {
+            foreach ($bookList['list'] as $item) {
+                $currentId = $item['id'] ?? '';
+                $title = $item['title'] ?? '';
+                $titleData[$currentId] = $title;
+            }
+        }
+        $currentTitle = $titleData[$id] ?? '';
+        $info = $data[$id] ?? [];
+        array_unshift($info, ['style' => 'title', 'value' => $currentTitle]);
+
+        //组合出视频完整链接
+        $apiHost = Yii::$app->params['hdHost'];
+        foreach ($info as $key => $val) {
+            if (isset($val['style']) && $val['style'] == 'video') {
+                $info[$key]['value'] = $apiHost . '/' . $val['value'];
+            }
+        }
+
+        util::success(['list' => $info]);
+    }
+
+}

+ 2 - 2
app-hd/controllers/GoodsController.php

@@ -186,8 +186,8 @@ class GoodsController extends BaseController
         $data['shopId'] = $this->shopId ?? 0;
         $data['flower'] = $info['flower'] ?? 0;
 
-        if (isset($info['spu']) && !empty($info['spu'])) {
-            util::fail('美团商品暂时不能修改');
+        if (!empty($info['spu'])) {
+            //util::fail('美团商品暂时不能修改');
         }
 
         $connection = Yii::$app->db;

+ 3 - 2
app-hd/controllers/IntraCityController.php

@@ -308,8 +308,9 @@ class IntraCityController extends BaseController
             util::success($result, "查询成功");
         } else {
             $errMsg = $result['errmsg'] ?? '';
-            Yii::error("运费查询失败:" . $errMsg);
-            util::fail('查询失败');
+            $errCode = $result['errcode'] ?? '';
+            noticeUtil::push("运费查询失败了哦:" . $errMsg . ",编号:" . $errCode, '15280215347');
+            util::fail('查询失败,编号673');
         }
     }
 

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

@@ -568,6 +568,7 @@ class PurchaseController extends BaseController
             } else {
                 //同城发货包装费和运费的计算
                 $sendCost = 0;
+                $sendDistance = 0;
                 if ($sendType == dict::getDict('sendType', 'thirdSend')) {
                     $weight = 0;
                     foreach ($productList as $itemData) {
@@ -578,8 +579,10 @@ class PurchaseController extends BaseController
                     }
                     $result = PurchaseClass::getDistanceFee($this->shop, $ghsShopInfo, $weight, $custom);
                     $sendCost = $result['fee'] ?? 0;
+                    $sendDistance = $result['distance'] ?? 0;
                 }
                 $post['sendCost'] = $sendCost;
+                $post['sendDistance'] = $sendDistance;
                 //出车、发快递、发物流可以算包装费
                 $packCost = 0;
                 if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {