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
cf53079d
Commit
cf53079d
authored
Sep 05, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台接口
parent
7f71a544
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
75 deletions
+150
-75
CoinIssueCoin.php
common/models/psources/CoinIssueCoin.php
+13
-2
IssueChainController.php
wallet/controllers/IssueChainController.php
+48
-0
IssueCoinController.php
wallet/controllers/IssueCoinController.php
+89
-73
No files found.
common/models/psources/CoinIssueCoin.php
View file @
cf53079d
...
@@ -10,6 +10,13 @@ class CoinIssueCoin extends CommonActiveRecord
...
@@ -10,6 +10,13 @@ class CoinIssueCoin extends CommonActiveRecord
const
STATUS_SUCCESS
=
1
;
//发行成功
const
STATUS_SUCCESS
=
1
;
//发行成功
const
STATUS_FAIL
=
0
;
//发行失败
const
STATUS_FAIL
=
0
;
//发行失败
const
UN_AUDIT
=
0
;
const
ALLOW_ISSUE
=
1
;
const
REFUSE_ISSUE
=
2
;
const
SUCCESS_ISSUE
=
3
;
const
FAIL_ISSUE
=
4
;
const
CANCEL_ISSUE
=
5
;
//定义场景
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
const
SCENARIOS_UPDATE
=
'update'
;
...
@@ -31,7 +38,9 @@ class CoinIssueCoin extends CommonActiveRecord
...
@@ -31,7 +38,9 @@ class CoinIssueCoin extends CommonActiveRecord
[[
'total'
,
'category'
,
'platform_id'
,
'chain_id'
],
'integer'
],
[[
'total'
,
'category'
,
'platform_id'
,
'chain_id'
],
'integer'
],
[
'introduction'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'introduction'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'msg'
,
'string'
,
'length'
=>
[
1
,
10
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'status'
,
'in'
,
'range'
=>
[
1
,
2
,
0
]],
[
'symbol'
,
'unique'
],
[
'symbol'
,
'unique'
],
];
];
}
}
...
@@ -40,7 +49,7 @@ class CoinIssueCoin extends CommonActiveRecord
...
@@ -40,7 +49,7 @@ class CoinIssueCoin extends CommonActiveRecord
{
{
$scenarios
=
[
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge'
],
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge'
],
self
::
SCENARIOS_UPDATE
=>
[
'
name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
,
'charge
'
],
self
::
SCENARIOS_UPDATE
=>
[
'
status'
,
'msg
'
],
];
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
}
...
@@ -69,7 +78,9 @@ class CoinIssueCoin extends CommonActiveRecord
...
@@ -69,7 +78,9 @@ class CoinIssueCoin extends CommonActiveRecord
'introduction'
=>
'Token简介'
,
'introduction'
=>
'Token简介'
,
'category'
=>
'是否增发'
,
'category'
=>
'是否增发'
,
'chain_id'
=>
'平行链名称'
,
'chain_id'
=>
'平行链名称'
,
'charge'
=>
'手续费'
'charge'
=>
'手续费'
,
'msg'
=>
'失败原因'
,
'status'
=>
'状态'
];
];
}
}
...
...
wallet/controllers/IssueChainController.php
0 → 100644
View file @
cf53079d
<?php
namespace
wallet\controllers
;
use
Yii
;
use
wallet\base\BaseController
;
use
common\models\psources\CoinIssueChain
;
use
common\service\chain33\Chain33Service
;
class
IssueChainController
extends
BaseController
{
/**
* landing
* @return array
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public
function
actionIndex
()
{
$data
=
null
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
==
$platform_id
)
{
$chain_model
=
CoinIssueChain
::
find
()
->
select
(
'id, chain_name, charge'
)
->
asArray
()
->
all
();
}
else
{
$chain_model
=
CoinIssueChain
::
find
()
->
select
(
'id, chain_name, charge'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
()
->
one
();
}
if
(
false
==
$chain_model
)
{
$msg
=
'不存在的链'
;
$code
=
-
1
;
goto
doEnd
;
}
$msg
=
'ok'
;
$code
=
0
;
$data
=
$chain_model
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
public
function
actionSetCharge
()
{
}
}
\ No newline at end of file
wallet/controllers/IssueCoinController.php
View file @
cf53079d
...
@@ -2,100 +2,115 @@
...
@@ -2,100 +2,115 @@
namespace
wallet\controllers
;
namespace
wallet\controllers
;
use
common\models\psources\CoinIssueChain
;
use
Yii
;
use
Yii
;
use
common\models\Admin
;
use
yii\data\Pagination
;
use
wallet\base\BaseController
;
use
common\models\psources\CoinIssueCoin
;
class
IssueCoinController
extends
BaseController
class
IssueCoinController
extends
BaseController
{
{
/**
public
function
actionApplyList
()
* landing
* @return array
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public
function
actionList
()
{
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
===
$platform_id
)
{
$page
=
\Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$platforms
=
CoinPlatform
::
find
()
->
select
(
'id, name'
)
->
asArray
()
->
all
();
$size
=
\Yii
::
$app
->
request
->
get
(
'size'
,
10
);
$status
=
\Yii
::
$app
->
request
->
get
(
'status'
,
''
);
if
(
1
==
$platform_id
)
{
$query
=
CoinIssueCoin
::
find
()
->
select
(
'name, total, create_time, status, chain_id, owner, category, charge'
)
->
orderBy
(
'create_time desc'
);
}
else
{
}
else
{
$platforms
=
CoinPlatform
::
find
()
->
select
(
'id, name'
)
->
where
([
'id'
=>
$platform_id
])
->
asArray
()
->
all
();
$query
=
CoinIssueCoin
::
find
()
->
select
(
'name, total, create_time, status, chain_id, owner, category, charge'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
orderBy
(
'create_time desc'
);
}
}
if
(
false
!=
$status
)
{
$query
->
where
([
'status'
=>
$status
]);
}
return
[
'code'
=>
0
,
'msg'
=>
'ok'
,
'data'
=>
$platforms
];
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
$size
]);
$models
=
$query
->
offset
(
$pages
->
offset
)
->
limit
(
$pages
->
limit
)
->
all
();
foreach
(
$models
as
&
$val
)
{
$val
->
chain_id
=
$val
->
chain
->
chain_name
;
}
$data
=
[
'list'
=>
$models
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
$size
,
'currentPage'
=>
$page
,
]
];
$msg
=
'ok'
;
$code
=
0
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
public
function
action
WalletBallance
()
public
function
action
ApplyDetail
()
{
{
$
current_platform_id
=
Yii
::
$app
->
request
->
getPlatformId
(
);
$
id
=
Yii
::
$app
->
request
->
get
(
'id'
,
''
);
if
(
1
===
$current_platform_id
)
{
$data
=
null
;
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
1
);
if
(
empty
(
$id
))
{
$
platform_id
=
empty
(
$platform_id
)
?
1
:
$platform_id
;
$
msg
=
'缺少必要的参数'
;
}
else
{
$code
=
-
1
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
()
;
goto
doEnd
;
}
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
])){
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'此钱包节点尚未开通'
];
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$data
=
CoinIssueCoin
::
find
()
->
where
([
'id'
=>
$id
])
->
asArray
()
->
one
();
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$code
=
0
;
$size
=
Yii
::
$app
->
request
->
get
(
'size'
,
15
);
$msg
=
'success'
;
$currency
=
Yii
::
$app
->
request
->
get
(
'currency '
,
''
);
$params
=
[
'type'
=>
$type
,
'page'
=>
$page
,
'size'
=>
$size
,
'currency'
=>
$currency
];
$time
=
time
();
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
doEnd
:
'FZM-Wallet-Signature'
=>
$signature
,
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
'FZM-Wallet-Timestamp'
=>
$time
,
'FZM-Wallet-AppKey'
=>
$appKey
,
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$result
=
$service
->
getWalletBalance
(
$params
);
if
(
200
!==
$result
[
'code'
])
{
return
[
'code'
=>
$result
[
'code'
],
'data'
=>
[],
'msg'
=>
$result
[
'msg'
]];
}
return
[
'code'
=>
1
,
'data'
=>
$result
[
'msg'
],
'msg'
=>
'success'
];
}
}
public
function
action
UserAsset
()
public
function
action
Verify
()
{
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$id
=
Yii
::
$app
->
request
->
post
(
'id'
,
''
);
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$status
=
Yii
::
$app
->
request
->
post
(
'status'
,
''
);
$uid
=
Yii
::
$app
->
request
->
get
(
'uid'
,
''
);
$msg
=
Yii
::
$app
->
request
->
post
(
'msg'
,
''
);
$params
=
[
if
(
false
==
$id
||
false
==
$status
)
{
'uid'
=>
$uid
$msg
=
'缺少必要的参数'
;
];
$code
=
-
1
;
$time
=
time
();
goto
doEnd
;
$appKey
=
isset
(
$node_params
[
'appKey'
])
?
$node_params
[
'appKey'
]
:
null
;
}
$appSecret
=
isset
(
$node_params
[
'appSecret'
])
?
$node_params
[
'appSecret'
]
:
null
;
$signature
=
self
::
getSign
(
$params
,
$appKey
,
$appSecret
,
$time
);
$headers
=
[
if
(
!
in_array
(
$status
,
[
CoinIssueCoin
::
UN_AUDIT
,
CoinIssueCoin
::
ALLOW_ISSUE
,
CoinIssueCoin
::
REFUSE_ISSUE
]))
{
'FZM-Wallet-Signature'
=>
$signature
,
$msg
=
'状态值错误'
;
'FZM-Wallet-Timestamp'
=>
$time
,
$code
=
-
1
;
'FZM-Wallet-AppKey'
=>
$appKey
,
goto
doEnd
;
'FZM-Wallet-AppIp'
=>
Yii
::
$app
->
request
->
userIP
}
];
$service
=
new
TrusteeShipService
(
$node_params
,
$headers
);
$model
=
CoinIssueCoin
::
findOne
(
$id
);
$result
=
$service
->
getUserAsset
(
$params
);
if
(
false
==
$model
)
{
if
(
200
!==
$result
[
'code'
])
{
$msg
=
'不存在的记录'
;
return
[
'code'
=>
$result
[
'code'
],
'data'
=>
[],
'msg'
=>
$result
[
'msg'
]];
$code
=
-
1
;
goto
doEnd
;
}
$data
=
[
'status'
=>
$status
,
'msg'
=>
$msg
];
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_UPDATE
);
$model
->
load
(
$data
,
''
);
if
(
!
$model
->
save
())
{
$msg
=
current
(
$model
->
firstErrors
);
$code
=
-
1
;
goto
doEnd
;
}
}
return
[
'code'
=>
1
,
'data'
=>
$result
[
'msg'
],
'msg'
=>
'success'
];
}
$code
=
0
;
$msg
=
'success'
;
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
}
}
}
\ No newline at end of file
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