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
68b06e20
Commit
68b06e20
authored
Dec 02, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
742c3367
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
Boc.php
common/service/exchange/Boc.php
+10
-6
TickerController.php
console/controllers/TickerController.php
+3
-1
No files found.
common/service/exchange/Boc.php
View file @
68b06e20
...
...
@@ -15,7 +15,7 @@ class Boc extends Exchange implements ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_boc'
;
protected
$quotation_prefix
=
'quotation_boc_'
;
protected
$base_url
=
'http://srh.bankofchina.com/search/whpj/search
.jsp'
;
protected
$base_url
=
'https://srh.bankofchina.com/search/whpj/search_cn
.jsp'
;
public
function
symbolExists
(
$tag
=
'CNY'
,
$aim
=
"JPY"
)
{
...
...
@@ -25,6 +25,7 @@ class Boc extends Exchange implements ExchangeInterface
}
return
false
;
}
/**
* 转化交易对为请求变量
*
...
...
@@ -34,7 +35,7 @@ class Boc extends Exchange implements ExchangeInterface
*/
public
function
formatSymbol
(
$tag
=
'CNY'
,
$aim
=
'JPY'
)
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
'_'
.
$aim
);
}
/**
...
...
@@ -60,13 +61,14 @@ class Boc extends Exchange implements ExchangeInterface
'erectDate'
=>
''
,
'nothing'
=>
''
,
'pjname'
=>
1323
])
->
post
(
'http
://srh.bankofchina.com/search/whpj/search
.jsp'
);
])
->
post
(
'http
s://srh.bankofchina.com/search/whpj/search_cn
.jsp'
);
$response
=
iconv
(
'UTF-8'
,
'GBK//TRANSLIT'
,
$response
);
$response
=
iconv
(
'UTF-8'
,
'GBK//TRANSLIT'
,
$response
);
$html
=
HtmlDomParser
::
str_get_html
(
$response
);
$div
=
(
$html
->
find
(
'div.BOC_main'
));
foreach
(
$div
->
find
(
'td'
)
as
$key
=>
$e
){
if
(
$key
==
5
){
if
(
$div
->
find
(
'td'
))
{
foreach
(
$div
->
find
(
'td'
)
as
$key
=>
$e
)
{
if
(
$key
==
5
)
{
$key
=
$this
->
quotation_prefix
.
'CNY_JPY'
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$e
->
innertext
,
'high'
,
$e
->
innertext
,
'last'
,
$e
->
innertext
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'CNYJPY'
);
...
...
@@ -74,5 +76,6 @@ class Boc extends Exchange implements ExchangeInterface
}
}
}
}
}
\ No newline at end of file
console/controllers/TickerController.php
View file @
68b06e20
...
...
@@ -45,11 +45,12 @@ class TickerController extends Controller
'erectDate'
=>
''
,
'nothing'
=>
''
,
'pjname'
=>
$val
->
currency
->
pj_id
])
->
post
(
'http
://srh.bankofchina.com/search/whpj/search
.jsp'
);
])
->
post
(
'http
s://srh.bankofchina.com/search/whpj/search_cn
.jsp'
);
$response
=
iconv
(
'UTF-8'
,
'GBK//TRANSLIT'
,
$response
);
$html
=
HtmlDomParser
::
str_get_html
(
$response
);
$div
=
(
$html
->
find
(
'div.BOC_main'
));
if
(
$div
->
find
(
'td'
))
{
foreach
(
$div
->
find
(
'td'
)
as
$key
=>
$e
)
{
if
(
$key
==
5
)
{
$key
=
'quotation_boc_'
.
'CNY_'
.
$val
->
currency
->
symbol
;
...
...
@@ -57,6 +58,7 @@ class TickerController extends Controller
Yii
::
$app
->
redis_currency
->
hmset
(
$key
,
'low'
,
$currency
,
'high'
,
$currency
,
'last'
,
$currency
,
'open'
,
$currency
);
}
}
}
});
}
echo
date
(
'Y-m-d H:i:s'
)
.
'计价货币更新成功'
.
PHP_EOL
;
...
...
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