shish 6 anni fa
parent
commit
bfbc94de74

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

@@ -3,14 +3,14 @@
 namespace shop\controllers;
 
 use biz\admin\services\AdminRoleService;
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\wx\services\WxOpenService;
 use common\components\jwt;
 use common\components\util;
 use Yii;
 use yii\web\Controller;
 
-class AdminShopController extends BaseController
+class ShopAdminController extends BaseController
 {
 	
 	//创建管理员数据准备 shish 2020.4.17
@@ -28,7 +28,7 @@ class AdminShopController extends BaseController
 		$post['adminId'] = $this->adminId;
 		$merchant = WxOpenService::getWxInfo();
 		$post['merchant'] = $merchant;
-		$respond = AdminShopService::prepareBindAdmin($post);
+		$respond = ShopAdminService::prepareBindAdmin($post);
 		$miniCode = isset($respond['miniCode']) ? Yii::$app->params['imgHost'] . $respond['miniCode'] : '';
 		util::success(['miniCode' => $miniCode]);
 	}
@@ -37,7 +37,7 @@ class AdminShopController extends BaseController
 	public function actionGenerateAdmin()
 	{
 		$post = Yii::$app->request->post();
-		$respond = AdminShopService::generateAdmin($post);
+		$respond = ShopAdminService::generateAdmin($post);
 		util::success($respond);
 	}
 	
@@ -47,9 +47,9 @@ class AdminShopController extends BaseController
 		$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::getById($id);
-		AdminShopService::valid($adminShop, $this->shopId);
-		AdminShopService::updateById($id, ['remind' => $remind]);
+		$shopAdmin = ShopAdminService::getById($id);
+		ShopAdminService::valid($shopAdmin, $this->shopId);
+		ShopAdminService::updateById($id, ['remind' => $remind]);
 		util::complete();
 	}
 	
@@ -59,9 +59,9 @@ class AdminShopController extends BaseController
 		$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::getById($id);
-		AdminShopService::valid($adminShop, $this->shopId);
-		AdminShopService::updateById($id, ['status' => $status]);
+		$shopAdmin = ShopAdminService::getById($id);
+		ShopAdminService::valid($shopAdmin, $this->shopId);
+		ShopAdminService::updateById($id, ['status' => $status]);
 		util::complete();
 	}
 
@@ -72,7 +72,7 @@ class AdminShopController extends BaseController
 		$where = [];
 		$where['shopId'] = $this->shopId;
 		$where['delStatus'] = 0;
-		$list = AdminShopService::getAdminList($where);
+		$list = ShopAdminService::getAdminList($where);
 		util::success($list);
 	}
 	

+ 1 - 1
app/shop/controllers/ApplyController.php

@@ -2,7 +2,7 @@
 
 namespace shop\controllers;
 
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\saas\services\ApplyService;
 use biz\wx\services\WxBaseService;
 use biz\wx\services\WxOpenService;

+ 5 - 5
app/shop/controllers/AuthController.php

@@ -2,7 +2,7 @@
 
 namespace shop\controllers;
 
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\admin\services\AdminService;
 use biz\auth\services\AuthService;
 use biz\user\classes\UserClass;
@@ -154,9 +154,9 @@ class AuthController extends PublicController
 			util::fail('密码错误');
 		}
 		$adminId = $admin['id'];
-		$adminShop = AdminShopService::getByCondition(['adminId' => $adminId]);
-		$merchantId = isset($adminShop['merchantId']) ? $adminShop['merchantId'] : 0;
-		$shopId = isset($adminShop['shopId']) ? $adminShop['shopId'] : 0;
+		$shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
+		$merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
+		$shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
 		if (empty($shopId)) {
 			util::fail('您不是管理员');
 		}
@@ -203,7 +203,7 @@ class AuthController extends PublicController
 			$adminId = $admin['id'];
 		} else {
 			$adminId = $admin['id'];
-			$relate = AdminShopService::getByCondition(['adminId' => $adminId]);
+			$relate = ShopAdminService::getByCondition(['adminId' => $adminId]);
 			$shopId = isset($relate['shopId']) ? $relate['shopId'] : 0;
 		}
 		//管理员关联商家

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

@@ -2,7 +2,7 @@
 
 namespace shop\controllers;
 
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\merchant\services\AdminService;
 use biz\merchant\services\MerchantExtendService;
 use biz\merchant\services\MerchantService;

+ 1 - 1
biz/admin/classes/AdminClass.php

@@ -99,7 +99,7 @@ class AdminClass extends BaseClass
 	}
 	
 	//获取商家所有员工已经关联微信的userId
