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
603eaa09
authored
Aug 29, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
兑换红包接口
parent
afeb7343
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
17 deletions
app/Http/Controllers/CodesController.php
app/Services/CodeService.php
routes/web.php
app/Http/Controllers/CodesController.php
0 → 100644
View file @
603eaa09
<?php
namespace
App\Http\Controllers
;
use
App\Services\CodeService
;
use
Illuminate\Http\Request
;
/**
* 红包码
* Class CodesController
* @package App\Http\Controllers
*/
class
CodesController
extends
Controller
{
/**
* 兑换红包码
* @param Request $request
* @param CodeService $service
* @return array
*/
public
function
store
(
Request
$request
,
CodeService
$service
)
{
$code
=
$request
->
get
(
'code'
);
if
(
empty
(
$code
))
{
return
$this
->
Export
(
self
::
INVALID_PARAMETER
);
}
$data
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'code'
=>
$request
->
get
(
'code'
),
];
$result
=
$service
->
addCode
(
$data
);
if
(
$result
[
'errcode'
]
===
self
::
SUCCESS
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
self
::
EXCHANGE_CODE_FAIL
);
}
}
}
\ No newline at end of file
app/Services/CodeService.php
0 → 100644
View file @
603eaa09
<?php
namespace
App\Services
;
class
CodeService
{
//回复报价需要添加流水
public
function
addCode
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/codes/add'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
\ No newline at end of file
routes/web.php
View file @
603eaa09
...
@@ -11,20 +11,11 @@
...
@@ -11,20 +11,11 @@
|
|
*/
*/
$router
->
get
(
'/'
,
function
()
use
(
$router
)
{
$router
->
addRoute
([
'GET'
,
'POST'
],
'/'
,
function
()
use
(
$router
)
{
return
$router
->
app
->
version
();
return
$router
->
app
->
version
();
});
});
$router
->
group
([
'middleware'
=>
[
'web'
,
'login'
]],
function
()
use
(
$router
)
{
$router
->
group
([
'middleware'
=>
[
'web'
,
'login'
]],
function
()
use
(
$router
)
{
$router
->
get
(
'/goods/add'
,
'ApiController@AddGoods'
);
$router
->
get
(
'/goods/info'
,
'ApiController@GoodsInfo'
);
$router
->
get
(
'/goods/save'
,
'ApiController@SaveGoods'
);
$router
->
get
(
'/goods/status'
,
'ApiController@GoodsStatus'
);
$router
->
get
(
'/goods/count'
,
'ApiController@MysqlGoodsCount'
);
$router
->
post
(
'/goods/upload'
,
'ApiController@UploadGoods'
);
$router
->
options
(
'/goods/upload'
,
'ApiController@UploadGoods'
);
//前端插件需要这个请求
$router
->
get
(
'/goods/upload/list'
,
'ApiController@UploadGoodsList'
);
//签到
//签到
$router
->
get
(
'/check_in/list'
,
'CheckInController@index'
);
$router
->
get
(
'/check_in/list'
,
'CheckInController@index'
);
$router
->
post
(
'/check_in/add'
,
'CheckInController@add'
);
$router
->
post
(
'/check_in/add'
,
'CheckInController@add'
);
...
@@ -46,21 +37,21 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
...
@@ -46,21 +37,21 @@ $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
->
addRoute
([
'GET'
,
'POST'
],
'user_exchanges/exchange'
,
'UserExchangesController@exchange'
);
//每日分享
//每日分享
$router
->
post
(
'share/add'
,
'ShareController@store'
);
$router
->
addRoute
([
'GET'
,
'POST'
],
'share/add'
,
'ShareController@store'
);
//邀请好友
//邀请好友
$router
->
post
(
'invites/add'
,
'InvitesController@store'
);
$router
->
addRoute
([
'GET'
,
'POST'
],
'invites/add'
,
'InvitesController@store'
);
$router
->
get
(
'invites/list'
,
'InvitesController@index'
);
$router
->
get
(
'invites/list'
,
'InvitesController@index'
);
$router
->
get
(
'invites/info'
,
'InvitesController@info'
);
$router
->
get
(
'invites/info'
,
'InvitesController@info'
);
//红包兑换
$router
->
addRoute
([
'GET'
,
'POST'
],
'codes/exchange'
,
'CodesController@store'
);
});
});
$router
->
group
([
'middleware'
=>
'web'
],
function
()
use
(
$router
)
{
$router
->
post
(
'/oss/upload'
,
'OssController@upload'
);
$router
->
get
(
'/goods/search'
,
'ApiController@GoodsInfo'
);
});
...
...
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