Commit 388bd269 authored by shajiaiming's avatar shajiaiming

一键发币

parent aacd9d0e
...@@ -2,13 +2,9 @@ ...@@ -2,13 +2,9 @@
namespace api\controllers; namespace api\controllers;
use common\models\psources\CoinIssueChain;
use common\models\Tools;
use common\service\chain33\Chain33Service;
use Yii; use Yii;
use api\base\BaseController; use api\base\BaseController;
use common\models\psources\CoinIssueCoin; use common\models\psources\CoinPlatform;
use yii\data\Pagination;
class IssueChainController extends BaseController class IssueChainController extends BaseController
{ {
...@@ -31,19 +27,29 @@ class IssueChainController extends BaseController ...@@ -31,19 +27,29 @@ class IssueChainController extends BaseController
} }
if (1 == $platform_id) { if (1 == $platform_id) {
$chain_model = CoinIssueChain::find()->select('id, chain_name, charge')->asArray()->all(); $chain_model = CoinPlatform::find()->all();
} else { } else {
$chain_model = CoinIssueChain::find()->select('id, chain_name, charge')->where(['platform_id' => $platform_id])->asArray()->one(); $chain_model = CoinPlatform::find()->where(['id' => $platform_id])->all();
} }
if (false == $chain_model) { if (false == $chain_model) {
$msg = '不存在的链'; $msg = '不存在的链';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
foreach ($chain_model as &$val) {
$val->chain_name = isset($val->chain->platform) ? $val->chain->platform : '';
unset($val->download_url);
unset($val->introduce);
unset($val->create_time);
unset($val->update_time);
unset($val->chain_id);
}
$msg = 'ok'; $msg = 'ok';
$code = 0; $code = 0;
$data = $chain_model; $data = is_array($chain_model) ? $chain_model : [$chain_model];
doEnd : doEnd :
return ['code' => $code, 'msg' => $msg, 'data' => $data]; return ['code' => $code, 'msg' => $msg, 'data' => $data];
......
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
namespace api\controllers; namespace api\controllers;
use common\models\psources\CoinIssueChain;
use common\models\Tools;
use Yii; use Yii;
use yii\data\Pagination;
use api\base\BaseController; use api\base\BaseController;
use common\models\psources\CoinPlatform;
use common\models\psources\CoinIssueCoin; use common\models\psources\CoinIssueCoin;
use yii\data\Pagination;
class IssueCoinController extends BaseController class IssueCoinController extends BaseController
{ {
...@@ -38,8 +37,8 @@ class IssueCoinController extends BaseController ...@@ -38,8 +37,8 @@ class IssueCoinController extends BaseController
} }
$result = Yii::$app->request->post(); $result = Yii::$app->request->post();
$chain_id = isset($result['chain_id']) ? $result['chain_id'] : 0; $chain_id = isset($result['chain_id']) ? $result['chain_id'] : 0;
$chain_model = CoinIssueChain::find()->where(['id' => $chain_id])->asArray()->one(); $issue_charge = CoinPlatform::find()->where(['id' => $platform_id])->asArray()->one();
if (false == $chain_model) { if (false == $chain_id) {
$msg = '不存在的链'; $msg = '不存在的链';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
...@@ -53,7 +52,7 @@ class IssueCoinController extends BaseController ...@@ -53,7 +52,7 @@ class IssueCoinController extends BaseController
'category' => isset($result['category']) ? $result['category'] : 0, 'category' => isset($result['category']) ? $result['category'] : 0,
'platform_id' => $platform_id, 'platform_id' => $platform_id,
'chain_id' => $chain_id, 'chain_id' => $chain_id,
'charge' => $chain_model['charge'] 'charge' => $issue_charge['issue_charge']
]; ];
$model->load($result, ''); $model->load($result, '');
if (!$model->save()) { if (!$model->save()) {
...@@ -98,7 +97,7 @@ class IssueCoinController extends BaseController ...@@ -98,7 +97,7 @@ class IssueCoinController extends BaseController
$models = $query->offset(($page - 1) * $size)->limit($size)->all(); $models = $query->offset(($page - 1) * $size)->limit($size)->all();
$pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $size]); $pages = new Pagination(['totalCount' => $countQuery->count(), 'pageSize' => $size]);
foreach ($models as &$val) { foreach ($models as &$val) {
$val->chain_id = $val->chain->chain_name; $val->chain_id = $val->chain->platform;
} }
$data = [ $data = [
'list' => $models, 'list' => $models,
......
...@@ -10,6 +10,7 @@ namespace backend\controllers; ...@@ -10,6 +10,7 @@ namespace backend\controllers;
use backend\models\coin\CoinPlatformForm; use backend\models\coin\CoinPlatformForm;
use common\models\psources\CoinPlatform; use common\models\psources\CoinPlatform;
use common\models\psources\CoinPlatformWithHold;
use Yii; use Yii;
...@@ -39,6 +40,7 @@ class WalletController extends BaseController ...@@ -39,6 +40,7 @@ class WalletController extends BaseController
{ {
$model = new CoinPlatformForm(); $model = new CoinPlatformForm();
$model->scenario = 'add'; $model->scenario = 'add';
$platform_withhold = CoinPlatformWithHold::find()->select('id, platform')->orderBy('platform')->asArray()->all();
if (Yii::$app->request->isPost) { if (Yii::$app->request->isPost) {
$data = Yii::$app->request->post(); $data = Yii::$app->request->post();
if ($model->load($data, '') && $model->validate()) { if ($model->load($data, '') && $model->validate()) {
...@@ -60,7 +62,8 @@ class WalletController extends BaseController ...@@ -60,7 +62,8 @@ class WalletController extends BaseController
} }
$this->error($errors, Yii::$app->request->getReferrer()); $this->error($errors, Yii::$app->request->getReferrer());
} }
return $this->render('add', ['model' => $model]);
return $this->render('add', ['model' => $model, 'platform_withhold' => $platform_withhold]);
} }
public function actionEdit() public function actionEdit()
...@@ -90,9 +93,10 @@ class WalletController extends BaseController ...@@ -90,9 +93,10 @@ class WalletController extends BaseController
} elseif (Yii::$app->request->isGet) { } elseif (Yii::$app->request->isGet) {
$id = Yii::$app->request->get('id', null); $id = Yii::$app->request->get('id', null);
if ($id) { if ($id) {
$platform_withhold = CoinPlatformWithHold::find()->select('id, platform')->orderBy('platform')->asArray()->all();
$coin = CoinPlatform::findOne(['id' => $id]); $coin = CoinPlatform::findOne(['id' => $id]);
$this->layout = false; $this->layout = false;
return $this->render('edit', ['model' => $coin]); return $this->render('edit', ['model' => $coin, 'platform_withhold' => $platform_withhold]);
} }
} }
} }
......
...@@ -14,6 +14,7 @@ class CoinPlatformForm extends Model ...@@ -14,6 +14,7 @@ class CoinPlatformForm extends Model
{ {
public $id; public $id;
public $name; public $name;
public $chain_id;
public $download_url; public $download_url;
public $introduce; public $introduce;
...@@ -27,6 +28,7 @@ class CoinPlatformForm extends Model ...@@ -27,6 +28,7 @@ class CoinPlatformForm extends Model
return [ return [
[['name'], 'required', 'on' => 'add'], [['name'], 'required', 'on' => 'add'],
[['id', 'name'], 'required', 'on' => 'update'], [['id', 'name'], 'required', 'on' => 'update'],
[['chain_id', 'download_url', 'introduce'], 'safe']
]; ];
} }
...@@ -34,6 +36,7 @@ class CoinPlatformForm extends Model ...@@ -34,6 +36,7 @@ class CoinPlatformForm extends Model
{ {
return [ return [
'id' => 'ID', 'id' => 'ID',
'chain_id' => '所属链',
'name' => '名称', 'name' => '名称',
'download_url' => '下载链接', 'download_url' => '下载链接',
'introduce' => '介绍' 'introduce' => '介绍'
...@@ -46,10 +49,16 @@ class CoinPlatformForm extends Model ...@@ -46,10 +49,16 @@ class CoinPlatformForm extends Model
'add' => [ 'add' => [
'id', 'id',
'name', 'name',
'chain_id',
'download_url',
'introduce'
], ],
'update' => [ 'update' => [
'id', 'id',
'name', 'name',
'chain_id',
'download_url',
'introduce'
], ],
]; ];
} }
......
...@@ -23,6 +23,18 @@ ...@@ -23,6 +23,18 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">所属链</label>
<div class="layui-input-block">
<select name="chain_id">
<?php foreach ($platform_withhold as $val): ?>
<option value="<?= $val['id'] ?>" <?php if ($model->chain_id == $val['id']) {
echo "selected";
} ?>><?= $val['platform'] ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">下载地址</label> <label class="layui-form-label">下载地址</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input class="layui-input" name="download_url" value="<?= $model->download_url ?>"> <input class="layui-input" name="download_url" value="<?= $model->download_url ?>">
...@@ -40,3 +52,6 @@ ...@@ -40,3 +52,6 @@
</form> </form>
</div> </div>
</div> </div>
<script>
layui.form.render();
</script>
...@@ -24,6 +24,18 @@ ...@@ -24,6 +24,18 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">所属链</label>
<div class="layui-input-block">
<select name="chain_id">
<?php foreach ($platform_withhold as $val): ?>
<option value="<?= $val['id'] ?>" <?php if ($model->chain_id == $val['id']) {
echo "selected";
} ?>><?= $val['platform'] ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">下载地址</label> <label class="layui-form-label">下载地址</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input class="layui-input" name="download_url" value="<?= $model->download_url ?>"> <input class="layui-input" name="download_url" value="<?= $model->download_url ?>">
......
<?php
namespace common\models\psources;
use Yii;
use yii\db\Expression;
class CoinIssueChain extends CommonActiveRecord
{
//定义场景
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_chain}}';
}
public function rules()
{
return [
[['chain_name', 'chain_url', 'platform_id', 'charge'], 'required'],
[['platform_id'], 'integer'],
['chain_name', 'unique'],
];
}
public function scenarios()
{
$scenarios = [
self:: SCENARIOS_CREATE => ['chain_name', 'chain_url', 'platform_id', 'charge'],
self:: SCENARIOS_UPDATE => ['chain_name', 'chain_url', 'platform_id', 'charge'],
];
return array_merge(parent:: scenarios(), $scenarios);
}
public function fields()
{
return [
'chain_name',
'chain_url',
'platform_id',
'charge'
];
}
public function attributeLabels()
{
return [
'chain_name' => '',
'chain_url' => '',
'platform_id' => '',
'charge' => ''
];
}
}
\ No newline at end of file
...@@ -34,7 +34,7 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -34,7 +34,7 @@ class CoinIssueCoin extends CommonActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id', 'charge'], 'required'], [['name', 'symbol', 'total', 'owner', 'introduction', 'category', 'platform_id', 'chain_id'], 'required'],
[['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]],
...@@ -48,26 +48,12 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -48,26 +48,12 @@ class CoinIssueCoin extends CommonActiveRecord
public function scenarios() public function scenarios()
{ {
$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'],
self:: SCENARIOS_UPDATE => ['status', 'msg'], self:: SCENARIOS_UPDATE => ['status', 'msg'],
]; ];
return array_merge(parent:: scenarios(), $scenarios); return array_merge(parent:: scenarios(), $scenarios);
} }
// public function fields()
// {
// return [
// 'name',
// 'symbol',
// 'total',
// 'owner',
// 'introduction',
// 'category',
// 'chain_id',
// 'charge'
// ];
// }
public function attributeLabels() public function attributeLabels()
{ {
return [ return [
...@@ -78,12 +64,16 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -78,12 +64,16 @@ class CoinIssueCoin extends CommonActiveRecord
'introduction' => 'Token简介', 'introduction' => 'Token简介',
'category' => '是否增发', 'category' => '是否增发',
'chain_id' => '平行链名称', 'chain_id' => '平行链名称',
'charge' => '手续费',
'msg' => '失败原因', 'msg' => '失败原因',
'status' => '状态' 'status' => '状态'
]; ];
} }
public function attributes()
{
return array_merge(parent::attributes(), ['charge']);
}
/** /**
* 获取状态数组 * 获取状态数组
* @return array * @return array
...@@ -98,6 +88,11 @@ class CoinIssueCoin extends CommonActiveRecord ...@@ -98,6 +88,11 @@ class CoinIssueCoin extends CommonActiveRecord
public function getChain() public function getChain()
{ {
return $this->hasOne(CoinIssueChain::className(), ['id' => 'chain_id']); return $this->hasOne(CoinPlatformWithHold::className(), ['id' => 'chain_id']);
}
public function getPlatform()
{
return $this->hasOne(CoinPlatform::className(), ['id' => 'platform_id']);
} }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ namespace common\models\psources; ...@@ -10,6 +10,7 @@ namespace common\models\psources;
class CoinPlatform extends BaseActiveRecord class CoinPlatform extends BaseActiveRecord
{ {
public static function tableName() public static function tableName()
{ {
return '{{%coin_platform}}'; return '{{%coin_platform}}';
...@@ -18,8 +19,8 @@ class CoinPlatform extends BaseActiveRecord ...@@ -18,8 +19,8 @@ class CoinPlatform extends BaseActiveRecord
/** /**
* 获取钱包信息列表 * 获取钱包信息列表
* *
* @param int $page * @param int $page
* @param int $limit * @param int $limit
* @param array $condition * @param array $condition
* @return array|\yii\db\ActiveRecord[] * @return array|\yii\db\ActiveRecord[]
*/ */
...@@ -30,7 +31,7 @@ class CoinPlatform extends BaseActiveRecord ...@@ -30,7 +31,7 @@ class CoinPlatform extends BaseActiveRecord
$query = $query->andWhere($item); $query = $query->andWhere($item);
} }
$count = $query->count(); $count = $query->count();
$data = $query->offset(($page - 1) * 10)->limit($limit)->asArray()->all(); $data = $query->offset(($page - 1) * 10)->limit($limit)->asArray()->all();
return ['count' => $count, 'data' => $data]; return ['count' => $count, 'data' => $data];
} }
...@@ -73,4 +74,14 @@ class CoinPlatform extends BaseActiveRecord ...@@ -73,4 +74,14 @@ class CoinPlatform extends BaseActiveRecord
return ['code' => $exception->getCode(), 'message' => $exception->getMessage()]; return ['code' => $exception->getCode(), 'message' => $exception->getMessage()];
} }
} }
public function attributes()
{
return array_merge(parent::attributes(), ['chain_name']);
}
public function getChain()
{
return $this->hasOne(CoinPlatformWithHold::className(), ['id' => 'chain_id']);
}
} }
...@@ -298,6 +298,11 @@ class Chain33Service ...@@ -298,6 +298,11 @@ class Chain33Service
return $this->send($params, 'Chain33.SignRawTx'); return $this->send($params, 'Chain33.SignRawTx');
} }
public function createRawTokenPreCreateTx($params)
{
return $this->send($params, 'token.CreateRawTokenPreCreateTx');
}
public function getBlock2MainInfo($start, $end) public function getBlock2MainInfo($start, $end)
{ {
$params = [ $params = [
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace console\controllers; namespace console\controllers;
use common\models\psources\CoinIssueCoin; use common\models\psources\CoinIssueCoin;
use common\service\chain33\Chain33Service;
use Yii; use Yii;
use yii\console\Controller; use yii\console\Controller;
...@@ -11,23 +12,111 @@ class IssueCoinController extends Controller ...@@ -11,23 +12,111 @@ class IssueCoinController extends Controller
public function actionAutoIssue() public function actionAutoIssue()
{ {
$manual_review = Yii::$app->redis->get('issue_chain_manual_review'); $manual_review = Yii::$app->redis->get('issue_chain_manual_review');
if (false == $manual_review || 'open' == $manual_review) { if (false == $manual_review) {
Yii::$app->redis->set('issue_chain_manual_review', 'open');
}
if ('close' == $manual_review) {
return 0; return 0;
} }
$issue_coin_model = CoinIssueCoin::find() $issue_coin_model = CoinIssueCoin::find()
->select('name, symbol, introduction, total, charge, category, owner') ->select('id, name, symbol, introduction, total, category, owner')
->where(['status' => CoinIssueCoin::UN_AUDIT])->asArray()->all(); ->where(['status' => CoinIssueCoin::UN_AUDIT])
echo json_encode($issue_coin_model);exit; ->orderBy('create_time desc')
->all();
if (false == $issue_coin_model) { if (false == $issue_coin_model) {
echo date('Y-m-d H:i:s') . '暂无需要发行任务' . PHP_EOL; echo date('Y-m-d H:i:s') . '暂无发行任务' . PHP_EOL;
return 0; return 0;
} }
foreach ($issue_coin_model as $key => $issue_coin) {
go(function () use ($issue_coin) { $chain_service = new Chain33Service();
foreach ($issue_coin_model as $issue_coin) {
go(function () use ($issue_coin, $chain_service) {
\Co::sleep(0.5); \Co::sleep(0.5);
$params = [
'name' => $issue_coin->name,
'symbol' => $issue_coin->symbol,
'introduction' => $issue_coin->introduction,
//'total' => (int)$issue_coin->total,
'total' => 10,
//'price' => (int)$issue_coin[''],
'price' => 3,
'category' => (int)$issue_coin->category,
//'owner' => $issue_coin->owner
'owner' => '14TaZDqdzzmt8FcLrSJuWQux62JXmJynR9'
];
$result = $chain_service->createRawTokenPreCreateTx($params);
if (null == $result['error'] && false == $result['code']) {
$status = CoinIssueCoin::SUCCESS_ISSUE;
} else {
$status = CoinIssueCoin::FAIL_ISSUE;
}
if ($status > CoinIssueCoin::REFUSE_ISSUE) {
CoinIssueCoin::updateAll([
'msg' => $result['result'],
'status' => $status
], [
'id' => $issue_coin['id'],
]);
}
});
}
echo date('Y-m-d H:i:s') . '发行成功' . PHP_EOL;
return 0;
}
public function actionManualIssue()
{
$issue_coin_model = CoinIssueCoin::find()
->select('id, name, symbol, introduction, total, category, owner')
->where(['status' => CoinIssueCoin::ALLOW_ISSUE])
->orderBy('create_time desc')
->all();
if (false == $issue_coin_model) {
echo date('Y-m-d H:i:s') . '暂无发行任务' . PHP_EOL;
return 0;
}
$chain_service = new Chain33Service();
foreach ($issue_coin_model as $issue_coin) {
go(function () use ($issue_coin, $chain_service) {
\Co::sleep(0.5);
$params = [
'name' => $issue_coin->name,
'symbol' => $issue_coin->symbol,
'introduction' => $issue_coin->introduction,
//'total' => (int)$issue_coin->total,
'total' => 10,
//'price' => (int)$issue_coin[''],
'price' => 3,
'category' => (int)$issue_coin->category,
//'owner' => $issue_coin->owner
'owner' => '14TaZDqdzzmt8FcLrSJuWQux62JXmJynR9'
];
$result = $chain_service->createRawTokenPreCreateTx($params);
if (null == $result['error'] && false == $result['code']) {
$status = CoinIssueCoin::SUCCESS_ISSUE;
} else {
$status = CoinIssueCoin::FAIL_ISSUE;
}
if ($status > CoinIssueCoin::REFUSE_ISSUE) {
CoinIssueCoin::updateAll([
'msg' => $result['result'],
'status' => $status
], [
'id' => $issue_coin['id'],
]);
}
}); });
} }
echo date('Y-m-d H:i:s') . '发行成功' . PHP_EOL;
return 0; return 0;
} }
} }
\ No newline at end of file
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
namespace wallet\controllers; namespace wallet\controllers;
use common\models\psources\CoinPlatform;
use Yii; use Yii;
use wallet\base\BaseController; use wallet\base\BaseController;
use common\models\psources\CoinIssueChain;
use common\service\chain33\Chain33Service;
class IssueChainController extends BaseController class IssueChainController extends BaseController
{ {
...@@ -21,16 +20,26 @@ class IssueChainController extends BaseController ...@@ -21,16 +20,26 @@ class IssueChainController extends BaseController
$platform_id = Yii::$app->request->getPlatformId(); $platform_id = Yii::$app->request->getPlatformId();
if (1 == $platform_id) { if (1 == $platform_id) {
$chain_model = CoinIssueChain::find()->select('id, chain_name, charge')->asArray()->all(); $chain_model = CoinPlatform::find()->all();
} else { } else {
$chain_model = CoinIssueChain::find()->select('id, chain_name, charge')->where(['platform_id' => $platform_id])->asArray()->one(); $chain_model = CoinPlatform::find()->where(['id' => $platform_id])->all();
} }
if (false == $chain_model) { if (false == $chain_model) {
$msg = '不存在的链'; $msg = '不存在的链';
$code = -1; $code = -1;
goto doEnd; goto doEnd;
} }
foreach ($chain_model as &$val) {
$val->chain_name = isset($val->chain->platform) ? $val->chain->platform : '';
unset($val->download_url);
unset($val->introduce);
unset($val->create_time);
unset($val->update_time);
unset($val->chain_id);
}
$msg = 'ok'; $msg = 'ok';
$code = 0; $code = 0;
$data = $chain_model; $data = $chain_model;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace wallet\controllers; namespace wallet\controllers;
use common\models\psources\CoinIssueChain;
use Yii; use Yii;
use yii\data\Pagination; use yii\data\Pagination;
use wallet\base\BaseController; use wallet\base\BaseController;
...@@ -20,11 +19,11 @@ class IssueCoinController extends BaseController ...@@ -20,11 +19,11 @@ class IssueCoinController extends BaseController
$chain_id = \Yii::$app->request->get('chain_id', ''); $chain_id = \Yii::$app->request->get('chain_id', '');
if (1 == $platform_id) { if (1 == $platform_id) {
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, total, status, chain_id, owner, category, charge, symbol, introduction, create_time') ->select('id, name, total, status, chain_id, owner, category, symbol, introduction, create_time')
->orderBy('create_time desc'); ->orderBy('create_time desc');
} else { } else {
$query = CoinIssueCoin::find() $query = CoinIssueCoin::find()
->select('id, name, total, status, chain_id, owner, category, charge, symbol, introduction, create_time') ->select('id, name, total, status, chain_id, owner, category, symbol, introduction, create_time')
->where(['platform_id' => $platform_id]) ->where(['platform_id' => $platform_id])
->orderBy('create_time desc'); ->orderBy('create_time desc');
} }
...@@ -47,7 +46,8 @@ class IssueCoinController extends BaseController ...@@ -47,7 +46,8 @@ class IssueCoinController extends BaseController
->all(); ->all();
foreach ($models as &$val) { foreach ($models as &$val) {
$val->chain_id = $val->chain->chain_name; $val->chain_id = $val->chain->platform;
$val->charge = isset($val->platform->issue_charge) ? $val->platform->issue_charge : 0;
} }
$data = [ $data = [
'list' => $models, 'list' => $models,
......
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