Commit 765647a7 by 杨树贤

好友主力的头像问题

parent 993f9f8c
......@@ -48,10 +48,11 @@ class AssistsController extends Controller
$userExchangeService = new UserExchangeService();
$userExchange = array_get($userExchangeService->getUserExchange(['id' => $exchangeId]), 'data');
$result['data']['amount'] = array_get($userExchange, 'amount', '0');
$temp = array_get($userExchange, 'user_id');
$user = $this->service->getUserInfo($temp);
$userId = array_get($userExchange, 'user_id');
$user = $this->service->getUserInfo($userId);
$userAvatar = !empty($user['wechat_oauth']['oauth_head']) ? $user['wechat_oauth']['oauth_head'] : '';
$result['data']['user_info'] = [
'avatar' => array_get($user, 'avatar', ''),
'avatar' => $userAvatar ?: array_get($user, 'avatar', ''),
'company_name' => array_get($user, 'company_name', $user['mobile']),
'user_id' => array_get($user, 'user_id', ''),
];
......
......@@ -20,8 +20,11 @@ class AssistService extends BaseService
$users = $this->getUsersFromRedis($ids);
foreach ($users as $user) {
$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) {
$value['assist_user_name'] = $userNames[$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