Commit f5cd65cc by 杨树贤

添加微信兑换信息

parent a22130a5
......@@ -4,6 +4,7 @@
namespace App\Http\Controllers;
use App\Http\Transformers\ExchangeSettingTransformer;
use App\Services\AssistService;
use App\Services\ExchangeSettingService;
use App\Services\UserExchangeService;
use App\Services\UserIntegralService;
......@@ -48,11 +49,16 @@ class ExchangeSettingsController extends Controller
$integral = array_get($user, 'integral', 0);
$exchangeSettings['integral'] = $integral;
$exchangeSettings['mobile'] = $mobile;
//检查是否可以进行兑换
$userExchangeService = new UserExchangeService();
$canExchangeStatus = $userExchangeService->checkCanExchange($userId);
$exchangeSettings['can_exchange'] = $canExchangeStatus;
//获取微信兑换状况
$info = $this->service->getWeixinExchangeInfo(98);
$exchangeSettings['weixin_exchange_info'] = $info;
return $this->Export(0, 'ok', $exchangeSettings);
}
}
\ No newline at end of file
......@@ -14,4 +14,29 @@ class ExchangeSettingService
return $result;
}
//获取微信兑换的状态
public function getWeixinExchangeInfo($userId)
{
//先去获取用户是否有正卡着好友助力的兑换记录
$map = [
'user_id' => $userId,
];
$userExchangeService = new UserExchangeService();
$userExchange = array_get($userExchangeService->getUserExchange($map), 'data', []);
//如果最后一条记录是未审核就代表这个需要好友助力
$info = [];
$info['exchanging'] = 1;
if (is_array($userExchange)) {
//如果审核状态为未审核,就代表需要好友助力,也就是说正在兑换
if ($userExchange['status'] == 0) {
$info['assist_count'] = $userExchange['assist_count'];
} else {
//否则直接返回没有正在兑换
$info['exchanging'] = $info['assist_count'] = 0;
}
}
return $info;
}
}
\ No newline at end of file
......@@ -9,6 +9,15 @@ use Common\Model\RedisModel;
class UserExchangeService
{
public function getUserExchange($map = [])
{
$url = config('website.BaseUrl') . '/user_exchanges/info';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
return $result;
}
public function getUserExchangeList($map = [])
{
$url = config('website.BaseUrl') . '/user_exchanges/list';
......
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