Commit 765647a7 by 杨树贤

好友主力的头像问题

parent 993f9f8c
...@@ -48,10 +48,11 @@ class AssistsController extends Controller ...@@ -48,10 +48,11 @@ class AssistsController extends Controller
$userExchangeService = new UserExchangeService(); $userExchangeService = new UserExchangeService();
$userExchange = array_get($userExchangeService->getUserExchange(['id' => $exchangeId]), 'data'); $userExchange = array_get($userExchangeService->getUserExchange(['id' => $exchangeId]), 'data');
$result['data']['amount'] = array_get($userExchange, 'amount', '0'); $result['data']['amount'] = array_get($userExchange, 'amount', '0');
$temp = array_get($userExchange, 'user_id'); $userId = array_get($userExchange, 'user_id');
$user = $this->service->getUserInfo($temp); $user = $this->service->getUserInfo($userId);
$userAvatar = !empty($user['wechat_oauth']['oauth_head']) ? $user['wechat_oauth']['oauth_head'] : '';
$result['data']['user_info'] = [ $result['data']['user_info'] = [
'avatar' => array_get($user, 'avatar', ''), 'avatar' => $userAvatar ?: array_get($user, 'avatar', ''),
'company_name' => array_get($user, 'company_name', $user['mobile']), 'company_name' => array_get($user, 'company_name', $user['mobile']),
'user_id' => array_get($user, 'user_id', ''), 'user_id' => array_get($user, 'user_id', ''),
]; ];
......
...@@ -20,8 +20,11 @@ class AssistService extends BaseService ...@@ -20,8 +20,11 @@ class AssistService extends BaseService
$users = $this->getUsersFromRedis($ids); $users = $this->getUsersFromRedis($ids);
foreach ($users as $user) { foreach ($users as $user) {
$userNames[$user['user_id']] = isset($user['company_name']) ?: $user['mobile']; $userNames[$user['user_id']] = isset($user['company_name']) ?: $user['mobile'];
$userAvatars[$user['user_id']] = $user['avatar']; //微信头像
$weixinAvatar = !empty($user['wechat_oauth']['oauth_head']) ? $user['wechat_oauth']['oauth_head'] : '';
$userAvatars[$user['user_id']] = $weixinAvatar ? : $user['avatar'];
} }
$result['data'] = array_map(function ($value) use ($userNames, $userAvatars) { $result['data'] = array_map(function ($value) use ($userNames, $userAvatars) {
$value['assist_user_name'] = $userNames[$value['assist_user_id']]; $value['assist_user_name'] = $userNames[$value['assist_user_id']];
$value['assist_user_avatar'] = $userAvatars[$value['assist_user_id']]; $value['assist_user_avatar'] = $userAvatars[$value['assist_user_id']];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment