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