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
ab2f4798
Commit
ab2f4798
authored
Jun 24, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into 'master'
推荐币添加所属链 See merge request
!48
parents
cb8c089e
b299d0eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
CoinRecommendController.php
backend/controllers/CoinRecommendController.php
+2
-1
index.php
backend/views/coin-recommend/index.php
+19
-2
CoinRecommend.php
common/models/psources/CoinRecommend.php
+3
-1
No files found.
backend/controllers/CoinRecommendController.php
View file @
ab2f4798
...
@@ -57,7 +57,8 @@ class CoinRecommendController extends BaseController
...
@@ -57,7 +57,8 @@ class CoinRecommendController extends BaseController
}
else
{
}
else
{
$platforms
=
CoinPlatform
::
find
()
->
where
([
'id'
=>
$user_platform_id
])
->
asArray
()
->
all
();
$platforms
=
CoinPlatform
::
find
()
->
where
([
'id'
=>
$user_platform_id
])
->
asArray
()
->
all
();
}
}
return
$this
->
render
(
'index'
,
[
'platforms'
=>
$platforms
]);
$chains
=
Coin
::
getPlatformList
();
return
$this
->
render
(
'index'
,
[
'platforms'
=>
$platforms
,
'chains'
=>
$chains
]);
}
}
public
function
actionAdd
()
public
function
actionAdd
()
...
...
backend/views/coin-recommend/index.php
View file @
ab2f4798
...
@@ -88,6 +88,17 @@
...
@@ -88,6 +88,17 @@
</select>
</select>
</div>
</div>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
所属链
</label>
<div
class=
"layui-input-inline"
>
<select
class=
"layui-select"
name=
"chain"
>
<option
value=
""
>
请选择一个链
</option>
<?php
foreach
(
$chains
as
$chain
)
:
?>
<option
value=
"
<?=
$chain
?>
"
>
<?=
$chain
?>
</option>
<?php
endforeach
;
?>
</select>
</div>
</div>
</form>
</form>
</div>
</div>
...
@@ -162,6 +173,10 @@ table.render({
...
@@ -162,6 +173,10 @@ table.render({
templet
:
'#type_tpl'
templet
:
'#type_tpl'
},
},
{
{
field
:
'chain'
,
title
:
'所属链'
,
},
{
field
:
'sort'
,
field
:
'sort'
,
title
:
'排序'
title
:
'排序'
},
},
...
@@ -191,7 +206,8 @@ table.on('toolbar(table1)', function(obj) {
...
@@ -191,7 +206,8 @@ table.on('toolbar(table1)', function(obj) {
coin
:
''
,
coin
:
''
,
sort
:
''
,
sort
:
''
,
recommend
:
''
,
recommend
:
''
,
type
:
''
type
:
''
,
chain
:
''
,
});
});
},
},
btn1
:
function
()
{
btn1
:
function
()
{
...
@@ -238,7 +254,8 @@ table.on('tool(table1)', function(obj) {
...
@@ -238,7 +254,8 @@ table.on('tool(table1)', function(obj) {
coin
:
data
.
coin
,
coin
:
data
.
coin
,
sort
:
data
.
sort
,
sort
:
data
.
sort
,
recommend
:
data
.
recommend
,
recommend
:
data
.
recommend
,
type
:
data
.
type
type
:
data
.
type
,
chain
:
data
.
chain
});
});
},
},
btn1
:
function
()
{
btn1
:
function
()
{
...
...
common/models/psources/CoinRecommend.php
View file @
ab2f4798
...
@@ -82,6 +82,7 @@ class CoinRecommend extends BaseActiveRecord
...
@@ -82,6 +82,7 @@ class CoinRecommend extends BaseActiveRecord
$recommend_type
=
$params
[
'recommend'
]
??
1
;
$recommend_type
=
$params
[
'recommend'
]
??
1
;
$sort
=
$params
[
'sort'
]
??
0
;
$sort
=
$params
[
'sort'
]
??
0
;
$type
=
$params
[
'type'
]
??
1
;
$type
=
$params
[
'type'
]
??
1
;
$chain
=
$params
[
'chain'
]
??
''
;
$coin
=
Coin
::
findOne
([
'name'
=>
strtoupper
(
$coin_name
)]);
$coin
=
Coin
::
findOne
([
'name'
=>
strtoupper
(
$coin_name
)]);
if
(
empty
(
$coin
))
{
if
(
empty
(
$coin
))
{
...
@@ -92,7 +93,7 @@ class CoinRecommend extends BaseActiveRecord
...
@@ -92,7 +93,7 @@ class CoinRecommend extends BaseActiveRecord
$coin_recommend
=
CoinRecommend
::
findOne
(
$id
);
$coin_recommend
=
CoinRecommend
::
findOne
(
$id
);
}
else
{
}
else
{
$coin_recommend
=
new
CoinRecommend
();
$coin_recommend
=
new
CoinRecommend
();
$count
=
self
::
find
()
->
where
([
'cid'
=>
$coin
->
id
,
'platform_id'
=>
$platform_id
,
'type'
=>
$type
])
->
count
();
$count
=
self
::
find
()
->
where
([
'cid'
=>
$coin
->
id
,
'platform_id'
=>
$platform_id
,
'type'
=>
$type
,
'chain'
=>
$chain
])
->
count
();
if
(
$count
>
0
)
{
if
(
$count
>
0
)
{
return
[
'code'
=>
-
1
,
'msg'
=>
'推荐币种已经存在'
];
return
[
'code'
=>
-
1
,
'msg'
=>
'推荐币种已经存在'
];
}
}
...
@@ -106,6 +107,7 @@ class CoinRecommend extends BaseActiveRecord
...
@@ -106,6 +107,7 @@ class CoinRecommend extends BaseActiveRecord
$coin_recommend
->
platform_id
=
$platform_id
;
$coin_recommend
->
platform_id
=
$platform_id
;
$coin_recommend
->
sort
=
$sort
;
$coin_recommend
->
sort
=
$sort
;
$coin_recommend
->
type
=
$type
;
$coin_recommend
->
type
=
$type
;
$coin_recommend
->
chain
=
$chain
;
if
(
$coin_recommend
->
save
())
{
if
(
$coin_recommend
->
save
())
{
return
[
'code'
=>
0
,
'msg'
=>
'保存成功'
];
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