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
463cdcb3
Commit
463cdcb3
authored
Nov 13, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into develop
parents
6544a8f1
06afd62d
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
576 additions
and
59 deletions
+576
-59
CoinController.php
api/controllers/CoinController.php
+1
-1
TickerController.php
api/controllers/TickerController.php
+49
-1
WalletController.php
api/controllers/WalletController.php
+13
-15
AuthController.php
backend/controllers/AuthController.php
+13
-2
index.php
backend/views/auth/index.php
+4
-4
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+31
-23
Hd.php
common/service/exchange/Hd.php
+69
-0
Wbf.php
common/service/exchange/Wbf.php
+71
-0
Ztb.php
common/service/exchange/Ztb.php
+15
-13
HdBuilder.php
common/service/exchange/factory/HdBuilder.php
+54
-0
WbfBuilder.php
common/service/exchange/factory/WbfBuilder.php
+201
-0
ZtbBuilder.php
common/service/exchange/factory/ZtbBuilder.php
+55
-0
No files found.
api/controllers/CoinController.php
View file @
463cdcb3
...
@@ -414,7 +414,7 @@ class CoinController extends BaseController
...
@@ -414,7 +414,7 @@ class CoinController extends BaseController
$request
=
Yii
::
$app
->
request
;
$request
=
Yii
::
$app
->
request
;
$platform
=
$request
->
post
(
'platform'
,
''
);
$platform
=
$request
->
post
(
'platform'
,
''
);
if
(
$platform
)
{
if
(
$platform
)
{
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
$platform
);
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
strtolower
(
$platform
)
);
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
}
else
{
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
...
...
api/controllers/TickerController.php
View file @
463cdcb3
...
@@ -288,7 +288,7 @@ class TickerController extends BaseController
...
@@ -288,7 +288,7 @@ class TickerController extends BaseController
public
function
actionHotTicker
()
public
function
actionHotTicker
()
{
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
0
)
;
$platform_id
=
$this
->
platform_id
??
0
;
$datas
=
[
$datas
=
[
[
[
'exchange'
=>
'huobi'
,
'exchange'
=>
'huobi'
,
...
@@ -335,6 +335,54 @@ class TickerController extends BaseController
...
@@ -335,6 +335,54 @@ class TickerController extends BaseController
]
]
];
];
}
}
if
(
52
==
$platform_id
)
{
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
],
],
[
'exchange'
=>
'ztb'
,
'symbol'
=>
[
'zycusdt'
],
]
];
}
if
(
53
==
$platform_id
)
{
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
],
],
[
'exchange'
=>
'wbf'
,
'symbol'
=>
[
'leleusdt'
],
]
];
}
if
(
54
==
$platform_id
)
{
$datas
=
[
[
'exchange'
=>
'huobi'
,
'symbol'
=>
[
'btcusdt'
,
'ethusdt'
],
],
[
'exchange'
=>
'hd'
,
'symbol'
=>
[
'hdusdt'
],
]
];
}
$ticker
=
[];
$ticker
=
[];
foreach
(
$datas
as
$data
)
{
foreach
(
$datas
as
$data
)
{
$builder
=
ExchangeBuilderFactory
::
create
(
$data
[
'exchange'
]);
$builder
=
ExchangeBuilderFactory
::
create
(
$data
[
'exchange'
]);
...
...
api/controllers/WalletController.php
View file @
463cdcb3
...
@@ -116,29 +116,28 @@ class WalletController extends BaseController
...
@@ -116,29 +116,28 @@ class WalletController extends BaseController
$token
=
Yii
::
$app
->
request
->
get
(
'address'
,
''
);
$token
=
Yii
::
$app
->
request
->
get
(
'address'
,
''
);
$symbol
=
Yii
::
$app
->
request
->
get
(
'symbol'
,
''
);
$symbol
=
Yii
::
$app
->
request
->
get
(
'symbol'
,
''
);
if
(
empty
(
$platform_id
)
||
empty
(
$token
)
||
empty
(
$symbol
))
{
if
(
empty
(
$platform_id
)
||
empty
(
$token
)
||
empty
(
$symbol
))
{
$msg
=
'参数不能为空'
;
$this
->
msg
=
'参数不能为空'
;
$code
=
-
1
;
$this
->
code
=
-
1
;
$data
=
null
;
goto
doEnd
;
goto
doEnd
;
}
}
$chain_model
=
CoinPlatform
::
find
()
->
select
(
'chain_id'
)
->
where
([
'id'
=>
$platform_id
])
->
andWhere
([
'<>'
,
'chain_id'
,
0
])
->
one
();
$chain_model
=
CoinPlatform
::
find
()
->
select
(
'chain_id'
)
->
where
([
'id'
=>
$platform_id
])
->
andWhere
([
'<>'
,
'chain_id'
,
0
])
->
one
();
if
(
empty
(
$chain_model
))
{
if
(
empty
(
$chain_model
))
{
$msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$
this
->
msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$code
=
-
1
;
$
this
->
code
=
-
1
;
goto
doEnd
;
goto
doEnd
;
}
}
$platform
=
CoinPlatformWithHold
::
find
()
->
select
(
'exer, platform'
)
->
where
([
'id'
=>
$chain_model
->
chain_id
])
->
one
();
$platform
=
CoinPlatformWithHold
::
find
()
->
select
(
'exer, platform'
)
->
where
([
'id'
=>
$chain_model
->
chain_id
])
->
one
();
if
(
empty
(
$platform
))
{
if
(
empty
(
$platform
))
{
$msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$
this
->
msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$code
=
-
1
;
$
this
->
code
=
-
1
;
goto
doEnd
;
goto
doEnd
;
}
}
$node
=
Yii
::
$app
->
params
[
'chain_nodes'
][
strtoupper
(
$platform
->
platform
)];
$node
=
Yii
::
$app
->
params
[
'chain_nodes'
][
strtoupper
(
$platform
->
platform
)]
??
null
;
if
(
empty
(
$node
))
{
if
(
empty
(
$node
))
{
$msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$
this
->
msg
=
'此功能为付费功能,有兴趣请与销售联系'
;
$code
=
-
1
;
$
this
->
code
=
-
1
;
goto
doEnd
;
goto
doEnd
;
}
}
...
@@ -170,14 +169,13 @@ class WalletController extends BaseController
...
@@ -170,14 +169,13 @@ class WalletController extends BaseController
}
}
if
(
0
!==
$result
[
'code'
])
{
if
(
0
!==
$result
[
'code'
])
{
$msg
=
'当前发币人数过多,请客官稍后再试'
;
$this
->
msg
=
'当前发币人数过多,请客官稍后再试'
;
$code
=
-
1
;
$this
->
code
=
-
1
;
$data
=
null
;
goto
doEnd
;
goto
doEnd
;
}
}
$data
=
$result
[
'result'
];
$
this
->
data
=
$result
[
'result'
];
doEnd
:
doEnd
:
return
[
'code'
=>
$
code
,
'data'
=>
$data
,
'msg'
=>
$
msg
];
return
[
'code'
=>
$
this
->
code
,
'data'
=>
$this
->
data
,
'msg'
=>
$this
->
msg
];
}
}
public
function
actionTransfer
()
public
function
actionTransfer
()
...
...
backend/controllers/AuthController.php
View file @
463cdcb3
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
backend\controllers
;
namespace
backend\controllers
;
use
common\components\Tools
;
use
common\models\psources\CoinPlatform
;
use
common\models\psources\CoinPlatform
;
use
Yii
;
use
Yii
;
use
common\models\Admin
;
use
common\models\Admin
;
...
@@ -47,9 +48,19 @@ class AuthController extends BaseController
...
@@ -47,9 +48,19 @@ class AuthController extends BaseController
/* 获取角色列表 */
/* 获取角色列表 */
$self_roles
=
current
(
$auth
->
getRolesByUser
(
Yii
::
$app
->
user
->
id
));
$self_roles
=
current
(
$auth
->
getRolesByUser
(
Yii
::
$app
->
user
->
id
));
$roles
=
$auth
->
getChildRoles
(
$self_roles
->
name
);
$roles
=
$auth
->
getChildRoles
(
$self_roles
->
name
);
$roles_temp
=
[];
foreach
(
$roles
as
$key
=>
$role
)
{
$roles_temp
[
$role
->
name
][
'type'
]
=
$role
->
type
;
$roles_temp
[
$role
->
name
][
'name'
]
=
$role
->
name
;
$roles_temp
[
$role
->
name
][
'description'
]
=
$role
->
description
;
$roles_temp
[
$role
->
name
][
'ruleName'
]
=
$role
->
ruleName
;
$roles_temp
[
$role
->
name
][
'data'
]
=
$role
->
data
;
$roles_temp
[
$role
->
name
][
'createdAt'
]
=
$role
->
createdAt
;
$roles_temp
[
$role
->
name
][
'updatedAt'
]
=
$role
->
updatedAt
;
}
$roles_temp
=
Tools
::
arraySort
(
$roles_temp
,
'createdAt'
);
return
$this
->
render
(
'index'
,
[
return
$this
->
render
(
'index'
,
[
'roles'
=>
$roles
,
'roles'
=>
$roles
_temp
,
]);
]);
}
}
...
...
backend/views/auth/index.php
View file @
463cdcb3
...
@@ -32,10 +32,10 @@ use yii\helpers\Url;
...
@@ -32,10 +32,10 @@ use yii\helpers\Url;
<tr
class=
"odd gradeX"
>
<tr
class=
"odd gradeX"
>
<?php
$nn
++
;
?>
<?php
$nn
++
;
?>
<td>
<?=
$nn
?>
</td>
<td>
<?=
$nn
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
$value
->
name
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
$value
[
'name'
]
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
$value
->
description
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
$value
[
'description'
]
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
date
(
'Y-m-d H:i'
,
$value
->
createdAt
)
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
date
(
'Y-m-d H:i'
,
$value
[
'createdAt'
]
)
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
date
(
'Y-m-d H:i'
,
$value
->
updatedAt
)
?>
</td>
<td
style =
'white-space: nowrap;'
>
<?=
date
(
'Y-m-d H:i'
,
$value
[
'updatedAt'
]
)
?>
</td>
<td
style =
'white-space: nowrap;'
>
<td
style =
'white-space: nowrap;'
>
<a
href=
"
<?=
Url
::
toRoute
([
'edit'
,
'role'
=>
$key
])
?>
"
class=
"btn btn-xs blue"
><i
class=
"fa fa-edit"
></i>
编辑
</a>
<a
href=
"
<?=
Url
::
toRoute
([
'edit'
,
'role'
=>
$key
])
?>
"
class=
"btn btn-xs blue"
><i
class=
"fa fa-edit"
></i>
编辑
</a>
<a
href=
"
<?=
Url
::
toRoute
([
'auth'
,
'role'
=>
$key
])
?>
"
class=
"btn btn-xs blue"
><i
class=
"icon-key"
></i>
授权
</a>
<a
href=
"
<?=
Url
::
toRoute
([
'auth'
,
'role'
=>
$key
])
?>
"
class=
"btn btn-xs blue"
><i
class=
"icon-key"
></i>
授权
</a>
...
...
common/business/ExchangeBusiness.php
View file @
463cdcb3
...
@@ -32,21 +32,18 @@ class ExchangeBusiness
...
@@ -32,21 +32,18 @@ class ExchangeBusiness
3
=>
'Bitfinex'
,
3
=>
'Bitfinex'
,
4
=>
'Bittrex'
,
4
=>
'Bittrex'
,
5
=>
'Zb'
,
5
=>
'Zb'
,
6
=>
'Token7'
,
6
=>
'Zg'
,
7
=>
'Zg'
,
7
=>
'Go'
,
8
=>
'Go'
,
8
=>
'Zhaobi'
,
9
=>
'Zhaobi'
,
9
=>
'Binance'
,
10
=>
'Ex'
,
10
=>
'Bilaxy'
,
11
=>
'Zt'
,
11
=>
'Bitnasdaq'
,
12
=>
'Tsc'
,
12
=>
'Isummit'
,
13
=>
'Binance'
,
13
=>
'Boc'
,
14
=>
'Bilaxy'
,
14
=>
'Jinwang'
,
15
=>
'Bitnasdaq'
,
15
=>
'Hd'
,
16
=>
'Dag'
,
16
=>
'Ztb'
,
17
=>
'Coinka'
,
17
=>
'Wbf'
18
=>
'Isummit'
,
19
=>
'Boc'
,
20
=>
'Jinwang'
//1 => 'Hadax', //不需要
//1 => 'Hadax', //不需要
//2 => 'Bitfinex', //不需要
//2 => 'Bitfinex', //不需要
...
@@ -58,6 +55,11 @@ class ExchangeBusiness
...
@@ -58,6 +55,11 @@ class ExchangeBusiness
//7 => 'Gdpro',//已挂
//7 => 'Gdpro',//已挂
//8 => 'Ceohk', //已挂
//8 => 'Ceohk', //已挂
//14 => 'Biki',//已挂
//14 => 'Biki',//已挂
//6 => 'Token7',//已挂
//10 => 'Ex',//已挂
//12 => 'Tsc',//已挂
//16 => 'Dag',//已挂
//17 => 'Coinka',//已挂
];
];
/**
/**
...
@@ -142,10 +144,10 @@ class ExchangeBusiness
...
@@ -142,10 +144,10 @@ class ExchangeBusiness
if
(
strtoupper
(
$tag
)
==
'POKE'
)
{
if
(
strtoupper
(
$tag
)
==
'POKE'
)
{
$quotation
=
[
$quotation
=
[
'low'
=>
0.16
0
1
,
'low'
=>
0.16
1
1
,
'high'
=>
0.16
0
1
,
'high'
=>
0.16
1
1
,
'last'
=>
0.16
0
1
,
'last'
=>
0.16
1
1
,
'rmb'
=>
0.16
0
1
,
'rmb'
=>
0.16
1
1
,
];
];
goto
doEnd
;
goto
doEnd
;
}
}
...
@@ -273,9 +275,9 @@ class ExchangeBusiness
...
@@ -273,9 +275,9 @@ class ExchangeBusiness
goto
doEnd
;
goto
doEnd
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'CIC'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'CIC'
,
'ZYC'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Zt"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Zt
b
"
);
$quotation
=
$exchange
->
getTicker
(
'CIC'
,
'USDT'
);
$quotation
=
$exchange
->
getTicker
(
strtoupper
(
$tag
)
,
'USDT'
);
goto
doEnd
;
goto
doEnd
;
}
}
...
@@ -339,6 +341,12 @@ class ExchangeBusiness
...
@@ -339,6 +341,12 @@ class ExchangeBusiness
goto
doEnd
;
goto
doEnd
;
}
}
if
(
in_array
(
strtoupper
(
$tag
),
[
'HDC'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Hd"
);
$quotation
=
$exchange
->
getTicker
(
'HD'
,
'USDT'
);
goto
doEnd
;
}
foreach
(
self
::
$exchanges
as
$exchange
)
{
foreach
(
self
::
$exchanges
as
$exchange
)
{
/**
/**
* @var $exchange \common\service\exchange\Exchange
* @var $exchange \common\service\exchange\Exchange
...
@@ -396,7 +404,7 @@ class ExchangeBusiness
...
@@ -396,7 +404,7 @@ class ExchangeBusiness
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$cny_usd_rate
=
1
/
$rate
[
'last'
];
$cny_usd_rate
=
1
/
$rate
[
'last'
];
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'
KPC8'
,
'BVA'
,
'DAG'
,
'BNC'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
,
'SUM'
,
'USDW'
,
'FUT'
,
'MBTC'
,
'METH'
,
'GLCW
'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'
ZYC'
,
'KPC8'
,
'BVA'
,
'DAG'
,
'BNC'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
,
'SUM'
,
'USDW'
,
'FUT'
,
'MBTC'
,
'METH'
,
'GLCW'
,
'HDC
'
]))
{
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
$quotation
[
'low'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]);
$quotation
[
'low'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]);
...
...
common/service/exchange/Hd.php
0 → 100644
View file @
463cdcb3
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-8-7
* Time: 上午11:30
*/
namespace
common\service\exchange
;
use
linslin\yii2\curl\Curl
;
class
Hd
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_hd'
;
protected
$quotation_prefix
=
'quotation_hd_'
;
protected
$base_url
=
'https://app.honordecent.com/exchange/getHdcCurrPrice'
;
public
function
symbolExists
(
$tag
=
'HD'
,
$aim
=
"USDT"
)
{
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
return
true
;
}
return
false
;
}
/**
* 转化交易对为请求变量
*
* @param string $tag
* @param string $aim
* @return mixed
*/
public
function
formatSymbol
(
$tag
=
'HD'
,
$aim
=
'USDT'
)
{
return
strtoupper
(
$tag
.
$aim
);
}
/**
* 保存支持的交易对到redis数据库,使用crontab定时更新
*
* @return mixed|void
*/
public
function
setSupportedSymbol
()
{
}
/**
* 更新交易对行情保存到redis,使用crontab定时更新
*
* @return mixed|void
*/
public
function
setQuotation
()
{
$curl
=
new
Curl
();
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$res
)
&&
1
==
$res
[
'code'
])
{
$key
=
$this
->
quotation_prefix
.
'HDUSDT'
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$res
[
'data'
],
'high'
,
$res
[
'data'
],
'last'
,
$res
[
'data'
]);
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
'HDUSDT'
))
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'HDUSDT'
);
}
}
}
}
\ No newline at end of file
common/service/exchange/Wbf.php
0 → 100644
View file @
463cdcb3
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-8-7
* Time: 上午11:30
*/
namespace
common\service\exchange
;
use
linslin\yii2\curl\Curl
;
class
Wbf
extends
Exchange
implements
ExchangeInterface
{
protected
$supported_symbol
=
'supported_symbol_wbf'
;
protected
$quotation_prefix
=
'quotation_wbf_'
;
protected
$base_url
=
'https://openapi.wbf.live/open/api/get_allticker'
;
public
function
symbolExists
(
$tag
=
'LELE'
,
$aim
=
"USDT"
)
{
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
return
true
;
}
return
false
;
}
/**
* 转化交易对为请求变量
*
* @param string $tag
* @param string $aim
* @return mixed
*/
public
function
formatSymbol
(
$tag
=
'LELE'
,
$aim
=
'USDT'
)
{
return
strtoupper
(
$tag
.
$aim
);
}
/**
* 保存支持的交易对到redis数据库,使用crontab定时更新
*
* @return mixed|void
*/
public
function
setSupportedSymbol
()
{
}
/**
* 更新交易对行情保存到redis,使用crontab定时更新
*
* @return mixed|void
*/
public
function
setQuotation
()
{
$curl
=
new
Curl
();
$res
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$res
)
&&
isset
(
$res
[
'data'
]))
{
$data
=
$res
[
'data'
][
'ticker'
];
foreach
(
$data
as
$item
)
{
$key
=
$this
->
quotation_prefix
.
strtoupper
(
$item
[
'symbol'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$item
[
'low'
],
'high'
,
$item
[
'high'
],
'last'
,
$item
[
'last'
],
'vol'
,
$item
[
'vol'
],
'change'
,
$item
[
'change'
]);
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
strtoupper
(
$item
[
'symbol'
]))){
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
strtoupper
(
$item
[
'symbol'
]));
}
}
}
}
}
\ No newline at end of file
common/service/exchange/Zt.php
→
common/service/exchange/Zt
b
.php
View file @
463cdcb3
...
@@ -10,14 +10,14 @@ namespace common\service\exchange;
...
@@ -10,14 +10,14 @@ namespace common\service\exchange;
use
linslin\yii2\curl\Curl
;
use
linslin\yii2\curl\Curl
;
class
Zt
extends
Exchange
implements
ExchangeInterface
class
Zt
b
extends
Exchange
implements
ExchangeInterface
{
{
protected
$supported_symbol
=
'supported_symbol_zt'
;
protected
$supported_symbol
=
'supported_symbol_zt
b
'
;
protected
$quotation_prefix
=
'quotation_zt_'
;
protected
$quotation_prefix
=
'quotation_zt
b
_'
;
protected
$base_url
=
'https://www.zt
.com/api/v1/tickers'
;
protected
$base_url
=
'https://www.ztb
.com/api/v1/tickers'
;
public
function
symbolExists
(
$tag
=
'
CI
C'
,
$aim
=
"USDT"
)
public
function
symbolExists
(
$tag
=
'
ZY
C'
,
$aim
=
"USDT"
)
{
{
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
...
@@ -25,6 +25,7 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -25,6 +25,7 @@ class Zt extends Exchange implements ExchangeInterface
}
}
return
false
;
return
false
;
}
}
/**
/**
* 转化交易对为请求变量
* 转化交易对为请求变量
*
*
...
@@ -32,9 +33,9 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -32,9 +33,9 @@ class Zt extends Exchange implements ExchangeInterface
* @param string $aim
* @param string $aim
* @return mixed
* @return mixed
*/
*/
public
function
formatSymbol
(
$tag
=
'
CI
C'
,
$aim
=
'USDT'
)
public
function
formatSymbol
(
$tag
=
'
ZY
C'
,
$aim
=
'USDT'
)
{
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
$aim
);
}
}
/**
/**
...
@@ -44,7 +45,7 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -44,7 +45,7 @@ class Zt extends Exchange implements ExchangeInterface
*/
*/
public
function
setSupportedSymbol
()
public
function
setSupportedSymbol
()
{
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'
CI
CUSDT'
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'
ZY
CUSDT'
);
}
}
/**
/**
...
@@ -55,15 +56,16 @@ class Zt extends Exchange implements ExchangeInterface
...
@@ -55,15 +56,16 @@ class Zt extends Exchange implements ExchangeInterface
public
function
setQuotation
()
public
function
setQuotation
()
{
{
$curl
=
new
Curl
();
$curl
=
new
Curl
();
$content
=
$curl
->
get
(
$this
->
base_url
,
false
);
$content
=
$curl
->
get
(
$this
->
base_url
,
true
);
$content
=
json_decode
(
$content
,
true
);
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
if
(
is_array
(
$content
)
&&
isset
(
$content
[
'ticker'
]))
{
$data
=
$content
[
'ticker'
];
$data
=
$content
[
'ticker'
];
foreach
(
$data
as
$item
)
{
foreach
(
$data
as
$item
)
{
if
(
in_array
(
$item
[
'symbol'
],
[
'
CI
C_USDT'
]))
{
if
(
in_array
(
$item
[
'symbol'
],
[
'
ZY
C_USDT'
]))
{
$data
=
$item
;
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
$item
[
'symbol'
]
;
$key
=
$this
->
quotation_prefix
.
str_replace
(
'_'
,
''
,
$item
[
'symbol'
])
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'low'
],
'high'
,
$data
[
'high'
],
'last'
,
$data
[
'last'
]
,
'vol'
,
$data
[
'vol'
],
'change'
,
$data
[
'change'
]
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'symbol'
]
);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
str_replace
(
'_'
,
''
,
$item
[
'symbol'
])
);
}
}
}
}
}
}
...
...
common/service/exchange/factory/HdBuilder.php
0 → 100644
View file @
463cdcb3
<?php
/**
* Created by PhpStorm.
* User: jiaming
* Date: 2019/8/15
* Time: 10:10
*/
namespace
common\service\exchange\factory
;
use
common\components\Tools
;
use
linslin\yii2\curl\Curl
;
class
HdBuilder
extends
FactoryService
{
protected
$base_url
=
'https://api.hd.pro'
;
protected
$supported_symbol
=
'supported_symbol_hd'
;
protected
$supported_symbol_list
=
'supported_symbol_hd_list'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_hd'
;
protected
$supported_symbol_close_desc
=
'supported_symbol_close_desc_hd'
;
protected
$supported_symbol_change_asc
=
'supported_symbol_change_asc_hd'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_hd'
;
protected
$quotation_prefix
=
'quotation_hd_'
;
public
function
getHotTicker
(
$symbol
=
[])
{
if
(
empty
(
$symbol
))
{
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
[]];
}
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$last
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
$val
),
'low'
,
'high'
,
'last'
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
'USDT'
;
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
(
0
==
$low
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$last
-
$low
)
/
$low
*
100
);
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'low_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
array_push
(
$ticker
,
$temp
);
}
if
(
count
(
$ticker
)
>
0
)
{
$this
->
code
=
0
;
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
common/service/exchange/factory/WbfBuilder.php
0 → 100644
View file @
463cdcb3
<?php
/**
* Created by PhpStorm.
* User: jiaming
* Date: 2019/8/15
* Time: 10:10
*/
namespace
common\service\exchange\factory
;
use
common\components\Tools
;
use
linslin\yii2\curl\Curl
;
class
WbfBuilder
extends
FactoryService
{
protected
$base_url
=
'https://api.wbf.pro'
;
protected
$supported_symbol
=
'supported_symbol_wbf'
;
protected
$supported_symbol_list
=
'supported_symbol_wbf_list'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_wbf'
;
protected
$supported_symbol_close_desc
=
'supported_symbol_close_desc_wbf'
;
protected
$supported_symbol_change_asc
=
'supported_symbol_change_asc_wbf'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_wbf'
;
protected
$quotation_prefix
=
'quotation_wbf_'
;
public
function
hotTickerUpdate
()
{
$curl
=
new
Curl
();
$symbols
=
[
'btcusdt'
,
'ethusdt'
,
'eosusdt'
];
foreach
(
$symbols
as
$symbol
)
{
$api
=
$this
->
base_url
.
'/market/detail?symbol='
.
$symbol
;
$res
=
$curl
->
get
(
$api
,
false
);
if
(
isset
(
$res
[
'status'
])
&&
'ok'
==
$res
[
'status'
])
{
$key
=
$this
->
quotation_prefix
.
$symbol
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$res
[
'tick'
][
'low'
],
'high'
,
$res
[
'tick'
][
'high'
],
'last'
,
$res
[
'tick'
][
'close'
],
'open'
,
$res
[
'tick'
][
'open'
],
'vol'
,
$res
[
'tick'
][
'vol'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$symbol
);
}
}
}
public
function
getTickerFromCache
(
$page
=
1
,
$condition
=
[])
{
$size
=
0
;
for
(
$i
=
0
;
$i
<
$page
;
$i
++
)
{
$size
+=
50
;
$this
->
end
=
$size
;
}
$this
->
start
=
$this
->
end
-
50
;
$this
->
end
=
$this
->
end
-
1
;
$keys
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
false
==
$this
->
redis
->
exists
(
$this
->
supported_symbol_list
))
{
foreach
(
$keys
as
$val
)
{
foreach
(
$this
->
basic_coin
as
$k
=>
$coin
)
{
$explode_arr
=
explode
(
strtolower
(
$coin
),
$val
);
if
(
2
==
count
(
$explode_arr
)
&&
empty
(
$explode_arr
[
1
]))
{
$this
->
redis
->
lpush
(
$this
->
supported_symbol_list
,
$val
);
}
}
}
}
if
(
false
!=
$condition
)
{
if
(
'price'
==
$condition
[
'data_value'
])
{
if
(
'price_asc'
==
$condition
[
'sort_value'
])
{
$keys
=
$this
->
redis_ticker
->
lrange
(
$this
->
supported_symbol_close_asc
,
$this
->
start
,
$this
->
end
);
}
if
(
'price_desc'
==
$condition
[
'sort_value'
])
{
$keys
=
$this
->
redis_ticker
->
lrange
(
$this
->
supported_symbol_close_desc
,
$this
->
start
,
$this
->
end
);
}
}
if
(
'change'
==
$condition
[
'data_value'
])
{
if
(
'change_asc'
==
$condition
[
'sort_value'
])
{
$keys
=
$this
->
redis_ticker
->
lrange
(
$this
->
supported_symbol_change_asc
,
$this
->
start
,
$this
->
end
);
}
if
(
'change_desc'
==
$condition
[
'sort_value'
])
{
$keys
=
$this
->
redis_ticker
->
lrange
(
$this
->
supported_symbol_change_desc
,
$this
->
start
,
$this
->
end
);
}
}
}
else
{
$keys
=
$this
->
redis
->
lrange
(
$this
->
supported_symbol_list
,
$this
->
start
,
$this
->
end
);
}
$ticker
=
[];
foreach
(
$keys
as
$val
)
{
foreach
(
$this
->
basic_coin
as
$k
=>
$coin
)
{
$explode_arr
=
explode
(
strtoupper
(
$coin
),
strtoupper
(
$val
));
if
(
2
==
count
(
$explode_arr
)
&&
empty
(
$explode_arr
[
1
]))
{
if
(
false
!=
$condition
)
{
list
(
$low
,
$high
,
$close
,
$open
,
$vol
)
=
$this
->
redis_ticker
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
$val
),
'low'
,
'high'
,
'last'
,
'open'
,
'vol'
);
}
else
{
list
(
$low
,
$high
,
$close
,
$open
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$val
),
'low'
,
'high'
,
'last'
,
'open'
,
'vol'
);
}
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/'
.
$coin
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
strtoupper
(
$coin
);
$temp
[
'close'
]
=
rtrim
(
sprintf
(
'%.8f'
,
floatval
(
$close
)),
'0'
);
$temp
[
'close_usd'
]
=
rtrim
(
sprintf
(
'%.6f'
,
floatval
(
$close
*
$this
->
basic_price
[
$coin
][
'usd'
])),
'0'
);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$temp
[
'change'
]
=
(
false
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$temp
[
'low_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$temp
[
'vol'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$vol
);
$temp
[
'optional'
]
=
false
;
$temp
[
'platform_zh'
]
=
'火币'
;
$temp
[
'platform_us'
]
=
'wbf'
;
array_push
(
$ticker
,
$temp
);
}
}
}
$this
->
code
=
0
;
$data
=
[
'ticker'
=>
$ticker
,
'page'
=>
[
'pageSize'
=>
50
,
'currentPage'
=>
(
int
)
$page
,
]
];
return
[
'code'
=>
$this
->
code
,
'data'
=>
$data
];
}
public
function
TickerSort
()
{
$len
=
$this
->
redis
->
llen
(
$this
->
supported_symbol_list
);
$ticker
=
[];
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
{
$symbol
=
$this
->
redis
->
lindex
(
$this
->
supported_symbol_list
,
$i
);
list
(
$close
,
$open
,
$low
,
$high
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$symbol
),
'last'
,
'open'
,
'low'
,
'high'
,
'vol'
);
if
(
'0.00000000'
==
$close
)
continue
;
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$symbol
);
$temp
[
'close'
]
=
$close
;
foreach
(
$this
->
basic_coin
as
$k
=>
$coin
)
{
$explode_arr
=
explode
(
strtoupper
(
$coin
),
strtoupper
(
$symbol
));
if
(
2
==
count
(
$explode_arr
)
&&
empty
(
$explode_arr
[
1
]))
{
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
}
}
$temp
[
'low'
]
=
$low
;
$temp
[
'high'
]
=
$high
;
$temp
[
'open'
]
=
$open
;
$temp
[
'vol'
]
=
$vol
;
$temp
[
'change'
]
=
(
0
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
array_push
(
$ticker
,
$temp
);
$key
=
$this
->
quotation_prefix
.
strtoupper
(
$symbol
);
$this
->
redis_ticker
->
hmset
(
$key
,
'low'
,
$low
,
'high'
,
$high
,
'last'
,
$close
,
'open'
,
$open
,
'vol'
,
$vol
);
}
$ticker_sort_close
=
Tools
::
arraySort
(
$ticker
,
'close_rmb'
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_close_desc
);
foreach
(
$ticker_sort_close
as
$val
)
{
$this
->
redis_ticker
->
lpush
(
$this
->
supported_symbol_close_asc
,
strtoupper
(
$val
[
'symbol'
]));
$this
->
redis_ticker
->
rpush
(
$this
->
supported_symbol_close_desc
,
strtoupper
(
$val
[
'symbol'
]));
}
$ticker_change_close
=
Tools
::
arraySort
(
$ticker
,
'change'
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_change_asc
);
$this
->
redis_ticker
->
del
(
$this
->
supported_symbol_change_desc
);
foreach
(
$ticker_change_close
as
$val
)
{
$this
->
redis_ticker
->
lpush
(
$this
->
supported_symbol_change_asc
,
strtoupper
(
$val
[
'symbol'
]));
$this
->
redis_ticker
->
rpush
(
$this
->
supported_symbol_change_desc
,
strtoupper
(
$val
[
'symbol'
]));
}
}
public
function
getHotTicker
(
$symbol
=
[])
{
if
(
empty
(
$symbol
))
{
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
[]];
}
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$close
,
$vol
,
$change
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
$val
),
'low'
,
'high'
,
'last'
,
'vol'
,
'change'
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
'USDT'
;
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$change
);
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'low_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'vol'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$vol
);
array_push
(
$ticker
,
$temp
);
}
if
(
count
(
$ticker
)
>
0
)
{
$this
->
code
=
0
;
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
common/service/exchange/factory/ZtbBuilder.php
0 → 100644
View file @
463cdcb3
<?php
/**
* Created by PhpStorm.
* User: jiaming
* Date: 2019/8/15
* Time: 10:10
*/
namespace
common\service\exchange\factory
;
use
common\components\Tools
;
use
linslin\yii2\curl\Curl
;
class
ZtbBuilder
extends
FactoryService
{
protected
$base_url
=
'https://api.ztb.pro'
;
protected
$supported_symbol
=
'supported_symbol_ztb'
;
protected
$supported_symbol_list
=
'supported_symbol_ztb_list'
;
protected
$supported_symbol_close_asc
=
'supported_symbol_close_asc_ztb'
;
protected
$supported_symbol_close_desc
=
'supported_symbol_close_desc_ztb'
;
protected
$supported_symbol_change_asc
=
'supported_symbol_change_asc_ztb'
;
protected
$supported_symbol_change_desc
=
'supported_symbol_change_desc_ztb'
;
protected
$quotation_prefix
=
'quotation_ztb_'
;
public
function
getHotTicker
(
$symbol
=
[])
{
if
(
empty
(
$symbol
))
{
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
[]];
}
$ticker
=
[];
foreach
(
$symbol
as
$val
)
{
list
(
$low
,
$high
,
$change
,
$last
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtoupper
(
str_replace
(
'USDT'
,
'_USDT'
,
$val
)),
'low'
,
'high'
,
'change'
,
'last'
,
'vol'
);
$explode_arr
=
explode
(
'usdt'
,
$val
);
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/USDT'
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
'USDT'
;
$temp
[
'close'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$last
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'change'
]
=
(
float
)
sprintf
(
"%0.2f"
,
$change
);;
$temp
[
'high_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'low_usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'usd'
]);
$temp
[
'high_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$high
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'low_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$low
*
$this
->
basic_price
[
'USDT'
][
'rmb'
]);
$temp
[
'vol'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$vol
);
array_push
(
$ticker
,
$temp
);
}
if
(
count
(
$ticker
)
>
0
)
{
$this
->
code
=
0
;
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
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