Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
3a12c875
Commit
3a12c875
authored
Jun 21, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
Feature/optimize See merge request
!46
parents
b7af8d09
b35c8b41
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
5 deletions
+17
-5
ServiceController.php
api/controllers/ServiceController.php
+4
-4
CoinRecommendController.php
backend/controllers/CoinRecommendController.php
+2
-1
index.php
backend/views/coin-recommend/index.php
+9
-0
CoinRecommend.php
common/models/psources/CoinRecommend.php
+2
-0
No files found.
api/controllers/ServiceController.php
View file @
3a12c875
...
...
@@ -92,8 +92,8 @@ class ServiceController extends BaseController
public
function
actionCoinIndex
()
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
6
);
//$coinItems = $request->post('names',[]
);
$coin_recommendItems
=
$this
->
coinRecommendList
(
$platform_id
);
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$coin_recommendItems
=
$this
->
coinRecommendList
(
$platform_id
,
$type
);
$fields
=
[
'id'
,
'sid'
,
'icon'
,
'name'
,
'nickname'
,
'chain'
,
'platform'
];
$rows
=
Coin
::
getSelectList
(
1
,
999
,
$fields
,[[
'in'
,
'id'
,
$coin_recommendItems
]]);
foreach
(
$rows
[
'data'
]
as
$key
=>
&
$value
)
{
...
...
@@ -107,9 +107,9 @@ class ServiceController extends BaseController
* @return array
* 托管钱包推荐币种
*/
private
function
coinRecommendList
(
$platform_id
)
private
function
coinRecommendList
(
$platform_id
,
$type
=
1
)
{
$recommend_list
=
CoinRecommend
::
find
()
->
select
(
'cid'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
$recommend_list
=
CoinRecommend
::
find
()
->
select
(
'cid'
)
->
where
([
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
all
();
if
(
$recommend_list
){
$coin_ids
=
array_column
(
$recommend_list
,
'cid'
);
return
$coin_ids
;
...
...
backend/controllers/CoinRecommendController.php
View file @
3a12c875
...
...
@@ -67,9 +67,10 @@ class CoinRecommendController extends BaseController
$get
=
Yii
::
$app
->
request
->
get
();
$platform_id
=
$get
[
'platform_id'
]
??
1
;
$platform_id
=
empty
(
$get
[
'platform_id'
])
?
1
:
$get
[
'platform_id'
]
;
$user_platform_id
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
#var_dump($platform_id, $user_platform_id);exit;
if
(
1
!=
$user_platform_id
&&
$user_platform_id
!=
$platform_id
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
'没有权限修改'
];
}
...
...
backend/views/coin-recommend/index.php
View file @
3a12c875
...
...
@@ -79,6 +79,15 @@
<input
name=
"sort"
class=
"layui-input"
type=
"text"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
所属类型
</label>
<div
class=
"layui-input-block"
>
<select
name=
"type"
class=
"layui-select"
>
<option
value=
"1"
>
币钱包
</option>
<option
value=
"2"
>
托管钱包
</option>
</select>
</div>
</div>
</form>
</div>
...
...
common/models/psources/CoinRecommend.php
View file @
3a12c875
...
...
@@ -81,6 +81,7 @@ class CoinRecommend extends BaseActiveRecord
$coin_name
=
$params
[
'coin'
]
??
''
;
$recommend_type
=
$params
[
'recommend'
]
??
1
;
$sort
=
$params
[
'sort'
]
??
0
;
$type
=
$params
[
'type'
]
??
1
;
$coin
=
Coin
::
findOne
([
'name'
=>
strtoupper
(
$coin_name
)]);
if
(
empty
(
$coin
))
{
...
...
@@ -104,6 +105,7 @@ class CoinRecommend extends BaseActiveRecord
$coin_recommend
->
recommend
=
$recommend_type
;
$coin_recommend
->
platform_id
=
$platform_id
;
$coin_recommend
->
sort
=
$sort
;
$coin_recommend
->
type
=
$type
;
if
(
$coin_recommend
->
save
())
{
return
[
'code'
=>
0
,
'msg'
=>
'保存成功'
];
}
...
...
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