Commit b53c7874 by 杨树贤

添加exchange_id返回

parent ffd5d364
......@@ -60,7 +60,6 @@ class UserExchangesController extends Controller
//这个是兑换的商品id,不是兑换流水的id,因为这个时候还没有生成
$exchangeId = $request->get('exchange_id');
//先写死用于测试
$exchangeId = 1;
$userId = $request->user->user_id;
//判断是否可以兑换
......@@ -85,7 +84,11 @@ class UserExchangesController extends Controller
//这里直接使用服务返回的错误码,对应的错误码在language.php
if ($result['errcode'] == 0) {
return $this->Export($result['errcode'], 'ok', $result['data']);
return $this->Export($result['errcode'], 'ok', [
'data' => [
'exchange_id' => array_get($result, 'data'),
],
]);
} else {
return $this->Export($result['errcode']);
}
......
......@@ -26,15 +26,17 @@ class ExchangeSettingService
$userExchange = array_get($userExchangeService->getUserExchange($map), 'data', []);
//如果最后一条记录是未审核就代表这个需要好友助力
$info = [];
$info['exchanging'] = $info['assist_count'] = 0;
$info['exchanging'] = $info['assist_count'] = $info['exchange_id'] = 0;
if (is_array($userExchange)) {
//如果审核状态为未审核,就代表需要好友助力,也就是说正在兑换
if ($userExchange['status'] == 0) {
$info['assist_count'] = $userExchange['assist_count'];
$info['exchanging'] = 1;
$info['exchange_id'] = $userExchange['id'];
}
//否则直接返回没有正在兑换
}
return $info;
}
}
\ 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