Răsfoiți Sursa

Merge branch 'master' into debt

shish 1 an în urmă
părinte
comite
995d5eb593

+ 15 - 2
app-ghs/controllers/BaseController.php

@@ -41,9 +41,22 @@ class BaseController extends PublicController
 
         //token验证
         $adminId = jwt::getLoginId();
-        if (getenv('YII_ENV', 'local') == 'local') {
-            //$adminId = 730;
+
+        //将石少华的号模拟成别人的号进行测试,有多处需要同步修改,关键词 simulate_other ssh 20250717
+        $simulateKey = 'simulate_admin_id';
+        $simulateId = Yii::$app->redis->executeCommand('GET', [$simulateKey]);
+        if (!empty($simulateId) && $simulateId > 0) {
+            if (getenv('YII_ENV') == 'production') {
+                if ($adminId == 4) {
+                    $adminId = $simulateId;
+                }
+            } else {
+                if ($adminId == 919) {
+                    $adminId = $simulateId;
+                }
+            }
         }
+
         if (empty($adminId) && in_array($action->id, $this->guestAccess) == false) {
             util::notLogin();
         }

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

@@ -49,7 +49,7 @@ class NotifyController extends BaseController
     {
         $get = Yii::$app->request->get();
         $staffId = $this->shopAdminId;
-        $where = ['mainId' => $this->mainId, 'staffId' => $staffId];
+        $where = ['staffId' => $staffId];
         $read = $get['read'] ?? '';
         if (is_numeric($read)) {
             $where['read'] = $read;

+ 2 - 38
app-ghs/controllers/OrderController.php

@@ -2970,45 +2970,9 @@ class OrderController extends BaseController
         if (empty($order)) {
             util::fail('没有找到订单');
         }
-        $customId = $order->customId ?? 0;
-        $custom = CustomClass::getById($customId, true);
-        if (empty($custom)) {
-            util::fail('没有找到客户');
-        }
-        $shortName = $custom->shortName ?? '';
-        if (empty($shortName)) {
-            util::fail('客户的短名没有设置');
-        }
-        $shortName = stringUtil::subStringUtf8($shortName, 5);
-        $customMobile = $order->customMobile ?? '';
-        if (empty($customMobile)) {
-            util::fail('客户手机号无效');
-        }
-        $shortMobile = substr($customMobile, -4);
-        $remark = $order->remark ?? '';
-        $shortRemark = stringUtil::subStringUtf8($remark, 8);
-
-        $shop = $this->shop;
-        $shopName = $shop->shopName ?? '';
-        $sjName = $shop->merchantName;
-        $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
-        $telephone = $shop->telephone ?? '';
-
         $ext = $this->shopExt;
-        $wlLabelSn = $ext->wlLabelSn ?? '';
-        if (empty($wlLabelSn)) {
-            util::fail('请绑定物流标签机');
-        }
-        $p = new printUtil($wlLabelSn);
-        $p->times = 2;
-        $content = '<TEXT x="420" y="130" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
-        $content .= '<TEXT x="395" y="10" font="12" w="2" h="2" r="90">地址</TEXT>';
-        $content .= '<TEXT x="290" y="130" font="12" w="4" h="4" r="90">' . $shortMobile . '</TEXT>';
-        $content .= '<TEXT x="265" y="10" font="12" w="2" h="2" r="90">代码</TEXT>';
-        $content .= '<TEXT x="170" y="130" font="12" w="4" h="4" r="90">' . $shortRemark . '</TEXT>';
-        $content .= '<TEXT x="150" y="10" font="12" w="2" h="2" r="90">物流</TEXT>';
-        $content .= '<TEXT x="45" y="70" font="12" w="2" h="2" r="90">' . $currentName . ' ' . $telephone . '</TEXT>';
-        $p->printLabelMsg($content);
+        $shop = $this->shop;
+        OrderClass::printLogisticsLabel($order, $shop, $ext);
         util::complete('打印成功');
     }
 

+ 22 - 1
app-ghs/controllers/TestController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use biz\admin\classes\AdminClass;
 use biz\ghs\classes\GhsClass;
 use biz\shop\classes\ShopClass;
 use biz\sj\services\MerchantService;
@@ -40,7 +41,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', 'sim'];
 
     public function actionFx()
     {
@@ -1376,4 +1377,24 @@ class TestController extends BaseController
         $r = $producer->publish($msg, 'informExchange', 'informRoute');
     }
 
+    public function actionSim()
+    {
+        //将石少华的号模拟成别人的号进行测试,有多处需要同步修改,关键词 simulate_other ssh 20250717
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $simulateKey = 'simulate_admin_id';
+        if ($id == 0) {
+            Yii::$app->redis->executeCommand('DEL', [$simulateKey]);
+            util::stop('已将石少华账号清空');
+        }
+        $admin = AdminClass::getById($id, true);
+        if (empty($admin)) {
+            util::fail('管理员无效');
+        }
+        $adminName = $admin->name ?? '';
+        $simulateKey = 'simulate_admin_id';
+        Yii::$app->redis->executeCommand('SET', [$simulateKey, $id]);
+        echo "已将石少华账号设置为:" . $adminName;
+    }
+
 }

+ 15 - 2
app-hd/controllers/BaseController.php

@@ -32,9 +32,22 @@ class BaseController extends PublicController
 
         //token验证 
         $adminId = jwt::getLoginId();
-        if (getenv('YII_ENV', 'local') != 'production') {
-            //$adminId = 253;
+
+        //将石少华的号模拟成别人的号进行测试,有多处需要同步修改,关键词 simulate_other ssh 20250717
+        $simulateKey = 'simulate_admin_id';
+        $simulateId = Yii::$app->redis->executeCommand('GET', [$simulateKey]);
+        if (!empty($simulateId) && $simulateId > 0) {
+            if (getenv('YII_ENV') == 'production') {
+                if ($adminId == 4) {
+                    $adminId = $simulateId;
+                }
+            } else {
+                if ($adminId == 919) {
+                    $adminId = $simulateId;
+                }
+            }
         }
+
         if (empty($adminId) && in_array($action->id, $this->guestAccess) == false) {
             util::notLogin();
         }

+ 0 - 10
biz-ghs/item/classes/ItemClass.php

@@ -492,14 +492,4 @@ class ItemClass extends BaseClass
         return self::updateByCondition(['itemId' => $itemId, 'sjId' => $sjId], ['cost' => $cost]);
     }
 
-    //获取itemId=>classId
-    public static function getItemIdClassIdMap($sjId)
-    {
-        $map = [];
-        $itemData = self::getGhsItemAll($sjId, "itemId,classId");
-        foreach ($itemData as $v) {
-            $map[$v['itemId']] = $v['classId'];
-        }
-        return $map;
-    }
 }

