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
4ebc2a70
Commit
4ebc2a70
authored
Feb 18, 2020
by
shajiaming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
使用旧表
parent
ced55c07
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
17 deletions
+74
-17
WalletChainController.php
api/controllers/WalletChainController.php
+12
-16
CoinPlatformWithHold.php
common/models/psources/CoinPlatformWithHold.php
+60
-0
WalletChain.php
common/models/psources/WalletChain.php
+1
-0
IssueChainTransferController.php
console/controllers/IssueChainTransferController.php
+1
-1
No files found.
api/controllers/WalletChainController.php
View file @
4ebc2a70
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
api\controllers
;
namespace
api\controllers
;
use
common\models\psources\Coin
;
use
common\models\psources\Coin
;
use
common\models\psources\CoinPlatformWithHold
;
use
common\service\chain33\Chain33Service
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
use
Yii
;
use
api\base\BaseController
;
use
api\base\BaseController
;
...
@@ -36,7 +37,7 @@ class WalletChainController extends BaseController
...
@@ -36,7 +37,7 @@ class WalletChainController extends BaseController
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$size
=
Yii
::
$app
->
request
->
get
(
'size'
,
10
);
$size
=
Yii
::
$app
->
request
->
get
(
'size'
,
10
);
$query
=
WalletChain
::
find
()
$query
=
CoinPlatformWithHold
::
find
()
->
select
(
'id, token, platform, status'
)
->
select
(
'id, token, platform, status'
)
->
where
([
'wallet_address'
=>
$wallet_address
])
->
where
([
'wallet_address'
=>
$wallet_address
])
->
orderBy
(
'id'
);
->
orderBy
(
'id'
);
...
@@ -82,8 +83,8 @@ class WalletChainController extends BaseController
...
@@ -82,8 +83,8 @@ class WalletChainController extends BaseController
goto
doEnd
;
goto
doEnd
;
}
}
$post
=
$request
->
post
();
$post
=
$request
->
post
();
$model
=
new
WalletChain
();
$model
=
new
CoinPlatformWithHold
();
$model
->
setScenario
(
WalletChain
::
SCENARIOS_CREATE
);
$model
->
setScenario
(
CoinPlatformWithHold
::
SCENARIOS_CREATE
);
$params
=
[
$params
=
[
'platform'
=>
isset
(
$post
[
'platform'
])
?
$post
[
'platform'
]
:
''
,
'platform'
=>
isset
(
$post
[
'platform'
])
?
$post
[
'platform'
]
:
''
,
'address'
=>
isset
(
$post
[
'address'
])
?
$post
[
'address'
]
:
''
,
'address'
=>
isset
(
$post
[
'address'
])
?
$post
[
'address'
]
:
''
,
...
@@ -92,10 +93,11 @@ class WalletChainController extends BaseController
...
@@ -92,10 +93,11 @@ class WalletChainController extends BaseController
'host'
=>
isset
(
$post
[
'host'
])
?
$post
[
'host'
]
:
''
,
'host'
=>
isset
(
$post
[
'host'
])
?
$post
[
'host'
]
:
''
,
'port'
=>
isset
(
$post
[
'port'
])
?
$post
[
'port'
]
:
''
,
'port'
=>
isset
(
$post
[
'port'
])
?
$post
[
'port'
]
:
''
,
'wallet_address'
=>
isset
(
$post
[
'wallet_address'
])
?
$post
[
'wallet_address'
]
:
''
,
'wallet_address'
=>
isset
(
$post
[
'wallet_address'
])
?
$post
[
'wallet_address'
]
:
''
,
'status'
=>
WalletChain
::
STATUS_NO
,
'status'
=>
CoinPlatformWithHold
::
STATUS_NO
,
'origin'
=>
WalletChain
::
ORIGIN_USER
,
'origin'
=>
CoinPlatformWithHold
::
ORIGIN_USER
,
'fee'
=>
isset
(
$post
[
'fee'
])
?
$post
[
'fee'
]
:
''
,
'fee'
=>
isset
(
$post
[
'fee'
])
?
$post
[
'fee'
]
:
''
,
'hash'
=>
isset
(
$post
[
'hash'
])
?
$post
[
'hash'
]
:
''
'hash'
=>
isset
(
$post
[
'hash'
])
?
$post
[
'hash'
]
:
''
,
'exer'
=>
'user.p.'
.
(
isset
(
$post
[
'platform'
])
?
$post
[
'platform'
]
:
''
)
];
];
if
(
$model
->
load
(
$params
,
''
)
&&
!
$model
->
save
())
{
if
(
$model
->
load
(
$params
,
''
)
&&
!
$model
->
save
())
{
...
@@ -104,12 +106,6 @@ class WalletChainController extends BaseController
...
@@ -104,12 +106,6 @@ class WalletChainController extends BaseController
goto
doEnd
;
goto
doEnd
;
}
}
$id
=
Yii
::
$app
->
p_sources
->
getLastInsertID
();
$id
=
Yii
::
$app
->
p_sources
->
getLastInsertID
();
// $params = [
// 'platform' => 'BZCHAIN',
// 'host' => '112.74.59.221',
// 'port' => 1235,
// ];
$node_params
=
Yii
::
$app
->
params
[
'para'
];
$node_params
=
Yii
::
$app
->
params
[
'para'
];
$service
=
new
Chain33Service
(
$node_params
);
$service
=
new
Chain33Service
(
$node_params
);
...
@@ -122,9 +118,9 @@ class WalletChainController extends BaseController
...
@@ -122,9 +118,9 @@ class WalletChainController extends BaseController
$this
->
syncCoin
([
'platform'
=>
$params
[
'platform'
],
'token'
=>
$params
[
'token'
]]);
$this
->
syncCoin
([
'platform'
=>
$params
[
'platform'
],
'token'
=>
$params
[
'token'
]]);
$chain_update
=
WalletChain
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
$chain_update
=
CoinPlatformWithHold
::
find
()
->
where
([
'id'
=>
$id
])
->
one
();
$chain_update
->
setScenario
(
WalletChain
::
SCENARIOS_UPDATE
);
$chain_update
->
setScenario
(
CoinPlatformWithHold
::
SCENARIOS_UPDATE
);
$chain_update
->
status
=
WalletChain
::
STATUS_YES
;
$chain_update
->
status
=
CoinPlatformWithHold
::
STATUS_YES
;
$chain_update
->
save
();
$chain_update
->
save
();
...
@@ -155,7 +151,7 @@ class WalletChainController extends BaseController
...
@@ -155,7 +151,7 @@ class WalletChainController extends BaseController
}
}
$model
=
WalletChain
::
find
()
->
select
(
'platform, token, address, private_key, fee, host, port, hash, status, create_time'
)
->
where
([
'id'
=>
(
int
)
$id
])
->
asArray
()
->
one
();
$model
=
CoinPlatformWithHold
::
find
()
->
select
(
'platform, token, address, private_key, fee, host, port, hash, status, create_time'
)
->
where
([
'id'
=>
(
int
)
$id
])
->
asArray
()
->
one
();
if
(
empty
(
$model
))
{
if
(
empty
(
$model
))
{
goto
doEnd
;
goto
doEnd
;
}
}
...
...
common/models/psources/CoinPlatformWithHold.php
View file @
4ebc2a70
...
@@ -10,6 +10,66 @@ namespace common\models\psources;
...
@@ -10,6 +10,66 @@ namespace common\models\psources;
class
CoinPlatformWithHold
extends
BaseActiveRecord
class
CoinPlatformWithHold
extends
BaseActiveRecord
{
{
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
const
STATUS_NO
=
0
;
//创建失败
const
STATUS_YES
=
1
;
//创建成功
const
ORIGIN_MANAGE
=
1
;
//管理员创建
const
ORIGIN_USER
=
2
;
//h5用户创建
public
function
attributeLabels
()
{
return
[
'id'
=>
'ID'
,
'platform'
=>
'平行链名称'
,
'address'
=>
'代扣地址'
,
'private_key'
=>
'代扣私钥'
,
'execer'
=>
'执行器'
,
'fee'
=>
'手续费'
,
'brower_url'
=>
'浏览器链接'
,
'token'
=>
'手续费(基础代币)'
,
'host'
=>
'钱包服务IP'
,
'port'
=>
'钱包服务端口'
,
'wallet_address'
=>
'钱包地址'
,
'status'
=>
'申请状态'
,
'origin'
=>
'创建人'
,
'hash'
=>
'申请费用hash'
];
}
public
function
rules
()
{
return
[
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'exer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'status'
,
'port'
,
'fee'
,
'origin'
,
'hash'
],
'required'
],
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'exer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'hash'
],
'string'
],
[
'address'
,
'unique'
,
'message'
=>
'地址已存在'
],
[[
'platform'
],
'string'
,
'length'
=>
[
1
,
30
]],
[[
'token'
],
'string'
,
'length'
=>
[
1
,
10
]],
[[
'port'
,
'status'
,
'origin'
],
'integer'
],
[
'host'
,
'verfiyIp'
]
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'platform'
,
'token'
,
'address'
,
'private_key'
,
'fee'
,
'host'
,
'port'
,
'wallet_address'
,
'status'
,
'origin'
,
'hash'
,
'exer'
],
self
::
SCENARIOS_UPDATE
=>
[
'status'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
verfiyIp
(
$attribute
,
$params
)
{
if
(
!
preg_match
(
'/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/'
,
$this
->
host
))
{
$this
->
addError
(
$attribute
,
'错误的Ip地址'
);
return
false
;
}
}
public
static
function
tableName
()
public
static
function
tableName
()
{
{
return
'coin_platform_withhold'
;
return
'coin_platform_withhold'
;
...
...
common/models/psources/WalletChain.php
View file @
4ebc2a70
...
@@ -52,6 +52,7 @@ class WalletChain extends BaseActiveRecord
...
@@ -52,6 +52,7 @@ class WalletChain extends BaseActiveRecord
return
[
return
[
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'status'
,
'port'
,
'fee'
,
'origin'
,
'hash'
],
'required'
],
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'status'
,
'port'
,
'fee'
,
'origin'
,
'hash'
],
'required'
],
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'hash'
],
'string'
],
[[
'platform'
,
'address'
,
'private_key'
,
'execer'
,
'brower_url'
,
'token'
,
'host'
,
'wallet_address'
,
'hash'
],
'string'
],
[
'address'
,
'unique'
,
'message'
=>
'地址已存在'
],
[[
'platform'
],
'string'
,
'length'
=>
[
1
,
30
]],
[[
'platform'
],
'string'
,
'length'
=>
[
1
,
30
]],
[[
'token'
],
'string'
,
'length'
=>
[
1
,
10
]],
[[
'token'
],
'string'
,
'length'
=>
[
1
,
10
]],
[[
'port'
,
'status'
,
'origin'
],
'integer'
],
[[
'port'
,
'status'
,
'origin'
],
'integer'
],
...
...
console/controllers/IssueChainTransferController.php
View file @
4ebc2a70
...
@@ -372,7 +372,7 @@ class IssueChainTransferController extends Controller
...
@@ -372,7 +372,7 @@ class IssueChainTransferController extends Controller
public
function
actionAsyncCoin
()
public
function
actionAsyncCoin
()
{
{
$chains
=
WalletChain
::
find
()
->
select
(
'host, platform'
)
$chains
=
CoinPlatformWithHold
::
find
()
->
select
(
'host, platform'
)
->
where
([
'status'
=>
1
,
'origin'
=>
WalletChain
::
ORIGIN_USER
])
->
where
([
'status'
=>
1
,
'origin'
=>
WalletChain
::
ORIGIN_USER
])
->
asArray
()
->
asArray
()
->
all
();
->
all
();
...
...
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