Commit 010b4916 authored by rlgy's avatar rlgy

update

parent f3ab64e3
......@@ -21,8 +21,8 @@ class CoinReleaseMemberController extends BaseController
public function actionList()
{
$get = Yii::$app->request->get();
$page = $get['page'] ?? 1;
$get = Yii::$app->request->get();
$page = $get['page'] ?? 1;
$limit = $get['limit'] ?? 10;
if (Yii::$app->request->isAjax) {
......@@ -33,7 +33,7 @@ class CoinReleaseMemberController extends BaseController
return ['code' => -1, 'msg' => 'failed'];
}
$condition = [['rule_id' => $rule_id]];
$datas = CoinReleaseMember::getList($page, $limit, $condition);
$datas = CoinReleaseMember::getList($page, $limit, $condition);
return $datas;
}
return $this->render('list');
......@@ -47,15 +47,15 @@ class CoinReleaseMemberController extends BaseController
} else {
if (Yii::$app->request->isPost) {
Yii::$app->response->format = 'json';
$post = Yii::$app->request->post();
$post = Yii::$app->request->post();
// 获取rule_id
$rule_id = $this->getRuleId();
if ($rule_id) {
$post['rule_id'] = $rule_id;
$post['rule_id'] = $rule_id;
$coin_publish_rule = CoinPublishRule::findOne($rule_id);
if ($coin_publish_rule) {
$post['release'] = $post['amount'] * (100 - $coin_publish_rule->lock) / 100;
$post['freeze'] = $post['amount'] * $coin_publish_rule->lock / 100;
$post['freeze'] = $post['amount'] * $coin_publish_rule->lock / 100;
} else {
return ['code' => -1, 'msg' => '规则不存在'];
}
......@@ -63,13 +63,16 @@ class CoinReleaseMemberController extends BaseController
return ['code' => -1, 'msg' => '规则不存在'];
}
if (isset($post['id']) && !empty($post['id'])) {
$model = CoinReleaseMember::findOne($post['id']);
$model = CoinReleaseMember::findOne($post['id']);
$model->scenario = CoinReleaseMember::SCENARIOS_UPDATE;
} else {
$model = new CoinReleaseMember();
$model = new CoinReleaseMember();
$model->scenario = CoinReleaseMember::SCENARIOS_ADD;
}
if ($model->load($post) && $model->validate()) {
$model->amount = $model->amount * 1e8;
$model->release = $model->release * 1e8;
$model->freeze = $model->freeze * 1e8;
if ($model->save()) {
return ['code' => 0, 'msg' => '添加成功'];
}
......@@ -87,14 +90,14 @@ class CoinReleaseMemberController extends BaseController
public function actionImplode()
{
Yii::$app->response->format = 'json';
$file = UploadedFile::getInstanceByName('file');
$file = UploadedFile::getInstanceByName('file');
try {
$fd = fopen($file->tempName, 'r');
$data = [];
$fd = fopen($file->tempName, 'r');
$data = [];
$rule_id = $this->getRuleId();
if ($rule_id) {
$coin_publish_rule = CoinPublishRule::findOne($rule_id);
$present = $coin_publish_rule->lock;
$present = $coin_publish_rule->lock;
if (!$coin_publish_rule) {
return ['code' => -1, 'msg' => '规则不存在'];
}
......@@ -127,6 +130,7 @@ class CoinReleaseMemberController extends BaseController
/**
* 获取rule_id
*
* @return int
*/
private function getRuleId()
......
......@@ -23,7 +23,7 @@ ListAsset::register($this);
<tr>
<td><?= $coin_name ?></td>
<td><?= $amount / 1e8 ?></td>
<td><?= $release_amount ?></td>
<td><?= $release_amount / 1e8 ?></td>
<td><?= $address ?></td>
</tr>
</tbody>
......
......@@ -9,9 +9,21 @@ table.render({
cols: [[
{field: 'mobile', title: '手机号'},
{field: 'coin', title: '币种'},
{field: 'amount', title: '总量'},
{field: 'release', title: '已解冻'},
{field: 'freeze', title: '已冻结'},
{
field: 'amount', title: '总量', templet: function (d) {
return d.amount / 1e8;
}
},
{
field: 'release', title: '已解冻', templet: function (d) {
return d.release / 1e8;
}
},
{
field: 'freeze', title: '已冻结', templet: function (d) {
return d.freeze / 1e8;
}
},
]]
});
......@@ -29,7 +41,7 @@ upload.render({
}
});
},
before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
before: function (obj) { //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
}
});
......
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