+ 1 - 5
biz-ghs/order/classes/CheckOrderClass.php

@@ -445,10 +445,6 @@ class CheckOrderClass extends BaseClass
         $orderInfo = CheckOrderItemClass::getOrderItemDetail($orderSn);
         $itemData = [];
 
-        //获取itemId=>classId
-        $sjId = $orderData['sjId'];
-        $itemIdClassIdMap = ProductClass::getItemIdClassIdMap($sjId);
-
         if ($orderInfo) {
             foreach ($orderInfo as $v) {
                 $info = json_decode($v['itemInfo'], true);
@@ -461,7 +457,7 @@ class CheckOrderClass extends BaseClass
 
                 $tmp = array_merge($tmp, $v);
                 $tmp['id'] = $v['productId'];
-                $tmp['classId'] = $itemIdClassIdMap[$v['itemId']] ?? 0;
+                $tmp['classId'] = 0;
                 $itemData[] = $tmp;
             }
         }

+ 106 - 3
biz-ghs/order/classes/OrderClass.php

@@ -154,7 +154,7 @@ class OrderClass extends BaseClass
             $wlName = $custom['wlName'] ?? '';
             $myList[] = ['sendNum' => $sendNum, 'customMobile' => $customMobile, 'shortName' => $shortName, 'wlName' => $wlName];
         }
-        $myList = arrayUtil::arraySort($myList,'customMobile');
+        $myList = arrayUtil::arraySort($myList, 'customMobile');
 
         $size = 50;
         $arr = array_chunk($myList, $size);
@@ -1798,6 +1798,21 @@ class OrderClass extends BaseClass
         $shopName = $shop->shopName ?? '';
         $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
 
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+        $printSn = $ext->printSn ?? '';
+
+        /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+        $orderMainId = $orderInfo['mainId'] ?? 0;
+        if (getenv('YII_ENV') == 'production') {
+            $map = [65726, 58];
+        } else {
+            $map = [828, 0];
+        }
+        if (in_array($orderMainId, $map)) {
+            self::printLogisticsLabel($orderInfo, $shop, $ext);
+        }
+        /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+
         $itemList = $showItem['list'] ?? [];
         if (count($itemList) > 40) {
             //超出数量的打印
@@ -1993,12 +2008,11 @@ class OrderClass extends BaseClass
         $content .= "<BR>";
         $content .= "<BR>";
 
-        $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);
-        $printSn = $ext['printSn'] ?? '';
         if (!empty($printSn)) {
             $p = new printUtil($printSn);
             $p->printMsg($content, $shop, $orderSn);
         }
+
     }
 
     //打印数据 ssh 20210702
@@ -2828,4 +2842,93 @@ XL;
         util::success(['file' => $fileUrl, 'shortFile' => $file]);
     }
 
+    public static function printLogisticsLabel($order, $shop, $ext)
+    {
+        /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+        $orderMainId = $order->mainId;
+        if (getenv('YII_ENV') == 'production') {
+            $map = [65726, 58];
+        } else {
+            $map = [828, 0];
+        }
+        /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+        $customId = $order->customId ?? 0;
+        $custom = CustomClass::getById($customId, true);
+        if (empty($custom)) {
+            if (!in_array($orderMainId, $map)) {
+                util::fail('没有找到客户');
+            } else {
+                return false;
+            }
+        }
+        $shortName = $custom->shortName ?? '';
+
+        $shortName = stringUtil::subStringUtf8($shortName, 5);
+        $customMobile = $order->customMobile ?? '';
+        if (empty($customMobile)) {
+            if (!in_array($orderMainId, $map)) {
+                util::fail('客户手机号无效');
+            } else {
+                return false;
+            }
+        }
+        $customName = $order->customName ?? '';
+        $shortMobile = substr($customMobile, -4);
+        $remark = $order->remark ?? '';
+        $shortRemark = stringUtil::subStringUtf8($remark, 8);
+
+        $address = $order->address ?? '';
+        $floor = $order->floor ?? '';
+        $fullAddress = $address . $floor;
+
+        $shopName = $shop->shopName ?? '';
+        $sjName = $shop->merchantName;
+        $currentName = $shopName == '首店' ? $sjName : $sjName . ' ' . $shopName;
+        $telephone = $shop->telephone ?? '';
+
+        $wlLabelSn = $ext->wlLabelSn ?? '';
+        if (empty($wlLabelSn)) {
+            if (!in_array($orderMainId, $map)) {
+                util::fail('请绑定物流标签机');
+            } else {
+                return false;
+            }
+        }
+        $p = new printUtil($wlLabelSn);
+
+        if (!in_array($orderMainId, $map)) {
+            if (empty($shortName)) {
+                util::fail('客户短名没有设置');
+            }
+            $p->times = 2;
+            $content = '<TEXT x="420" y="130" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
+            $content .= '<TEXT x="395" y="10" font="12" w="2" h="2" r="90">地址</TEXT>';
+            $content .= '<TEXT x="290" y="130" font="12" w="4" h="4" r="90">' . $shortMobile . '</TEXT>';
+            $content .= '<TEXT x="265" y="10" font="12" w="2" h="2" r="90">代码</TEXT>';
+            $content .= '<TEXT x="170" y="130" font="12" w="4" h="4" r="90">' . $shortRemark . '</TEXT>';
+            $content .= '<TEXT x="150" y="10" font="12" w="2" h="2" r="90">物流</TEXT>';
+            $content .= '<TEXT x="45" y="70" font="12" w="2" h="2" r="90">' . $currentName . ' ' . $telephone . '</TEXT>';
+        } else {
+            /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+            $sameTimeIds = $order->sameTimeIds;
+            $num = 1;
+            if (!empty($sameTimeIds)) {
+                $ids = explode(',', $sameTimeIds);
+                if (!empty($ids)) {
+                    $num = count($ids);
+                }
+            }
+            if ($num > 1) {
+                $customName = $customName . ' ' . $num . '单';
+            }
+            $content = '<TEXT x="430" y="30" font="12" w="4" h="4" r="90">' . $shortName . '</TEXT>';
+            $content .= '<TEXT x="300" y="30" font="12" w="2" h="3" r="90">' . $customName . '</TEXT>';
+            $content .= '<TEXT x="190" y="10" font="12" w="1" h="2" r="90">' . $fullAddress . '</TEXT>';
+            $content .= '<TEXT x="120" y="10" font="12" w="2" h="2" r="90">' . $customMobile . '</TEXT>';
+            /**************************如果是好多花的云仓还要再打一下标签纸,多处要同步修改,关键词 hdh_yc *****************************/
+        }
+        $p->printLabelMsg($content);
+        return true;
+    }
+
 }

+ 0 - 11
biz-ghs/product/classes/ProductClass.php

@@ -2501,17 +2501,6 @@ class ProductClass extends BaseClass
         return self::updateById($productId, $data);
     }
 
-    //获取itemId=>classId
-    public static function getItemIdClassIdMap($sjId)
-    {
-        $map = [];
-        $itemData = self::getGhsItemAll($sjId, "itemId,classId");
-        foreach ($itemData as $v) {
-            $map[$v['itemId']] = $v['classId'];
-        }
-        return $map;
-    }
-
     //获取当前供货商下的所有item
     public static function getGhsItemAll($sjId, $select = "*")
     {

+ 11 - 3
biz/admin/classes/AdminClass.php

@@ -3,6 +3,7 @@
 namespace biz\admin\classes;
 
 use biz\base\classes\BaseClass;
+use Yii;
 
 class AdminClass extends BaseClass
 {
@@ -31,9 +32,16 @@ class AdminClass extends BaseClass
     //获取平台的超级管理员 ssh 20231005
     public static function getPtSuperAdminId()
     {
-        $adminId = 919;
-        if (getenv('YII_ENV') == 'production') {
-            $adminId = 4;
+        //如果模拟成别人的账号,就取消超管的能力
+        $simulateKey = 'simulate_admin_id';
+        $simulateId = Yii::$app->redis->executeCommand('GET', [$simulateKey]);
+        if (!empty($simulateId)) {
+            $adminId = 0;
+        } else {
+            $adminId = 919;
+            if (getenv('YII_ENV') == 'production') {
+                $adminId = 4;
+            }
         }
         return $adminId;
     }