Commit d13972a7 authored by rlgy's avatar rlgy

update

parent 010b4916
......@@ -20,12 +20,13 @@ class CoinReleaseCheckController extends BaseController
const STEP_CANCEL = 3; //撤提
public $enableCsrfValidation = false;
public function actionIndex()
{
$admins = $this->getAccessAdmins();
//获取所有币种
$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', [
'coins' => $coins,
'check_firsts' => $admins,
......@@ -44,7 +45,7 @@ class CoinReleaseCheckController extends BaseController
$page = $get['page'] ?? 1;
$limit = $page['limit'] ?? 10;
$datas = CoinReleaseCheck::find()
->andFilterWhere(['status' => 0, 'coin' => $model->coin, 'mobile' => $model->mobile]);
->andFilterWhere(['status' => 0, 'coin' => $model->coin, 'mobile' => $model->mobile]);
if ($model->start_time) {
$datas = $datas->andFilterWhere(['>=', 'create_time', $model->start_time]);
}
......@@ -53,9 +54,9 @@ class CoinReleaseCheckController extends BaseController
}
$count = $datas->count();
$datas = $datas->limit($limit)
->offset(($page - 1) * $limit)
->asArray()
->all();
->offset(($page - 1) * $limit)
->asArray()
->all();
//获取操作次数
//提出地址
$addresses = array_values(array_unique(array_column($datas, 'to_address')));
......@@ -81,13 +82,13 @@ class CoinReleaseCheckController extends BaseController
$page = $get['page'] ?? 1;
$limit = $page['limit'] ?? 10;
$query = CoinReleaseCheck::find()
->andFilterWhere(['!=', 'status', 0])
->andFilterWhere([
'status' => $model->status,
'coin' => $model->coin,
'check_first_uid' => $model->check_first_uid,
'check_second_uid' => $model->check_second_uid,
]);
->andFilterWhere(['!=', 'status', 0])
->andFilterWhere([
'status' => $model->status,
'coin' => $model->coin,
'check_first_uid' => $model->check_first_uid,
'check_second_uid' => $model->check_second_uid,
]);
if ($model->start_time) {
$query = $query->andFilterWhere(['>=', 'create_time', $model->start_time]);
}
......@@ -109,7 +110,8 @@ class CoinReleaseCheckController extends BaseController
return ['code' => 0, 'count' => $count, 'data' => $datas];
} else {
return ['code' => -1, 'msg' => current($model->firstErrors)];}
return ['code' => -1, 'msg' => current($model->firstErrors)];
}
}
public function actionCheck()
......
......@@ -5,17 +5,20 @@
* @date 2018-09-05 18:40:23
* @authors rlgy <rlgyzhcn@qq.com>
*/
use backend\assets\coinReleaseCheck\IndexAsset;
IndexAsset::register($this);
?>
<style type="text/css">
.layui-form-label{
.layui-form-label {
width: 60px;
padding: 0 0 0 0;
line-height: 40px;
text-align: center;
}
.layui-inline{
.layui-inline {
margin-bottom: 0;
margin-right: 10px;
}
......@@ -23,20 +26,21 @@ IndexAsset::register($this);
<div class="layui-row">
<table class="layui-table">
<thead>
<tr>
<th>币种</th>
<?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?>
<th><?=strtoupper($value);?></th>
<?php endforeach;?>
<?php endif;?>
</tr>
<tr>
<th>币种</th>
<?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?>
<th><?= strtoupper($value); ?></th>
<?php endforeach; ?>
<?php endif; ?>
</tr>
</thead>
<tbody>
<tr>
<td>高度</td>
<td>56646</td>
</tr>
<tr>
<td>高度</td>
<td>56646</td>
<td>56646</td>
</tr>
</tbody>
</table>
</div>
......@@ -53,9 +57,9 @@ IndexAsset::register($this);
<option value="">全部</option>
<?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?>
<option value="<?=strtoupper($value);?>"><?=strtoupper($value);?></option>
<?php endforeach;?>
<?php endif;?>
<option value="<?= strtoupper($value); ?>"><?= strtoupper($value); ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
......@@ -110,9 +114,9 @@ IndexAsset::register($this);
<option value="">全部</option>
<?php if (is_array($coins)): ?>
<?php foreach ($coins as $key => $value): ?>
<option value="<?=strtoupper($value);?>"><?=strtoupper($value);?></option>
<?php endforeach;?>
<?php endif;?>
<option value="<?= strtoupper($value); ?>"><?= strtoupper($value); ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
......@@ -121,8 +125,8 @@ IndexAsset::register($this);
<div class="layui-input-inline">
<select class="layui-select" name="check_first_uid">
<option value="">全部</option>
<?php if(!empty($check_firsts)): ?>
<?php foreach($check_firsts as $key => $value): ?>
<?php if (!empty($check_firsts)): ?>
<?php foreach ($check_firsts as $key => $value): ?>
<option value="<?= $key ?>"><?= $value ?></option>
<?php endforeach; ?>
<?php endif; ?>
......@@ -134,8 +138,8 @@ IndexAsset::register($this);
<div class="layui-input-inline">
<select class="layui-select" name="check_second_uid">
<option value="">全部</option>
<?php if(!empty($check_seconds)): ?>
<?php foreach($check_seconds as $key => $value): ?>
<?php if (!empty($check_seconds)): ?>
<?php foreach ($check_seconds as $key => $value): ?>
<option value="<?= $key ?>"><?= $value ?></option>
<?php endforeach; ?>
<?php endif; ?>
......@@ -175,39 +179,39 @@ IndexAsset::register($this);
<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>
{{# }else{ }}
{{# }else{ }}
<!-- 复核之后无法在初审 -->
{{# if(1==d.check_second_status){ }}
{{# if(1==d.check_first_status){ }}
<button class="layui-btn layui-btn-xs" lay-event="check_first">初审</button>
{{# }else if(2==d.check_first_status && 2!=d.check_seconf_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="check_first">初审(已通过)</button>
{{# }else if(3==d.check_first_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="check_first">初审(不通过)</button>
{{# } }}
{{# if(1==d.check_first_status){ }}
<button class="layui-btn layui-btn-xs" lay-event="check_first">初审</button>
{{# }else if(2==d.check_first_status && 2!=d.check_seconf_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="check_first">初审(已通过)</button>
{{# }else if(3==d.check_first_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="check_first">初审(不通过)</button>
{{# } }}
{{# }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_first_status){ }}
{{# if(1==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs" lay-event="check_second">复核</button>
{{# }else if(2==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="check_second">复核(已通过)</button>
{{# }else if(3==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="check_second">复核(不通过)</button>
{{# } }}
{{# if(1==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs" lay-event="check_second">复核</button>
{{# }else if(2==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-primary" lay-event="check_second">复核(已通过)</button>
{{# }else if(3==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="check_second">复核(不通过)</button>
{{# } }}
{{# }else{ }}
<button class="layui-btn layui-btn-xs layui-btn-disabled">复核</button>
{{# } }}
{{# } }}
{{# } }}
{{# if(2==d.check_second_status){ }}
<button class="layui-btn layui-btn-xs layui-btn-disabled">撤提</button>
{{# }else{ }}
......
......@@ -12,10 +12,10 @@ table.render({
page: 1,
limit: 10,
cols: [[
{field: "id", title: "ID"},
{field: "coin_name_en", title: '币种中文名'},
{field: "coin_name_zh", title: "币种英文名"},
{field: "address", title: "热钱包地址"},
{title: "操作", toolbar: "#toolbar"}
{field: 'id', title: 'ID'},
{field: 'coin_name_en', title: '币种中文名'},
{field: 'coin_name_zh', title: '币种英文名'},
{field: 'address', title: '热钱包地址'},
{title: '操作', toolbar: '#toolbar'}
]]
});
\ No newline at end of file
......@@ -18,7 +18,11 @@ var table_check = table.render({
{field: 'id', title: '流水编号'},
{field: 'mobile', title: '手机号'},
{field: 'coin', title: '币种'},
{field: 'amount', title: '数量'},
{
field: 'amount', title: '数量', templet: function (d) {
return d.amount / 1e8;
}
},
{field: 'to_address', title: '对方地址'},
{field: 'today', title: '该地址今日提币次数'},
{field: 'total', title: '该地址总操作数'},
......@@ -58,8 +62,8 @@ laydate.render({
});
form.on('submit(submit_check)', function (data) {
table.reload('table_check', {
page:{
curr:1
page: {
curr: 1
},
where: data.field
});
......@@ -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 data = obj.data;
if (event=='check_first') {
var index = layer.msg('审核通过?',{
if (event == 'check_first') {
var index = layer.msg('审核通过?', {
title: '审核',
btn: ['通过', '不通过', '取消'],
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);
if (0==rev.code) {
if (0 == rev.code) {
table_check.reload();
layer.close(index);
}
});
},
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);
if (0==rev.code) {
if (0 == rev.code) {
table_check.reload();
layer.close(index);
}
});
}
});
} else if('check_second'==event){
var index = layer.msg('复核通过?',{
} else if ('check_second' == event) {
var index = layer.msg('复核通过?', {
title: '复核',
btn: ['通过', '不通过', '取消'],
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);
if (0==rev.code) {
if (0 == rev.code) {
table_check.reload();
table_search.reload();
layer.close(index);
......@@ -117,23 +121,23 @@ table.on('tool(table_check)',function (obj) {
});
},
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);
if (0==rev.code) {
if (0 == rev.code) {
table_check.reload();
layer.close(index);
}
});
}
});
} else if('extract_cancel' == event){
var index = layer.msg('撤提该申请?',{
} else if ('extract_cancel' == event) {
var index = layer.msg('撤提该申请?', {
title: '撤提',
btn: ['撤提', '取消'],
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);
if (0==rev.code) {
if (0 == rev.code) {
table_check.reload();
table_search.reload();
layer.close(index);
......
......@@ -9,7 +9,9 @@
namespace h5\controllers;
use common\models\psources\Coin;
use common\models\psources\CoinExtract;
use common\models\psources\CoinPublishRule;
use common\models\psources\CoinReleaseCheck;
use common\models\psources\CoinReleaseMember;
use h5\base\ResponseBuild;
use Yii;
......@@ -55,4 +57,70 @@ class GuodunController extends BaseController
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