shish 4 jaren geleden
bovenliggende
commit
ffe72c68bf

+ 2 - 3
app-ghs/controllers/ConsoleController.php

@@ -49,7 +49,6 @@ class ConsoleController extends BaseController
 
         $incomeStat = [];
 
-        $shopInfo = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
 
         $menu = [
             ["name" => "商城", "img" => "ghs/home/shop.png", "url" => "/admin/home/mall"],
@@ -61,7 +60,7 @@ class ConsoleController extends BaseController
             ["name" => "调拨出库", "img" => "ghs/home/dbck.png", "url" => "/pagesStorehouse/allot/allotEx"],
             ["name" => "调拨入库", "img" => "ghs/home/dbrk.png", "url" => "/pagesStorehouse/allot/allotPut"]
         ];
-        $agent = $shopInfo['agentLevel'] ?? 0;
+        $agent = $this->shop->agentLevel ?? 0;
         if ($agent == 1) {
             //代理商显示邀请开店按钮
             $menu = [
@@ -76,7 +75,7 @@ class ConsoleController extends BaseController
             ];
         }
 
-        util::success(['asset' => $shopInfo,'notice' => $notice,'todayData' => $todayData,'incomeStat' => $incomeStat,'menu' => $menu,]);
+        util::success(['asset' => $this->main, 'notice' => $notice, 'todayData' => $todayData, 'incomeStat' => $incomeStat, 'menu' => $menu,]);
     }
 
     //常用初始化

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

@@ -118,7 +118,7 @@ class CustomController extends BaseController
         $get = Yii::$app->request->get();
         $type = isset($get['type']) ? $get['type'] : 0;
         $name = isset($get['name']) ? $get['name'] : '';
