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
939b4129
authored
Oct 10, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加兑现相关逻辑
parent
cce9face
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
app/Http/Controllers/UserExchangesController.php
app/Services/ExchangeSettingService.php
routes/web.php
app/Http/Controllers/UserExchangesController.php
View file @
939b4129
...
@@ -59,7 +59,6 @@ class UserExchangesController extends Controller
...
@@ -59,7 +59,6 @@ class UserExchangesController extends Controller
{
{
//这个是兑换的商品id,不是兑换流水的id,因为这个时候还没有生成
//这个是兑换的商品id,不是兑换流水的id,因为这个时候还没有生成
$exchangeId
=
$request
->
get
(
'exchange_id'
);
$exchangeId
=
$request
->
get
(
'exchange_id'
);
//先写死用于测试
$userId
=
$request
->
user
->
user_id
;
$userId
=
$request
->
user
->
user_id
;
//判断是否可以兑换
//判断是否可以兑换
...
@@ -95,4 +94,28 @@ class UserExchangesController extends Controller
...
@@ -95,4 +94,28 @@ class UserExchangesController extends Controller
}
}
/**
* 确认兑换接口
* @param Request $request
* @param UserExchangeService $service
* @return array|false|string
*/
public
function
confirm
(
Request
$request
,
UserExchangeService
$service
)
{
$exchangeId
=
$request
->
get
(
'exchange_id'
);
if
(
empty
(
$exchangeId
))
{
return
$this
->
Export
(
self
::
INVALID_PARAMETER
);
}
return
$this
->
Export
(
0
,
'ok'
);
//
// $result = $service->confirmExchange($exchangeId);
// if ($result['errcode'] == 0) {
// return $this->Export($result['errcode'], 'ok');
// } else {
// return $this->Export($result['errcode'], '确认兑换失败');
// }
}
}
}
\ No newline at end of file
app/Services/ExchangeSettingService.php
View file @
939b4129
...
@@ -51,7 +51,10 @@ class ExchangeSettingService
...
@@ -51,7 +51,10 @@ class ExchangeSettingService
$redis
=
new
RedisModel
();
$redis
=
new
RedisModel
();
//user_oauth 绑定公众号类型为2
//user_oauth 绑定公众号类型为2
$oauthOfficialAccountType
=
2
;
$oauthOfficialAccountType
=
2
;
$keyName
=
$userId
.
'-'
.
$oauthOfficialAccountType
;
//先获取union_id
$user
=
json_decode
(
$redis
->
hget
(
'ic_user'
,
$userId
),
true
);
$unionId
=
array_get
(
$user
,
'union_id'
);
$keyName
=
$unionId
.
'_'
.
$oauthOfficialAccountType
;
$userOauth
=
json_decode
(
$redis
->
hget
(
'ic_user_oauth'
,
$keyName
),
true
);
$userOauth
=
json_decode
(
$redis
->
hget
(
'ic_user_oauth'
,
$keyName
),
true
);
return
$userOauth
;
return
$userOauth
;
...
...
routes/web.php
View file @
939b4129
...
@@ -38,6 +38,8 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
...
@@ -38,6 +38,8 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//用户兑换接口
//用户兑换接口
$router
->
addRoute
([
'GET'
,
'POST'
],
'user_exchanges/exchange'
,
'UserExchangesController@exchange'
);
$router
->
addRoute
([
'GET'
,
'POST'
],
'user_exchanges/exchange'
,
'UserExchangesController@exchange'
);
//确认兑换接口,目前只是给微信转账用
$router
->
addRoute
([
'GET'
,
'POST'
],
'user_exchanges/exchange/confirm'
,
'UserExchangesController@confirm'
);
//每日分享
//每日分享
$router
->
addRoute
([
'GET'
,
'POST'
],
'share/add'
,
'ShareController@store'
);
$router
->
addRoute
([
'GET'
,
'POST'
],
'share/add'
,
'ShareController@store'
);
...
...
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