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
d40b4c89
Commit
d40b4c89
authored
Dec 23, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into feature/optimize
parents
75649d9a
b5b6252a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
3 deletions
+95
-3
SupportedChainController.php
api/controllers/SupportedChainController.php
+41
-0
CoinSupportedChain.php
common/models/psources/CoinSupportedChain.php
+51
-0
FactoryService.php
common/service/exchange/factory/FactoryService.php
+1
-1
ZhaobiBuilder.php
common/service/exchange/factory/ZhaobiBuilder.php
+2
-2
No files found.
api/controllers/SupportedChainController.php
0 → 100644
View file @
d40b4c89
<?php
namespace
api\controllers
;
use
Yii
;
use
api\base\BaseController
;
use
common\models\psources\CoinSupportedChain
;
class
SupportedChainController
extends
BaseController
{
public
function
actionIndex
()
{
$header
=
Yii
::
$app
->
request
->
headers
;
$platform_id
=
$header
[
'FZM-PLATFORM-ID'
]
??
null
;
$data
=
null
;
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
goto
doEnd
;
}
$supported_chain_model
=
CoinSupportedChain
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
if
(
false
==
$supported_chain_model
)
{
$msg
=
'success'
;
$code
=
0
;
goto
doEnd
;
}
$data
=
[];
foreach
(
$supported_chain_model
as
$key
=>
&
$val
)
{
$data
[]
=
!
empty
(
$val
->
coin
)
?
$val
->
coin
:
''
;
}
$msg
=
'success'
;
$code
=
0
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
common/models/psources/CoinSupportedChain.php
0 → 100644
View file @
d40b4c89
<?php
namespace
common\models\psources
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
CoinSupportedChain
extends
BaseActiveRecord
{
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_supported_chain}}'
;
}
public
function
rules
()
{
return
[
[[
'coin_id'
,
'platform_id'
],
'required'
],
[[
'coin_id'
,
'platform_id'
],
'integer'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'coin_id'
,
'platform_id'
],
self
::
SCENARIOS_UPDATE
=>
[
'id'
,
'coin_id'
,
'platform_id'
]
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
attributes
()
{
return
array_merge
(
parent
::
attributes
(),
[
'coins'
]);
}
public
function
getCoin
()
{
return
$this
->
hasOne
(
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
->
select
(
'name as chain'
);
}
}
common/service/exchange/factory/FactoryService.php
View file @
d40b4c89
...
...
@@ -13,7 +13,7 @@ use linslin\yii2\curl\Curl;
abstract
class
FactoryService
{
protected
$code
=
-
1
;
protected
$basic_coin
=
[
'ETH'
,
'BTC'
,
'USDT'
,
'BTY'
,
'CNYT'
,
'CCNY'
];
protected
$basic_coin
=
[
'ETH'
,
'BTC'
,
'USDT'
,
'BTY'
,
'CNYT'
];
protected
$basic_price
=
[];
protected
$redis
;
...
...
common/service/exchange/factory/ZhaobiBuilder.php
View file @
d40b4c89
...
...
@@ -196,7 +196,7 @@ class ZhaobiBuilder extends FactoryService
}
}
if
(
$this
->
basic_coin
[
5
]
==
$base_currency
)
{
//基础货币为CCNY
if
(
'CCNY'
==
$base_currency
)
{
//基础货币为CCNY
$symbol_currency
=
$currency
.
$this
->
basic_coin
[
2
];
$symbol_base_currency
=
$this
->
basic_coin
[
2
]
.
$base_currency
;
list
(
$low_currency
,
$high_currency
,
$close_currency
,
$open_currency
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$symbol_currency
),
'low'
,
'high'
,
'last'
,
'open'
);
...
...
@@ -222,7 +222,7 @@ class ZhaobiBuilder extends FactoryService
goto
doEnd
;
}
if
(
$this
->
basic_coin
[
5
]
==
$currency
)
{
//交易货币为CCNY
if
(
'CCNY'
==
$currency
)
{
//交易货币为CCNY
$symbol_currency
=
$base_currency
.
$this
->
basic_coin
[
2
];
$symbol_base_currency
=
$this
->
basic_coin
[
2
]
.
$currency
;
if
(
$currency
.
$base_currency
==
'CCNYUSDT'
)
{
...
...
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