|
|
@@ -67,31 +67,30 @@ class UserClass extends BaseClass
|
|
|
$shopName = $val['shopName'] ?? '';
|
|
|
$sjName = $val['merchantName'] ?? '';
|
|
|
$default = $val['default'] ?? 0;
|
|
|
- $showName = $sjName . ' ' . $shopName;
|
|
|
- if ($default == 1) {
|
|
|
- $showName = $sjName;
|
|
|
- }
|
|
|
+ $showName = $default == 1 ? $sjName : $sjName . ' ' . $shopName;
|
|
|
$list[$key]['showName'] = $showName;
|
|
|
}
|
|
|
}
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
- //添加最近访问的门店 ssh 2021.4.10
|
|
|
- public static function addRecentShop($lookShopId, $user)
|
|
|
+ //添加最近访问的门店 ssh 20220916
|
|
|
+ public static function addRecentShop($shopId, $user)
|
|
|
{
|
|
|
- if (empty($lookShopId)) {
|
|
|
+ if (empty($shopId)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (isset($user) == false || empty($user)) {
|
|
|
return false;
|
|
|
}
|
|
|
- $hasRecentShop = $user['recentShop'];
|
|
|
- $userId = $user['id'];
|
|
|
- $newShopIds = [];
|
|
|
- if (!empty($hasRecentShop)) {
|
|
|
- $newShopIds = json_decode($hasRecentShop, true);
|
|
|
+ $hasShopIds = isset($user->recentShop) && !empty($user->recentShop) ? json_decode($user->recentShop, true) : [];
|
|
|
+ if (in_array($shopId, $hasShopIds)) {
|
|
|
+ return false;
|
|
|
}
|
|
|
- $newShopIds = array_merge($newShopIds, [$lookShopId]);
|
|
|
+ $newShopIds = array_merge($hasShopIds, [$shopId]);
|
|
|
$newShopIds = array_unique(array_filter($newShopIds));
|
|
|
- self::updateById($userId, ['recentShop' => json_encode($newShopIds)]);
|
|
|
+ $user->recentShop = json_encode($newShopIds);
|
|
|
+ $user->save();
|
|
|
}
|
|
|
|
|
|
//组合客户基本和资产信息
|