Commit 85290268 authored by ZhuChunYang's avatar ZhuChunYang

update

parent 10909296
......@@ -110,4 +110,46 @@ class CoinPublishController extends BaseController
}
return ['code' => -1, 'msg' => 'failed'];
}
public function actionSetAutoCheck()
{
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = 'json';
$request = Yii::$app->request;
$id = $request->get('id', '');
$enable = $request->get('enable',1);
if($id){
$publish = CoinPublish::getPublish($id);
if(!$publish){
return ['code' => 1,'msg' =>'币种监控不存在,不能设置自动审核'];
}
$publish->auto_check = $enable;
$publish->save();
return ['code' => 0,'msg' => '自动审核设置成功'];
}else{
return ['code' => 1 ,'msg' => '自动审核设置失败'];
}
}
}
public function actionSetLimit()
{
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = 'json';
$request = Yii::$app->request;
$id = $request->get('id', '');
$auto_check_limit = $request->get('auto_check_limit');
if($id && $auto_check_limit){
$publish = CoinPublish::getPublish($id);
if(!$publish){
return ['code' => 1,'msg' =>'币种监控不存在,不能设置自动审核'];
}
$publish->auto_check_limit = $auto_check_limit;
$publish->save();
return ['code' => 0,'msg' => '自动审核上限值设置成功'];
}else{
return ['code' => 1 ,'msg' => '自动审核上限值设置失败'];
}
}
}
}
\ No newline at end of file
......@@ -34,7 +34,6 @@
<label class="layui-form-label" style="width: 110px;">类型</label>
<div class="layui-input-block">
<select name="type" class="layui-input">
<option value="0"></option>
<option value="1">按锁仓总量释放</option>
<option value="2">按锁仓余量释放</option>
</select>
......
......@@ -34,7 +34,6 @@
<label class="layui-form-label" style="width: 110px;">类型</label>
<div class="layui-input-block">
<select name="type" class="layui-input">
<option value="0"></option>
<option value="1">按锁仓总量释放</option>
<option value="2">按锁仓余量释放</option>
</select>
......
......@@ -28,4 +28,7 @@ IndexAsset::register($this);
<?php if ($is_show_button): ?>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
<?php endif; ?>
</script>
<script type="text/html" id="autoCheckTpl">
<input type="checkbox" name="auto_check" value="{{d.id}}" lay-skin="switch" lay-text="是|否" lay-filter="autoCheckDemo" {{ d.auto_check == 1 ? 'checked' : '' }}>
</script>
\ No newline at end of file
......@@ -17,6 +17,13 @@ table.render({
return d.amount / 1e8;
}
},
{field: 'auto_check_limit', title: '自动审核上限值', edit: 'text'},
{
title: '自动审核',
field: 'auto_check',
templet: '#autoCheckTpl',
width: 100
},
{toolbar: '#toolbar', title: '操作'}
]],
});
......@@ -99,4 +106,35 @@ $('#add').click(function () {
});
return false;
});
var form = layui.form;
form.render();
form.on('switch(autoCheckDemo)', function(obj){
var enable = 1;
if(obj.elem.checked){
enable = 1
}else{
enable = 0;
}
$.get('/admin/coin-publish/set-auto-check', {id:this.value,enable:enable}, function(rev) {
layer.msg(rev.msg);
if (0 == rev.code) {
}else{
}
});
});
//监听单元格编辑
table.on('edit(table1)', function(obj){
var value = obj.value; //得到修改后的值
var data = obj.data; //得到所在行所有键值
$.get('/admin/coin-publish/set-limit', {id:data.id,auto_check_limit:value}, function(rev) {
layer.msg(rev.msg);
if (0 == rev.code) {
table.reload('table1',{});
}else{
}
});
});
\ No newline at end of file
......@@ -31,4 +31,10 @@ class CoinPublish extends BaseActiveRecord
return '{{%coin_publish}}';
}
public static function getPublish($id)
{
return self::find()->where(['id' => $id])->one();
}
}
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