|
|
@@ -155,7 +155,7 @@ class UserClass extends BaseClass
|
|
|
$user = self::add($getUserInfo, true);
|
|
|
$userId = $user->id;
|
|
|
if (empty($userName)) {
|
|
|
- $user->name = '游客' . $userId;
|
|
|
+ $user->name = '游客';
|
|
|
$user->save();
|
|
|
}
|
|
|
|
|
|
@@ -496,42 +496,14 @@ class UserClass extends BaseClass
|
|
|
{
|
|
|
$userInfo = self::switchUserInfo($userInfo, $source);
|
|
|
$userSource = self::$userSourceId;
|
|
|
- switch ($source) {
|
|
|
- case $userSource['mini']['name']:
|
|
|
- $sourceId = $userSource['mini']['id'];
|
|
|
- $miniOpenId = $userInfo['miniOpenId'];
|
|
|
- $user = self::getByMiniOpenId($miniOpenId);
|
|
|
- break;
|
|
|
- case $userSource['alipay']['name']:
|
|
|
- $sourceId = $userSource['alipay']['id'];
|
|
|
- $aliId = $userInfo['alipayId'];
|
|
|
- $user = self::getByAlipayId($aliId);
|
|
|
- break;
|
|
|
- case $userSource['official']['name']:
|
|
|
- $sourceId = $userSource['official']['id'];
|
|
|
- //后台添加的客户没有openId
|
|
|
- $openId = isset($userInfo['openId']) ? $userInfo['openId'] : '';
|
|
|
- $user = [];
|
|
|
- if (!empty($openId)) {
|
|
|
- $user = self::getByOpenId($openId);
|
|
|
- }
|
|
|
- break;
|
|
|
- case $userSource['system']['name']:
|
|
|
- $sourceId = $userSource['system']['id'];
|
|
|
- $mobile = isset($userInfo['mobile']) && !empty($userInfo['mobile']) ? $userInfo['mobile'] : '';
|
|
|
- $user = [];
|
|
|
- if (!empty($mobile)) {
|
|
|
- $user = self::getByCondition(['mobile' => $mobile]);
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- throw new \Exception('未知来源的用户');
|
|
|
- }
|
|
|
- //支付宝暂时获取不到很多客户信息不进行更新
|
|
|
- if ($source == $userSource['alipay']['name']) {
|
|
|
- if (!empty($user)) {
|
|
|
- return $user;
|
|
|
- }
|
|
|
+ $sourceId = 0;
|
|
|
+ if ($source == $userSource['mini']['name']) {
|
|
|
+ //小程序来源的创建用户
|
|
|
+ $sourceId = $userSource['mini']['id'];
|
|
|
+ $miniOpenId = $userInfo['miniOpenId'];
|
|
|
+ $user = self::getByMiniOpenId($miniOpenId);
|
|
|
+ } else {
|
|
|
+ util::fail('暂不支持访问');
|
|
|
}
|
|
|
if (empty($user)) {
|
|
|
$userInfo['sourceType'] = $sourceId;
|