Browse Source

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

林琦海 5 years ago
parent
commit
c1cd12cd34

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

@@ -32,7 +32,7 @@ class RenewController extends BaseController
         $shopAdmin = $this->shopAdmin;
         $adminName = $shopAdmin['name'] ?? '';
         $addData['shopAdminName'] = $adminName;
-        $price = 3980;
+        $price = 0.01;
         $prePrice = $price;
         $actPrice = $price;
         $addData['actPrice'] = $actPrice;

+ 2 - 0
app-ghs/controllers/ShopAdminController.php

@@ -62,6 +62,8 @@ class ShopAdminController extends BaseController
         if ($openShop != AdminClass::OPEN_SHOP_NO) {
             util::fail('您已申请开过店,不能成为别人的员工');
         }
+        // 头像
+        $post['avatar'] = $admin['avatar'];
         $respond = ShopAdminService::generateAdmin($post);
         util::success($respond);
     }

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

@@ -32,7 +32,7 @@ class RenewController extends BaseController
         $shopAdmin = $this->shopAdmin;
         $adminName = $shopAdmin['name'] ?? '';
         $addData['shopAdminName'] = $adminName;
-        $price = 3980;
+        $price = 0.01;
         $prePrice = $price;
         $actPrice = $price;
         $addData['actPrice'] = $actPrice;

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

@@ -61,6 +61,8 @@ class ShopAdminController extends BaseController
         if ($openShop != AdminClass::OPEN_SHOP_NO) {
             util::fail('您已申请开过店,不能成为别人的员工');
         }
+        // 头像
+        $post['avatar'] = $admin['avatar'];
         $respond = ShopAdminService::generateAdmin($post);
         util::success($respond);
     }

+ 11 - 3
biz-hd/admin/services/ShopAdminService.php

@@ -64,11 +64,12 @@ class ShopAdminService extends BaseService
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
+
         $sjId = $shop['merchantId'] ?? 0;
-        $shopAdmin = ShopAdminClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId]);
+        $shopAdmin = ShopAdminClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId], true);
         if (!empty($shopAdmin)) {
             //员工已经删除的补回
-            if (isset($shopAdmin->delStatus) && $shopAdmin->delStatus == 1) {
+            if ($shopAdmin->delStatus == 1) {
                 $shopAdmin->delStatus = 0;
                 $shopAdmin->roleId = $roleId;
                 $shopAdmin->remind = $remind;
@@ -76,6 +77,8 @@ class ShopAdminService extends BaseService
                 $shopAdmin->save();
                 $update = ['name' => $name, 'mobile' => $mobile, 'password' => $password, 'remark' => $remark, 'currentShopId' => $shopId];
                 AdminClass::updateById($adminId, $update);
+                // 员工数+1
+                AdminRoleClass::counters(['num' => 1], ['id' => $roleId]);
 
                 return $shopAdmin->attributes;
             }
@@ -105,7 +108,12 @@ class ShopAdminService extends BaseService
             'mobile' => $mobile,
         ];
         ShopAdminClass::delBindAdminData($shopId, $recommendAdminId);
-        return ShopAdminClass::add($addData);
+
+        $result = ShopAdminClass::add($addData);
+        // 员工数+1
+        AdminRoleClass::counters(['num' => 1], ['id' => $roleId]);
+
+        return $result;
     }
 
     //获取管理员 ssh 2020.4.21

+ 22 - 0
biz-hd/merchant/classes/ShopClass.php

@@ -29,6 +29,28 @@ class ShopClass extends BaseClass
         return isset($merchant['defaultShopId']) ? $merchant['defaultShopId'] : 0;
     }
 
+    //创建门店 ssh 2020.2.8
+    public static function addShop($data)
+    {
+        $data['createTime'] = date("Y-m-d H:i:s");
+        $shopName = isset($data['shopName']) ? $data['shopName'] : '';
+        if (empty($shopName)) {
+            util::fail('请填写门店名称');
+        }
+        $exists = self::getByCondition(['merchantId' => $data['merchantId'], 'shopName' => $shopName]);
+        if (!empty($exists)) {
+            util::fail('门店名称已经存在');
+        }
+        $data['img'] = isset($data['img']) ? json_encode($data['img']) : json_encode([]);
+        $shop = self::add($data);
+        $newShopId = $shop['id'];
+        //初始化花材 linqh 2021.5.11
+        $adminId = $data['adminId']??0;
+        $shopId = $data['shopId']??0;
+        ProductClass::newShopInitProduct($data['merchantId'],$shopId,$newShopId,$adminId);
+        return $shop;
+    }
+
     //更新门店 ssh 2020.2.29
     public static function updateShop($id, $data)
     {

+ 0 - 1
biz/shop/classes/ShopAdminClass.php

@@ -199,7 +199,6 @@ class ShopAdminClass extends BaseClass
         if (isset($admin->currentShopId) && $admin->currentShopId == $currentShopId) {
             $has = self::getByCondition(['adminId' => $adminId, 'delStatus' => 0, 'status' => 1], true);
             if (!empty($has)) {
-
                 $hasId = $has->shopId;
                 $admin->currentShopId = $hasId;
             } else {