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
f1593aa5
Commit
f1593aa5
authored
Jun 05, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上架交易所
parent
4130d346
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
12 deletions
+76
-12
main.php
api/config/main.php
+3
-3
CoinController.php
backend/controllers/CoinController.php
+17
-3
index.php
backend/views/coin/index.php
+39
-1
params.php
common/config/params.php
+9
-1
Coin.php
common/models/pwallet/Coin.php
+8
-4
No files found.
api/config/main.php
View file @
f1593aa5
...
...
@@ -25,9 +25,9 @@ return [
'baseUrl'
=>
'/interface'
,
'cookieValidationKey'
=>
'123456'
,
'enableCsrfValidation'
=>
false
,
//
'parsers' => [
//
'application/json' => 'yii\web\JsonParser',
//
],
'parsers'
=>
[
'application/json'
=>
'yii\web\JsonParser'
,
],
],
'response'
=>
[
'class'
=>
'api\base\BaseResponse'
,
...
...
backend/controllers/CoinController.php
View file @
f1593aa5
...
...
@@ -8,7 +8,6 @@
namespace
backend\controllers
;
use
backend\controllers\BaseController
;
use
Yii
;
use
common\models\pwallet\Coin
;
use
backend\models\coin\CoinForm
;
...
...
@@ -16,6 +15,7 @@ use yii\base\InvalidConfigException;
use
yii\db\Exception
;
use
yii\web\UploadedFile
;
use
yii\validators\ImageValidator
;
use
common\business\CoinBusiness
;
/**
* 币种管理控制器
...
...
@@ -31,10 +31,18 @@ class CoinController extends BaseController
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$name
=
$request
->
get
(
'name'
,
null
);
$platform
=
$request
->
get
(
'platform'
,
null
);
$condition
=
[];
if
(
$name
)
{
$condition
[]
=
[
'like'
,
'name'
,
$name
];
}
if
(
$platform
)
{
$condition
[]
=
[
'platform'
=>
$platform
];
}
$data
=
CoinBusiness
::
getList
(
$page
,
$limit
,
$condition
);
$data
[
'code'
]
=
0
;
//ajax return
Yii
::
$app
->
response
->
format
=
'json'
;
$data
=
Coin
::
getList
(
$page
,
$limit
,
[
'like'
,
'name'
,
$name
]);
$data
[
'code'
]
=
0
;
return
$data
;
}
return
$this
->
render
(
'index'
);
...
...
@@ -129,4 +137,9 @@ class CoinController extends BaseController
return
[
'code'
=>
$exception
->
getCode
(),
'msg'
=>
$exception
->
getMessage
()];
}
}
public
function
actionCost
()
{
return
''
;
}
}
\ No newline at end of file
backend/views/coin/index.php
View file @
f1593aa5
...
...
@@ -28,18 +28,28 @@
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"margin-bottom: 0; width: 100px;"
>
平台
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"platform"
>
<option>
all
</option>
<option
value=
"ethereum"
>
eth
</option>
</select>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"form1"
>
搜索
</button>
</div>
</form>
</div>
</div>
<div
class=
"layui-row"
>
<table
class=
"layui-table"
id=
"table1"
></table>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<script>
var
table
=
layui
.
table
;
var
form
=
layui
.
form
;
var
layer
=
layui
.
layer
;
form
.
render
();
table
.
render
({
elem
:
"#table1"
,
url
:
'/admin/coin/index'
,
...
...
@@ -55,6 +65,13 @@
{
field
:
'official'
,
title
:
'官网'
,
templet
:
"#officialTpl"
},
{
field
:
'paper'
,
title
:
'白皮书'
,
templet
:
"#paperTpl"
},
{
field
:
'platform'
,
title
:
'平台'
},
{
field
:
'exchange'
,
title
:
'上架交易所'
,
templet
:
"#exchangeTpl"
,
style
:
'cursor: pointer;'
,
event
:
'getExchange'
},
{
field
:
'price'
,
title
:
'众筹价格'
},
{
field
:
'release'
,
title
:
'发行时间'
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
'#operationTpl'
}
...
...
@@ -68,6 +85,23 @@
});
return
false
;
});
//监听单元格事件
table
.
on
(
'tool(table1)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
console
.
log
(
data
);
if
(
obj
.
event
===
'getExchange'
)
{
var
content
=
''
;
$
.
each
(
data
.
exchange
.
data
,
function
(
index
,
item
)
{
content
+=
'<li>'
+
item
+
'</li>'
;
});
layer
.
open
({
type
:
0
,
title
:
'上架交易所列表'
,
content
:
content
,
tips
:
3
});
}
});
</script>
<script
type=
"text/html"
id=
"iconTpl"
>
<
img
src
=
"{{d.icon}}"
style
=
"max-width: 32px; max-height: 32px;"
/>
...
...
@@ -95,3 +129,6 @@
<
button
class
=
"layui-btn layui-btn-sm"
><
i
class
=
"layui-icon"
>&
#
xe642
;
<
/i></
button
>
<
/a
>
</script>
<script
type=
"text/html"
id=
"exchangeTpl"
>
{{
d
.
exchange
.
count
}}
家
</script>
\ No newline at end of file
common/config/params.php
View file @
f1593aa5
...
...
@@ -22,10 +22,18 @@ return [
],
'pager'
=>
[
'options'
=>
[
'class'
=>
'pagination'
,
'style'
=>
'visibility: visible;'
],
'options'
=>
[
'class'
=>
'pagination'
,
'style'
=>
'visibility: visible;'
],
'firstPageLabel'
=>
"首页"
,
'prevPageLabel'
=>
'上一页'
,
'nextPageLabel'
=>
'下一页'
,
'lastPageLabel'
=>
'末页'
,
],
/** 非小号数据爬取地址 */
'feixiaohao_domain'
=>
'https://www.feixiaohao.com'
,
'feixiaohao_page'
=>
[
'assets'
=>
'/assets/'
,
//代币
'currencies'
=>
'/currencies/'
,
//币种详情
'coinmarket'
=>
'/coinmarket/'
,
//上市交易所
],
];
common/models/pwallet/Coin.php
View file @
f1593aa5
...
...
@@ -28,13 +28,17 @@ class Coin extends BaseActiveRecord
* 获取币种信息列表
* @param int $page
* @param int $limit
* @param array $con
fig
* @param array $con
dition
* @return array|\yii\db\ActiveRecord[]
*/
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$con
fig
=
[])
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$con
dition
=
[])
{
$count
=
self
::
find
()
->
filterWhere
(
$config
)
->
count
();
$data
=
self
::
find
()
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
)
->
filterWhere
(
$config
)
->
asArray
()
->
all
();
$query
=
self
::
find
();
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andFilterWhere
(
$item
);
}
$count
=
$query
->
count
();
$data
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
foreach
(
$data
as
$key
=>
$item
)
{
$data
[
$key
][
'price'
]
=
sprintf
(
"%0.6f"
,
$item
[
'price'
]);
// $data[$key]['release'] = date('Y-m-d', $item['release']);
...
...
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