Prechádzať zdrojové kódy

Merge branch 'master' into debt

shish 1 rok pred
rodič
commit
8c53bd60be
52 zmenil súbory, kde vykonal 1381 pridanie a 202 odobranie
  1. 3 1
      README.md
  2. 1 8
      app-ghs/controllers/CgRefundController.php
  3. 48 5
      app-ghs/controllers/ExpendController.php
  4. 251 91
      app-ghs/controllers/ExpressController.php
  5. 7 5
      app-ghs/controllers/MainController.php
  6. 7 0
      app-ghs/controllers/OrderController.php
  7. 1 1
      app-ghs/controllers/PurchaseOrderController.php
  8. 1 1
      app-ghs/controllers/RenewController.php
  9. 31 2
      app-ghs/controllers/ShopController.php
  10. 0 1
      app-ghs/controllers/StatController.php
  11. 27 19
      app-ghs/controllers/TestController.php
  12. BIN
      app-ghs/web/image/custom/cg_share.jpg
  13. BIN
      app-ghs/web/image/custom/cg_share_seat.jpg
  14. BIN
      app-ghs/web/image/custom/cg_share_seat_sn.jpg
  15. BIN
      app-ghs/web/image/custom/hit_me_clear.jpg
  16. BIN
      app-ghs/web/image/custom/hit_me_pay_clear.jpg
  17. BIN
      app-ghs/web/image/custom/order_share.jpg
  18. 36 0
      app-hd/controllers/AdminController.php
  19. 48 14
      app-hd/controllers/ExpressController.php
  20. 1 1
      app-hd/controllers/GhsController.php
  21. 12 0
      app-hd/controllers/OrderController.php
  22. 14 11
      app-hd/controllers/ShopAdminController.php
  23. 32 3
      app-hd/controllers/TestController.php
  24. BIN
      app-hd/web/image/cg/buy_look2.png
  25. BIN
      app-hd/web/image/custom/cg_share.jpg
  26. BIN
      app-hd/web/image/custom/cg_share_seat.jpg
  27. BIN
      app-hd/web/image/custom/cg_share_seat_sn.jpg
  28. BIN
      app-hd/web/image/custom/hit_me_clear.jpg
  29. BIN
      app-hd/web/image/custom/hit_me_pay_clear.jpg
  30. BIN
      app-hd/web/image/custom/order_share.jpg
  31. 10 1
      app-pt/controllers/WxController.php
  32. 6 6
      app-pt/views/main/app.php
  33. 7 0
      biz-ghs/admin/classes/AdminClass.php
  34. 10 0
      biz-ghs/custom/classes/CustomClass.php
  35. 237 0
      biz-ghs/express/classes/ExpressClass.php
  36. 2 5
      biz-ghs/express/models/DeliveryOrder.php
  37. 13 0
      biz-ghs/express/models/Express.php
  38. 2 0
      biz-ghs/order/classes/PurchaseOrderClass.php
  39. 26 14
      biz-ghs/stat/classes/StatSaleClass.php
  40. 7 0
      biz-hd/admin/classes/AdminClass.php
  41. 33 0
      biz-hd/express/classes/ExpressClass.php
  42. 13 0
      biz-hd/express/models/Express.php
  43. 65 6
      biz-hd/order/classes/OrderClass.php
  44. 96 2
      biz-hd/staff/classes/StaffClass.php
  45. 0 1
      biz-hd/staff/services/StaffService.php
  46. 1 0
      biz/ghs/classes/GhsClass.php
  47. 22 0
      common/base/classes/BaseClass.php
  48. 1 1
      common/components/book.php
  49. 7 0
      common/components/dict.php
  50. 175 0
      common/components/expressUtil.php
  51. 127 0
      common/components/shippingUtil.php
  52. 1 3
      common/components/util.php

+ 3 - 1
README.md

@@ -59,4 +59,6 @@ REDIS_HOST=127.0.0.1
 REDIS_PASSWORD=null # 密码为空,请写上 null
 REDIS_PORT=6379
 REDIS_DB=0
-```
+```
+
+#### 测试 gogs webhook -- 9

+ 1 - 8
app-ghs/controllers/CgRefundController.php

@@ -155,14 +155,7 @@ class CgRefundController extends BaseController
                     //小向花卉售后必须备注
                     $remark = $post['remark'] ?? '';
                     if (empty($remark)) {
-                        util::fail('请填写备注456');
-                    }
-                }
-            } else {
-                if ($this->mainId == 644) {
-                    $remark = $post['remark'] ?? '';
-                    if (empty($remark)) {
-                        util::fail('请填写备注113');
+                        util::fail('请填写备注哈');
                     }
                 }
             }

+ 48 - 5
app-ghs/controllers/ExpendController.php

@@ -38,6 +38,7 @@ class ExpendController extends BaseController
 
         $where = ['mainId' => $this->mainId];
         $where['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
+        $where['delStatus'] = 0; //过滤掉已删除的
         $list = ExpendClass::getAllByCondition($where, null, '*', null);
         $arr = [];
         $cat = [];
@@ -92,7 +93,7 @@ class ExpendController extends BaseController
     {
         ini_set('memory_limit', '2045M');
         set_time_limit(0);
-        $where = ['mainId' => $this->mainId, 'bx' => 0];
+        $where = ['mainId' => $this->mainId, 'bx' => 0, 'delStatus' => 0];
         $list = ExpendClass::getAllByCondition($where, null, '*', null);
         $arr = [];
         if (!empty($list)) {
@@ -103,7 +104,7 @@ class ExpendController extends BaseController
                 $currentAmount = $amount;
                 $unAmount = $amount;
                 if (isset($arr[$staffId])) {
-                    $arr[$staffId]['amount'] = bcadd($arr[$staffId]['amount'], $unAmount,2);
+                    $arr[$staffId]['amount'] = bcadd($arr[$staffId]['amount'], $unAmount, 2);
                     $arr[$staffId]['num'] = bcadd($arr[$staffId]['num'], 1);
                 } else {
                     $arr[$staffId]['totalAmount'] = $currentAmount;
@@ -148,7 +149,8 @@ class ExpendController extends BaseController
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
         try {
-            $list = ExpendClass::getAllByCondition(['mainId' => $this->mainId, 'bx' => 0, 'staffId' => $staffId], null, '*', null, true);
+            $condition = ['mainId' => $this->mainId, 'bx' => 0, 'staffId' => $staffId, 'delStatus' => 0];
+            $list = ExpendClass::getAllByCondition($condition, null, '*', null, true);
             $total = 0;
             $staff = $this->shopAdmin;
             $bxData = [
@@ -168,7 +170,7 @@ class ExpendController extends BaseController
             $bx->amount = $total;
             $bx->save();
             if (floatval($postAmount) != floatval($total)) {
-                util::fail('金额错误,请刷新页面,实际:'.floatval($total));
+                util::fail('金额错误,请刷新页面,实际:' . floatval($total));
             }
             $transaction->commit();
             util::complete();
@@ -205,6 +207,7 @@ class ExpendController extends BaseController
         if ($bx != -1) {
             $where['bx'] = $bx;
         }
+        $where['delStatus'] = 0;
         $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'thisYear';
         $startTime = $get['startTime'] ?? '';
         $endTime = $get['endTime'] ?? '';
@@ -256,7 +259,7 @@ class ExpendController extends BaseController
         $amount = $post['amount'] ?? 0;
         $remark = $post['remark'] ?? '';
         $bx = $post['bx'] ?? -1;
-        if (is_numeric($amount) == false || $amount <= 0) {
+        if (!is_numeric($amount) || $amount <= 0) {
             util::fail('请输入正确的金额');
         }
         if ($bx == -1) {
@@ -359,6 +362,46 @@ class ExpendController extends BaseController
         }
     }
 
+    //删除支出
+    public function actionDelExpend()
+    {
+        $post = Yii::$app->request->post();
+
+        $staff = $this->shopAdmin;
+        if ($staff->finance == 0) {
+            util::fail('没有财务权限');
+        }
+        $staffId = $this->shopAdminId;
+
+        $id = intval($post['id']);
+        $expend = ExpendClass::getById($id, true);
+        if ($expend->mainId != $this->mainId) {
+            util::fail('没有找到支出数据');
+        }
+        if ($expend->delStatus == 1) {
+            util::fail('此支出数据已是删除状态');
+        }
+
+        // 处理报销表数据
+        if ($expend->bxId != 0) {
+            $expendBx = ExpendBxClass::getById($expend->bxId, true);
+            $expendBx->amount = bcsub($expendBx->amount, $expend->amount, 2);
+            //怕remark字段不足,这边缩短长度
+            $expendBx->remark = $expendBx->remark . "|删除支出ID " . $expend->id;
+            $expendBx->save();
+        }
+
+        $expend->delStaffId = $staffId;
+        $expend->delStaffName = $staff->name;
+        $expend->delStatus = 1;
+        $rs = $expend->save();
+        if ($rs) {
+            util::complete();
+        } else {
+            util::fail('删除支出失败');
+        }
+    }
+
     //修改账单日期 ssh 20241122
     public function actionChangePayTime()
     {

+ 251 - 91
app-ghs/controllers/ExpressController.php

@@ -1,119 +1,279 @@
 <?php
-/**
- * User: admin
- * Date Time: 2021/2/21 19:55
- */
 
 namespace ghs\controllers;
 
-
-use biz\shop\classes\ShopExpressClass;
 use bizGhs\custom\classes\CustomClass;
-use bizGhs\custom\services\CustomService;
-use bizGhs\express\services\MiniExpressService;
-use bizGhs\merchant\services\ShopService;
-use bizGhs\product\services\ProductService;
+use bizGhs\express\classes\ExpressClass;
+use bizGhs\order\classes\OrderClass;
+use common\components\dict;
+use common\components\imgUtil;
 use common\components\util;
 use Yii;
 
+//用于物流服务
 class ExpressController extends BaseController
 {
 
-
-    //获取即时配送快递列表
-    public function actionList()
+    //获取采购单物流运单的轨迹 ssh 20250705
+    public function actionGetCgExpressTrack()
     {
-        $data = MiniExpressService::getAllImmeDelivery("id,deliveryId,deliveryName", ['status' => 1]);
-        util::success($data);
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $mainId = $this->mainId;
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+        }
+        $params = [
+            'deliveryId' => $deliveryId,
+        ];
+        $respond = ExpressClass::getTrack($params, $order);
+        util::success($respond);
     }
 
-    //配送费预估
-    public function actionPreAddOrder()
+    public function actionTestUpdate()
     {
-        // util::success(['fee' => 16.5]);
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $action = $get['action'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $fhWlNo = $order->fhWlNo ?? '';
+        if (empty($fhWlNo)) {
+            util::fail('没有找到物流单');
+        }
 
-        $post = Yii::$app->request->post();
-        $expressId = $post['expressId'] ?? 0;
-        $ghsItemInfo = $post['itemInfo'] ?? '';
-        if (empty($ghsItemInfo)) {
-            util::fail('请选择花材5');
-        }
-        $ghsItemInfo = json_decode($ghsItemInfo, true); // [{productId:0,itemPrice:1,bigNum:1,smallNum:0}]
-
-        //计算总价格,总重量
-        $cargoInfo = ProductService::groupCargo($ghsItemInfo);
-
-        $shop_order_id = time();
-        $expressData = MiniExpressService::getExpressInfo($expressId);
-        if(empty($expressData)){
-            util::fail("暂不支持");
-        }
-
-        $shop_no = ShopExpressClass::getShopNo($this->sjId,$this->shopId,strtolower( $expressData['deliveryId'])); //与快递签约时的门店ID
-
-        $openid = isset($this->admin) && !empty($this->admin) ? $this->admin->miniOpenId : '';
-        if (empty($openId)) {
-            util::fail('没有找到openId');
-        }
-
-        //客户id
-        $customId = $post['customId'] ?? 0;
-        //获取客户name
-        $customInfo = CustomService::getCustomInfo($customId);
-        CustomClass::valid($customInfo, $this->shopId);
-
-        //当前门店的地址信息
-        $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,
+        $orderSn = $order->orderSn;
+        $wayBillId = $order->fhWlNo;
+        $actionTime = time();
+        $actionTypeMap = [
+            0 => 100001,
+            1 => 100002,
+            2 => 100003,
+            3 => 200001,
+            4 => 300002,
+            5 => 300003,
+            6 => 300004,
+            7 => 400001,
+            8 => 400002,
         ];
+        $actionType = $actionTypeMap[$action] ?? 100001;
+        $actionMsg = '编号' . rand(1111, 9999);
 
-        $receiver = [
-            'name' => $customInfo['name'],
-            'city' => $post['city'] ?? '',
-            'address' => $post['address'] ?? '',
-            'address_detail' => $post['floor'] ?? '',
-            //'phone'=>$customInfo['mobile']??'199121223333',
-            'phone' => '18030142050',
-            'lng' => (float)$post['long'] ?? '118.134343',
-            'lat' => (float)$post['lat'] ?? '24.491566',
-            'coordinate_type' => 0,
-        ];
-        $cargo = [
-            'goods_value' => $cargoInfo['totalPrice'], //总价格  元
-            'goods_weight' => $cargoInfo['totalWeight'], //总重量 kg
-            'cargo_first_class' => '鲜花',
-            'cargo_second_class' => '鲜花',
-        ];
-        $orderInfo = [
-            'is_direct_delivery' => 0,//闪送只能为1,只能直拿直送
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+        }
+        $params = [
+            'deliveryId' => $deliveryId,
+            'bizId' => $bizId,
+            'orderSn' => $orderSn,
+            'wayBillId' => $wayBillId,
+            'actionType' => $actionType,
+            'actionMsg' => $actionMsg,
+            'actionTime' => $actionTime,
         ];
-        $shop = [
-            'wxa_path' => '/shop',
-            'img_url' => 'http://www.baidu.com/test.png',
-            'goods_name' => '鲜花',
-            'goods_count' => count($ghsItemInfo),
+        ExpressClass::testUpdate($params, $order);
+    }
+
+    public function actionCancelWayBill()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $fhWlNo = $order->fhWlNo ?? '';
+        if (empty($fhWlNo)) {
+            util::fail('没有找到物流单');
+        }
+        $mainId = $this->mainId;
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+        }
+        $params = [
+            'deliveryId' => $deliveryId,
+            'bizId' => $bizId,
         ];
-        $res = MiniExpressService::preAddOrder($expressId, $shop_no, $shop_order_id, $openid, $sender, $receiver, $cargo, $orderInfo, $shop);
-        util::success(['fee' => $res['fee']]);
+        ExpressClass::cancel($params, $order);
     }
 
-    //根据订单号发货
-    public function actionAddOrder()
+    //新建运单 ssh
+    public function actionCreateWayBill()
     {
         $post = Yii::$app->request->post();
-        $expressId = $post['expressId'] ?? 0;// 快递ID
-        $orderSn = $post['orderSn'] ?? '';
+        $id = $post['id'] ?? 0;
+        $weight = $post['weight'] ?? 0;
+        if (empty($weight) || $weight <= 0) {
+            util::fail('请填写重量');
+        }
+        $length = $post['length'] ? trim($post['length']) : 0;
+        if (!is_numeric($length) || $length <= 0) {
+            util::fail('请填写长度');
+        }
+        $width = $post['width'] ? trim($post['width']) : 0;
+        if (!is_numeric($width) || $width <= 0) {
+            util::fail('请填写宽度');
+        }
+        $height = $post['height'] ? trim($post['height']) : 0;
+        if (!is_numeric($height) || $height <= 0) {
+            util::fail('请填写高度');
+        }
+        $packageNum = $post['packageNum'] ? trim($post['packageNum']) : 0;
+        if (!is_numeric($packageNum) || $packageNum <= 0) {
+            util::fail('请填写包裹数量');
+        }
+
+        $order = OrderClass::getById($id, true);
+        if (empty($order)) {
+            util::fail('没有找到订单');
+        }
+        if ($order->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        if ($order->payStatus == 0) {
+            util::fail('订单没有付款');
+        }
+        if (in_array($order->status, [3, 4]) && $order->fhWlStatus == 1) {
+            util::fail('已经发过快递了');
+        }
+        $orderSn = $order->orderSn ?? '';
+        $customId = $order->customId ?? 0;
+        $custom = CustomClass::getById($customId, true);
+        if (empty($custom)) {
+            util::fail('没有找到客户');
+        }
+        //要先去后台绑定,这里填写才有用,mainId对应月结账号
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        $mainId = $this->mainId;
 
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+            $serviceType = 0;
+            $serviceName = '标准快递';
+            //销花宝移动应用的微信appId
+            $wxAppId = 'wxb379c1f2f3ef705e';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+            $serviceType = 1;
+            $serviceName = 'test_service_name';
+            $wxAppId = 'wx4bf74abf453eb789';
+        }
 
-    }
+//        $admin = $this->admin;
+//        $openId = $admin->ghsMiniOpenId ?? '';
+//        if (empty($openId)) {
+//            util::fail('请用小程序发单');
+//        }
+
+        $shop = $this->shop;
+        $shopName = $shop->shopName;
+        $sjName = $shop->merchantName;
+        $senderName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
+        $senderMobile = !empty($shop->telephone) ? $shop->telephone : $shop->mobile;
+        $senderProvince = $shop->province;
+        $senderCity = $shop->city;
+        $senderAddress = $shop->address;
+        if (empty($senderAddress)) {
+            util::fail('你的门店地址还没有设置');
+        }
 
+        $receiverName = $custom->name;
+        $receiverMobile = $custom->mobile;
+        $receiverProvince = $custom->province;
+        $receiverCity = $custom->city;
+        $receiverAddress = $custom->address;
+        $receiverFloor = $custom->floor;
+        $goodsName = '鲜花花材';
+        $customRemark = '鲜花花材,编号:' . $order->sendNum;
+        $goodsCount = ceil($order->itemNum);;
+
+        $shopImgUrl = imgUtil::groupImg('logo4.png') . "?x-oss-process=image/resize,m_fill,h_80,w_80";
+
+        $staff = $this->shopAdmin;
+        $staffId = $staff->id;
+        $staffName = $staff->name ?? '';
+
+        $params = [
+            'bizId' => $bizId,// 快递公司客户编码或月结账号
+            //'openId' => $openId,
+            'senderName' => $senderName,
+            'senderMobile' => $senderMobile,
+            'senderProvince' => $senderProvince,
+            'senderCity' => $senderCity,
+            'senderAddress' => $senderAddress,
+            'receiverName' => $receiverName,
+            'receiverMobile' => $receiverMobile,
+            'receiverProvince' => $receiverProvince,
+            'receiverCity' => $receiverCity,
+            'receiverAddress' => $receiverAddress,
+            'receiverFloor' => $receiverFloor,
+            'goodsCount' => $goodsCount,
+            'goodsName' => $goodsName,
+            'customRemark' => $customRemark,
+            'weight' => $weight,
+            'length' => $length,
+            'width' => $width,
+            'height' => $height,
+            'packageNum' => $packageNum,
+            'deliveryId' => $deliveryId,
+            'serviceType' => $serviceType,
+            'serviceName' => $serviceName,
+            'orderSn' => $orderSn,
+            'shopImgUrl' => $shopImgUrl,
+            'staffId' => $staffId,
+            'staffName' => $staffName,
+            'wxAppId' => $wxAppId,
+        ];
+        ExpressClass::addWayBill($params, $order);
+        util::complete('操作成功');
+    }
 
-}
+}

+ 7 - 5
app-ghs/controllers/MainController.php

@@ -224,7 +224,6 @@ class MainController extends BaseController
     //我的 ssh 2021.1.30
     public function actionMy()
     {
-
         $lookMoney = ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
 
         $shop = $this->shop ?? null;
@@ -234,10 +233,13 @@ class MainController extends BaseController
         $money = $main->money ?? 0;
         $cashAccount = $main->cashAccount ?? '';
         $sj = isset($this->sj) && !empty($this->sj) ? $this->sj->attributes : [];
-        $shopImg = Yii::$app->params['ghsImgHost'] . 'retail/default-img.png';
-        if (isset($shop->avatar) && !empty($shop->avatar)) {
-            $shopImg = Yii::$app->params['ghsImgHost'] . $shop->avatar;
+
+        $shopImg = imgUtil::groupImg('');
+        if (!empty($shop)) {
+            $shopImg = imgUtil::groupImg($shop->avatar);
         }
+        $smallShopImg = $shopImg . "?x-oss-process=image/resize,m_fill,h_80,w_80";
+
         $deadline = $sj['deadline'] ?? '';
         $relation = isset($this->shopAdmin) && !empty($this->shopAdmin) ? $this->shopAdmin->attributes : [];
         $adminName = $relation['name'] ?? '';
@@ -254,6 +256,7 @@ class MainController extends BaseController
             'sjName' => $sjName,
             'shopName' => $shopName,
             'shopImg' => $shopImg,
+            'smallShopImg' => $smallShopImg,
             'cashAccount' => $cashAccount,
             'shopAdminId' => $shopAdminId,
             'shopId' => $this->shopId,
@@ -262,7 +265,6 @@ class MainController extends BaseController
             'money' => $money,
             'shopInfo' => $shop,
             'lookMoney' => $lookMoney,
-            'deadline' => $deadline,
             'fast1' => '17189513228',
             'fast2' => '15280215347',
         ];

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

@@ -538,6 +538,9 @@ class OrderController extends BaseController
         if ($order->status == OrderClass::ORDER_STATUS_COMPLETE) {
             util::complete('订单已付款');
         }
+        if ($order->status == OrderClass::ORDER_STATUS_CANCEL) {
+            util::complete('订单已取消');
+        }
         if ($order->status != OrderClass::ORDER_STATUS_UN_PAY) {
             util::complete('订单不是待付款状态');
         }
@@ -661,6 +664,10 @@ class OrderController extends BaseController
             $msg = '没有找到订单';
             util::success(['returnStatus' => 'FAILURE'], $msg);
         }
+        if ($order->status == 5) {
+            $msg = '订单已取消';
+            util::success(['returnStatus' => 'FAILURE'], $msg);
+        }
         if ($order->status != 1) {
             $msg = '不是待付款订单';
             util::success(['returnStatus' => 'FAILURE'], $msg);

+ 1 - 1
app-ghs/controllers/PurchaseOrderController.php

@@ -101,7 +101,7 @@ class PurchaseOrderController extends BaseController
             'ghsName' => $ghsName,
             'clearCode' => $shortOrderSn,
             'staffName' => $shopAdminName,
-            'telephone' => $telephone,
+            'telephone' => '-',
             'kind' => $kind,
             'orderSn' => $orderSn,
             'sjShopName' => $sjShopName . ' 采购单',

+ 1 - 1
app-ghs/controllers/RenewController.php

@@ -106,7 +106,7 @@ class RenewController extends BaseController
         if (getenv('YII_ENV') == 'production') {
             $unitPrice = $pfLevel == 0 ? 1580 : 2580;
             if ($mainId == 50) {
-                //$unitPrice = $pfLevel == 0 ? 0.1 : 0.2;
+                $unitPrice = $pfLevel == 0 ? 0.5 : 1;
             }
         } else {
             $unitPrice = $pfLevel == 0 ? 0.1 : 0.2;

+ 31 - 2
app-ghs/controllers/ShopController.php

@@ -157,7 +157,7 @@ class ShopController extends BaseController
             }
         }
 
-        if($this->mainId == 59421){
+        if ($this->mainId == 59421) {
             if (!in_array($this->adminId, [4])) {
                 util::fail('已停用,请联系管理员');
             }
@@ -175,6 +175,36 @@ class ShopController extends BaseController
         util::complete();
     }
 
+    // 更新门店头像
+    public function actionUpdateAvatar()
+    {
+        $post = Yii::$app->request->post();
+        $shopId = $post['shopId'];
+        if ($post['shopId'] != $this->shopId or $this->mainId == 0) {
+            util::fail('不是您的门店');
+        }
+        $avatar = $post['avatar'];
+        if ($avatar == '') {
+            util::fail('头像地址不能为空');
+        }
+
+        $shop = ShopClass::getById($shopId, true);
+        $shop->avatar = $avatar;
+        $shop->save();
+
+        $ptStyle = $shop['ptStyle'] ?? dict::getDict('ptStyle', 'hd');
+        $update = ['avatar' => $avatar];
+        $where = ['mainId' => $this->mainId];
+        if ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
+            GhsClass::updateByCondition($where, $update);
+        } else {
+            util::fail('门店头像更新失败,平台类型错误');
+        }
+        $shopImg = imgUtil::groupImg($shop->avatar);
+        $smallShopImg = imgUtil::groupImg($shop->avatar) . "?x-oss-process=image/resize,m_fill,h_80,w_80";
+        util::success(['shopImg' => $shopImg, 'smallShopImg' => $smallShopImg], '门店头像更新成功');
+    }
+
     //添加门店 ssh 2021.1.14
     public function actionAdd()
     {
@@ -336,7 +366,6 @@ class ShopController extends BaseController
     //切换门店 lqh 2021.1.31
     public function actionToggleShop()
     {
-
         $mainId = $this->mainId;
         $adminId = $this->adminId;
         if (getenv('YII_ENV') == 'production') {

+ 0 - 1
app-ghs/controllers/StatController.php

@@ -121,7 +121,6 @@ class StatController extends BaseController
 
     public function actionProfit()
     {
-
         ini_set('memory_limit', '2045M');
         set_time_limit(0);
 

+ 27 - 19
app-ghs/controllers/TestController.php

@@ -23,10 +23,12 @@ use bizHd\refund\classes\HdRefundClass;
 use common\components\arrayUtil;
 use common\components\dateUtil;
 use common\components\dict;
+use common\components\expressUtil;
 use common\components\lakala\Lakala;
 use common\components\miniUtil;
 use common\components\noticeUtil;
 use common\components\orderSn;
+use common\components\shippingUtil;
 use common\components\wxUtil;
 use common\components\payUtil;
 use Yii;
@@ -38,7 +40,7 @@ use wkhtmltox\Image\Converter;
 class TestController extends BaseController
 {
 
-    public $guestAccess = ['fx', 'on', 'in', 'clear-query', 'ip', 'html', 'debt', 'apply', 'clear', 'ls-trade-query','ls-trade-refund', 'refund-query', 'inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund','recharge-query'];
+    public $guestAccess = ['fx', 'on', 'in', 'clear-query', 'ip', 'html', 'debt', 'apply', 'clear', 'ls-trade-query', 'ls-trade-refund', 'refund-query', 'inform', 'notice', 'order-query', 'add-order', 'index', 'get', 'trade-query', 'query', 'balance-query', 'refund', 'recharge-query'];
 
     public function actionFx()
     {
@@ -74,25 +76,30 @@ class TestController extends BaseController
 
     public function actionOn()
     {
-        echo "<pre>";
-        $cacheKey = 'test';
-        Yii::$app->redis->executeCommand('HSET', [$cacheKey, 'shish', 1]);
-        echo Yii::$app->redis->executeCommand('HGET', [$cacheKey, 'shish']);
-
-        $return = Yii::$app->redis->executeCommand('HEXISTS', [$cacheKey, 'shish']);
-        var_dump($return);
-
-        Yii::$app->redis->executeCommand('HSET', [$cacheKey, 'sofashi', 2]);
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+        if (getenv('YII_ENV') == 'production') {
+            $appId = 'wxcf32b3f0684c2433';
+        } else {
+            $appId = 'wx21b7c3ef12082099';
+        }
+        $data = [
+            'appid' => $appId,
+        ];
 
-        Yii::$app->redis->executeCommand('HSET', [$cacheKey, 'lgl', 3]);
+        //查询小程序是否已开通发货信息管理服务
+        $res = shippingUtil::isTradeManage($merchant, $data, $ptStyle);
+        echo '<pre>';
+        print_r($res);
 
-        $arr = Yii::$app->redis->executeCommand('HKEYS', [$cacheKey]);
-        print_r($arr);
+        //查询小程序是否已完成交易结算管理确认
+        $ret = shippingUtil::isTradeManageConfirmComplete($merchant, $data, $ptStyle);
+        echo '<pre>';
+        print_r($ret);
 
-        Yii::$app->redis->executeCommand('HDEL', [$cacheKey, 'lgl']);
+        $r = expressUtil::getAllDelivery($merchant, $ptStyle);
+        print_r($r);
 
-        $arr = Yii::$app->redis->executeCommand('HKEYS', [$cacheKey]);
-        print_r($arr);
     }
 
     public function actionIn()
@@ -351,7 +358,8 @@ class TestController extends BaseController
             //['name' => '徐州贴心鲜花批发', 'merchantNo' => '82230305992005L', 'wx' => [770844003, 770842534], 'zfb' => '2088370485434992'],
             //['name' => '海沧好多花换店', 'merchantNo' => '8223930599200CN', 'wx' => [772684174, 772684211], 'zfb' => '2088370864383343'],
             //['name' => '九江伊朵鲜花批发', 'merchantNo' => '82242405992002A', 'wx' => [774681090, 774681246], 'zfb' => '2088470298005142'],
-            ['name' => '徐州云之南鲜花', 'merchantNo' => '82230305992005R', 'wx' => [774780650, 774780913], 'zfb' => '2088470313464547'],
+            //['name' => '徐州云之南鲜花', 'merchantNo' => '82230305992006C', 'wx' => [788161779, 788162410], 'zfb' => '2088670707622207'],
+            ['name' => '济南伟伟鲜花', 'merchantNo' => '8224510599200EL', 'wx' => [789073494, 789074603], 'zfb' => '2088670850497224'],
             //['name' => '日照温暖小筑', 'merchantNo' => '82247705992002F', 'wx' => [781363841, 781362087], 'zfb' => '2088570557754874'],
             //['name' => '昆明建芳基地鲜花直发', 'merchantNo' => '8223970599200AH', 'wx' => [775915046, 775915051], 'zfb' => '2088470558755358'],
             //['name' => '日照月下鲜花批发', 'merchantNo' => '82247705992002D', 'wx' => [759404451, 759404055], 'zfb' => '2088170264295192'],
@@ -714,10 +722,10 @@ class TestController extends BaseController
         }
         $orderSn = 'KD26615540';
         $orderInfo = ClassesOrderClass::getByCondition(['orderSn' => $orderSn], true);
-        if(!empty($orderInfo)){
+        if (!empty($orderInfo)) {
             util::stop('有订单,不能走这个退款渠道');
         }
-        $order = ['orderSn' => $orderSn,'actPrice' => 55];
+        $order = ['orderSn' => $orderSn, 'actPrice' => 55];
         $respond = HdRefundClass::onlyRefundAmount($shop, $order);
         echo "<pre>";
         print_r($respond);

BIN
app-ghs/web/image/custom/cg_share.jpg


BIN
app-ghs/web/image/custom/cg_share_seat.jpg


BIN
app-ghs/web/image/custom/cg_share_seat_sn.jpg


BIN
app-ghs/web/image/custom/hit_me_clear.jpg


BIN
app-ghs/web/image/custom/hit_me_pay_clear.jpg


BIN
app-ghs/web/image/custom/order_share.jpg


+ 36 - 0
app-hd/controllers/AdminController.php

@@ -7,7 +7,10 @@ use biz\shop\services\ShopAdminService;
 use bizHd\admin\classes\AdminClass;
 use bizHd\admin\classes\ShopAdminClass;
 use bizHd\admin\services\AdminService;
+use bizHd\staff\classes\StaffClass;
+use bizHd\staff\services\StaffService;
 use bizHd\wx\services\WxOpenService;
+use common\components\dict;
 use common\components\imgUtil;
 use common\components\noticeUtil;
 use common\components\util;
@@ -39,6 +42,39 @@ class AdminController extends BaseController
         util::complete();
     }
 
+    //我已离职(从某门店离职)
+    public function actionDelStaff()
+    {
+        $admin = $this->admin;
+        $staff = $this->shopAdmin;
+        if ($staff->founder == 2) {
+            util::fail('老板不能离职');
+        }
+        if ($staff->delStatus == 1) {
+            util::fail('您已离职');
+        }
+        $adminId = $this->adminId;
+        $shop = $this->shop;
+        if ($shop->adminId == $adminId) {
+            util::fail('老板不能离职哦');
+        }
+
+        // 使用事务保证数据一致性
+        $connection = Yii::$app->db;
+        $transaction = $connection->beginTransaction();
+
+        try {
+            // 执行离职操作
+            $respond = StaffClass::executeStaffResignation($admin, $staff);
+            $transaction->commit();
+            util::success($respond);
+        } catch (\Exception $exception) {
+            $transaction->rollBack();
+            Yii::error("员工离职失败:" . $exception->getMessage());
+            util::fail('离职操作失败');
+        }
+    }
+
     //个人信息 ssh 20230505
     public function actionInfo()
     {

+ 48 - 14
app-hd/controllers/ExpressController.php

@@ -2,8 +2,11 @@
 
 namespace hd\controllers;
 
+use bizHd\express\classes\ExpressClass;
 use bizHd\merchant\services\ExpressService;
 use bizHd\merchant\services\ShopService;
+use bizHd\purchase\classes\PurchaseClass;
+use common\components\dict;
 use Yii;
 use yii\web\Controller;
 use common\components\util;
@@ -11,19 +14,50 @@ use common\components\util;
 class ExpressController extends BaseController
 {
 
-	//计算客户距离和运费 ssh 2020.5.14
-	public function actionGetUserDistance()
-	{
-		//经度
-		$lng = Yii::$app->request->get('lng', '');
-		//纬度
-		$lat = Yii::$app->request->get('lat', '');
-		if (empty($lng) || empty($lat)) {
-			util::fail('经度或纬度不能为空');
-		}
-		$shopId = ShopService::getDefaultShopId($this->sj);
-		$respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->sjExtend);
-		util::success($respond);
-	}
+    //获取采购单物流运单的轨迹 ssh 20250705
+    public function actionGetCgExpressTrack()
+    {
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $cg = PurchaseClass::getById($id, true);
+        if (empty($cg)) {
+            util::fail('没有找到订单');
+        }
+        if ($cg->mainId != $this->mainId) {
+            util::fail('不是你的订单');
+        }
+        $bizIdMap = dict::getDict('expressBizIdMap');
+        if (getenv('YII_ENV') == 'production') {
+            $bizId = $bizIdMap[$mainId] ?? 0;
+            if (empty($bizId)) {
+                util::fail('没有找到月结账号');
+            }
+            //暂时只支持顺丰
+            $deliveryId = 'SF';
+        } else {
+            $deliveryId = 'TEST';
+            $bizId = 'test_biz_id';
+        }
+        $params = [
+            'deliveryId' => $deliveryId,
+        ];
+        $respond = ExpressClass::getTrack($params, $cg);
+        util::success($respond);
+    }
+
+    //计算客户距离和运费 ssh 2020.5.14
+    public function actionGetUserDistance()
+    {
+        //经度
+        $lng = Yii::$app->request->get('lng', '');
+        //纬度
+        $lat = Yii::$app->request->get('lat', '');
+        if (empty($lng) || empty($lat)) {
+            util::fail('经度或纬度不能为空');
+        }
+        $shopId = ShopService::getDefaultShopId($this->sj);
+        $respond = ExpressService::getUserDistance($lng, $lat, $shopId, $this->sjExtend);
+        util::success($respond);
+    }
 
 }

+ 1 - 1
app-hd/controllers/GhsController.php

@@ -264,7 +264,7 @@ class GhsController extends BaseController
         $info['shareLogo'] = $shareLogo;
         $info['superWx'] = '';
         if (!empty($ghsShop->superWx)) {
-            $info['superWx'] = imgUtil::groupImg($ghsShop->superWx);
+            $info['superWx'] = imgUtil::groupImg($ghsShop->superWx). "?x-oss-process=image/resize,w_150";
         }
 
         $ghsMainId = $ghsShop->mainId ?? 0;

+ 12 - 0
app-hd/controllers/OrderController.php

@@ -252,6 +252,9 @@ class OrderController extends BaseController
         if ($order->status == OrderClass::ORDER_STATUS_COMPLETE) {
             util::success(['returnStatus' => 'SUCCESS']);
         }
+        if ($order->status == OrderClass::ORDER_STATUS_CANCEL) {
+            util::complete('订单已取消');
+        }
         if ($order->status != OrderClass::ORDER_STATUS_UN_PAY) {
             util::complete('订单不是待付款状态');
         }
@@ -328,6 +331,15 @@ class OrderController extends BaseController
         $order = OrderClass::getById($id, true);
         OrderClass::valid($order, $this->mainId);
 
+        if ($order->status == OrderClass::ORDER_STATUS_CANCEL) {
+            $msg = '订单已取消';
+            util::success(['returnStatus' => 'FAILURE'], $msg);
+        }
+        if ($order->status != OrderClass::ORDER_STATUS_UN_PAY) {
+            $msg = '订单不是待付款状态';
+            util::success(['returnStatus' => 'FAILURE'], $msg);
+        }
+
         $shop = $this->shop;
         $sj = $shop->merchantName;
         $shopName = $shop->shopName;

+ 14 - 11
app-hd/controllers/ShopAdminController.php

@@ -42,7 +42,6 @@ class ShopAdminController extends BaseController
     //添加员工
     public function actionAddStaff()
     {
-
         $shopAdmin = $this->shopAdmin;
         if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
             util::fail('没有权限');
@@ -67,17 +66,21 @@ class ShopAdminController extends BaseController
 
             $ptStyle = Yii::$app->params['ptStyle'];
 
-            $cacheKey = 'add_staff_auth_code_' . $ptStyle . '_' . $mobile;
-            $saveAuthCode = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
-            if (empty($saveAuthCode)) {
-                util::fail('请填写验证码哦');
-            }
-            if (empty($authCode)) {
-                util::fail('请填写验证码');
-            }
-            if ($saveAuthCode != $authCode) {
-                util::fail('验证码错误');
+            //验证码取消验证,临时使用的方法
+            if ($authCode != 19640123) {
+                $cacheKey = 'add_staff_auth_code_' . $ptStyle . '_' . $mobile;
+                $saveAuthCode = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+                if (empty($saveAuthCode)) {
+                    util::fail('请填写验证码哦');
+                }
+                if (empty($authCode)) {
+                    util::fail('请填写验证码');
+                }
+                if ($saveAuthCode != $authCode) {
+                    util::fail('验证码错误');
+                }
             }
+
             $adminInfo = ['name' => $name, 'mobile' => $mobile, 'style' => $ptStyle, 'currentShopId' => $this->shopId];
             $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
             $admin = \bizGhs\admin\classes\AdminClass::replaceAdmin($adminInfo, $fromApp);

+ 32 - 3
app-hd/controllers/TestController.php

@@ -2,11 +2,40 @@
 
 namespace hd\controllers;
 
-use bizHd\wx\services\WxOpenService;
-use common\components\miniUtil;
+use bizHd\order\classes\OrderClass;
+use common\components\util;
 use Yii;
 
 class TestController extends BaseController
 {
-
+    public function actionTestPayAfter()
+    {
+//        $get = Yii::$app->request->get();
+//        $id = $get['order_id'];
+//        $order = OrderClass::getById($id, true);
+//        if (empty($order)) {
+//            util::fail('没有找到订单');
+//        }
+//        if ($order->mainId != $this->mainId) {
+//            util::fail('不是你的订单');
+//        }
+//
+//        $payWay = 1; // balancePay
+//        $connection = Yii::$app->db;
+//        $transaction = $connection->beginTransaction();
+//        try {
+//            $actPrice = $order->actPrice;
+//            $order->debtPrice = $actPrice;
+//            $order->remainDebtPrice = $actPrice;
+//            $order->debt = 1;
+//            $order->save();
+//            OrderClass::payAfter($order, $payWay);
+//            $transaction->commit();
+//            util::complete('付款成功');
+//        } catch (\Exception $exception) {
+//            $transaction->rollBack();
+//            Yii::info("付款失败原因:" . $exception->getMessage());
+//            util::fail('操作失败');
+//        }
+    }
 }

BIN
app-hd/web/image/cg/buy_look2.png


BIN
app-hd/web/image/custom/cg_share.jpg


BIN
app-hd/web/image/custom/cg_share_seat.jpg


BIN
app-hd/web/image/custom/cg_share_seat_sn.jpg


BIN
app-hd/web/image/custom/hit_me_clear.jpg


BIN
app-hd/web/image/custom/hit_me_pay_clear.jpg


BIN
app-hd/web/image/custom/order_share.jpg


+ 10 - 1
app-pt/controllers/WxController.php

@@ -173,10 +173,19 @@ class WxController extends PublicController
             if ($this->msgType == 'event') {
 
                 switch ($Event) {
+                    case 'trade_manage_remind_access_api':
+                        noticeUtil::push('trade_manage_remind_access_api', '15280215347');
+                        break;
+                    case 'trade_manage_remind_shipping':
+                        noticeUtil::push('trade_manage_remind_shipping', '15280215347');
+                        break;
+                    case 'trade_manage_order_settlement':
+                        noticeUtil::push('trade_manage_order_settlement', '15280215347');
+                        break;
                     //关注
                     case 'subscribe':
 
-                        //noticeUtil::push('销花宝 关注者openId ' . $this->fromUsername, '15280215347');
+                        noticeUtil::push('批发端新关注者openId:' . $this->fromUsername, '15280215347');
 
                         $text = $this->replyTextContent("{$this->fromUsername}");
                         $pc = new \WXBizMsgCrypt($openToken, $encodingAesKey, $openAppId);

+ 6 - 6
app-pt/views/main/app.php

@@ -21,33 +21,33 @@ if ($xhbApi == 'wixhb.com') {
 <body>
 <div style="text-align:center;margin-top:100px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
-       href="https://img.<?php echo $xhbApi; ?>/apk/ghs/1230.apk">销花宝APP</a>
+       href="https://api.shop.<?php echo $xhbApi; ?>/1235.apk">销花宝APP</a>
 </div>
 
 <div style="text-align:center;margin-top:30px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
-       href="https://img.<?php echo $hhbApi; ?>/apk/hd/192.apk">花掌柜APP</a>
+       href="https://api.shop.<?php echo $hhbApi; ?>/192.apk">花掌柜APP</a>
 </div>
 <div style="text-align:center;margin-top:30px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
 
-       href="https://img.wixhb.com/apk/hd/pad180.apk">花掌柜收银</a>
+       href="https://api.shop.wixhb.com/pad180.apk">花掌柜收银</a>
 </div>
 <div style="text-align:center;margin-top:30px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
 
-       href="https://img.wixhb.com/apk/ghs/pad141.apk">销花宝收银</a>
+       href="https://api.shop.wixhb.com/pad141.apk">销花宝收银</a>
 </div>
 <div style="width:100%;text-align:center;margin-top:20px;">-----------------------------------------------------------------</div>
 <div style="text-align:center;margin-top:30px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
 
-       href="https://img.wixhb.com/apk/hd/pad180.apk">花掌柜收银(最新版)</a>
+       href="https://api.shop.wixhb.com/pad180.apk">花掌柜收银(最新版)</a>
 </div>
 <div style="text-align:center;margin-top:30px;">
     <a style="margin:0 auto;display:inline-block;border:none;padding:8px 15px;border-radius:16px;color:white;background-color:#3385FF;text-decoration:none"
 
-       href="https://img.wixhb.com/apk/ghs/pad144.apk">销花宝收银(最新版)</a>
+       href="https://api.shop.wixhb.com/pad144.apk">销花宝收银(最新版)</a>
 </div>
 </body>
 </html>

+ 7 - 0
biz-ghs/admin/classes/AdminClass.php

@@ -410,6 +410,13 @@ class AdminClass extends BaseClass
         if (empty($right)) {
             util::fail("没有权限");
         }
+
+        // 判断 $newShop 是否本账号下的门店
+        $exit = ShopAdminClass::exists(['adminId'=>$admin->id, 'mainId'=>$newShop->mainId]);
+        if (!$exit) { // 不存在说明不是本账号下的门店,则直接返回
+            util::fail("切换的不是您的门店");
+        }
+
         $newShopId = $newShop->id ?? 0;
         $lsShopId = $newShop->lsShopId ?? 0;
         $shopAdmin = \biz\shop\classes\ShopAdminClass::changeShopAddRelate($originShopAdmin, $newShop);

+ 10 - 0
biz-ghs/custom/classes/CustomClass.php

@@ -682,6 +682,8 @@ class CustomClass extends BaseClass
         $objPHPExcel->getActiveSheet()->setCellValue('E1', '余额');
         $objPHPExcel->getActiveSheet()->setCellValue('F1', '待结金额');
         $objPHPExcel->getActiveSheet()->setCellValue('G1', '最近下单');
+        $objPHPExcel->getActiveSheet()->setCellValue('H1', '累计消费');
+        $objPHPExcel->getActiveSheet()->setCellValue('I1', '累计消费次数');
 
         //设置宽度
         $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
@@ -690,6 +692,8 @@ class CustomClass extends BaseClass
         $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
         $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
         $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(30);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(15);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
         //加粗
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(9)->setBold(true);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(9)->setBold(true);
@@ -698,6 +702,8 @@ class CustomClass extends BaseClass
         $objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->setSize(9)->setBold(true);
         $objPHPExcel->getActiveSheet()->getStyle('F1')->getFont()->setSize(9)->setBold(true);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->getFont()->setSize(9)->setBold(true);
+        $objPHPExcel->getActiveSheet()->getStyle('H1')->getFont()->setSize(9)->setBold(true);
+        $objPHPExcel->getActiveSheet()->getStyle('I1')->getFont()->setSize(9)->setBold(true);
 
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
         $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
@@ -719,6 +725,8 @@ class CustomClass extends BaseClass
             } else {
                 $objPHPExcel->getActiveSheet()->setCellValue('G' . $i, $custom['recentExpend']);
             }
+            $objPHPExcel->getActiveSheet()->setCellValue('H' . $i, $custom['buyAmount']);
+            $objPHPExcel->getActiveSheet()->setCellValue('I' . $i, $custom['buyNum']);
             //居左
             $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
             $objPHPExcel->getActiveSheet()->getStyle('B' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
@@ -727,6 +735,8 @@ class CustomClass extends BaseClass
             $objPHPExcel->getActiveSheet()->getStyle('E' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
             $objPHPExcel->getActiveSheet()->getStyle('F' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
             $objPHPExcel->getActiveSheet()->getStyle('G' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('H' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('I' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
         }
         $fileName = '客户-' . date("m-d");
         $objPHPExcel->getActiveSheet()->setTitle($fileName);

+ 237 - 0
biz-ghs/express/classes/ExpressClass.php

@@ -0,0 +1,237 @@
+<?php
+
+namespace bizGhs\express\classes;
+
+
+use bizGhs\order\classes\OrderClass;
+use bizHd\base\classes\BaseClass;
+use bizHd\purchase\classes\PurchaseClass;
+use bizHd\wx\classes\WxOpenClass;
+use common\components\dict;
+use common\components\expressUtil;
+use common\components\util;
+use Yii;
+
+class ExpressClass extends BaseClass
+{
+
+    public static $baseFile = '\bizGhs\express\models\DeliveryOrder';
+
+    public static function getTrack($params, $order)
+    {
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+
+        $wayBillId = $order->fhWlNo;
+
+        $data = [
+            'delivery_id' => $deliveryId,
+            'waybill_id' => $wayBillId,
+        ];
+        return expressUtil::getPath($merchant, $data, $ptStyle);
+    }
+
+    public static function testUpdate($params, $order)
+    {
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+        $wayBillId = $params['wayBillId'];
+        $orderSn = $params['orderSn'];
+        $bizId = $params['bizId'];
+        $actionType = $params['actionType'];
+        $actionTime = $params['actionTime'];
+        $actionMsg = $params['actionMsg'];
+
+        $data = [
+            'delivery_id' => $deliveryId,
+            'waybill_id' => $wayBillId,
+            'order_id' => $orderSn,
+            'biz_id' => $bizId,
+            'action_time' => $actionTime,
+            'action_type' => $actionType,
+            'action_msg' => $actionMsg,
+        ];
+        $ret = expressUtil::testUpdateOrder($merchant, $data, $ptStyle);
+        print_r($ret);
+    }
+
+    public static function cancel($params, $order)
+    {
+        $cgId = $order->purchaseId;
+        $cg = PurchaseClass::getById($cgId, true);
+        if (empty($cg)) {
+            util::fail('订单信息缺失');
+        }
+
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+
+        $wayBillId = $order->fhWlNo ?? '';
+        $orderSn = $order->orderSn;
+
+        $data = [
+            'delivery_id' => $deliveryId,
+            'waybill_id' => $wayBillId,
+            'order_id' => $orderSn
+        ];
+
+        $ret = expressUtil::cancelOrder($merchant, $data, $ptStyle);
+        if ($ret['errcode'] == 0) {
+            $order->fhWlStatus = 2;
+            $order->save();
+            $cg->fhWlStatus = 2;
+            $cg->save();
+            util::complete('取消成功');
+        } else {
+            $code = $ret['errcode'] ?? '';
+            $msg = $ret['errmsg'] ?? '';
+            util::fail('取消失败,原因:' . $code . ' / ' . $msg);
+        }
+    }
+
+    //新增运单 ssh 20250703
+    public static function addWayBill($params, $order)
+    {
+        $cgId = $order->purchaseId;
+        $cg = PurchaseClass::getById($cgId, true);
+        if (empty($cg)) {
+            util::fail('订单信息缺失');
+        }
+
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $orderSn = $params['orderSn'];
+        //$openId = $params['openId'];
+        $deliveryId = $params['deliveryId'];
+        $bizId = $params['bizId'];
+        $customRemark = $params['customRemark'];
+        $senderName = $params['senderName'];
+        $senderMobile = $params['senderMobile'];
+        $senderProvince = $params['senderProvince'];
+        $senderCity = $params['senderCity'];
+        $senderAddress = $params['senderAddress'];
+        $receiverName = $params['receiverName'];
+        $receiverMobile = $params['receiverMobile'];
+        $receiverProvince = $params['receiverProvince'];
+        $receiverCity = $params['receiverCity'];
+        $receiverAddress = $params['receiverAddress'];
+        $receiverFloor = $params['receiverFloor'];
+        $goodsCount = $params['goodsCount'];
+        $goodsName = $params['goodsName'];
+        $weight = $params['weight'];
+        $height = $params['height'];
+        $length = $params['length'];
+        $width = $params['width'];
+        $packageNum = $params['packageNum'];
+        $serviceType = $params['serviceType'];
+        $serviceName = $params['serviceName'];
+        $shopImgUrl = $params['shopImgUrl'];
+        $wxAppId = $params['wxAppId'];
+
+        $data = [
+            // 订单信息
+            'order_id' => $orderSn, // 商家订单ID,需唯一
+            //'openid' => $openId, // 用户openid
+            'delivery_id' => $deliveryId, // 快递公司ID
+            'biz_id' => $bizId, // 快递公司客户编码或月结账号
+            'custom_remark' => $customRemark, // 备注
+            //0表示已事先约定取件时间;否则请传预期揽件时间戳,需大于当前时间
+            'expect_time' => 0,
+            //订单来源,0为小程序订单,2为App或H5订单,填2则不发送物流服务通知
+            'add_source' => 2,
+            'wx_appid' => $wxAppId,
+            // 发件人信息
+            'sender' => [
+                'name' => $senderName, // 发件人姓名
+                'mobile' => $senderMobile, // 发件人手机号
+                'province' => $senderProvince, // 发件人省份
+                'city' => $senderCity, // 发件人城市
+                'address' => $senderAddress, // 发件人详细地址
+            ],
+
+            // 收件人信息
+            'receiver' => [
+                'name' => $receiverName, // 收件人姓名
+                'mobile' => $receiverMobile, // 收件人手机号
+                'province' => $receiverProvince, // 收件人省份
+                'city' => $receiverCity, // 收件人城市
+                'address' => $receiverAddress . $receiverFloor, // 收件人详细地址
+            ],
+            // 商品信息
+            'shop' => [
+                'goods_name' => $goodsName, // 商品名称
+                'goods_count' => $goodsCount, // 商品数量
+                'img_url' => $shopImgUrl,
+            ],
+            // 货物信息
+            'cargo' => [
+                'count' => $packageNum, // 货物数量
+                'weight' => $weight, // 货物总重量,单位kg
+                'space_x' => $length, // 货物长度,单位cm
+                'space_y' => $width, // 货物宽度,单位cm
+                'space_z' => $height, // 货物高度,单位cm
+                'detail_list' => [
+                    [
+                        'name' => '鲜花花材', // 货物名称
+                        'count' => $packageNum, // 货物数量
+                    ],
+                ],
+            ],
+            // 保价信息
+            'insured' => [
+                'use_insured' => 0, // 是否保价,0-否,1-是
+            ],
+            // 服务类型
+            'service' => [
+                'service_type' => $serviceType, // 服务类型,0-标准快递
+                'service_name' => $serviceName, // 服务名称
+            ],
+        ];
+        $ret = expressUtil::addOrder($merchant, $data, $ptStyle);
+        if ($ret['errcode'] == 0) {
+            $wayBillId = $ret['waybill_id'] ?? 0;
+            $wayBillName = '顺丰速运';
+            $order->fhWlSn = $deliveryId;
+            $order->fhWl = $wayBillName;
+            $order->fhWlNo = $wayBillId;
+            $order->fhWlStatus = 1;//已经叫物流
+            $order->save();
+
+            $cg->fhWlSn = $deliveryId;
+            $cg->fhWl = $wayBillName;
+            $cg->fhWlNo = $wayBillId;
+            $cg->fhWlStatus = 1;//已经叫物流
+            $cg->save();
+
+            if ($order->status == 2) {
+                $staffId = $params['staffId'];
+                $staffName = $params['staffName'];
+                $params = [
+                    'fhType' => 0,
+                    'fhWl' => '',
+                    'fhWlNo' => '',
+                    'staffId' => $staffId,
+                    'staffName' => $staffName,
+                ];
+                OrderClass::orderSend($order, $params);
+            }
+
+            $order->fhType = 1;
+            $order->save();
+            $cg->fhType = 1;
+            $cg->save();
+        } else {
+            $code = $ret['errcode'] ?? '';
+            $msg = $ret['errmsg'] ?? '';
+            util::fail('提交失败,原因:' . $code . ' / ' . $msg);
+        }
+    }
+
+}

+ 2 - 5
biz-ghs/express/models/DeliveryOrder.php

@@ -1,12 +1,9 @@
 <?php
-/**
- * User: admin
- * Date Time: 2022/7/24 21:53
- */
 
 namespace bizGhs\express\models;
 
-use bizHd\base\models\Base;
+use bizGhs\base\models\Base;
+
 class DeliveryOrder extends Base
 {
     public static function tableName()

+ 13 - 0
biz-ghs/express/models/Express.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizGhs\express\models;
+use bizGhs\base\models\Base;
+
+class Express extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhExpress';
+    }
+
+}

+ 2 - 0
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -924,6 +924,8 @@ class PurchaseOrderClass extends BaseClass
         } else {
             util::fail('没有找到这个运费支付方式');
         }
+        // $paidPrice 字段说明,此字段表示收货方已付款金额,包括 $localCharge本地运费、 $pickCharge提货费、 $shortCharge短途运费(到付时算,如果不是到付,不算在$paidPrice里)、$longCharge长途运费(到付时算,如果不是到付,不算在$paidPrice里)
+        //请搜索关键词 cg_item_cost ,有多处相似情况要考虑
         $data['prePrice'] = $currentPrice;
         if (isset($data['modifyPrice']) && !empty($data['modifyPrice']) && $data['modifyPrice'] > 0) {
             //报损减免后金额

+ 26 - 14
biz-ghs/stat/classes/StatSaleClass.php

@@ -221,24 +221,32 @@ class StatSaleClass extends BaseClass
             foreach ($cgList as $cgKey => $cgItem) {
                 $actPrice = $cgItem['actPrice'] ?? 0;
                 $paidPrice = $cgItem['paidPrice'] ?? 0;
-                $total = bcadd($actPrice, $paidPrice, 2);
-                //物流费用不算成本
-                if (isset($cgItem['isCost']) && $cgItem['isCost'] == 0) {
-                    $shortCharge = $cgItem['shortCharge'] ?? 0;
-                    $longCharge = $cgItem['longCharge'] ?? 0;
-                    $pickCharge = $cgItem['pickCharge'] ?? 0;
-                    $localCharge = $cgItem['localCharge'] ?? 0;
-                    $a1 = bcadd($shortCharge, $longCharge, 2);
-                    $a2 = bcadd($pickCharge, $localCharge, 2);
-                    $a = bcadd($a1, $a2, 2);
-                    $total = bcsub($total, $a, 2);
+                if ($actPrice <= 0) {
+                    // 如果$actPrice=0,表示这个采购单已经全部退款,不需要再统计成本,本来$paidPrice要同步清零,但没有,这个问题由徐州邂逅花坊马总,提出的需求发现
+                    $cg = bcadd($cg, 0, 2);
+                } else {
+                    $total = bcadd($actPrice, $paidPrice, 2);
+                    //物流费用不算成本。意思是说,长短途运费+提货费+本地运费,这四项和打包费一起,参与到平摊花材运费成本的计算,但那四项不参与总的采购成本登记,因为,有另外地方会独立登记运费成本。
+                    //$paidPrice 字段说明,此字段表示收货方已付款金额,包括 $localCharge本地运费、 $pickCharge提货费、 $shortCharge短途运费(到付时算,如果不是到付,不算在$paidPrice里)、$longCharge长途运费(到付时算,如果不是到付,不算在$paidPrice里)
+                    //请搜索关键词 cg_item_cost ,有多处相似情况要考虑
+                    if (isset($cgItem['isCost']) && $cgItem['isCost'] == 0) {
+                        $shortCharge = $cgItem['shortCharge'] ?? 0;
+                        $longCharge = $cgItem['longCharge'] ?? 0;
+                        $pickCharge = $cgItem['pickCharge'] ?? 0;
+                        $localCharge = $cgItem['localCharge'] ?? 0;
+                        $a1 = bcadd($shortCharge, $longCharge, 2);
+                        $a2 = bcadd($pickCharge, $localCharge, 2);
+                        $a = bcadd($a1, $a2, 2);
+                        //注意下面是减号 bcsub
+                        $total = bcsub($total, $a, 2);
+                    }
+                    $cg = bcadd($cg, $total, 2);
                 }
-                $cg = bcadd($cg, $total, 2);
             }
         }
         $cg = floatval($cg);
 
-        $lsCgWhere = ['mainId' => $mainId, 'status' => 4,'belongCost'=>1];
+        $lsCgWhere = ['mainId' => $mainId, 'status' => 4, 'belongCost' => 1];
         $lsCgWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
         $lsCgList = PurchaseClass::getAllByCondition($lsCgWhere, null, '*');
         $lsCgAmount = 0;
@@ -326,7 +334,11 @@ class StatSaleClass extends BaseClass
             }
         }
 
-        $condition = ['mainId' => $mainId, 'payTime' => ['between', [$currentStartTime, $currentEndTime]],];
+        $condition = [
+            'mainId' => $mainId,
+            'payTime' => ['between', [$currentStartTime, $currentEndTime]],
+            'delStatus' => 0,
+        ];
         $expendList = ExpendClass::getAllByCondition($condition, null, '*', null, true);
         $expendTypeMap = dict::getDict('expendTypeMap');
         $expendAmount = [];

+ 7 - 0
biz-hd/admin/classes/AdminClass.php

@@ -36,6 +36,13 @@ class AdminClass extends BaseClass
         if (empty($right)) {
             util::fail("没有权限");
         }
+
+        // 判断 $newShop 是否本账号下的门店
+        $exit = ShopAdminClass::exists(['adminId'=>$admin->id, 'mainId'=>$newShop->mainId]);
+        if (!$exit) { // 不存在说明不是本账号下的门店,则直接返回
+            util::fail("切换的不是您的门店");
+        }
+
         $newShopId = $newShop->id ?? 0;
         $pfShopId = $newShop->pfShopId ?? 0;
         $shopAdmin = \biz\shop\classes\ShopAdminClass::changeShopAddRelate($originShopAdmin, $newShop);

+ 33 - 0
biz-hd/express/classes/ExpressClass.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace bizHd\express\classes;
+
+use bizHd\wx\classes\WxOpenClass;
+use common\components\dict;
+use common\components\expressUtil;
+use common\components\util;
+use Yii;
+use bizHd\base\classes\BaseClass;
+
+class ExpressClass extends BaseClass
+{
+
+    public static $baseFile = '\bizHd\express\models\Express';
+
+    public static function getTrack($params, $cg)
+    {
+        $merchant = WxOpenClass::getGhsWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'ghs');
+
+        $deliveryId = $params['deliveryId'];
+
+        $wayBillId = $cg->fhWlNo;
+
+        $data = [
+            'delivery_id' => $deliveryId,
+            'waybill_id' => $wayBillId,
+        ];
+        return expressUtil::getPath($merchant, $data, $ptStyle);
+    }
+
+}

+ 13 - 0
biz-hd/express/models/Express.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizHd\express\models;
+use bizHd\base\models\Base;
+
+class Express extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhExpress';
+    }
+
+}

+ 65 - 6
biz-hd/order/classes/OrderClass.php

@@ -20,6 +20,7 @@ use bizGhs\stock\classes\StockRecordClass;
 use bizGhs\ws\services\WsService;
 use bizHd\custom\classes\CustomClass;
 use bizHd\merchant\classes\SjClass;
+use bizHd\order\classes\OrderItemClass;
 use bizHd\refund\classes\HdRefundClass;
 use bizHd\shop\classes\MainClass;
 use bizHd\shop\classes\ShopMoneyChangeClass;
@@ -245,7 +246,6 @@ class OrderClass extends BaseClass
         $order->save();
 
         self::payAfter($order, $payWay);
-
     }
 
     //订单完成 ssh 2021.4.20
@@ -259,16 +259,28 @@ class OrderClass extends BaseClass
         }
         $orderSn = $order->orderSn ?? '';
         if ($order->status == self::ORDER_STATUS_CANCEL) {
-            noticeUtil::push('注意,散客订单:' . $orderSn . ',付款成功但订单已取消,关键词 cancel_get_money', '15280215347');
             $shopId = $order->shopId;
             $shop = ShopClass::getById($shopId, true);
-            if (!empty($shop)) {
-                HdRefundClass::onlyRefundAmount($shop, $order);
+            if (empty($shop)) {
+                noticeUtil::push('注意,零售订单:' . $orderSn . ',付款成功但订单已取消,没有找到门店,关键词 cancel_get_money', '15280215347');
+                util::stop("SUCCESS");
+            }
+            Yii::$app->params['errorReport'] = 1;
+            try {
+                //恢复取消的订单
+                self::recoverOrderToPay($order);
+                noticeUtil::push('注意,零售订单:' . $orderSn . ',付款成功,取消的订单,已恢复 SUCCESS', '15280215347');
+            } catch (\Exception $exception) {
+                $ret = HdRefundClass::onlyRefundAmount($shop, $order);
+                if ($ret['status'] == 0) {
+                    $errMsg = $exception->getMessage();
+                    noticeUtil::push('注意,零售订单:' . $orderSn . ',付款成功但订单取消。订单没有恢复成功,原因' . $errMsg . ',也没有退款成功。请手动处理。关键词 cancel_get_money', '15280215347');
+                }
+                util::stop("SUCCESS");
             }
-            util::stop("SUCCESS");
         }
         if ($order->payStatus == 1) {
-            noticeUtil::push('注意散客订单:' . $orderSn . ',已经付过款了,无需重复请求和操作', '15280215347');
+            noticeUtil::push('注意,零售订单:' . $orderSn . ',已经付过款了,无需重复请求和操作', '15280215347');
             util::fail('订单已经付过款了');
         }
 
@@ -529,6 +541,53 @@ class OrderClass extends BaseClass
         }
     }
 
+    // 恢复订单 -- 即:把订单的状态从取消状态变成待付款状态
+    public static function recoverOrderToPay($order)
+    {
+        $now = time();
+        $order->status = 1;
+        $order->deadline = $now + 86400;
+        $order->save();
+
+        // 重新占用库存(与取消订单时的库存回滚相反)
+        $itemList = OrderItemClass::getAllByCondition(['orderSn' => $order->orderSn], null, '*', null, true);
+
+        if (!empty($itemList)) {
+            foreach ($itemList as $item) {
+                $ptItemId = $item->ptItemId ?? 0;
+                $sjId = $item->sjId ?? 0;
+                $shopId = $item->shopId ?? 0;
+                $mainId = $item->mainId ?? 0;
+                $ratio = $item->ratio ?? 20;
+                $unitType = $item->unitType ?? 0;
+                if ($unitType == 0) {
+                    $bigNum = $item->num;
+                    $smallNum = 0;
+                } else {
+                    $bigNum = 0;
+                    $smallNum = $item->num;
+                }
+                $itemId = $item->itemId ?? 0;
+
+                // 重新扣减库存(占用库存)
+                $stockInfo = ProductClass::decreaseStock($itemId, $bigNum, $smallNum, true);
+                $recordData = [];
+                $recordData['sjId'] = $sjId;
+                $recordData['shopId'] = $shopId;
+                $recordData['mainId'] = $mainId;
+                $recordData['itemId'] = $ptItemId;
+                $recordData['itemNum'] = ProductClass::mergeItemNum($bigNum, $smallNum, $ratio);
+                $recordData['oldStock'] = $stockInfo['oldStock'];
+                $recordData['newStock'] = $stockInfo['newStock'];
+                $recordData['productId'] = $itemId;
+                $recordData['orderSn'] = $order->orderSn;
+                $recordData['relateName'] = $order->customName ?? '';
+                StockRecordClass::hdKdAddRecord($recordData);
+            }
+        }
+        return true;
+    }
+
     // 扣库存
     protected static function decGoodsStock($orderGoods)
     {

+ 96 - 2
biz-hd/staff/classes/StaffClass.php

@@ -4,10 +4,11 @@ namespace bizHd\staff\classes;
 
 use bizHd\admin\classes\AdminClass;
 use bizHd\admin\classes\AdminRoleClass;
+use bizHd\admin\models\Admin;
 use bizHd\shop\classes\ShopClass;
-use common\components\sms;
+use bizHd\staff\models\Staff;
+use common\components\dict;
 use common\components\util;
-use Yii;
 use bizHd\base\classes\BaseClass;
 
 class StaffClass extends BaseClass
@@ -114,4 +115,97 @@ class StaffClass extends BaseClass
         return $shopAdmin;
     }
 
+    /**
+     * 执行员工离职操作
+     * @param Admin $admin 管理员模型
+     * @param Staff $staff 员工模型
+     */
+    public static function executeStaffResignation($admin, $staff)
+    {
+        // 标记员工为已删除
+        $staff->delStatus = 1;
+        $staff->save();
+
+        $mobile = $admin->mobile;
+
+        $hasShop = 0;
+
+        // 检查管理员是否有自己的门店
+        $shopList = ShopClass::getAllByCondition(['mobile' => $mobile], null, 'id,shopName,mainId,pfShopId,lsShopId,adminId,ptStyle', null, true);
+        if (empty($shopList)) {
+            // 情况1:自己没有店,在别人那边当员工,直接退出
+            $admin->currentShopId = 0;
+            $admin->currentGhsShopId = 0;
+            $admin->save();
+        } else {
+            // 情况2:自己有店,自己可能开批零店,也可能只开零售店,也在其他店当员工
+            $hdMainId = 0;
+            $ghsMainId = 0;
+            if (count($shopList) == 1) {
+                foreach ($shopList as $shop) {
+                    if ($shop->ptStyle == 1) {
+                        $admin->currentShopId = $shop->id;
+                        $admin->currentGhsShopId = 0;
+                        $admin->save();
+                    } else {
+                        util::fail('账号异常,请联系管理员,编号266389');
+                    }
+                }
+            } else {
+                if (count($shopList) != 2) {
+                    util::fail('账号异常,请联系管理员,编号873380');
+                }
+                foreach ($shopList as $shop) {
+                    if ($shop->ptStyle == 2) {
+                        $ghsMainId = $shop->mainId;
+                        $admin->currentGhsShopId = $shop->id;
+                        $admin->save();
+                    }
+                    if ($shop->ptStyle == 1) {
+                        $hdMainId = $shop->mainId;
+                        $admin->currentShopId = $shop->id;
+                        $admin->save();
+                    }
+                }
+                if ($ghsMainId != $hdMainId) {
+                    util::fail('账号异常,请联系管理,编号0068');
+                }
+                if ($ghsMainId == 0) {
+                    util::fail('账号异常,请联系管理,编号006835');
+                }
+            }
+            $adminId = $admin->id;
+            $staffList = StaffClass::getAllByCondition(['mainId' => $hdMainId, 'adminId' => $adminId], null, '*', null, true);
+            if (empty($staffList)) {
+                $role = AdminRoleClass::getByCondition(['mainId' => $hdMainId], true);
+                $roleId = $role->id;
+                $avatar = $admin->avatar;
+                $name = $admin->name;
+                $staffData = [
+                    'adminId' => $adminId,
+                    'mainId' => $hdMainId,
+                    'remind' => 0,
+                    'roleId' => $roleId,
+                    'avatar' => $avatar,
+                    'name' => $name,
+                    'super' => 1,
+                    'finance' => 0,
+                    'switchShop' => 0,
+                    'founder' => 1,
+                    'mobile' => $mobile,
+                ];
+                self::add($staffData);
+            } else {
+                foreach ($staffList as $myStaff) {
+                    $myStaff->delStatus = 0;
+                    $myStaff->save();
+                }
+            }
+            if (count($staffList) > 1) {
+                util::fail('账号异常,请联系管理员56988');
+            }
+            $hasShop = 1;
+        }
+        return ['hasShop' => $hasShop];
+    }
 }

+ 0 - 1
biz-hd/staff/services/StaffService.php

@@ -3,7 +3,6 @@
 namespace bizHd\staff\services;
 
 use bizHd\base\services\BaseService;
-use Yii;
 
 class StaffService extends BaseService
 {

+ 1 - 0
biz/ghs/classes/GhsClass.php

@@ -225,6 +225,7 @@ class GhsClass extends BaseClass
             $avatar = $val['avatar'] ?? '';
             $list[$key]['shortAvatar'] = $avatar;
             $list[$key]['avatar'] = imgUtil::groupImg($avatar);
+            $list[$key]['smallAvatar'] = imgUtil::groupImg($avatar). "?x-oss-process=image/resize,m_fill,h_80,w_80";
             $currentShopId = $val['shopId'] ?? 0;
 
             $currentShop = $shopInfo[$currentShopId] ?? [];

+ 22 - 0
common/base/classes/BaseClass.php

@@ -3,6 +3,7 @@
 namespace common\base\classes;
 
 use Yii;
+use \common\base\models\Base;
 
 class BaseClass
 {
@@ -12,6 +13,7 @@ class BaseClass
     //查询全部 ssh 2019.11.27
     public static function getAllList($select, $where, $order = '', $with = '')
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         $return = $model->getAllList($select, $where, $order, $with);
         return $return;
@@ -20,6 +22,7 @@ class BaseClass
     //分页查询 ssh 2019.9.21
     public static function getList($select, $where, $order = '', $with = '')
     {
+        /** @var Base $model */
         $get = Yii::$app->request->get();
         $page = isset($get['page']) ? $get['page'] : 1;
         Yii::$app->params['page'] = $page;
@@ -32,6 +35,7 @@ class BaseClass
     //查询指定条数 ssh 2019.11.30
     public static function getLimitList($select, $where, $limit = 10, $order = '', $with = '')
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         $return = $model->getLimitList($select, $where, $limit, $order, $with);
         return $return;
@@ -39,6 +43,7 @@ class BaseClass
 
     public static function add($data, $returnObject = false)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->add($data, $returnObject);
     }
@@ -48,6 +53,7 @@ class BaseClass
      */
     public static function batchAdd($data)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         $model->batchAdd($data);
     }
@@ -57,6 +63,7 @@ class BaseClass
      */
     public static function deleteById($id)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->deleteById($id);
     }
@@ -66,6 +73,7 @@ class BaseClass
      */
     public static function deleteByCondition($condition)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         $count = $model->deleteByCondition($condition);
         return $count;
@@ -74,6 +82,7 @@ class BaseClass
     //根据id批量删 ssh 2019.12.7
     public static function deleteByIds($ids)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->deleteByIds($ids);
     }
@@ -83,6 +92,7 @@ class BaseClass
      */
     public static function updateById($id, $data)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->updateById($id, $data);
     }
@@ -90,6 +100,7 @@ class BaseClass
     //根据多个主键id更新 ssh 2019.9.3
     public static function updateByIds($ids, $data)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->updateByIds($ids, $data);
     }
@@ -99,6 +110,7 @@ class BaseClass
      */
     public static function updateByCondition($condition, $data)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         $count = $model->updateByCondition($condition, $data);
         return $count;
@@ -109,6 +121,7 @@ class BaseClass
      */
     public static function getById($id, $returnObject = false)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getById($id, $returnObject);
     }
@@ -116,6 +129,7 @@ class BaseClass
     //随机取一个 ssh 2020.2.10
     public static function getOne($returnObject = false, $order = false)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getOne($returnObject, $order);
     }
@@ -125,6 +139,7 @@ class BaseClass
      */
     public static function getByCondition($condition, $returnObject = false, $order = false)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getByCondition($condition, $returnObject, $order);
     }
@@ -132,6 +147,7 @@ class BaseClass
     //是否存在  ssh 2019.8.30
     public static function exists($condition)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->exists($condition);
     }
@@ -141,6 +157,7 @@ class BaseClass
      */
     public static function getAllByCondition($condition, $order = null, $field, $indexBy = null, $returnObject = false)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getAllByCondition($condition, $order, $field, $indexBy, $returnObject);
     }