-        $where = ['ownShopId' => $this->shopId];
+        $where = ['ownMainId' => $this->mainId];
         $sort = 'visitTime DESC';
         if ($type == 1) {
             //消费排行

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

@@ -33,7 +33,7 @@ class ShopController extends BaseController
             $custom = CustomClass::getById($id, true);
             CustomClass::valid($custom, $this->shopId);
             $shop = $this->shop ?? [];
-            $lsShopId = $shop->id ?? 0;
+            $lsShopId = $shop->lsShopId ?? 0;
             if (!empty($lsShopId)) {
                 util::fail('您已经绑定过了');
             }

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

@@ -24,8 +24,8 @@ class AdminController extends BaseController
         if (empty($admin)) {
             util::fail('请先注册');
         }
-        $openShop = $admin['openHdShop'] ?? 1;
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $openShop = $admin['openShop'] ?? 1;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             if ($openShop == 2) {
                 util::fail('审核中');

+ 3 - 3
app-hd/controllers/ApplyController.php

@@ -149,11 +149,11 @@ class ApplyController extends BaseController
             $fromApp = dict::getDict('userSourceGetId', 'app', 'id');
             $admin = AdminService::replaceAdmin($adminInfo, $fromApp);
             $adminId = $admin['id'] ?? 0;
-            $currentShopId = $admin['currentHdShopId'] ?? 0;
+            $currentShopId = $admin['currentShopId'] ?? 0;
             if (!empty($currentShopId)) {
                 util::fail('您已提交过申请,管理员ID:' . $adminId);
             }
-            if (isset($admin['openHdShop']) && $admin['openHdShop'] == 2) {
+            if (isset($admin['openShop']) && $admin['openShop'] == 2) {
                 util::fail('审核中,无需重复申请');
             }
             $post['adminId'] = $adminId;
@@ -177,7 +177,7 @@ class ApplyController extends BaseController
             $newMainId = $newShop->mainId ?? 0;
             $newShopId = $newShop->id ?? 0;
             //前端用于判断是否注册
-            $admin['currentHdShopId'] = $newShopId;
+            $admin['currentShopId'] = $newShopId;
             $adminId = $admin['id'];
             $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId, 'mainId' => $newMainId], true);
             if (empty($shopAdmin)) {

+ 7 - 7
app-hd/controllers/AuthController.php

@@ -62,8 +62,8 @@ class AuthController extends PublicController
         if (empty($admin)) {
             util::fail('请先注册');
         }
-        $openShop = $admin['openHdShop'] ?? 1;
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $openShop = $admin['openShop'] ?? 1;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             if ($openShop == 2) {
                 util::fail('审核中');
@@ -132,8 +132,8 @@ class AuthController extends PublicController
         if (password_verify($password, $admin['password']) == false) {
             util::fail('密码错误');
         }
-        $openShop = $admin['openHdShop'] ?? 1;
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $openShop = $admin['openShop'] ?? 1;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             if ($openShop == 2) {
                 util::fail('审核中');
@@ -220,8 +220,8 @@ class AuthController extends PublicController
         if (empty($admin)) {
             util::fail('请先注册');
         }
-        $openShop = $admin['openHdShop'] ?? 1;
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $openShop = $admin['openShop'] ?? 1;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             if ($openShop == 2) {
                 util::fail('审核中');
@@ -449,7 +449,7 @@ class AuthController extends PublicController
             util::success(['token' => '', 'currentMiniOpenId' => $openid]);
         }
         $adminId = $admin['id'];
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (empty($currentShopId)) {
             //没有管理店铺不允许登录
             util::success(['token' => '', 'currentMiniOpenId' => $openid]);

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

@@ -51,7 +51,7 @@ class BaseController extends PublicController
             }
         }
         //后台
-        $currentShopId = $admin->currentHdShopId ?? 0;
+        $currentShopId = $admin->currentShopId ?? 0;
         if (empty($currentShopId)) {
             if (in_array($action->id, $this->guestAccess) == false) {
                 util::fail('请注册登录');

+ 1 - 3
app-hd/controllers/ConsoleController.php

@@ -84,10 +84,8 @@ class ConsoleController extends BaseController
             'list' => ['7.1' => 100, '7.2' => 200, '7.3' => 300, '7.4' => 400, '7.5' => 500],
         ];
 
-        $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
-
         util::success([
-            'asset' => $shop,
+            'asset' => $this->main,
             'notice' => $notice,
             'todayData' => $todayData,
             'visitStat' => $visitStat,

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

@@ -110,7 +110,7 @@ class ShopAdminController extends BaseController
         $post['adminId'] = $this->adminId;
         $post['mainId'] = $this->mainId;
         $admin = $this->admin->attributes;
-        $currentShopId = $admin['currentHdShopId'] ?? 0;
+        $currentShopId = $admin['currentShopId'] ?? 0;
         if (!empty($currentShopId)) {
             $shop = ShopClass::getShopInfo($currentShopId);
             //一个人不能同时在二个商家门店下工作
@@ -118,7 +118,7 @@ class ShopAdminController extends BaseController
                 util::fail('您已经是别的商家员工');
             }
         }
-        $openShop = $admin['openHdShop'] ?? AdminClass::OPEN_SHOP_NO;
+        $openShop = $admin['openShop'] ?? AdminClass::OPEN_SHOP_NO;
         if ($openShop != AdminClass::OPEN_SHOP_NO) {
             util::fail('您已申请开过店,不能成为别人的员工');
         }

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

@@ -76,8 +76,8 @@ class AdminClass extends BaseClass
         if (!empty($admin)) {
             $ptStyle = $applyData['style'] ?? dict::getDict('ptStyle', 'hd');
             if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
-                $admin->openHdShop = 3;
-                $admin->currentHdShopId = $shopId;
+                $admin->openShop = 3;
+                $admin->currentShopId = $shopId;
                 $admin->save();
             } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
                 $admin->openGhsShop = 3;
@@ -429,7 +429,7 @@ class AdminClass extends BaseClass
         $shopAdmin = \biz\shop\classes\ShopAdminClass::changeShopAddRelate($originShopAdmin, $newShop);
         $ptStyle = Yii::$app->params['ptStyle'];
         if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
-            self::updateById($adminId, ['currentHdShopId' => $newShopId]);
+            self::updateById($adminId, ['currentShopId' => $newShopId]);
         }
         if ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
             self::updateById($adminId, ['currentGhsShopId' => $newShopId]);

+ 2 - 1
biz-ghs/merchant/classes/ShopClass.php

@@ -141,13 +141,14 @@ class ShopClass extends BaseClass
         $setData = ['mainId' => $ghsMainId, 'riseType' => 0, 'riseAmount' => 0];
         GoodsSettingClass::add($setData);
 
+        //允许员工登录零售店
         $staffList = ShopAdminClass::getAllByCondition(['mainId' => $ghsMainId], null, '*', null, true);
         if (!empty($staffList)) {
             foreach ($staffList as $staff) {
                 $adminId = $staff->adminId ?? 0;
                 $admin = AdminClass::getById($adminId, true);
                 if (!empty($admin)) {
-                    $admin->currentHdShopId = $customShopId;
+                    $admin->currentShopId = $customShopId;
                     $admin->save();
                 }
             }

+ 2 - 2
biz/shop/classes/ShopAdminClass.php

@@ -184,10 +184,10 @@ class ShopAdminClass extends BaseClass
         $relation->delStatus = 1;
         $relation->save();
         //删除员工关系后,再找出这个员工还有没其它门店员工身份补上
-        if (!empty($admin) && isset($admin->currentHdShopId) && $admin->currentHdShopId == $currentShopId) {
+        if (!empty($admin) && isset($admin->currentShopId) && $admin->currentShopId == $currentShopId) {
             $has = self::getByCondition(['adminId' => $adminId, 'delStatus' => 0, 'status' => 1], true);
             $hasCurrentShopId = $has->shopId ?? 0;
-            $admin->currentHdShopId = $hasCurrentShopId;
+            $admin->currentShopId = $hasCurrentShopId;
             $admin->save();
         }
         // 员工数-1

+ 2 - 2
console/controllers/InitController.php

@@ -205,8 +205,8 @@ class InitController extends Controller
                         $adminId = $staff['adminId'] ?? 0;
                         $admin = AdminClass::getById($adminId, true);
                         if (!empty($admin)) {
-                            if(empty($admin->currentHdShopId)){
-                                $admin->currentHdShopId = $lsShopId;
+                            if(empty($admin->currentShopId)){
+                                $admin->currentShopId = $lsShopId;
                                 $admin->save();
                             }
                         }

+ 7 - 4
sql.sql

@@ -962,12 +962,15 @@ alter table xhShop drop column openTime;
 
 ALTER TABLE xhAd ADD mainId INT NOT NULL DEFAULT 0 COMMENT '' AFTER `sjId`;
 
-ALTER TABLE xhAdmin ADD `currentHdShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '当前管理的门店' AFTER `openShop`;
-ALTER TABLE xhAdmin ADD `openHdShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过' AFTER `currentHdShopId`;
-ALTER TABLE xhAdmin ADD `currentGhsShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '当前管理的门店' AFTER `openHdShop`;
-ALTER TABLE xhAdmin ADD `openGhsShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '申请开店 1没有 2有申请,待审核 3有申请,已审核通过' AFTER `currentGhsShopId`;
+ALTER TABLE xhAdmin ADD `currentGhsShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '供应商当前管理的门店' AFTER `openShop`;
+ALTER TABLE xhAdmin ADD `openGhsShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '供应商申请开店 1没有 2有申请,待审核 3有申请,已审核通过' AFTER `currentGhsShopId`;
 
 ALTER TABLE xhGoodsSetting DROP INDEX `merchantId`;
 ALTER TABLE xhAdminRole ADD mainId INT NOT NULL DEFAULT 0 COMMENT '中央id' AFTER `sjId`;
+ALTER TABLE xhAdmin ADD `ghsMiniOpenId` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '供应商小程序openid' AFTER `miniOpenId`;
+ALTER TABLE xhAdmin MODIFY `miniOpenId` VARCHAR(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '零售小程序openid';
+
+ALTER TABLE `xhAdmin` MODIFY `currentShopId` INT(11) NOT NULL DEFAULT '0' COMMENT '零售当前管理的门店' AFTER `super`;
+ALTER TABLE `xhAdmin` MODIFY `openShop` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '零售申请开店 1没有 2有申请,待审核 3有申请,已审核通过' AFTER `currentShopId`;
 
 -- ssh 20220424