Commit cce9face by 杨树贤

添加字段告诉前端是否已经绑定公众号

parent 580b1303
......@@ -59,6 +59,9 @@ class ExchangeSettingsController extends Controller
$info = $this->service->getWeixinExchangeInfo($userId);
$exchangeSettings['weixin_exchange_info'] = $info;
//获取是否绑定了公众号
$exchangeSettings['official_account_bind'] = $this->service->getOfficialAccountBind($userId) ? 1 : 0;
return $this->Export(0, 'ok', $exchangeSettings);
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@
namespace App\Services;
use Common\Model\RedisModel;
class ExchangeSettingService
{
public function getExchangeSettingList($map = [])
......@@ -20,13 +22,13 @@ class ExchangeSettingService
{
//先去获取用户是否有正卡着好友助力的兑换记录
$map = [
'user_id' => $userId,
'type' => 2,
'user_id' => $userId,
'type' => 2,
'page_size' => 1,
];
$userExchangeService = new UserExchangeService();
$userExchange = array_get($userExchangeService->getUserExchangeList($map), 'data', []);
$userExchange = array_get($userExchange,0);
$userExchange = array_get($userExchange, 0);
//如果最后一条记录是未审核就代表这个需要好友助力
$info = [];
$info['exchanging'] = $info['assist_count'] = $info['exchange_id'] = 0;
......@@ -42,4 +44,16 @@ class ExchangeSettingService
return $info;
}
//获取公众号绑定信息
public function getOfficialAccountBind($userId)
{
$redis = new RedisModel();
//user_oauth 绑定公众号类型为2
$oauthOfficialAccountType = 2;
$keyName = $userId . '-' . $oauthOfficialAccountType;
$userOauth = json_decode($redis->hget('ic_user_oauth', $keyName),true);
return $userOauth;
}
}
\ No newline at end of file
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