Commit d13972a7 authored by rlgy's avatar rlgy

update

parent 010b4916
...@@ -20,12 +20,13 @@ class CoinReleaseCheckController extends BaseController ...@@ -20,12 +20,13 @@ class CoinReleaseCheckController extends BaseController
const STEP_CANCEL = 3; //撤提 const STEP_CANCEL = 3; //撤提
public $enableCsrfValidation = false; public $enableCsrfValidation = false;
public function actionIndex() public function actionIndex()
{ {
$admins = $this->getAccessAdmins(); $admins = $this->getAccessAdmins();
//获取所有币种 //获取所有币种
$coins = CoinPublish::find()->select('coin_name_en')->asArray()->all(); $coins = CoinPublish::find()->select('coin_name_en')->asArray()->all();
$coins = array_column(array_unique($coins), 'coin_name_en'); $coins = array_unique(array_column($coins, 'coin_name_en'));
return $this->render('index', [ return $this->render('index', [
'coins' => $coins, 'coins' => $coins,
'check_firsts' => $admins, 'check_firsts' => $admins,
...@@ -109,7 +110,8 @@ class CoinReleaseCheckController extends BaseController ...@@ -109,7 +110,8 @@ class CoinReleaseCheckController extends BaseController
return ['code' => 0, 'count' => $count, 'data' => $datas]; return ['code' => 0, 'count' => $count, 'data' => $datas];
} else { } else {
return ['code' => -1, 'msg' => current($model->firstErrors)];} return ['code' => -1, 'msg' => current($model->firstErrors)];
}
} }
public function actionCheck() public function actionCheck()
......
...@@ -5,17 +5,20 @@ ...@@ -5,17 +5,20 @@
* @date 2018-09-05 18:40:23 * @date 2018-09-05 18:40:23
* @authors rlgy <rlgyzhcn@qq.com> * @authors rlgy <rlgyzhcn@qq.com>
*/ */
use backend\assets\coinReleaseCheck\IndexAsset; use backend\assets\coinReleaseCheck\IndexAsset;
IndexAsset::register($this); IndexAsset::register($this);
?> ?>
<style type="text/css"> <style type="text/css">
.layui-form-label{ .layui-form-label {
width: 60px; width: 60px;
padding: 0 0 0 0; padding: 0 0 0 0;
line-height: 40px; line-height: 40px;
text-align: center; text-align: center;
} }
.layui-inline{
.layui-inline {
margin-bottom: 0; margin-bottom: 0;
margin-right: 10px; margin-right: 10px;
} }
...@@ -27,15 +30,16 @@ IndexAsset::register($this); ...@@ -27,15 +30,16 @@ IndexAsset::register($this);
<th>币种</th> <th>币种</th>
<?php if (is_array($coins)): ?> <?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?> <?php foreach ($coins as $key => $value): ?>
<th><?=strtoupper($value);?></th> <th><?= strtoupper($value); ?></th>
<?php endforeach;?> <?php endforeach; ?>
<?php endif;?> <?php endif; ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>高度</td> <td>高度</td>
<td>56646</td> <td>56646</td>
<td>56646</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -53,9 +57,9 @@ IndexAsset::register($this); ...@@ -53,9 +57,9 @@ IndexAsset::register($this);
<option value="">全部</option> <option value="">全部</option>
<?php if (is_array($coins)): ?> <?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?> <?php foreach ($coins as $key => $value): ?>
<option value="<?=strtoupper($value);?>"><?=strtoupper($value);?></option> <option value="<?= strtoupper($value); ?>"><?= strtoupper($value); ?></option>
<?php endforeach;?> <?php endforeach; ?>
<?php endif;?> <?php endif; ?>
</select> </select>
</div> </div>
</div> </div>
...@@ -110,9 +114,9 @@ IndexAsset::register($this); ...@@ -110,9 +114,9 @@ IndexAsset::register($this);
<option value="">全部</option> <option value="">全部</option>
<?php if (is_array($coins)): ?> <?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?> <?php foreach ($coins as $key => $value): ?>
<option value="<?=strtoupper($value);?>"><?=strtoupper($value);?></option> <option value="<?= strtoupper($value); ?>"><?= strtoupper($value); ?></option>
<?php endforeach;?> <?php endforeach; ?>
<?php endif;?> <?php endif; ?>
</select> </select>
</div> </div>
</div> </div>
...@@ -121,8 +125,8 @@ IndexAsset::register($this); ...@@ -121,8 +125,8 @@ IndexAsset::register($this);
<div class="layui-input-inline"> <div class="layui-input-inline">
<select class="layui-select" name="check_first_uid"> <select class="layui-select" name="check_first_uid">
<option value="">全部</option> <option value="">全部</option>
<?php if(!empty($check_firsts)): ?> <?php if (!empty($check_firsts)): ?>
<?php foreach($check_firsts as $key => $value): ?> <?php foreach ($check_firsts as $key => $value): ?>
<option value="<?= $key ?>"><?= $value ?></option> <option value="<?= $key ?>"><?= $value ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
...@@ -134,8 +138,8 @@ IndexAsset::register($this); ...@@ -134,8 +138,8 @@ IndexAsset::register($this);
<div class="layui-input-inline"> <div class="layui-input-inline">
<select class="layui-select" name="check_second_uid"> <select class="layui-select" name="check_second_uid">
<option value="">全部</option> <option value="">全部</option>
<?php if(!empty($check_seconds)): ?> <?php if (!empty($check_seconds)): ?>
<?php foreach($check_seconds as $key => $value): ?> <?php foreach ($check_seconds as $key => $value): ?>
<option value="<?= $key ?>"><?= $value ?></option> <option value="<?= $key ?>"><?= $value ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
...@@ -175,14 +179,14 @@ IndexAsset::register($this); ...@@ -175,14 +179,14 @@ IndexAsset::register($this);
<script type="text/html" id="toolbar_check"> <script type="text/html" id="toolbar_check">
<!-- 复核通过无法撤体 --> <!-- 复核通过无法撤体 -->
{{# if(d.status!=0){ }} {{# if(d.status!=0){ }}
<!-- 撤提之后无法进行任何操作 --> <!-- 撤提之后无法进行任何操作 -->
<button class="layui-btn layui-btn-xs layui-btn-disabled">初审</button> <button class="layui-btn layui-btn-xs layui-btn-disabled">初审</button>
<button class="layui-btn layui-btn-xs layui-btn-disabled">复核</button> <button class="layui-btn layui-btn-xs layui-btn-disabled">复核</button>
<button class="layui-btn layui-btn-xs layui-btn-disabled">撤提</button> <button class="layui-btn layui-btn-xs layui-btn-disabled">撤提</button>
{{# }else{ }} {{# }else{ }}
<!-- 复核之后无法在初审 --> <!-- 复核之后无法在初审 -->
{{# if(1==d.check_second_status){ }} {{# if(1==d.check_second_status){ }}
{{# if(1==d.check_first_status){ }} {{# if(1==d.check_first_status){ }}
...@@ -207,7 +211,7 @@ IndexAsset::register($this); ...@@ -207,7 +211,7 @@ IndexAsset::register($this);
{{# }else{ }} {{# }else{ }}
<button class="layui-btn layui-btn-xs layui-btn-disabled">复核</button> <button class="layui-btn layui-btn-xs layui-btn-disabled">复核</button>
{{# } }} {{# } }}
{{# } }} {{# } }}
{{# if(2==d.check_second_status){ }} {{# if(2==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-disabled">撤提</button> <button class="layui-btn layui-btn-xs layui-btn-disabled">撤提</button>
{{# }else{ }} {{# }else{ }}
......
...@@ -12,10 +12,10 @@ table.render({ ...@@ -12,10 +12,10 @@ table.render({
page: 1, page: 1,
limit: 10, limit: 10,
cols: [[ cols: [[
{field: "id", title: "ID"}, {field: 'id', title: 'ID'},
{field: "coin_name_en", title: '币种中文名'}, {field: 'coin_name_en', title: '币种中文名'},
{field: "coin_name_zh", title: "币种英文名"}, {field: 'coin_name_zh', title: '币种英文名'},
{field: "address", title: "热钱包地址"}, {field: 'address', title: '热钱包地址'},
{title: "操作", toolbar: "#toolbar"} {title: '操作', toolbar: '#toolbar'}
]] ]]
}); });
\ No newline at end of file
...@@ -18,7 +18,11 @@ var table_check = table.render({ ...@@ -18,7 +18,11 @@ var table_check = table.render({
{field: 'id', title: '流水编号'}, {field: 'id', title: '流水编号'},
{field: 'mobile', title: '手机号'}, {field: 'mobile', title: '手机号'},
{field: 'coin', title: '币种'}, {field: 'coin', title: '币种'},
{field: 'amount', title: '数量'}, {
field: 'amount', title: '数量', templet: function (d) {
return d.amount / 1e8;
}
},
{field: 'to_address', title: '对方地址'}, {field: 'to_address', title: '对方地址'},
{field: 'today', title: '该地址今日提币次数'}, {field: 'today', title: '该地址今日提币次数'},
{field: 'total', title: '该地址总操作数'}, {field: 'total', title: '该地址总操作数'},
...@@ -58,8 +62,8 @@ laydate.render({ ...@@ -58,8 +62,8 @@ laydate.render({
}); });
form.on('submit(submit_check)', function (data) { form.on('submit(submit_check)', function (data) {
table.reload('table_check', { table.reload('table_check', {
page:{ page: {
curr:1 curr: 1
}, },
where: data.field where: data.field
}); });
...@@ -76,40 +80,40 @@ form.on('submit(submit_search)', function (data) { ...@@ -76,40 +80,40 @@ form.on('submit(submit_search)', function (data) {
}); });
//工具栏点击事件 //工具栏点击事件
table.on('tool(table_check)',function (obj) { table.on('tool(table_check)', function (obj) {
var event = obj.event; var event = obj.event;
var data = obj.data; var data = obj.data;
if (event=='check_first') { if (event == 'check_first') {
var index = layer.msg('审核通过?',{ var index = layer.msg('审核通过?', {
title: '审核', title: '审核',
btn: ['通过', '不通过', '取消'], btn: ['通过', '不通过', '取消'],
btn1: function (index, layero) { btn1: function (index, layero) {
$.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 1}, function(rev){ $.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 1}, function (rev) {
layer.msg(rev.msg); layer.msg(rev.msg);
if (0==rev.code) { if (0 == rev.code) {
table_check.reload(); table_check.reload();
layer.close(index); layer.close(index);
} }
}); });
}, },
btn2: function (index, layero) { btn2: function (index, layero) {
$.get('/admin/coin-release-check/check', {id: data.id, status: 3, step: 1}, function(rev){ $.get('/admin/coin-release-check/check', {id: data.id, status: 3, step: 1}, function (rev) {
layer.msg(rev.msg); layer.msg(rev.msg);
if (0==rev.code) { if (0 == rev.code) {
table_check.reload(); table_check.reload();
layer.close(index); layer.close(index);
} }
}); });
} }
}); });
} else if('check_second'==event){ } else if ('check_second' == event) {
var index = layer.msg('复核通过?',{ var index = layer.msg('复核通过?', {
title: '复核', title: '复核',
btn: ['通过', '不通过', '取消'], btn: ['通过', '不通过', '取消'],
btn1: function (index, layero) { btn1: function (index, layero) {
$.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 2}, function(rev){ $.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 2}, function (rev) {
layer.msg(rev.msg); layer.msg(rev.msg);
if (0==rev.code) { if (0 == rev.code) {
table_check.reload(); table_check.reload();
table_search.reload(); table_search.reload();
layer.close(index); layer.close(index);
...@@ -117,23 +121,23 @@ table.on('tool(table_check)',function (obj) { ...@@ -117,23 +121,23 @@ table.on('tool(table_check)',function (obj) {
}); });
}, },
btn2: function (index, layero) { btn2: function (index, layero) {
$.get('/admin/coin-release-check/check', {id: data.id, status: 3, step: 2}, function(rev){ $.get('/admin/coin-release-check/check', {id: data.id, status: 3, step: 2}, function (rev) {
layer.msg(rev.msg); layer.msg(rev.msg);
if (0==rev.code) { if (0 == rev.code) {
table_check.reload(); table_check.reload();
layer.close(index); layer.close(index);
} }
}); });
} }
}); });
} else if('extract_cancel' == event){ } else if ('extract_cancel' == event) {
var index = layer.msg('撤提该申请?',{ var index = layer.msg('撤提该申请?', {
title: '撤提', title: '撤提',
btn: ['撤提', '取消'], btn: ['撤提', '取消'],
btn1: function (index, layero) { btn1: function (index, layero) {
$.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 3}, function(rev){ $.get('/admin/coin-release-check/check', {id: data.id, status: 2, step: 3}, function (rev) {
layer.msg(rev.msg); layer.msg(rev.msg);
if (0==rev.code) { if (0 == rev.code) {
table_check.reload(); table_check.reload();
table_search.reload(); table_search.reload();
layer.close(index); layer.close(index);
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
namespace h5\controllers; namespace h5\controllers;
use common\models\psources\Coin; use common\models\psources\Coin;
use common\models\psources\CoinExtract;
use common\models\psources\CoinPublishRule; use common\models\psources\CoinPublishRule;
use common\models\psources\CoinReleaseCheck;
use common\models\psources\CoinReleaseMember; use common\models\psources\CoinReleaseMember;
use h5\base\ResponseBuild; use h5\base\ResponseBuild;
use Yii; use Yii;
...@@ -55,4 +57,70 @@ class GuodunController extends BaseController ...@@ -55,4 +57,70 @@ class GuodunController extends BaseController
return $response_; return $response_;
} }
} }
/**
* 提币申请
*/
public function actionRequestCoin()
{
$response = new ResponseBuild();
$post = Yii::$app->request->post();
$field = ['id', 'address', 'mobile', 'amount', 'validate_code'];
foreach ($field as $item) {
if (isset($post[$item]) && !empty($post[$item])) {
$$item = $post[$item];
} else {
$response->build(ResponseBuild::STATUS_PARAMS_NOT_VALIDATE, $item . ' can not be blank');
return $response;
}
}
$note = $post['note'] ?? '';
//todo 验证验证码
$user_asset = CoinReleaseMember::findOne([$id]);
//判断余额师傅充足
if ($user_asset->release < $amount * 1e5) {
$response->build(-1, '余额不足!');
return $response;
}
//添加提币申请
$request_coin = new CoinReleaseCheck();
$request_coin->uid = $user_asset->user_id;
$request_coin->mobile = $user_asset->mobile;
$request_coin->amount = $amount * 1e8;
$request_coin->coin = $user_asset->coin;
$request_coin->to_address = $address;
//记录提笔数据
$user_asset->release -= ($amount * 1e8);
$user_asset->output += $amount * 1e8;
//开启事务
try {
$trans = CoinReleaseMember::getDb()->beginTransaction();
if ($user_asset->save() && $request_coin->save()) {
$trans->commit();
$response->build(ResponseBuild::STATUS_SUCCEED);
} else {
$trans->rollBack();
$response->build(ResponseBuild::STATUS_INTERNAL_ERROR);
}
} catch (\Exception $exception) {
$response->build($exception->getCode(), $exception->getMessage());
}
//记录提币申请
$extract = CoinExtract::findOne(['address' => $address]);
if (!$extract) {
$extract = new CoinExtract();
}
$extract->address = $address;
$extract->total += 1;
if (strtotime($extract->update_time) < strtotime(date('Y-m-d', time()))) {
$extract->today = 1;
} else {
$extract->today += 1;
}
$extract->save();
return $response;
}
} }
\ No newline at end of file
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