Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_welfare_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b53c7874
authored
Sep 05, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加exchange_id返回
parent
ffd5d364
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
app/Http/Controllers/UserExchangesController.php
app/Services/ExchangeSettingService.php
app/Http/Controllers/UserExchangesController.php
View file @
b53c7874
...
@@ -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'
]);
}
}
...
...
app/Services/ExchangeSettingService.php
View file @
b53c7874
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment