Browse Source

管理员

shish 6 years ago
parent
commit
53f707801b
2 changed files with 64 additions and 64 deletions
  1. 63 63
      app/shop/controllers/AdminShopController.php
  2. 1 1
      biz/admin/services/AdminShopService.php

+ 63 - 63
app/shop/controllers/AdminShopController.php

@@ -12,68 +12,68 @@ use yii\web\Controller;
 
 class AdminShopController extends BaseController
 {
-	
-	//创建管理员数据准备 shish 2020.4.17
-	public function actionPrepareBind()
-	{
-		$post = Yii::$app->request->post();
-		$roleId = isset($post['roleId']) ? $post['roleId'] : 0;
-		$role = AdminRoleService::getById($roleId);
-		if (empty($role) || isset($role['merchantId']) != $this->merchantId) {
-			util::fail('请选择角色!');
-		}
-		unset($post['userId']);
-		unset($post['status']);
-		$post['shopId'] = $this->shopId;
-		$post['adminId'] = $this->adminId;
-		$merchant = WxOpenService::getWxInfo();
-		$post['merchant'] = $merchant;
-		$respond = AdminShopService::prepareBindAdmin($post);
-		$miniCode = isset($respond['miniCode']) ? Yii::$app->params['imgHost'] . $respond['miniCode'] : '';
-		util::success(['miniCode' => $miniCode]);
-	}
-	
-	//创建管理员 shish 2020.4.20
-	public function actionGenerateAdmin()
-	{
-		$post = Yii::$app->request->post();
-		$respond = AdminShopService::generateAdmin($post);
-		util::complete($respond);
-	}
-	
-	//收款通知 shish 2020.1.4
-	public function actionUpdateRemind()
-	{
-		$get = Yii::$app->request->get();
-		$id = isset($get['id']) ? $get['id'] : 0;
-		$remind = isset($get['remind']) && is_numeric($get['remind']) ? $get['remind'] : 0;
-		$adminShop = AdminShopService::getByCondition(['shopId' => $this->shopId, 'adminId' => $id]);
-		AdminShopService::valid($adminShop, $this->shopId);
-		AdminShopService::updateByCondition(['shopId' => $this->shopId, 'adminId' => $id], ['remind' => $remind]);
-		util::complete();
-	}
-	
-	//启用与停用 shish 2020.1.4
-	public function actionUpdateStatus()
-	{
-		$get = Yii::$app->request->get();
-		$id = isset($get['id']) && is_numeric($get['id']) ? $get['id'] : 0;
-		$status = isset($get['status']) ? $get['status'] : 0;
-		$adminShop = AdminShopService::getByCondition(['shopId' => $this->shopId, 'adminId' => $id]);
-		AdminShopService::valid($adminShop, $this->shopId);
-		AdminShopService::updateByCondition(['shopId' => $this->shopId, 'adminId' => $id], ['status' => $status]);
-		util::complete();
-	}
 
-	//员工列表 shish 2019.12.8
-	public function actionList()
-	{
-		$get = Yii::$app->request->get();
-		$where = [];
-		$where['shopId'] = $this->shopId;
-		$where['delStatus'] = 0;
-		$list = AdminShopService::getAdminList($where);
-		util::success($list);
-	}
-	
+    //创建管理员数据准备 shish 2020.4.17
+    public function actionPrepareBind()
+    {
+        $post = Yii::$app->request->post();
+        $roleId = isset($post['roleId']) ? $post['roleId'] : 0;
+        $role = AdminRoleService::getById($roleId);
+        if (empty($role) || isset($role['merchantId']) != $this->merchantId) {
+            util::fail('请选择角色!');
+        }
+        unset($post['userId']);
+        unset($post['status']);
+        $post['shopId'] = $this->shopId;
+        $post['adminId'] = $this->adminId;
+        $merchant = WxOpenService::getWxInfo();
+        $post['merchant'] = $merchant;
+        $respond = AdminShopService::prepareBindAdmin($post);
+        $miniCode = isset($respond['miniCode']) ? Yii::$app->params['imgHost'] . $respond['miniCode'] : '';
+        util::success(['miniCode' => $miniCode]);
+    }
+
+    //创建管理员 shish 2020.4.20
+    public function actionGenerateAdmin()
+    {
+        $post = Yii::$app->request->post();
+        $respond = AdminShopService::generateAdmin($post);
+        util::success($respond);
+    }
+
+    //收款通知 shish 2020.1.4
+    public function actionUpdateRemind()
+    {
+        $get = Yii::$app->request->get();
+        $id = isset($get['id']) ? $get['id'] : 0;
+        $remind = isset($get['remind']) && is_numeric($get['remind']) ? $get['remind'] : 0;
+        $adminShop = AdminShopService::getByCondition(['shopId' => $this->shopId, 'adminId' => $id]);
+        AdminShopService::valid($adminShop, $this->shopId);
+        AdminShopService::updateByCondition(['shopId' => $this->shopId, 'adminId' => $id], ['remind' => $remind]);
+        util::complete();
+    }
+
+    //启用与停用 shish 2020.1.4
+    public function actionUpdateStatus()
+    {
+        $get = Yii::$app->request->get();
+        $id = isset($get['id']) && is_numeric($get['id']) ? $get['id'] : 0;
+        $status = isset($get['status']) ? $get['status'] : 0;
+        $adminShop = AdminShopService::getByCondition(['shopId' => $this->shopId, 'adminId' => $id]);
+        AdminShopService::valid($adminShop, $this->shopId);
+        AdminShopService::updateByCondition(['shopId' => $this->shopId, 'adminId' => $id], ['status' => $status]);
+        util::complete();
+    }
+
+    //员工列表 shish 2019.12.8
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $where['shopId'] = $this->shopId;
+        $where['delStatus'] = 0;
+        $list = AdminShopService::getAdminList($where);
+        util::success($list);
+    }
+
 }

+ 1 - 1
biz/admin/services/AdminShopService.php

@@ -77,7 +77,7 @@ class AdminShopService extends BaseService
             'status' => $status,
             'merchantId' => $merchantId,
         ];
-        //AdminShopClass::delBindAdminData($shopId, $recommendAdminId);
+        AdminShopClass::delBindAdminData($shopId, $recommendAdminId);
         return AdminShopClass::add($addData);
     }