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
a9a0d0c0
Commit
a9a0d0c0
authored
Oct 21, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/ticker' into 'master'
修复已知问题 See merge request
!175
parents
7a1f0f85
06f5c702
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
4 deletions
+26
-4
CoinDogController.php
api/controllers/CoinDogController.php
+1
-0
BinanceBuilder.php
common/service/exchange/factory/BinanceBuilder.php
+13
-2
HuobiBuilder.php
common/service/exchange/factory/HuobiBuilder.php
+11
-2
ZhaobiBuilder.php
common/service/exchange/factory/ZhaobiBuilder.php
+1
-0
No files found.
api/controllers/CoinDogController.php
View file @
a9a0d0c0
...
@@ -56,6 +56,7 @@ class CoinDogController extends BaseController
...
@@ -56,6 +56,7 @@ class CoinDogController extends BaseController
$bishijie_service
=
new
BishijieService
(
$appid
,
$appSecret
);
$bishijie_service
=
new
BishijieService
(
$appid
,
$appSecret
);
$article
=
$bishijie_service
->
getArticleDetail
(
$id
);
$article
=
$bishijie_service
->
getArticleDetail
(
$id
);
$article
[
'share_url'
]
=
$bishijie
[
'Url'
]
.
'/shendu_'
.
$id
;
$article
[
'share_url'
]
=
$bishijie
[
'Url'
]
.
'/shendu_'
.
$id
;
$article
[
'source'
]
=
'币世界'
;
if
(
@
$article
[
'code'
])
{
if
(
@
$article
[
'code'
])
{
$msg
=
$article
[
'message'
];
$msg
=
$article
[
'message'
];
$code
=
-
1
;
$code
=
-
1
;
...
...
common/service/exchange/factory/BinanceBuilder.php
View file @
a9a0d0c0
...
@@ -85,10 +85,10 @@ class BinanceBuilder extends FactoryService
...
@@ -85,10 +85,10 @@ class BinanceBuilder extends FactoryService
list
(
$low
,
$high
,
$close
,
$open
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$val
),
'low'
,
'high'
,
'last'
,
'open'
,
'vol'
);
list
(
$low
,
$high
,
$close
,
$open
,
$vol
)
=
$this
->
redis
->
hmget
(
$this
->
quotation_prefix
.
strtolower
(
$val
),
'low'
,
'high'
,
'last'
,
'open'
,
'vol'
);
$temp
=
[];
$temp
=
[];
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/'
.
$coin
;
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/'
.
$coin
;
#if ('BCC/USDT' != $temp['symbol']) continue;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
strtoupper
(
$coin
);
$temp
[
'base_currency'
]
=
strtoupper
(
$coin
);
$temp
[
'close'
]
=
number_format
(
$close
,
6
,
'.'
,
''
);
$temp
[
'close'
]
=
$this
->
sctonum
(
$close
,
8
);
if
(
'0.000000'
==
$temp
[
'close'
])
continue
;
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$temp
[
'change'
]
=
(
0
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
$temp
[
'change'
]
=
(
0
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
...
@@ -147,4 +147,14 @@ class BinanceBuilder extends FactoryService
...
@@ -147,4 +147,14 @@ class BinanceBuilder extends FactoryService
array_multisort
(
$keysValue
,
$sort
,
$array
);
array_multisort
(
$keysValue
,
$sort
,
$array
);
return
$array
;
return
$array
;
}
}
protected
function
sctonum
(
$num
,
$double
=
5
)
{
if
(
false
!==
strpos
(
$num
,
"e"
))
{
$a
=
explode
(
"e"
,
strtolower
(
$num
));
return
bcmul
(
$a
[
0
],
bcpow
(
10
,
$a
[
1
],
$double
),
$double
);
}
else
{
return
number_format
(
$num
,
6
,
'.'
,
''
);
}
}
}
}
\ No newline at end of file
common/service/exchange/factory/HuobiBuilder.php
View file @
a9a0d0c0
...
@@ -70,8 +70,7 @@ class HuobiBuilder extends FactoryService
...
@@ -70,8 +70,7 @@ class HuobiBuilder extends FactoryService
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/'
.
$coin
;
$temp
[
'symbol'
]
=
strtoupper
(
$explode_arr
[
0
])
.
'/'
.
$coin
;
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'currency'
]
=
strtoupper
(
$explode_arr
[
0
]);
$temp
[
'base_currency'
]
=
strtoupper
(
$coin
);
$temp
[
'base_currency'
]
=
strtoupper
(
$coin
);
$temp
[
'close'
]
=
number_format
(
$close
,
6
,
'.'
,
''
);
$temp
[
'close'
]
=
$this
->
sctonum
(
$close
,
8
);
if
(
'0.000000'
==
$temp
[
'close'
])
continue
;
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'close_usd'
]
=
(
float
)
sprintf
(
"%0.6f"
,
$close
*
$this
->
basic_price
[
$coin
][
'usd'
]);
$temp
[
'close_rmb'
]
=
(
float
)
sprintf
(
"%0.4f"
,
$close
*
$this
->
basic_price
[
$coin
][
'rmb'
]);
$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
[
'change'
]
=
(
false
==
$open
)
?
0
:
(
float
)
sprintf
(
"%0.2f"
,
(
$close
-
$open
)
/
$open
*
100
);
...
@@ -162,4 +161,14 @@ class HuobiBuilder extends FactoryService
...
@@ -162,4 +161,14 @@ class HuobiBuilder extends FactoryService
}
}
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
return
[
'code'
=>
$this
->
code
,
'ticker'
=>
$ticker
];
}
}
protected
function
sctonum
(
$num
,
$double
=
5
)
{
if
(
false
!==
stripos
(
$num
,
"e"
))
{
$a
=
explode
(
"e"
,
strtolower
(
$num
));
return
bcmul
(
$a
[
0
],
bcpow
(
10
,
$a
[
1
],
$double
),
$double
);
}
else
{
return
number_format
(
$num
,
6
,
'.'
,
''
);
}
}
}
}
common/service/exchange/factory/ZhaobiBuilder.php
View file @
a9a0d0c0
...
@@ -106,6 +106,7 @@ class ZhaobiBuilder extends FactoryService
...
@@ -106,6 +106,7 @@ class ZhaobiBuilder extends FactoryService
$this
->
code
=
0
;
$this
->
code
=
0
;
$res
[
'data'
][
'abstract'
]
=
str_replace
(
' '
,
''
,
str_replace
(
' '
,
''
,
$res
[
'data'
][
'abstract'
]));
$res
[
'data'
][
'abstract'
]
=
str_replace
(
' '
,
''
,
str_replace
(
' '
,
''
,
$res
[
'data'
][
'abstract'
]));
$res
[
'data'
][
'content'
]
=
str_replace
(
' '
,
''
,
str_replace
(
' '
,
''
,
$res
[
'data'
][
'content'
]));
$res
[
'data'
][
'content'
]
=
str_replace
(
' '
,
''
,
str_replace
(
' '
,
''
,
$res
[
'data'
][
'content'
]));
$res
[
'data'
][
'source'
]
=
'找币'
;
$res
[
'data'
][
'share_url'
]
=
\Yii
::
$app
->
params
[
'service'
][
'ZhaobiService'
][
'url'
]
.
'/help/notice/'
.
$params
[
'id'
];
$res
[
'data'
][
'share_url'
]
=
\Yii
::
$app
->
params
[
'service'
][
'ZhaobiService'
][
'url'
]
.
'/help/notice/'
.
$params
[
'id'
];
return
[
'code'
=>
$this
->
code
,
'notice'
=>
$res
[
'data'
]];
return
[
'code'
=>
$this
->
code
,
'notice'
=>
$res
[
'data'
]];
}
else
{
}
else
{
...
...
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