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
26c3091d
authored
Aug 27, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
初步完成兑现接口
parent
4d433bd0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
11 deletions
app/Http/Controllers/Controller.php
app/Http/Controllers/UserExchangesController.php
app/Services/UserExchangeService.php
config/language.php
routes/web.php
app/Http/Controllers/Controller.php
View file @
26c3091d
...
@@ -10,17 +10,17 @@ class Controller extends BaseController
...
@@ -10,17 +10,17 @@ class Controller extends BaseController
const
SUCCESS
=
0
;
const
SUCCESS
=
0
;
//这个是服务那边返回的错误码,代表已经超出了每日每人可领取的对应项的数额(比如每人每天只能签到一次)
//这个是服务那边返回的错误码,代表已经超出了每日每人可领取的对应项的数额(比如每人每天只能签到一次)
const
INTEGRAL_LIMIT
=
109001
;
const
INTEGRAL_LIMIT
=
509000
;
//下面的都是这个接口项目的错误码
//下面的都是这个接口项目的错误码
//签到
//签到
const
CHECK_IN_FAIL
=
1091
01
;
const
CHECK_IN_FAIL
=
5090
01
;
//报价
//报价
const
OFFER_FAIL
=
1091
02
;
const
OFFER_FAIL
=
5090
02
;
//上传商品
//上传商品
const
UPLOAD_GOODS_FAIL
=
1091
03
;
const
UPLOAD_GOODS_FAIL
=
5090
03
;
public
function
Export
(
$Errcode
=
0
,
$ErrMsg
=
''
,
$dataArr
=
[])
public
function
Export
(
$Errcode
=
0
,
$ErrMsg
=
''
,
$dataArr
=
[])
...
...
app/Http/Controllers/UserExchangesController.php
View file @
26c3091d
...
@@ -43,4 +43,28 @@ class UserExchangesController extends Controller
...
@@ -43,4 +43,28 @@ class UserExchangesController extends Controller
return
$this
->
Export
(
0
,
'ok'
,
$result
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
}
/**
* 兑换商品接口(微信转账或者话费充值)
* @param Request $request
* @param UserExchangeService $service
* @return array
*/
public
function
exchange
(
Request
$request
,
UserExchangeService
$service
)
{
$exchangeId
=
$request
->
get
(
'exchange_id'
);
//先写死用于测试
// $exchangeId = 1;
$userId
=
$request
->
user
->
user_id
;
$type
=
$request
->
get
(
'type'
);
$result
=
$service
->
addUserExchange
([
'user_id'
=>
$userId
,
'exchange_id'
=>
$exchangeId
,
]);
//这里直接使用服务返回的错误码,对应的错误码在language.php
return
$this
->
Export
(
$result
[
'errcode'
]);
}
}
}
\ No newline at end of file
app/Services/UserExchangeService.php
View file @
26c3091d
...
@@ -14,4 +14,13 @@ class UserExchangeService
...
@@ -14,4 +14,13 @@ class UserExchangeService
return
$result
;
return
$result
;
}
}
public
function
addUserExchange
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/rob/exchange/quota'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
}
\ No newline at end of file
config/language.php
View file @
26c3091d
...
@@ -12,13 +12,16 @@ return [
...
@@ -12,13 +12,16 @@ return [
109002
=>
'Hprose请求失败'
,
109002
=>
'Hprose请求失败'
,
109003
=>
'登录失败'
,
109003
=>
'登录失败'
,
109100
=>
'参数不正确或者缺失,请检查请求的参数'
,
109100
=>
'今天已经兑换过了,请明天再来吧'
,
109101
=>
'今天已签到过'
,
109101
=>
'红包余额不足'
,
109102
=>
'签到添加红包失败'
,
109102
=>
'红包余额不足'
,
109103
=>
'今天已报价过'
,
109103
=>
'当前提现不可用'
,
109104
=>
'报价添加红包失败'
,
109105
=>
'今天已经上传商品过'
,
509000
=>
'超过操作类型的限额'
,
109106
=>
'上传商品添加红包失败'
,
509001
=>
'签到失败'
,
509002
=>
'报价失败'
,
509003
=>
'上传商品失败'
,
],
],
...
...
routes/web.php
View file @
26c3091d
...
@@ -44,6 +44,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
...
@@ -44,6 +44,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//商品配置列表
//商品配置列表
$router
->
get
(
'exchange_settings/list'
,
'ExchangeSettingsController@index'
);
$router
->
get
(
'exchange_settings/list'
,
'ExchangeSettingsController@index'
);
//用户兑换接口
$router
->
post
(
'user_exchanges/exchange'
,
'UserExchangesController@exchange'
);
});
});
$router
->
group
([
'middleware'
=>
'web'
],
function
()
use
(
$router
)
{
$router
->
group
([
'middleware'
=>
'web'
],
function
()
use
(
$router
)
{
$router
->
post
(
'/oss/upload'
,
'OssController@upload'
);
$router
->
post
(
'/oss/upload'
,
'OssController@upload'
);
...
...
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