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
cbd6f4d0
Commit
cbd6f4d0
authored
Jul 19, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f4c21ec8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
27 deletions
+39
-27
CoinController.php
api/controllers/CoinController.php
+39
-26
CoinPlatformWithHold.php
common/models/psources/CoinPlatformWithHold.php
+0
-1
No files found.
api/controllers/CoinController.php
View file @
cbd6f4d0
...
...
@@ -139,7 +139,7 @@ class CoinController extends BaseController
$coin_ids
=
array_column
(
$coin_recommends
,
'cid'
);
//获取币种信息
$coin_infos
=
Coin
::
getCoinInfoByIds
(
$coin_ids
,
$select
,
'id'
);
foreach
(
$coin_infos
as
$key
=>
&
$val
){
foreach
(
$coin_infos
as
$key
=>
&
$val
)
{
$nickname
=
json_decode
(
$val
[
'nickname'
],
true
);
$val
[
'nickname'
]
=
$nickname
[
$this
->
lang
];
}
...
...
@@ -179,7 +179,7 @@ class CoinController extends BaseController
unset
(
$key
,
$value
);
}
}
if
(
!
$datas
[
'data'
])
{
if
(
!
$datas
[
'data'
])
{
$datas
[
'data'
]
=
null
;
}
return
$datas
;
...
...
@@ -198,8 +198,8 @@ class CoinController extends BaseController
$coin
=
Coin
::
findOne
([
'name'
=>
$names
]);
if
(
$coin
)
{
$chain
=
$coin
->
chain
;
$miner_fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$chain
,
'type'
=>
1
])
->
one
();
if
(
!
$miner_fee
)
{
$miner_fee
=
MinerFee
::
find
()
->
where
([
'platform'
=>
$chain
,
'type'
=>
1
])
->
one
();
if
(
!
$miner_fee
)
{
throw
new
Exception
(
'8'
,
'旷工费未设置'
);
}
}
else
{
...
...
@@ -207,8 +207,8 @@ class CoinController extends BaseController
throw
new
Exception
(
'8'
,
'币种不存在'
);
}
$result
=
(
array
)
$miner_fee
->
getAttributes
();
$result
[
'min'
]
=
number_format
(
$result
[
'min'
],
6
);
$result
[
'max'
]
=
number_format
(
$result
[
'max'
],
6
);
$result
[
'min'
]
=
number_format
(
$result
[
'min'
],
6
);
$result
[
'max'
]
=
number_format
(
$result
[
'max'
],
6
);
return
$result
;
}
...
...
@@ -220,20 +220,20 @@ class CoinController extends BaseController
$names
=
Yii
::
$app
->
request
->
post
(
'names'
);
$platforms
=
[];
$newNames
=
[];
if
(
!
$names
)
{
return
[
'code'
=>
0
,
'data'
=>
[]];
if
(
!
$names
)
{
return
[
'code'
=>
0
,
'data'
=>
[]];
}
foreach
(
$names
as
$item
)
{
$item_array
=
explode
(
','
,
$item
);
foreach
(
$names
as
$item
)
{
$item_array
=
explode
(
','
,
$item
);
$newNames
[]
=
$item_array
[
0
];
if
(
isset
(
$item_array
[
1
]))
{
if
(
!
in_array
(
$item_array
[
1
],
$platforms
))
{
if
(
isset
(
$item_array
[
1
]))
{
if
(
!
in_array
(
$item_array
[
1
],
$platforms
))
{
$platforms
[]
=
$item_array
[
1
];
}
}
}
$condition
=
[[
'in'
,
'name'
,
$newNames
]];
if
(
$platforms
)
{
if
(
$platforms
)
{
$condition
[]
=
[
'in'
,
'platform'
,
$platforms
];
}
$result
=
ExchangeBusiness
::
getApiListForIndex
(
1
,
999
,
$condition
);
...
...
@@ -267,9 +267,9 @@ class CoinController extends BaseController
$limit
=
$request
->
post
(
'limit'
,
10
);
$platform_ids
=
$request
->
post
(
'platform_id'
,
null
);
$condition
=
[[
'in'
,
'chain'
,
[
'ETH'
,
'DCR'
,
'BTC'
,
'BTY'
]]];
$condition
=
[[
'in'
,
'chain'
,
[
'ETH'
,
'DCR'
,
'BTC'
,
'BTY'
]]];
if
(
!
empty
(
$name
))
{
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
}
if
(
$platform_ids
)
{
/* $platform_id_arr = explode(',', $platform_ids);
...
...
@@ -330,11 +330,11 @@ class CoinController extends BaseController
{
$request
=
Yii
::
$app
->
request
;
$platform
=
$request
->
post
(
'platform'
,
''
);
if
(
$platform
)
{
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
$platform
);
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
if
(
$platform
)
{
$brower_url
=
Yii
::
$app
->
redis
->
hget
(
'platform_brower_info'
,
$platform
);
return
[
'code'
=>
0
,
'data'
=>
$brower_url
];
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数不能为空'
];
}
}
...
...
@@ -345,13 +345,26 @@ class CoinController extends BaseController
{
$request
=
Yii
::
$app
->
request
;
$platform
=
$request
->
get
(
'platform'
,
''
);
if
(
$platform
){
$coin_name
=
$request
->
get
(
'coinname'
,
''
);
if
(
$platform
&&
$coin_name
)
{
$platform_with_hold
=
CoinPlatformWithHold
::
getRecord
(
$platform
);
if
(
$platform_with_hold
){
$coin_info
=
Coin
::
find
()
->
select
(
'treaty'
)
->
where
([
'name'
=>
strtoupper
(
$coin_name
)])
->
asArray
()
->
one
();
if
(
$platform_with_hold
)
{
$des
=
Yii
::
$app
->
des
;
$platform_with_hold
[
'private_key'
]
=
$des
->
encrypt
(
$platform_with_hold
[
'private_key'
]);
return
[
'code'
=>
0
,
'data'
=>
$platform_with_hold
];
}
else
{
if
(
1
==
$coin_info
[
'treaty'
]){
$platform_with_hold
[
'exer'
]
=
'user.p.'
.
$platform
.
'.token'
;
$platform_with_hold
[
'tokensymbol'
]
=
$platform
;
$platform_with_hold
[
'fee'
]
=
0
;
}
else
{
$platform_with_hold
[
'exer'
]
=
'user.p.'
.
$platform
.
'.coins'
;
$platform_with_hold
[
'tokensymbol'
]
=
$platform
.
'.coins'
;
$platform_with_hold
[
'fee'
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
$platform_with_hold
[
'fee'
]);
}
$platform_with_hold
[
'bty_fee'
]
=
(
float
)
sprintf
(
"%0.4f"
,
(
double
)
Yii
::
$app
->
params
[
'bty_fee'
]);;
return
[
'code'
=>
0
,
'data'
=>
$platform_with_hold
];
}
else
{
$data
=
[
'id'
=>
0
,
'platform'
=>
''
,
...
...
@@ -361,8 +374,8 @@ class CoinController extends BaseController
];
return
[
'code'
=>
0
,
'data'
=>
$data
];
}
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数
不能为空'
];
}
else
{
return
[
'code'
=>
1
,
'data'
=>
[],
'msg'
=>
'平台参数或币种名称
不能为空'
];
}
}
}
common/models/psources/CoinPlatformWithHold.php
View file @
cbd6f4d0
...
...
@@ -6,7 +6,6 @@
* Time: 17:37
*/
namespace
common\models\psources
;
use
Yii
;
class
CoinPlatformWithHold
extends
BaseActiveRecord
{
...
...
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