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
da14a141
Commit
da14a141
authored
Feb 14, 2020
by
shajiaming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/issue_coin' into develop
parents
87d9f33f
7afe6dbf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
14 deletions
+12
-14
WalletChainController.php
api/controllers/WalletChainController.php
+1
-1
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+3
-4
Tsc.php
common/service/exchange/Tsc.php
+8
-9
No files found.
api/controllers/WalletChainController.php
View file @
da14a141
...
...
@@ -152,7 +152,7 @@ class WalletChainController extends BaseController
}
$model
=
WalletChain
::
find
()
->
select
(
'platform, token, address, private_key, fee, host, port, hash, status'
)
->
where
([
'id'
=>
(
int
)
$id
])
->
asArray
()
->
one
();
$model
=
WalletChain
::
find
()
->
select
(
'platform, token, address, private_key, fee, host, port, hash, status
, create_time
'
)
->
where
([
'id'
=>
(
int
)
$id
])
->
asArray
()
->
one
();
if
(
empty
(
$model
))
{
goto
doEnd
;
}
...
...
common/business/ExchangeBusiness.php
View file @
da14a141
...
...
@@ -230,8 +230,7 @@ class ExchangeBusiness
if
(
in_array
(
strtoupper
(
$tag
),
[
'TSC'
]))
{
$exchange
=
ExchangeFactory
::
createExchange
(
"Tsc"
);
$quotation
=
$exchange
->
getTicker
(
'TSC'
,
'CNDT'
);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
=
$exchange
->
getTicker
(
'TSC'
,
'USDT'
);
goto
doEnd
;
}
...
...
@@ -267,7 +266,7 @@ class ExchangeBusiness
'low'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'low'
]
/
100
),
'high'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'high'
]
/
100
),
'last'
=>
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
100
),
'rmb'
=>
(
float
)
sprintf
(
"%0.
2
f"
,
$quotation
[
'last'
]
/
100
),
'rmb'
=>
(
float
)
sprintf
(
"%0.
4
f"
,
$quotation
[
'last'
]
/
100
),
];
goto
doEnd
;
}
...
...
@@ -329,7 +328,7 @@ class ExchangeBusiness
$exchange
=
ExchangeFactory
::
createExchange
(
"Go"
);
$rate
=
$exchange
->
getTicker
(
"CNY"
,
"USD"
);
$cny_usd_rate
=
1
/
$rate
[
'last'
];
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'KPC8'
,
'BVA'
,
'DAG'
,
'BNC'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
]))
{
if
(
in_array
(
strtoupper
(
$tag
),
[
'FOLI'
,
'CIC'
,
'KPC8'
,
'BVA'
,
'DAG'
,
'BNC'
,
'GHP'
,
'DRA'
,
'ETC'
,
'PAX'
,
'STH'
,
'XJH'
,
'SFT'
,
'TSC'
]))
{
$quotation
[
'usd'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]);
$quotation
[
'rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$quotation
[
'last'
]
/
$cny_usd_rate
);
}
else
if
(
in_array
(
strtoupper
(
$tag
),
[
'SUSD'
]))
{
...
...
common/service/exchange/Tsc.php
View file @
da14a141
...
...
@@ -16,7 +16,7 @@ class Tsc extends Exchange implements ExchangeInterface
protected
$quotation_prefix
=
'quotation_tsc_'
;
protected
$base_url
=
'https://api.tsc100.vip/openapi/quote/v1/ticker/24hr'
;
public
function
symbolExists
(
$tag
=
'TSC'
,
$aim
=
"
CN
DT"
)
public
function
symbolExists
(
$tag
=
'TSC'
,
$aim
=
"
US
DT"
)
{
$supported
=
$this
->
redis
->
smembers
(
$this
->
supported_symbol
);
if
(
is_array
(
$supported
)
&&
in_array
(
$this
->
formatSymbol
(
$tag
,
$aim
),
$supported
))
{
...
...
@@ -31,9 +31,9 @@ class Tsc extends Exchange implements ExchangeInterface
* @param string $aim
* @return mixed
*/
public
function
formatSymbol
(
$tag
=
'TSC'
,
$aim
=
'
CN
DT'
)
public
function
formatSymbol
(
$tag
=
'TSC'
,
$aim
=
'
US
DT'
)
{
return
strtoupper
(
$tag
.
'_'
.
$aim
);
return
strtoupper
(
$tag
.
$aim
);
}
/**
...
...
@@ -43,7 +43,7 @@ class Tsc extends Exchange implements ExchangeInterface
*/
public
function
setSupportedSymbol
()
{
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
'TSC_CNDT'
);
}
/**
...
...
@@ -57,11 +57,10 @@ class Tsc extends Exchange implements ExchangeInterface
$content
=
$curl
->
get
(
$this
->
base_url
,
false
);
if
(
is_array
(
$content
))
{
foreach
(
$content
as
$item
)
{
if
(
in_array
(
$item
[
'symbol'
],
[
'TSCCNDT'
]))
{
$data
=
$item
;
$key
=
$this
->
quotation_prefix
.
'TSC_CNDT'
;
$this
->
redis
->
hmset
(
$key
,
'low'
,
$data
[
'lowPrice'
],
'high'
,
$data
[
'highPrice'
],
'last'
,
$data
[
'lastPrice'
]);
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
$item
[
'symbol'
]);
$key
=
$this
->
quotation_prefix
.
strtoupper
(
$item
[
'symbol'
]);
$this
->
redis
->
hmset
(
$key
,
'low'
,
$item
[
'lowPrice'
],
'high'
,
$item
[
'highPrice'
],
'last'
,
$item
[
'lastPrice'
]);
if
(
!
$this
->
redis
->
sismember
(
$this
->
supported_symbol
,
strtoupper
(
$item
[
'symbol'
]))){
$this
->
redis
->
sadd
(
$this
->
supported_symbol
,
strtoupper
(
$item
[
'symbol'
]));
}
}
}
...
...
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