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
f5cd65cc
authored
Sep 03, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加微信兑换信息
parent
a22130a5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletions
app/Http/Controllers/ExchangeSettingsController.php
app/Services/ExchangeSettingService.php
app/Services/UserExchangeService.php
app/Http/Controllers/ExchangeSettingsController.php
View file @
f5cd65cc
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Http\Transformers\ExchangeSettingTransformer
;
use
App\Http\Transformers\ExchangeSettingTransformer
;
use
App\Services\AssistService
;
use
App\Services\ExchangeSettingService
;
use
App\Services\ExchangeSettingService
;
use
App\Services\UserExchangeService
;
use
App\Services\UserExchangeService
;
use
App\Services\UserIntegralService
;
use
App\Services\UserIntegralService
;
...
@@ -48,11 +49,16 @@ class ExchangeSettingsController extends Controller
...
@@ -48,11 +49,16 @@ class ExchangeSettingsController extends Controller
$integral
=
array_get
(
$user
,
'integral'
,
0
);
$integral
=
array_get
(
$user
,
'integral'
,
0
);
$exchangeSettings
[
'integral'
]
=
$integral
;
$exchangeSettings
[
'integral'
]
=
$integral
;
$exchangeSettings
[
'mobile'
]
=
$mobile
;
$exchangeSettings
[
'mobile'
]
=
$mobile
;
//检查是否可以进行兑换
$userExchangeService
=
new
UserExchangeService
();
$userExchangeService
=
new
UserExchangeService
();
$canExchangeStatus
=
$userExchangeService
->
checkCanExchange
(
$userId
);
$canExchangeStatus
=
$userExchangeService
->
checkCanExchange
(
$userId
);
$exchangeSettings
[
'can_exchange'
]
=
$canExchangeStatus
;
$exchangeSettings
[
'can_exchange'
]
=
$canExchangeStatus
;
//获取微信兑换状况
$info
=
$this
->
service
->
getWeixinExchangeInfo
(
98
);
$exchangeSettings
[
'weixin_exchange_info'
]
=
$info
;
return
$this
->
Export
(
0
,
'ok'
,
$exchangeSettings
);
return
$this
->
Export
(
0
,
'ok'
,
$exchangeSettings
);
}
}
}
}
\ No newline at end of file
app/Services/ExchangeSettingService.php
View file @
f5cd65cc
...
@@ -14,4 +14,29 @@ class ExchangeSettingService
...
@@ -14,4 +14,29 @@ class ExchangeSettingService
return
$result
;
return
$result
;
}
}
//获取微信兑换的状态
public
function
getWeixinExchangeInfo
(
$userId
)
{
//先去获取用户是否有正卡着好友助力的兑换记录
$map
=
[
'user_id'
=>
$userId
,
];
$userExchangeService
=
new
UserExchangeService
();
$userExchange
=
array_get
(
$userExchangeService
->
getUserExchange
(
$map
),
'data'
,
[]);
//如果最后一条记录是未审核就代表这个需要好友助力
$info
=
[];
$info
[
'exchanging'
]
=
1
;
if
(
is_array
(
$userExchange
))
{
//如果审核状态为未审核,就代表需要好友助力,也就是说正在兑换
if
(
$userExchange
[
'status'
]
==
0
)
{
$info
[
'assist_count'
]
=
$userExchange
[
'assist_count'
];
}
else
{
//否则直接返回没有正在兑换
$info
[
'exchanging'
]
=
$info
[
'assist_count'
]
=
0
;
}
}
return
$info
;
}
}
}
\ No newline at end of file
app/Services/UserExchangeService.php
View file @
f5cd65cc
...
@@ -9,6 +9,15 @@ use Common\Model\RedisModel;
...
@@ -9,6 +9,15 @@ use Common\Model\RedisModel;
class
UserExchangeService
class
UserExchangeService
{
{
public
function
getUserExchange
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/user_exchanges/info'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
public
function
getUserExchangeList
(
$map
=
[])
public
function
getUserExchangeList
(
$map
=
[])
{
{
$url
=
config
(
'website.BaseUrl'
)
.
'/user_exchanges/list'
;
$url
=
config
(
'website.BaseUrl'
)
.
'/user_exchanges/list'
;
...
...
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