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
5a4d7c8e
Commit
5a4d7c8e
authored
Jul 23, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into develop
parents
edde675c
70c11105
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+10
-0
ArticleController.php
console/controllers/ArticleController.php
+64
-0
No files found.
common/business/ExchangeBusiness.php
View file @
5a4d7c8e
...
...
@@ -125,6 +125,16 @@ class ExchangeBusiness
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'POKE'
)
{
$quotation
=
[
'low'
=>
0.15
,
'high'
=>
0.15
,
'last'
=>
0.15
,
'rmb'
=>
0.15
,
];
goto
doEnd
;
}
if
(
strtoupper
(
$tag
)
==
'GST'
||
strtoupper
(
$tag
)
==
'JNTK'
||
strtoupper
(
$tag
)
==
'SPT'
||
strtoupper
(
$tag
)
==
'STO'
||
strtoupper
(
$tag
)
==
'GM'
||
strtoupper
(
$tag
)
==
'BSTC'
||
strtoupper
(
$tag
)
==
'RYH'
||
strtoupper
(
$tag
)
==
'CNDT'
||
strtoupper
(
$tag
)
==
'WL'
||
strtoupper
(
$tag
)
==
'ETS'
||
strtoupper
(
$tag
)
==
'LIMS'
||
strtoupper
(
$tag
)
==
'AT'
||
strtoupper
(
$tag
)
==
'BTJ'
)
{
$quotation
=
[
'low'
=>
0
,
...
...
console/controllers/ArticleController.php
0 → 100644
View file @
5a4d7c8e
<?php
namespace
console\controllers
;
use
Yii
;
use
yii\console\Controller
;
use
linslin\yii2\curl\Curl
;
use
common\components\Tools
;
use
common\models\pwallet\Article
;
class
ArticleController
extends
Controller
{
public
function
actionIndex
()
{
$coindog
=
Yii
::
$app
->
params
[
'coindog'
];
$accessKey
=
$coindog
[
'accessKey'
];
$secretKey
=
$coindog
[
'secretKey'
];
$httpParams
=
array
(
'access_key'
=>
$accessKey
,
'date'
=>
time
()
);
$signParams
=
array_merge
(
$httpParams
,
array
(
'secret_key'
=>
$secretKey
));
ksort
(
$signParams
);
$signString
=
http_build_query
(
$signParams
);
$httpParams
=
[
'sign'
=>
strtolower
(
md5
(
$signString
)),
];
$url
=
$coindog
[
'live'
]
.
'?'
.
http_build_query
(
$httpParams
);
$curl
=
new
Curl
();
$resp
=
$curl
->
get
(
$url
,
false
);
if
(
!
isset
(
$resp
[
'list'
]))
{
return
0
;
}
$list
=
$resp
[
'list'
][
0
][
'lives'
];
$list
=
Tools
::
arraySort
(
$list
,
'created_at'
,
SORT_ASC
);
$create_time
=
Article
::
find
()
->
where
([
'source'
=>
1
])
->
max
(
'create_time'
);
$article
=
new
Article
();
foreach
(
$list
as
&
$item
)
{
go
(
function
()
use
(
$item
,
$article
,
$create_time
)
{
\Co
::
sleep
(
0.5
);
if
(
$item
[
'created_at'
]
>
$create_time
)
{
preg_match_all
(
"/\【(.+?)\】/"
,
$item
[
'content'
],
$match
);
$title
=
$match
[
1
][
0
];
$content
=
str_replace
(
'【'
.
$title
.
'】'
,
''
,
$item
[
'content'
]);
$article
->
setIsNewRecord
(
true
);
$article
->
title
=
$title
;
$article
->
content
=
$content
;
$article
->
platform_id
=
0
;
$article
->
create_time
=
$item
[
'created_at'
];
$article
->
source
=
1
;
$article
->
save
()
&&
$article
->
id
=
0
;;
}
});
}
return
0
;
}
}
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