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
8ecb71ac
Commit
8ecb71ac
authored
Aug 31, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/airdrop' into develop
parents
4c24e425
6f23d0d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
24 deletions
+61
-24
PlatformCoinsController.php
api/controllers/PlatformCoinsController.php
+40
-15
TradeController.php
api/controllers/TradeController.php
+2
-2
ExchangeBusiness.php
common/business/ExchangeBusiness.php
+4
-4
AirDropController.php
console/controllers/AirDropController.php
+15
-3
No files found.
api/controllers/PlatformCoinsController.php
View file @
8ecb71ac
...
...
@@ -3,6 +3,7 @@
namespace
api\controllers
;
use
api\base\BaseController
;
use
common\models\psources\CoinAirDropTransfer
;
use
common\models\psources\CoinPlatformCoins
;
use
Yii
;
...
...
@@ -25,32 +26,42 @@ class PlatformCoinsController extends BaseController
$header
=
Yii
::
$app
->
request
->
headers
;
$deviceCode
=
$header
[
'FZM-REQUEST-UUID'
]
??
null
;
if
(
empty
(
$platform_id
)
||
empty
(
$coins_address
)
||
empty
(
$type
))
{
return
[
'code'
=>
-
1
,
'data'
=>
null
,
'msg'
=>
'缺少必要的参数'
];
if
(
empty
(
$platform_id
)
||
empty
(
$coins_address
)
||
empty
(
$type
))
{
return
[
'code'
=>
-
1
,
'data'
=>
null
,
'msg'
=>
'缺少必要的参数'
];
}
if
(
empty
(
$deviceCode
)){
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
if
(
empty
(
$deviceCode
))
{
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
}
$is_exist
=
true
;
if
(
41
==
$platform_id
)
{
$model
=
CoinPlatformCoins
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'deviceCode'
=>
$deviceCode
])
->
one
();
if
(
!
$model
)
{
$is_exist
=
false
;
}
}
$item_array
=
[];
foreach
(
$coins_address
as
$item
){
$to_address
=
''
;
foreach
(
$coins_address
as
$item
)
{
$platform_coins_arr
=
explode
(
','
,
$item
);
$coin_name
=
$platform_coins_arr
[
0
];
$coins_address
=
$platform_coins_arr
[
1
];
if
(
empty
(
$coin_name
)
||
empty
(
$coins_address
))
continue
;
$to_address
=
$coins_address
;
if
(
empty
(
$coin_name
)
||
empty
(
$coins_address
))
continue
;
$isExistModel
=
CoinPlatformCoins
::
find
()
->
where
([
'coins_name'
=>
$coin_name
,
'coins_address'
=>
$coins_address
,
'platform_id'
=>
$platform_id
])
->
one
();
if
(
!
empty
(
$isExistModel
)
&&
empty
(
$isExistModel
->
deviceCode
))
{
if
(
!
empty
(
$isExistModel
)
&&
empty
(
$isExistModel
->
deviceCode
))
{
$isExistModel
->
deviceCode
=
$deviceCode
;
$isExistModel
->
save
();
continue
;
}
if
(
!
empty
(
$isExistModel
)
&&
strlen
(
$isExistModel
->
deviceCode
)
>
0
&&
$isExistModel
->
deviceCode
!==
$deviceCode
)
{
if
(
!
empty
(
$isExistModel
)
&&
strlen
(
$isExistModel
->
deviceCode
)
>
0
&&
$isExistModel
->
deviceCode
!==
$deviceCode
)
{
$isExistModel
->
deviceCode
=
$deviceCode
;
$isExistModel
->
save
();
continue
;
};
if
(
!
empty
(
$isExistModel
)
&&
$isExistModel
->
deviceCode
==
$deviceCode
)
{
if
(
!
empty
(
$isExistModel
)
&&
$isExistModel
->
deviceCode
==
$deviceCode
)
{
continue
;
};
$item_array
[]
=
[
...
...
@@ -59,17 +70,30 @@ class PlatformCoinsController extends BaseController
$type
,
$deviceCode
,
$platform_id
,
]
;
];
}
if
(
empty
(
$item_array
))
{
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
if
(
empty
(
$item_array
))
{
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
}
$result
=
CoinPlatformCoins
::
batchImport
(
$item_array
);
if
(
!
$result
)
{
return
[
'code'
=>
-
1
,
'data'
=>
null
,
'msg'
=>
'数据导入失败'
];
if
(
!
$result
)
{
return
[
'code'
=>
-
1
,
'data'
=>
null
,
'msg'
=>
'数据导入失败'
];
}
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
if
(
41
==
$platform_id
&&
false
==
$is_exist
)
{
$model
=
new
CoinAirDropTransfer
();
$model
->
txhash
=
'0'
;
$model
->
msg
=
''
;
$model
->
to_address
=
$to_address
;
$model
->
coin_name
=
'EPC'
;
$model
->
amount
=
0.001
;
$model
->
origin
=
CoinAirDropTransfer
::
ORIGIN_API
;
$model
->
type
=
CoinAirDropTransfer
::
TYPE_COINS
;
$model
->
save
();
}
return
[
'code'
=>
0
,
'data'
=>
null
,
'msg'
=>
'数据导入成功'
];
}
}
\ No newline at end of file
api/controllers/TradeController.php
View file @
8ecb71ac
...
...
@@ -69,14 +69,14 @@ class TradeController extends BaseController
if
(
empty
(
$model
))
{
return
[
'code'
=>
1
,
'data'
=>
''
,
'msg'
=>
'记录不存在'
];
}
return
[
'code'
=>
0
,
'data'
=>
$model
[
'memo'
]
];
return
[
'code'
=>
0
,
'data'
=>
(
string
)
sprintf
(
"%0.4f"
,
$model
[
'memo'
])
];
}
else
{
if
(
empty
(
$model
))
{
return
[
'code'
=>
0
,
'data'
=>
[
'memo'
=>
''
,
'coins_fee'
=>
''
],
'msg'
=>
'记录不存在'
];
}
return
[
'code'
=>
0
,
'data'
=>
[
'memo'
=>
$model
[
'memo'
],
'coins_fee'
=>
$model
[
'coins_fee'
]
'coins_fee'
=>
(
string
)
sprintf
(
"%0.4f"
,
$model
[
'coins_fee'
])
]];
}
}
...
...
common/business/ExchangeBusiness.php
View file @
8ecb71ac
...
...
@@ -138,10 +138,10 @@ class ExchangeBusiness
if
(
strtoupper
(
$tag
)
==
'POKE'
)
{
$quotation
=
[
'low'
=>
0.15
87
,
'high'
=>
0.15
87
,
'last'
=>
0.15
87
,
'rmb'
=>
0.15
87
,
'low'
=>
0.15
91
,
'high'
=>
0.15
91
,
'last'
=>
0.15
91
,
'rmb'
=>
0.15
91
,
];
goto
doEnd
;
}
...
...
console/controllers/AirDropController.php
View file @
8ecb71ac
...
...
@@ -269,13 +269,13 @@ class AirDropController extends Controller
$amount
=
$val
[
'amount'
]
*
1e8
;
$fee
=
100000
;
$note
=
''
;
if
(
CoinAirDropTransfer
::
TYPE_COINS
==
$val
[
'type'
])
{
if
(
CoinAirDropTransfer
::
TYPE_COINS
==
$val
[
'type'
]
&&
CoinAirDropTransfer
::
ORIGIN_IMPORT
==
$val
[
'origin'
]
)
{
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'primary'
];
$service
=
new
Chain33Service
(
$node_params
);
$execer
=
'coins'
;
$createRawTransaction
=
$service
->
createRawTransaction
(
$to
,
$amount
,
$fee
,
$note
,
$execer
);
}
if
(
CoinAirDropTransfer
::
TYPE_TOKEN
==
$val
[
'type'
])
{
if
(
CoinAirDropTransfer
::
TYPE_TOKEN
==
$val
[
'type'
]
&&
CoinAirDropTransfer
::
ORIGIN_IMPORT
==
$val
[
'origin'
]
)
{
$node_params
=
Yii
::
$app
->
params
[
'chain_parallel'
][
'parallel'
];
$service
=
new
Chain33Service
(
$node_params
);
$execer
=
'user.p.mall.token'
;
...
...
@@ -283,8 +283,20 @@ class AirDropController extends Controller
$tokenSymbol
=
$val
[
'coin_name'
];
$createRawTransaction
=
$service
->
createTokenRawTransaction
(
$to
,
$amount
,
$isToken
,
$tokenSymbol
,
$fee
,
$note
,
$execer
);
}
if
(
CoinAirDropTransfer
::
TYPE_COINS
==
$val
[
'type'
]
&&
CoinAirDropTransfer
::
ORIGIN_API
==
$val
[
'origin'
])
{
$node_params
=
[
'scheme'
=>
'http'
,
'host'
=>
'161.117.40.62'
,
'port'
=>
8901
];
$service
=
new
Chain33Service
(
$node_params
);
$execer
=
'user.p.ecopoolchain.coins'
;
$isToken
=
false
;
$tokenSymbol
=
$val
[
'coin_name'
];
$createRawTransaction
=
$service
->
createTokenRawTransaction
(
$to
,
$amount
,
$isToken
,
$tokenSymbol
,
$fee
,
$note
,
$execer
);
}
if
(
0
!=
$createRawTransaction
[
'code'
])
{
if
(
isset
(
$createRawTransaction
[
'code'
])
&&
0
!=
$createRawTransaction
[
'code'
])
{
$txhash
=
'0'
;
$msg
=
$createRawTransaction
[
'msg'
];
goto
doEnd
;
...
...
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