Commit b53c7874 by 杨树贤

添加exchange_id返回

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