|
@@ -5,6 +5,7 @@ namespace bizGhs\admin\classes;
|
|
|
use bizHd\user\classes\UserClass;
|
|
use bizHd\user\classes\UserClass;
|
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
use bizGhs\shop\classes\ShopAdminClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
use biz\shop\classes\ShopClass;
|
|
|
|
|
+use common\components\dict;
|
|
|
use common\components\imgUtil;
|
|
use common\components\imgUtil;
|
|
|
use common\components\sms;
|
|
use common\components\sms;
|
|
|
use common\components\util;
|
|
use common\components\util;
|
|
@@ -231,14 +232,25 @@ class AdminClass extends BaseClass
|
|
|
//创建以及更新用户 ssh 2020.2.7
|
|
//创建以及更新用户 ssh 2020.2.7
|
|
|
public static function replaceAdmin($wxInfo, $source)
|
|
public static function replaceAdmin($wxInfo, $source)
|
|
|
{
|
|
{
|
|
|
- $wxInfo = self::switchAdminInfo($wxInfo, $source);
|
|
|
|
|
- $unionId = isset($wxInfo['unionId']) && !empty($wxInfo['unionId']) ? $wxInfo['unionId'] : '';
|
|
|
|
|
- $style = Yii::$app->params['ptStyle'];
|
|
|
|
|
- $admin = \biz\admin\classes\AdminClass::getByCondition(['unionId' => $unionId, 'style' => $style]);
|
|
|
|
|
- if (empty($admin)) {
|
|
|
|
|
- $admin = self::generateAdmin($wxInfo);
|
|
|
|
|
|
|
+ if ($source == dict::getDict('userSourceGetId', 'app', 'id')) {
|
|
|
|
|
+ //app来源
|
|
|
|
|
+ $mobile = $wxInfo['mobile'] ?? '';
|
|
|
|
|
+ $style = $wxInfo['style'] ?? '';
|
|
|
|
|
+ $admin = \biz\admin\classes\AdminClass::getByCondition(['mobile' => $mobile, 'style' => $style]);
|
|
|
|
|
+ if (empty($admin)) {
|
|
|
|
|
+ $admin = self::generateAdmin($wxInfo);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- $admin = self::updateAdmin($admin, $wxInfo);
|
|
|
|
|
|
|
+ //非app来源
|
|
|
|
|
+ $wxInfo = self::switchAdminInfo($wxInfo, $source);
|
|
|
|
|
+ $unionId = isset($wxInfo['unionId']) && !empty($wxInfo['unionId']) ? $wxInfo['unionId'] : '';
|
|
|
|
|
+ $style = Yii::$app->params['ptStyle'];
|
|
|
|
|
+ $admin = \biz\admin\classes\AdminClass::getByCondition(['unionId' => $unionId, 'style' => $style]);
|
|
|
|
|
+ if (empty($admin)) {
|
|
|
|
|
+ $admin = self::generateAdmin($wxInfo);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $admin = self::updateAdmin($admin, $wxInfo);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return $admin;
|
|
return $admin;
|
|
|
}
|
|
}
|
|
@@ -301,6 +313,11 @@ class AdminClass extends BaseClass
|
|
|
$time = time();
|
|
$time = time();
|
|
|
//替换掉微信名称不支持的图片
|
|
//替换掉微信名称不支持的图片
|
|
|
$nickName = isset($getAdminInfo['nickName']) ? preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $getAdminInfo['nickName']) : '';
|
|
$nickName = isset($getAdminInfo['nickName']) ? preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $getAdminInfo['nickName']) : '';
|
|
|
|
|
+ if (empty($nickName)) {
|
|
|
|
|
+ if (isset($getAdminInfo['mobile']) && !empty($getAdminInfo['mobile'])) {
|
|
|
|
|
+ $nickName = $getAdminInfo['mobile'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$getAdminInfo['name'] = $nickName;
|
|
$getAdminInfo['name'] = $nickName;
|
|
|
$subscribe = isset($getAdminInfo['subscribe']) ? $getAdminInfo['subscribe'] : 0;
|
|
$subscribe = isset($getAdminInfo['subscribe']) ? $getAdminInfo['subscribe'] : 0;
|
|
|
$getAdminInfo['subscribe'] = $subscribe;
|
|
$getAdminInfo['subscribe'] = $subscribe;
|
|
@@ -316,7 +333,8 @@ class AdminClass extends BaseClass
|
|
|
$getAdminInfo['openShop'] = $getAdminInfo['openShop'] ?? \biz\admin\classes\AdminClass::OPEN_SHOP_NO;
|
|
$getAdminInfo['openShop'] = $getAdminInfo['openShop'] ?? \biz\admin\classes\AdminClass::OPEN_SHOP_NO;
|
|
|
$getAdminInfo['super'] = $getAdminInfo['super'] ?? \biz\admin\classes\AdminClass::SUPER_NO;
|
|
$getAdminInfo['super'] = $getAdminInfo['super'] ?? \biz\admin\classes\AdminClass::SUPER_NO;
|
|
|
$getAdminInfo['delStatus'] = 0;
|
|
$getAdminInfo['delStatus'] = 0;
|
|
|
- $getAdminInfo['style'] = Yii::$app->params['ptStyle'];
|
|
|
|
|
|
|
+ $style = $getAdminInfo['style'] ? $getAdminInfo['style'] : Yii::$app->params['ptStyle'];
|
|
|
|
|
+ $getAdminInfo['style'] = $style;
|
|
|
$getAdminInfo['openShop'] = 1;
|
|
$getAdminInfo['openShop'] = 1;
|
|
|
|
|
|
|
|
if (isset($getAdminInfo['headImgUrl']) && !empty($getAdminInfo['headImgUrl'])) {
|
|
if (isset($getAdminInfo['headImgUrl']) && !empty($getAdminInfo['headImgUrl'])) {
|