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
da1f11fb
Commit
da1f11fb
authored
Sep 03, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
573eb440
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
32 deletions
+100
-32
IssueCoinController.php
api/controllers/IssueCoinController.php
+36
-11
CoinIssueCoin.php
common/models/psources/CoinIssueCoin.php
+32
-8
CoinIssueCoinForm_.php
common/models/psources/CoinIssueCoinForm_.php
+31
-12
CommonActiveRecord.php
common/models/psources/CommonActiveRecord.php
+1
-1
No files found.
api/controllers/IssueCoinController.php
View file @
da1f11fb
...
...
@@ -3,6 +3,8 @@
namespace
api\controllers
;
use
Yii
;
use
api\base\BaseController
;
use
common\models\psources\CoinIssueCoin
;
class
IssueCoinController
extends
BaseController
{
...
...
@@ -12,32 +14,55 @@ class IssueCoinController extends BaseController
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public
function
action
List
()
public
function
action
IssueApply
()
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
===
$platform_id
)
{
$platforms
=
CoinPlatform
::
find
()
->
select
(
'id, name'
)
->
asArray
()
->
all
();
}
else
{
$platforms
=
CoinPlatform
::
find
()
->
select
(
'id, name'
)
->
where
([
'id'
=>
$platform_id
])
->
asArray
()
->
all
();
$model
=
new
CoinIssueCoin
();
$model
->
setScenario
(
CoinIssueCoin
::
SCENARIOS_CREATE
);
if
(
!
Yii
::
$app
->
request
->
isPost
)
{
$msg
=
'错误的请求方式'
;
$code
=
-
1
;
goto
doEnd
;
}
$data
=
Yii
::
$app
->
request
->
post
();
$data
=
[
'name'
=>
isset
(
$data
[
'name'
])
?
$data
[
'name'
]
:
''
,
'symbol'
=>
isset
(
$data
[
'symbol'
])
?
strtoupper
(
$data
[
'symbol'
])
:
''
,
'total'
=>
isset
(
$data
[
'total'
])
?
$data
[
'total'
]
:
''
,
'owner'
=>
isset
(
$data
[
'owner'
])
?
$data
[
'owner'
]
:
''
,
'introduction'
=>
isset
(
$data
[
'introduction'
])
?
$data
[
'introduction'
]
:
''
,
'category'
=>
isset
(
$data
[
'category'
])
?
$data
[
'category'
]
:
0
,
'platform_id'
=>
isset
(
$data
[
'platform_id'
])
?
$data
[
'platform_id'
]
:
''
,
'chain_id'
=>
isset
(
$data
[
'chain_id'
])
?
$data
[
'chain_id'
]
:
''
];
$model
->
load
(
$data
,
''
);
if
(
!
$model
->
save
())
{
$msg
=
current
(
$model
->
firstErrors
);
$code
=
-
1
;
goto
doEnd
;
}
$msg
=
'ok'
;
$code
=
0
;
return
[
'code'
=>
0
,
'msg'
=>
'ok'
,
'data'
=>
$platforms
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
];
}
public
function
actionWalletBallance
()
{
$current_platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
if
(
1
===
$current_platform_id
)
{
if
(
1
===
$current_platform_id
)
{
$platform_id
=
Yii
::
$app
->
request
->
get
(
'platform_id'
,
1
);
$platform_id
=
empty
(
$platform_id
)
?
1
:
$platform_id
;
}
else
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
}
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
if
(
!
isset
(
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
]))
{
return
[
'code'
=>
-
1
,
'data'
=>
[],
'msg'
=>
'此钱包节点尚未开通'
];
}
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$type
=
Yii
::
$app
->
request
->
get
(
'type'
,
1
);
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
...
...
@@ -72,7 +97,7 @@ class IssueCoinController extends BaseController
public
function
actionUserAsset
()
{
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$node_params
=
Yii
::
$app
->
params
[
'trusteeship'
][
'node_'
.
$platform_id
];
$uid
=
Yii
::
$app
->
request
->
get
(
'uid'
,
''
);
$params
=
[
'uid'
=>
$uid
...
...
common/models/psources/CoinIssueCoin.php
View file @
da1f11fb
<?php
namespace
common\models
;
namespace
common\models
\psources
;
use
Yii
;
use
yii\db\Expression
;
...
...
@@ -10,11 +10,41 @@ class CoinIssueCoin extends CommonActiveRecord
const
STATUS_SUCCESS
=
1
;
//发行成功
const
STATUS_FAIL
=
0
;
//发行失败
//定义场景
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'p_sources'
);
}
public
static
function
tableName
()
{
return
'{{%coin_issue_coin}}'
;
}
public
function
rules
()
{
return
[
[[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
],
'required'
],
[[
'total'
,
'category'
,
'platform_id'
,
'chain_id'
],
'integer'
],
[
'introduction'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'symbol'
,
'unique'
],
];
}
public
function
scenarios
()
{
$scenarios
=
[
self
::
SCENARIOS_CREATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
],
self
::
SCENARIOS_UPDATE
=>
[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
],
];
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
fields
()
{
return
[
...
...
@@ -28,11 +58,6 @@ class CoinIssueCoin extends CommonActiveRecord
];
}
public
static
function
tableName
()
{
return
'{{%coin_issue_coin}}'
;
}
public
function
attributeLabels
()
{
return
[
...
...
@@ -42,8 +67,7 @@ class CoinIssueCoin extends CommonActiveRecord
'owner'
=>
'接收地址'
,
'introduction'
=>
'Token简介'
,
'category'
=>
'是否增加发'
,
'chain_id'
=>
'平行链名称'
,
'msg'
=>
'失败原因'
'chain_id'
=>
'平行链名称'
];
}
...
...
common/models/psources/CoinIssueCoinForm.php
→
common/models/psources/CoinIssueCoinForm
_
.php
View file @
da1f11fb
<?php
namespace
common\models
;
namespace
common\models
\psources
;
use
yii\base\Model
;
...
...
@@ -30,14 +30,34 @@ class CoinIssueCoinForm extends Model
const
SCENARIOS_CREATE
=
'create'
;
const
SCENARIOS_UPDATE
=
'update'
;
public
static
function
getDb
()
{
return
\Yii
::
$app
->
get
(
'p_sources'
);
}
public
function
rules
()
{
return
[
[[
'name'
,
'symbol'
,
'total'
,
'owner'
,
'introduction'
,
'category'
,
'platform_id'
,
'chain_id'
],
'required'
],
[[
'total'
,
'category'
,
'platform_id'
,
'chain_id'
],
'integer'
],
[
'introduction'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'symbol'
,
'string'
,
'length'
=>
[
1
,
20
]],
[
'name'
,
'string'
,
'length'
=>
[
1
,
6
]],
[
'symbol'
,
'unique'
],
[[
'total'
],
'issuableAmout'
]
];
}
public
function
isExist
(
$attribute
,
$params
)
{
var_dump
(
$attribute
,
$params
);
exit
;
}
public
function
issuableAmout
(
$attribute
,
$params
)
{
return
true
;
}
public
function
scenarios
()
{
$scenarios
=
[
...
...
@@ -68,7 +88,7 @@ class CoinIssueCoinForm extends Model
public
function
getIssueList
(
$id
)
{
$this
->
_issue_coin_list
=
CoinIssueCoin
Form
::
find
()
$this
->
_issue_coin_list
=
CoinIssueCoin
::
find
()
->
where
(
'agent_id = :agent_id'
,
[
':agent_id'
=>
$id
])
->
one
();
...
...
@@ -92,17 +112,16 @@ class CoinIssueCoinForm extends Model
{
if
(
$this
->
validate
())
{
if
(
$this
->
getIsNewRecord
())
{
$this
->
_issue_coin_list
=
new
Agent
();
$isNew
=
true
;
}
else
{
$isNew
=
false
;
$this
->
_issue_coin_list
=
new
CoinIssueCoin
();
}
$this
->
_issue_coin_list
->
agent_id
=
$this
->
agent_id
;
$this
->
_issue_coin_list
->
title
=
$this
->
title
;
$this
->
_issue_coin_list
->
etitle
=
$this
->
etitle
;
$this
->
_issue_coin_list
->
description
=
$this
->
description
;
$this
->
_issue_coin_list
->
requirement
=
$this
->
requirement
;
$this
->
_issue_coin_list
->
status
=
$this
->
status
;
$this
->
_issue_coin_list
->
name
=
$this
->
name
;
$this
->
_issue_coin_list
->
symbol
=
$this
->
symbol
;
$this
->
_issue_coin_list
->
total
=
$this
->
total
;
$this
->
_issue_coin_list
->
owner
=
$this
->
owner
;
$this
->
_issue_coin_list
->
introduction
=
$this
->
introduction
;
$this
->
_issue_coin_list
->
category
=
$this
->
category
;
$this
->
_issue_coin_list
->
platform_id
=
$this
->
platform_id
;
$this
->
_issue_coin_list
->
chain_id
=
$this
->
chain_id
;
return
$this
->
_issue_coin_list
->
save
();
...
...
common/models/psources/CommonActiveRecord.php
View file @
da1f11fb
<?php
namespace
common\models
;
namespace
common\models
\psources
;
use
Yii
;
use
yii\db\ActiveRecord
;
...
...
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