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
6b8be7da
authored
Aug 29, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改邀请逻辑
parent
d7afcef3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
2 deletions
app/Http/Controllers/AssistsController.php
app/Http/Controllers/Controller.php
app/Http/Controllers/ShareController.php
app/Services/AssistService.php
config/language.php
app/Http/Controllers/AssistsController.php
0 → 100644
View file @
6b8be7da
<?php
namespace
App\Http\Controllers
;
use
App\Services\AssistService
;
use
Illuminate\Http\Request
;
/**
* 好友助力
* Class AssistsController
* @package App\Http\Controllers
*/
class
AssistsController
extends
Controller
{
/**
* @var AssistService
*/
private
$service
;
/**
* AssistsController constructor.
* @param AssistService $service
*/
public
function
__construct
(
AssistService
$service
)
{
$this
->
service
=
$service
;
}
/**
* 获取好友助力列表
* @param Request $request
* @return array
*/
public
function
index
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'is_api'
=>
1
,
'exchange_id'
=>
$request
->
get
(
'exchange_id'
),
];
$result
=
$this
->
service
->
getAssistList
(
$map
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
/**
* 添加好友助力
* 注意这个请求是助力者去请求的,不是被助力者,所以取出来的user_id其实是助力者的
* @param Request $request
* @return array
*/
public
function
store
(
Request
$request
)
{
$map
=
[
'assist_user_id'
=>
$request
->
user
->
user_id
,
'exchange_id'
=>
$request
->
get
(
'exchange_id'
),
];
$result
=
$this
->
service
->
addAssist
(
$map
);
if
(
$result
[
'errcode'
]
===
self
::
SUCCESS
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
self
::
ASSIST_FAIL
);
}
}
}
\ No newline at end of file
app/Http/Controllers/Controller.php
View file @
6b8be7da
...
...
@@ -35,6 +35,8 @@ class Controller extends BaseController
//红包兑换失败
const
EXCHANGE_CODE_FAIL
=
509006
;
//好友助力失败
const
ASSIST_FAIL
=
509007
;
public
function
Export
(
$Errcode
=
0
,
$ErrMsg
=
''
,
$dataArr
=
[])
{
...
...
app/Http/Controllers/ShareController.php
View file @
6b8be7da
...
...
@@ -17,12 +17,12 @@ class ShareController extends Controller
$this
->
service
=
$service
;
}
//
回复报价
的类型id
//
分享
的类型id
const
INTEGRAL_TYPE_SHARE
=
4
;
public
function
store
(
Request
$request
)
{
$userId
=
$request
->
user
->
user_id
;
$userId
=
$request
->
get
(
'user_id'
)
;
$integralId
=
self
::
INTEGRAL_TYPE_SHARE
;
$map
=
[
'user_id'
=>
$userId
,
...
...
app/Services/AssistService.php
0 → 100644
View file @
6b8be7da
<?php
namespace
App\Services
;
class
AssistService
{
public
function
getAssistList
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/assists/list'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
public
function
addAssist
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/assists/add'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
\ No newline at end of file
config/language.php
View file @
6b8be7da
...
...
@@ -23,6 +23,9 @@ return [
509002
=>
'报价失败'
,
509003
=>
'上传商品失败'
,
509004
=>
'邀请好友失败'
,
509005
=>
'分享失败'
,
509006
=>
'兑换红包码失败'
,
509007
=>
'好友助力失败'
,
],
...
...
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