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
67534fea
Commit
67534fea
authored
Jun 21, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into feature/ucenter
parents
a13f279b
cb8c089e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
10 deletions
+37
-10
CoinController.php
api/controllers/CoinController.php
+2
-2
ServiceController.php
api/controllers/ServiceController.php
+4
-4
CoinRecommendController.php
backend/controllers/CoinRecommendController.php
+2
-1
index.php
backend/views/coin-recommend/index.php
+26
-2
CoinRecommend.php
common/models/psources/CoinRecommend.php
+3
-1
No files found.
api/controllers/CoinController.php
View file @
67534fea
...
...
@@ -68,7 +68,7 @@ class CoinController extends BaseController
}
$recommend
=
$request
->
post
(
'recommend'
,
''
);
$condition
=
[
'platform_id'
=>
$platform_id
];
$condition
=
[
'platform_id'
=>
$platform_id
,
'type'
=>
1
];
if
(
$recommend
)
{
$condition
[
'recommend'
]
=
$recommend
;
}
...
...
@@ -126,7 +126,7 @@ class CoinController extends BaseController
$platform_id
=
$request
->
post
(
'platform_id'
,
1
);
//默认币钱包
$recommend
=
$request
->
post
(
'recommend'
,
''
);
$condition
=
[
'platform_id'
=>
$platform_id
];
$condition
=
[
'platform_id'
=>
$platform_id
,
'type'
=>
1
];
if
(
$recommend
)
{
$condition
[
'recommend'
]
=
$recommend
;
}
...
...
api/controllers/ServiceController.php
View file @
67534fea
...
...
@@ -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 @
67534fea
...
...
@@ -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 @
67534fea
...
...
@@ -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>
...
...
@@ -100,6 +109,14 @@
{{
#
}
}}
</script>
<script
type=
"text/html"
id=
"type_tpl"
>
{{
#
if
(
1
==
d
.
type
){
}}
币钱包
{{
#
}
else
if
(
2
==
d
.
type
){
}}
托管钱包
{{
#
}
}}
</script>
<script
type=
"text/html"
id=
"toolBar"
>
<
button
class
=
"layui-btn layui-btn-xs layui-btn-normal"
lay
-
event
=
"edit"
>
编辑
<
/button
>
<
button
class
=
"layui-btn layui-btn-xs layui-btn-danger"
lay
-
event
=
"del"
>
删除
<
/button
>
...
...
@@ -140,6 +157,11 @@ table.render({
templet
:
'#recommend_tpl'
},
{
field
:
'type'
,
title
:
'所属类型'
,
templet
:
'#type_tpl'
},
{
field
:
'sort'
,
title
:
'排序'
},
...
...
@@ -168,7 +190,8 @@ table.on('toolbar(table1)', function(obj) {
platform_id
:
$
(
'#platform_id'
).
val
(),
coin
:
''
,
sort
:
''
,
recommend
:
''
recommend
:
''
,
type
:
''
});
},
btn1
:
function
()
{
...
...
@@ -214,7 +237,8 @@ table.on('tool(table1)', function(obj) {
platform_id
:
data
.
platform_id
,
coin
:
data
.
coin
,
sort
:
data
.
sort
,
recommend
:
data
.
recommend
recommend
:
data
.
recommend
,
type
:
data
.
type
});
},
btn1
:
function
()
{
...
...
common/models/psources/CoinRecommend.php
View file @
67534fea
...
...
@@ -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
))
{
...
...
@@ -91,7 +92,7 @@ class CoinRecommend extends BaseActiveRecord
$coin_recommend
=
CoinRecommend
::
findOne
(
$id
);
}
else
{
$coin_recommend
=
new
CoinRecommend
();
$count
=
self
::
find
()
->
where
([
'cid'
=>
$coin
->
id
,
'platform_id'
=>
$platform_id
])
->
count
();
$count
=
self
::
find
()
->
where
([
'cid'
=>
$coin
->
id
,
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
count
();
if
(
$count
>
0
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
'推荐币种已经存在'
];
}
...
...
@@ -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