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
fb0edddd
Commit
fb0edddd
authored
Jun 15, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加矿工费 平台改用dropdown选择
parent
0b89476d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
11 deletions
+53
-11
form.php
backend/views/miner-fee/form.php
+15
-1
CoinBusiness.php
common/business/CoinBusiness.php
+7
-7
CoinService.php
common/service/CoinService.php
+31
-3
No files found.
backend/views/miner-fee/form.php
View file @
fb0edddd
...
...
@@ -9,6 +9,10 @@
/**
* @var $model backend\models\coin\CoinForm;
*/
use
common\models\pwallet\Coin
;
$platforms
=
Coin
::
getPlatformList
();
?>
<style>
.layui-form-label
{
...
...
@@ -23,7 +27,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
?>
"
lay-verify=
"required"
>
<select
name=
"platform"
>
<?php
foreach
(
$platforms
as
$platform
)
:
?>
<option
value=
"
<?=
$platform
?>
"
<?php
if
(
$model
->
platform
==
$platform
)
{
echo
"selected"
;
}
?>
>
<?=
$platform
?>
</option>
<?php
endforeach
;
?>
</select>
</div>
</div>
...
...
@@ -51,3 +61,6 @@
</form>
</div>
</div>
<script>
layui
.
form
.
render
();
</script>
\ No newline at end of file
common/business/CoinBusiness.php
View file @
fb0edddd
...
...
@@ -29,13 +29,13 @@ class CoinBusiness
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$rows
=
Coin
::
getList
(
$page
,
$limit
,
$condition
);
if
(
$rows
[
'count'
]
>
0
)
{
$datas
=
$rows
[
'data'
];
foreach
(
$datas
as
$key
=>
$value
)
{
//获取交易所信息
$rows
[
'data'
][
$key
][
'exchange'
]
=
CoinService
::
exchange
(
$value
[
'sid'
]);
}
}
//
if ($rows['count'] > 0) {
//
$datas = $rows['data'];
//
foreach ($datas as $key => $value) {
//
//获取交易所信息
//
$rows['data'][$key]['exchange'] = CoinService::exchange($value['sid']);
//
}
//
}
return
$rows
;
}
...
...
common/service/CoinService.php
View file @
fb0edddd
...
...
@@ -34,7 +34,7 @@ class CoinService
$name
,
//sid
];
$result
=
Yii
::
$app
->
cache
->
get
(
$key
);
if
(
$result
===
false
)
{
if
(
$result
===
false
||
YII_ENV_DEV
)
{
$url
=
Yii
::
$app
->
params
[
'feixiaohao_domain'
]
.
Yii
::
$app
->
params
[
'feixiaohao_page'
][
'coinmarket'
]
.
$name
.
'/'
;
$ch
=
new
Curl
();
try
{
...
...
@@ -42,9 +42,28 @@ class CoinService
preg_match_all
(
"/<div class=boxContain><table class=table3 id=markets>(.*)?<\/table>/is"
,
$content
,
$matchs
);
$content
=
$matchs
[
1
][
0
];
preg_match_all
(
'/alt=(.*?)>/is'
,
$content
,
$matchs
);
preg_match_all
(
'/
<a href="(.*?)"(.*?)
alt=(.*?)>/is'
,
$content
,
$matchs
);
//匹配到了
$result
=
array_unique
(
$matchs
[
1
]);
//保存匹配数据
$count
=
count
(
$matchs
[
1
]);
$result
=
[];
$r
=
[];
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
if
(
!
in_array
(
$matchs
[
3
][
$i
],
$r
))
{
$r
[]
=
$matchs
[
3
][
$i
];
//爬取正确的官网
if
(
strpos
(
$matchs
[
1
][
$i
],
'/exchange'
)
===
false
)
{
$matchs
[
1
][
$i
]
.=
'https:'
;
}
else
{
$url
=
'https://www.feixiaohao.com'
.
$matchs
[
1
][
$i
];
$content
=
$ch
->
get
(
$url
,
true
);
preg_match_all
(
'/官网地址:<a(.*?)>(.*?)<\/a><\/span>/'
,
$content
,
$matchs2
);
$matchs
[
1
][
$i
]
=
$matchs2
[
2
][
0
];
}
$result
[]
=
[
'url'
=>
$matchs
[
1
][
$i
],
'name'
=>
$matchs
[
3
][
$i
]];
}
}
unset
(
$content
,
$i
,
$r
,
$url
,
$matchs2
);
Yii
::
$app
->
cache
->
set
(
$key
,
$result
,
180
);
//set caching
return
[
'count'
=>
count
(
$result
),
'data'
=>
$result
];
}
catch
(
\Exception
$exception
)
{
...
...
@@ -55,6 +74,15 @@ class CoinService
}
/**
* 爬取交易所数量
* @param string $sid
* @return integer|bool
*/
public
static
function
exchange_count
(
$sid
=
'eos'
)
{
}
/**
* 爬取币种的实时行情,默认eos
*
* @param string $sid
...
...
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