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
8609825e
Commit
8609825e
authored
Nov 22, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
2d5efe4d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
8 deletions
+45
-8
CoinController.php
backend/controllers/CoinController.php
+9
-1
add.php
backend/views/coin/add.php
+3
-3
edit.php
backend/views/coin/edit.php
+3
-3
Coin.php
common/models/psources/Coin.php
+1
-1
CrawlerController.php
console/controllers/CrawlerController.php
+29
-0
No files found.
backend/controllers/CoinController.php
View file @
8609825e
...
...
@@ -80,6 +80,9 @@ class CoinController extends BaseController
$coin
=
Yii
::
createObject
(
Coin
::
className
());
$data
=
array_merge
(
$request
->
post
(),
[
'platform_id'
=>
Yii
::
$app
->
user
->
identity
->
platform_id
]);
unset
(
$data
[
'id'
]);
$data
[
'name'
]
=
strtoupper
(
$data
[
'name'
]);
$data
[
'platform'
]
=
strtolower
(
$data
[
'platform'
]);
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
$result
=
$coin
->
addOne
(
$data
);
if
(
$result
===
true
)
{
$this
->
success
(
'添加成功'
,
'/admin/coin/index'
);
...
...
@@ -103,11 +106,16 @@ class CoinController extends BaseController
public
function
actionEdit
()
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
$model
=
new
CoinForm
();
$model
->
scenario
=
'update'
;
$req
=
Yii
::
$app
->
request
;
$data
=
$req
->
post
();
$data
[
'name'
]
=
strtoupper
(
$data
[
'name'
]);
$data
[
'platform'
]
=
strtolower
(
$data
[
'platform'
]);
$data
[
'chain'
]
=
strtoupper
(
$data
[
'chain'
]);
Yii
::
$app
->
response
->
format
=
'json'
;
if
(
$model
->
load
(
$
req
->
post
()
)
&&
$model
->
validate
())
{
if
(
$model
->
load
(
$
data
)
&&
$model
->
validate
())
{
$platform_id
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$can
=
false
;
...
...
backend/views/coin/add.php
View file @
8609825e
...
...
@@ -20,7 +20,7 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
简称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name"
value=
"
<?=
$model
->
name
?>
"
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name"
placeholder=
"请填写大写字母"
value=
"
<?=
$model
->
name
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
@@ -88,13 +88,13 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
平台
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"platform"
value=
"
<?=
$model
->
platform
?>
"
>
<input
class=
"layui-input"
name=
"platform"
placeholder=
"请填写小写字母"
value=
"
<?=
$model
->
platform
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
类型
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"chain"
value=
"
<?=
$model
->
chain
?>
"
>
<input
class=
"layui-input"
name=
"chain"
placeholder=
"请填写小写字母"
value=
"
<?=
$model
->
chain
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
backend/views/coin/edit.php
View file @
8609825e
...
...
@@ -20,7 +20,7 @@
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
简称
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"name"
value=
"
<?=
$model
->
name
?>
"
lay-verify=
"required"
>
<input
class=
"layui-input"
name=
"name"
placeholder=
"请填写大写字母"
value=
"
<?=
$model
->
name
?>
"
lay-verify=
"required"
>
</div>
</div>
<div
class=
"layui-inline"
>
...
...
@@ -88,13 +88,13 @@
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
平台
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"platform"
value=
"
<?=
$model
->
platform
?>
"
>
<input
class=
"layui-input"
name=
"platform"
placeholder=
"请填写小写字母"
value=
"
<?=
$model
->
platform
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
类型
</label>
<div
class=
"layui-input-block"
>
<input
class=
"layui-input"
name=
"chain"
value=
"
<?=
$model
->
chain
?>
"
>
<input
class=
"layui-input"
name=
"chain"
placeholder=
"请填写小写字母"
value=
"
<?=
$model
->
chain
?>
"
>
</div>
</div>
<div
class=
"layui-form-item"
>
...
...
common/models/psources/Coin.php
View file @
8609825e
...
...
@@ -132,7 +132,7 @@ class Coin extends BaseActiveRecord
public
static
function
getPlatformList
()
{
$data
=
self
::
find
()
->
select
(
'platform'
)
->
asArray
()
->
all
();
$data
=
array_unique
(
array_map
(
'strto
upp
er'
,
array_column
(
$data
,
'platform'
)));
$data
=
array_unique
(
array_map
(
'strto
low
er'
,
array_column
(
$data
,
'platform'
)));
return
$data
;
}
...
...
console/controllers/CrawlerController.php
0 → 100644
View file @
8609825e
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/11/22
* Time: 10:57
*/
namespace
console\controllers
;
use
yii\console\Controller
;
class
CrawlerController
extends
Controller
{
public
function
actionCoinInfo
()
{
$feixiaohao_url
=
"https://www.feixiaohao.com/currencies/vechain"
;
$content
=
file_get_contents
(
$feixiaohao_url
);
$patt
=
"/<li><span class=tit>发行时间:<\/span> <span class=value>(.+?)<\/span><li>/"
;
preg_match
(
$patt
,
$content
,
$res
);
var_dump
(
$res
);
}
}
\ No newline at end of file
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