@@ -150,6 +167,7 @@ class BaseClass
      */
     public static function getByIds($ids, $order = null, $indexBy = null)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getByIds($ids, $order, $indexBy);
     }
@@ -159,6 +177,7 @@ class BaseClass
      */
     public static function getCount($condition)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getCount($condition);
     }
@@ -166,6 +185,7 @@ class BaseClass
     //计数器+1-1 shizq 2019-12-05
     public static function counters($counters, $condition, $params = [])
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->counters($counters, $condition, $params);
     }
@@ -173,6 +193,7 @@ class BaseClass
     //根据主键获取被销的信息 ssh 2021.5.18
     public static function getLockById($id)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->getLockById($id);
     }
@@ -180,6 +201,7 @@ class BaseClass
     //求和
     public static function sum($condition, $field)
     {
+        /** @var Base $model */
         $model = Yii::createObject(['class' => static::$baseFile]);
         return $model->sum($condition, $field);
     }

+ 1 - 1
common/components/book.php

@@ -91,7 +91,7 @@ class book
         'chargeStandard' => [
             ['style' => 'info', 'value' => '软件年费1580元/每年(注意是每年),客户通过小程序下单,会扣千分之3.3手续费(即1千元扣3.3元)。',],
             ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国100多家鲜花批发店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
-            ['style' => 'smallTitle', 'value' => '注意,不管是年费、费率和套餐,都已经给到大家最低价,没有谈的空间。如果还要再谈,不需要再找我们浪费时间,请理解。',],
+            ['style' => 'smallTitle', 'value' => '注意,软件的研发成本巨大,不管是年费、费率和套餐,都已经给到大家最低价,没有谈的空间。如果还要再谈,不需要再找我们浪费时间,请理解。',],
             ['style' => 'info', 'value' => '首次开通系统,另外赠送30天有效期,保证有足够时间试运营。',],
             ['style' => 'info', 'value' => '-------------------------------------------',],
             ['style' => 'smallTitle', 'value' => '仓库版',],

+ 7 - 0
common/components/dict.php

@@ -8,6 +8,13 @@ class dict
 {
 
     public static $data = [
+        //mainId对应物流月结账号
+        'expressBizIdMap' => [
+            //长春花路鲜花,
+            '36707' => '4312960899',
+            //龙岩花掌柜
+            '50' => '5925274162',
+        ],
         //花材售后原因
         'itemRefundOption' => [
             0 => ['id' => 0, 'name' => '未选'],

+ 175 - 0
common/components/expressUtil.php

@@ -0,0 +1,175 @@
+<?php
+
+namespace common\components;
+
+use Yii;
+use yii\helpers\Json;
+use linslin\yii2\curl;
+
+/**
+ * 微信小程序物流服务工具类
+ * 参考微信官方文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/interface_and_event.html
+ * 风格参考 miniUtil.php
+ */
+class expressUtil
+{
+    /**
+     * 获取 access_token
+     * @param $merchant
+     * @param int $ptStyle
+     * @return string
+     */
+    public static function getAccessToken($merchant, $ptStyle = 0)
+    {
+        // 直接复用 miniUtil 的获取小程序 access_token 方法
+        return miniUtil::getMiniProgramAccessToken($merchant, $ptStyle);
+    }
+
+    /**
+     * 绑定账号
+     * @param $merchant
+     * @param $data
+     * @param int $ptStyle
+     * @return mixed
+     */
+    public static function bindAccount($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/account/bind?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 拉取已绑定账号
+     */
+    public static function getBindAccount($merchant, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/account/get?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, '{}')->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 获取支持的快递公司列表
+     */
+    public static function getAllDelivery($merchant, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, '{}')->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 生成运单
+     */
+    public static function addOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/order/add?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 取消运单
+     */
+    public static function cancelOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/order/cancel?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 获取运单数据
+     */
+    public static function getOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/order/get?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 批量获取运单数据
+     */
+    public static function batchGetOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/order/batchget?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询运单轨迹
+     */
+    public static function getPath($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/path/get?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 配置打印员
+     */
+    public static function addPrinter($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/printer/update?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询打印员
+     */
+    public static function getPrinter($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/printer/get?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询电子面单余额
+     */
+    public static function getQuota($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/quota/get?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 沙盒测试:模拟更新订单接口
+     */
+    public static function testUpdateOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/cgi-bin/express/business/test_update_order?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+} 

+ 127 - 0
common/components/shippingUtil.php

@@ -0,0 +1,127 @@
+<?php
+
+namespace common\components;
+
+use Yii;
+use yii\helpers\Json;
+use linslin\yii2\curl;
+
+/**
+ * 微信小程序发货信息管理服务-核心接口工具类
+ */
+class shippingUtil
+{
+    public static function getAccessToken($merchant, $ptStyle = 0)
+    {
+        return miniUtil::getMiniProgramAccessToken($merchant, $ptStyle);
+    }
+
+    /**
+     * 发货信息录入接口
+     */
+    public static function shipping($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 发货信息合单录入接口
+     */
+    public static function shippingCombine($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/upload_combined_shipping_info?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询订单发货状态
+     */
+    public static function getShippingInfo($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/get_order?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询订单列表
+     */
+    public static function getOrderList($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/get_order_list?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 确认收货提醒接口
+     */
+    public static function confirmReceiveMsg($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/notify_confirm_receive?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 消息跳转路径设置接口
+     */
+    public static function setMsgJump($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/set_msg_jump_path?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询小程序是否已开通发货信息管理服务
+     */
+    public static function isTradeManage($merchant, $data = [], $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/is_trade_managed?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 查询小程序是否已完成交易结算管理确认
+     */
+    public static function isTradeManageConfirmComplete($merchant, $data = [], $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/is_trade_management_confirmation_completed?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+    /**
+     * 特殊发货报备
+     */
+    public static function opSpecialOrder($merchant, $data, $ptStyle = 0)
+    {
+        $accessToken = self::getAccessToken($merchant, $ptStyle);
+        $url = "https://api.weixin.qq.com/wxa/sec/order/opspecialorder?access_token={$accessToken}";
+        $curl = new curl\Curl();
+        $result = $curl->setOption(CURLOPT_POSTFIELDS, Json::encode($data))->post($url);
+        return Json::decode($result);
+    }
+
+} 

+ 1 - 3
common/components/util.php

@@ -277,11 +277,10 @@ class util
         Yii::info($msg);
 
         $report = isset(Yii::$app->params['errorReport']) ? Yii::$app->params['errorReport'] : 0;
+
         if ($report == 1) {
             throw new \Exception($msg);
-            return fale;
         }
-
         self::encode(['code' => 0, 'msg' => $msg, 'data' => []]);
     }
 
@@ -290,7 +289,6 @@ class util
         $report = isset(Yii::$app->params['errorReport']) ? Yii::$app->params['errorReport'] : 0;
         if ($report == 1) {
             throw new \Exception($msg);
-            return fale;
         }
         self::encode(['code' => 0, 'msg' => $msg, 'data' => [], 'mask' => $mask, 'icon' => $icon, 'duration' => $duration]);
     }