-	public static function getAdminShopUserId($merchantId)
+	public static function getShopAdminUserId($merchantId)
 	{
 		$list = self::getAdminList($merchantId);
 		return !empty($list) ? array_column($list, 'userId') : [];

+ 2 - 2
biz/admin/classes/AdminShopClass.php

@@ -7,10 +7,10 @@ use common\components\util;
 use Yii;
 use biz\base\classes\BaseClass;
 
-class AdminShopClass extends BaseClass
+class ShopAdminClass extends BaseClass
 {
 	
-	public static $baseFile = '\biz\admin\models\AdminShop';
+	public static $baseFile = '\biz\admin\models\ShopAdmin';
 	
 	const GENERATE_ADMIN_DATA = 'generate_admin_data_';//创建管理员需要的数据
 	

+ 2 - 2
biz/admin/models/AdminShop.php

@@ -4,12 +4,12 @@ namespace biz\admin\models;
 
 use biz\base\models\Base;
 
-class AdminShop extends Base
+class ShopAdmin extends Base
 {
 	
 	public static function tableName()
 	{
-		return 'xhAdminShop';
+		return 'xhShopAdmin';
 	}
 	
 }

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

@@ -4,7 +4,7 @@ namespace biz\admin\services;
 
 use biz\admin\classes\AdminClass;
 use biz\admin\classes\AdminRoleClass;
-use biz\admin\classes\AdminShopClass;
+use biz\admin\classes\ShopAdminClass;
 use biz\auth\services\AuthService;
 use biz\base\services\BaseService;
 use biz\merchant\classes\ShopClass;
@@ -18,16 +18,16 @@ use common\components\wxUtil;
 use common\services\xhTMessageService;
 use Yii;
 
-class AdminShopService extends BaseService
+class ShopAdminService extends BaseService
 {
 	
-	public static $baseFile = '\biz\admin\classes\AdminShopClass';
+	public static $baseFile = '\biz\admin\classes\ShopAdminClass';
 	
 	///创建管理员生成小程序 shish 2020.4.17
 	public static function prepareBindAdmin($data)
 	{
-		AdminShopClass::prepareBindAdmin($data);
-		$page = 'admin/adminShop/bind';
+		ShopAdminClass::prepareBindAdmin($data);
+		$page = 'admin/shopAdmin/bind';
 		$isOpen = 1;
 		$adminId = $data['adminId'];
 		$shopId = $data['shopId'];
@@ -43,7 +43,7 @@ class AdminShopService extends BaseService
 		$mobile = isset($data['mobile']) ? $data['mobile'] : '';
 		$shopId = isset($data['shopId']) ? $data['shopId'] : 0;
 		$adminId = isset($data['adminId']) ? $data['adminId'] : 0;
-		$bindData = AdminShopClass::getBindAdminData($shopId, $recommendAdminId);
+		$bindData = ShopAdminClass::getBindAdminData($shopId, $recommendAdminId);
 		$shop = ShopClass::getById($shopId);
 		if (empty($shop)) {
 			util::fail('没有找到门店');
@@ -52,8 +52,8 @@ class AdminShopService extends BaseService
 		if (empty($bindData)) {
 			util::fail('小程序码已经失效,请重新创建员工');
 		}
-		$adminShop = AdminShopClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId]);
-		if (!empty($adminShop)) {
+		$shopAdmin = ShopAdminClass::getByCondition(['adminId' => $adminId, 'shopId' => $shopId]);
+		if (!empty($shopAdmin)) {
 			util::fail('您已经是管理员了');
 		}
 		$adminName = isset($bindData['adminName']) ? $bindData['adminName'] : '';
@@ -82,15 +82,15 @@ class AdminShopService extends BaseService
 			'status' => $status,
 			'merchantId' => $merchantId,
 		];
-		AdminShopClass::delBindAdminData($shopId, $recommendAdminId);
-		return AdminShopClass::add($addData);
+		ShopAdminClass::delBindAdminData($shopId, $recommendAdminId);
+		return ShopAdminClass::add($addData);
 	}
 	
 	//获取管理员 shish 2020.4.21
 	// $sensitive true 密码等敏感信息不显示
 	public static function getAdminList($where, $sensitive = true)
 	{
-		$data = AdminShopClass::getList('*', $where, 'addTime DESC');
+		$data = ShopAdminClass::getList('*', $where, 'addTime DESC');
 		$list = isset($data['list']) && !empty($data['list']) ? $data['list'] : [];
 		if (empty($list)) {
 			return $data;
@@ -133,9 +133,9 @@ class AdminShopService extends BaseService
 		return $list;
 	}
 	
-	public static function valid($adminShop, $shopId)
+	public static function valid($shopAdmin, $shopId)
 	{
-		if (isset($adminShop['shopId']) == false || $adminShop['shopId'] != $shopId) {
+		if (isset($shopAdmin['shopId']) == false || $shopAdmin['shopId'] != $shopId) {
 			util::fail('不是您的员工');
 		}
 	}

+ 4 - 4
biz/merchant/classes/MerchantClass.php

@@ -4,7 +4,7 @@ namespace biz\merchant\classes;
 
 use biz\ad\classes\AdClass;
 use biz\admin\classes\AdminRoleClass;
-use biz\admin\classes\AdminShopClass;
+use biz\admin\classes\ShopAdminClass;
 use biz\coupon\classes\CouponAssetClass;
 use biz\goods\classes\CategoryClass;
 use biz\goods\classes\GoodsSettingClass;
@@ -175,8 +175,8 @@ class MerchantClass extends BaseClass
 		}
 		
 		//创建管理员
-		$adminShop = AdminShopClass::getByCondition(['shopId' => $shopId, 'adminId' => $adminId]);
-		if (empty($adminShop)) {
+		$shopAdmin = ShopAdminClass::getByCondition(['shopId' => $shopId, 'adminId' => $adminId]);
+		if (empty($shopAdmin)) {
 			$adminData = [
 				'password' => password_hash($mobile, PASSWORD_BCRYPT),
 				'confirmPassword' => password_hash($mobile, PASSWORD_BCRYPT),
@@ -193,7 +193,7 @@ class MerchantClass extends BaseClass
 				'addTime' => $time,
 			];
 			print_r($shopData);
-			AdminShopClass::add($shopData);
+			ShopAdminClass::add($shopData);
 		}
 		
 		//商品和分类初始化

+ 12 - 12
biz/message/classes/InformAdminClass.php

@@ -3,7 +3,7 @@
 namespace biz\message\classes;
 
 use biz\admin\classes\AdminClass;
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\user\classes\UserClass;
 use common\components\httpUtil;
 use common\components\wxUtil;
@@ -17,35 +17,35 @@ class InformAdminClass extends BaseClass
 	public static $baseFile = '\biz\message\models\InformAdmin';
 	
 	//增加通知员工 shish
-	public static function addInform($params, $adminShop, $type, $TMList)
+	public static function addInform($params, $shopAdmin, $type, $TMList)
 	{
 		//没有关注公众号暂时不进行通知
-		$subscribe = isset($adminShop['adminBaseInfo']['subscribe']) ? $adminShop['adminBaseInfo']['subscribe'] : 0;
+		$subscribe = isset($shopAdmin['adminBaseInfo']['subscribe']) ? $shopAdmin['adminBaseInfo']['subscribe'] : 0;
 		if ($subscribe == 0) {
 			return false;
 		}
 		//没有小程序id暂时不进行通知,目前只有小程序商家版,没有h5
-		$miniOpenId = isset($adminShop['adminBaseInfo']['miniOpenId']) ? $adminShop['adminBaseInfo']['miniOpenId'] : '';
+		$miniOpenId = isset($shopAdmin['adminBaseInfo']['miniOpenId']) ? $shopAdmin['adminBaseInfo']['miniOpenId'] : '';
 		if (empty($miniOpenId)) {
 			return false;
 		}
 		switch ($type) {
 			case 'goodsSold':
 				//宝贝售出
-				$respond = self::goodsSoldInform($params, $adminShop, $TMList);
+				$respond = self::goodsSoldInform($params, $shopAdmin, $TMList);
 				break;
 			case 'income':
 				//收入提醒
-				$respond = self::incomeInform($params, $adminShop, $TMList);
+				$respond = self::incomeInform($params, $shopAdmin, $TMList);
 				break;
 			case 'send':
-				$respond = self::sendInform($params, $adminShop, $TMList);
+				$respond = self::sendInform($params, $shopAdmin, $TMList);
 				break;
 			default:
 		}
-		$adminShopId = $adminShop['id'];
-		$shopId = $adminShop['shopId'];
-		$mobile = isset($adminShop['adminBaseInfo']['mobile']) ? $adminShop['adminBaseInfo']['mobile'] : '';
+		$shopAdminId = $shopAdmin['id'];
+		$shopId = $shopAdmin['shopId'];
+		$mobile = isset($shopAdmin['adminBaseInfo']['mobile']) ? $shopAdmin['adminBaseInfo']['mobile'] : '';
 		//通知管理员的都是平台通知
 		$isOpen = 1;
 		$data = [
@@ -53,7 +53,7 @@ class InformAdminClass extends BaseClass
 			'informWay' => 'miniProgram',
 			'userType' => 'admin',
 			'mobile' => $mobile,
-			'adminShopId' => $adminShopId,
+			'shopAdminId' => $shopAdminId,
 			'userId' => 0,
 			'shopId' => $shopId,
 			'isOpen' => $isOpen,
@@ -154,7 +154,7 @@ class InformAdminClass extends BaseClass
 		$merchantId = $merchant['id'];
 		$orderId = $order['id'];
 		$shopId = $order['shopId'];
-		$adminList = AdminShopService::getNoticeAdminList($shopId);
+		$adminList = ShopAdminService::getNoticeAdminList($shopId);
 		$tm = xhTMessageService::getList($merchantId);
 		$shortTempId = 'OPENTM201205968';//订单送达通知
 		$tempId = $tm[$shortTempId];

+ 12 - 12
biz/message/services/InformAdminService.php

@@ -3,9 +3,9 @@
 namespace biz\message\services;
 
 use biz\admin\classes\AdminClass;
-use biz\admin\classes\AdminShopClass;
+use biz\admin\classes\ShopAdminClass;
 use biz\admin\services\AdminService;
-use biz\admin\services\AdminShopService;
+use biz\admin\services\ShopAdminService;
 use biz\base\services\BaseService;
 use biz\merchant\services\MerchantService;
 use biz\message\classes\InformAdminClass;
@@ -24,8 +24,8 @@ class InformAdminService extends BaseService
 	//通知管理员 shish 2020.1.1
 	public static function addInform($shopId, $type, $params)
 	{
-		$adminShopList = AdminShopService::getNoticeAdminList($shopId);
-		if (empty($adminShopList)) {
+		$shopAdminList = ShopAdminService::getNoticeAdminList($shopId);
+		if (empty($shopAdminList)) {
 			return false;
 		}
 		//本地环境取消通知
@@ -33,24 +33,24 @@ class InformAdminService extends BaseService
 			return false;
 		}
 		$TMList = TMessageService::getOpenList();
-		foreach ($adminShopList as $adminKey => $adminShop) {
-			InformAdminClass::addInform($params, $adminShop, $type, $TMList);
+		foreach ($shopAdminList as $adminKey => $shopAdmin) {
+			InformAdminClass::addInform($params, $shopAdmin, $type, $TMList);
 		}
 	}
 
 	//消费通知内容 shish 2020.1.1
-	//['messageType'=>'inform','informWay'=>'miniProgram','userType'=>'admin','adminShopId'=>913,'mobile'=>'15280215347','tMessage'=>'','content'=>'','briefContent'=>'','isOpen'=>1]
+	//['messageType'=>'inform','informWay'=>'miniProgram','userType'=>'admin','shopAdminId'=>913,'mobile'=>'15280215347','tMessage'=>'','content'=>'','briefContent'=>'','isOpen'=>1]
 	public static function consumeInformQueue($data)
 	{
 		$informWay = $data['informWay'];
-		$adminShopId = isset($data['adminShopId']) ? $data['adminShopId'] : 0;
-		if (empty($adminShopId)) {
+		$shopAdminId = isset($data['shopAdminId']) ? $data['shopAdminId'] : 0;
+		if (empty($shopAdminId)) {
 			echo "\n 没有找到门店管理员 \n";
 			util::end();
 		}
-		$adminShop = AdminShopClass::getById($adminShopId);
-		$merchantId = $adminShop['merchantId'];
-		$adminId = $adminShop['adminId'];
+		$shopAdmin = ShopAdminClass::getById($shopAdminId);
+		$merchantId = $shopAdmin['merchantId'];
+		$adminId = $shopAdmin['adminId'];
 		$mobile = $data['mobile'];
 		$isOpen = isset($data['isOpen']) ? $data['isOpen'] : 0;
 		$merchant = WxOpenService::getWxInfo();

+ 3 - 3
biz/saas/classes/ApplyClass.php

@@ -2,7 +2,7 @@
 
 namespace biz\saas\classes;
 
-use biz\admin\classes\AdminShopClass;
+use biz\admin\classes\ShopAdminClass;
 use biz\agent\classes\AgentAssetClass;
 use common\components\sms;
 use common\components\stringUtil;
@@ -29,8 +29,8 @@ class ApplyClass extends BaseClass
         if (!empty($apply)) {
             util::fail('您已申请过了');
         }
-        $adminShop = AdminShopClass::getByCondition(['adminId' => $data['adminId']]);
-        if (!empty($adminShop)) {
+        $shopAdmin = ShopAdminClass::getByCondition(['adminId' => $data['adminId']]);
+        if (!empty($shopAdmin)) {
             util::fail('您已经有门店了');
         }
         $prefix = $data['province'] == $data['city'] ? $data['province'] : $data['province'] . $data['city'];

+ 6 - 6
console/controllers/UpgradeController.php

@@ -1377,14 +1377,14 @@ ALTER TABLE `xhAdmin` DROP COLUMN `currentShopId`;";
 		$sql = "ALTER TABLE `xhWxOpen` ADD `openAppBind` TINYINT NOT NULL DEFAULT 0 COMMENT '绑定平台状况 0没有创建 1公众号已绑 2小程序已绑 3公众号和小程序都已绑' AFTER `appIdCreated`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
-		$sql = "RENAME TABLE xhAdminRelate TO xhAdminShop;";
+		$sql = "RENAME TABLE xhAdminRelate TO xhShopAdmin;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
-		$sql = "ALTER TABLE `xhAdminShop` ADD `default` TINYINT NOT NULL DEFAULT 0 COMMENT '默认管理的门店 1是 0否' AFTER `roleId`;";
+		$sql = "ALTER TABLE `xhShopAdmin` ADD `default` TINYINT NOT NULL DEFAULT 0 COMMENT '默认管理的门店 1是 0否' AFTER `roleId`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
-		$sql = "ALTER TABLE `xhAdminShop` ADD `remind` TINYINT NOT NULL DEFAULT 0 COMMENT '动态提醒 0不需要 1需要' AFTER `shopId`;
-ALTER TABLE `xhAdminShop` ADD `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态 0停用 1正常' AFTER `default`;";
+		$sql = "ALTER TABLE `xhShopAdmin` ADD `remind` TINYINT NOT NULL DEFAULT 0 COMMENT '动态提醒 0不需要 1需要' AFTER `shopId`;
+ALTER TABLE `xhShopAdmin` ADD `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态 0停用 1正常' AFTER `default`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
 		$sql = "ALTER TABLE `xhAdmin` ADD `nickname` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '昵称' AFTER `adminName`;";
@@ -1394,7 +1394,7 @@ ALTER TABLE `xhAdminShop` ADD `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状
 UPDATE `xhUser` SET nickname=userName;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
-		$sql = "ALTER TABLE `xhAdminShop` ADD `delStatus` TINYINT NOT NULL DEFAULT 0 COMMENT '删除状态 0正常 1已删除' AFTER `default`;ALTER TABLE `xhAdmin` DROP COLUMN `remind`;ALTER TABLE `xhAdmin` CHANGE `status` `accountStatus` TINYINT NOT NULL DEFAULT 1 COMMENT '帐号状态 0禁用 1正常';";
+		$sql = "ALTER TABLE `xhShopAdmin` ADD `delStatus` TINYINT NOT NULL DEFAULT 0 COMMENT '删除状态 0正常 1已删除' AFTER `default`;ALTER TABLE `xhAdmin` DROP COLUMN `remind`;ALTER TABLE `xhAdmin` CHANGE `status` `accountStatus` TINYINT NOT NULL DEFAULT 1 COMMENT '帐号状态 0禁用 1正常';";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 		
 		$sql = "ALTER TABLE `xhStatIncome` ADD shopId INT NOT NULL DEFAULT 0 COMMENT '门店id' AFTER merchantId;
@@ -1466,7 +1466,7 @@ UPDATE `xhUserAsset` SET `member`=0 WHERE `member`=-1;";
 		$sql = "ALTER TABLE `xhGoodsCategory` MODIFY `inTurn` INT NOT NULL DEFAULT 0 COMMENT '排序';ALTER TABLE `xhGoodsCategory` ADD `addTime` INT NOT NULL DEFAULT 0 COMMENT '添加时间' AFTER `inTurn`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 
-		$sql = "ALTER TABLE `xhInformAdmin` DROP COLUMN `userId`;RENAME TABLE `xhAdminShop` TO `xhShopAdmin`;";
+		$sql = "ALTER TABLE `xhInformAdmin` DROP COLUMN `userId`;RENAME TABLE `xhShopAdmin` TO `xhShopAdmin`;";
 		Yii::$app->db->createCommand($sql)->execute($sql);
 	}