Commit 8a4de379 authored by shajiaming's avatar shajiaming

fix

parent 418c9007
......@@ -59,13 +59,18 @@ class IssueCoinController extends BaseController
'nickname' => isset($result['nickname']) ? $result['nickname'] : ''
];
$model = new CoinIssueCoin();
if (!in_array($params['token_type'], [0, 1, 2])) {
$params['template'] = isset($result['template']) ? $result['template'] : [];
$model->setScenario(CoinIssueCoin::SCENARIOS_VERIFY_MALL);
} else {
if (0 == $params['token_type']){
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE);
}
if (in_array($params['token_type'], [1, 2])){
$model->setScenario(CoinIssueCoin::SCENARIOS_NO_CHARGE);
}
if (in_array($params['token_type'], [3, 4])){
$model->setScenario(CoinIssueCoin::SCENARIOS_VERIFY_MALL);
}
$model->load($params, '');
if (!$model->validate()) {
$msg = $model->errors;
......@@ -141,12 +146,18 @@ class IssueCoinController extends BaseController
];
$model = new CoinIssueCoin();
if (!in_array($params['token_type'], [0, 1, 2])) {
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE_MALL);
} else {
if (0 == $params['token_type']){
$model->setScenario(CoinIssueCoin::SCENARIOS_CREATE);
}
if (in_array($params['token_type'], [1, 2])){
$model->setScenario(CoinIssueCoin::SCENARIOS_NO_CHARGE);
}
if (in_array($params['token_type'], [3, 4])){
$model->setScenario(CoinIssueCoin::SCENARIOS_VERIFY_MALL);
}
$model->load($result, '');
if (!$model->save()) {
......
......@@ -32,6 +32,7 @@ class CoinIssueCoin extends CommonActiveRecord
const SCENARIOS_CREATE = 'create';
const SCENARIOS_UPDATE = 'update';
const SCENARIOS_CANCEL = 'cancel';
const SCENARIOS_NO_CHARGE = 'no_charge';
const SCENARIOS_CREATE_MALL = 'create_mall';
const SCENARIOS_VERIFY_MALL = 'verify_mall';
......@@ -69,6 +70,7 @@ class CoinIssueCoin extends CommonActiveRecord
self:: SCENARIOS_CREATE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'charge_unit', 'charge', 'token_type', 'nickname'],
self:: SCENARIOS_CREATE_MALL => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'token_type', 'nickname'],
self:: SCENARIOS_VERIFY_MALL => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'token_type', 'nickname', 'template'],
self:: SCENARIOS_NO_CHARGE => ['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'type', 'platform_id', 'chain_id', 'token_type', 'nickname'],
self:: SCENARIOS_UPDATE => ['status'],
self:: SCENARIOS_CANCEL => ['status'],
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment