Commit 3e593713 authored by ZhuChunYang's avatar ZhuChunYang

添加币种配置批量删除

parent 56e68b1b
...@@ -387,15 +387,14 @@ class CoinController extends BaseController ...@@ -387,15 +387,14 @@ class CoinController extends BaseController
} }
return ['code' => 0, 'msg' => '复制成功']; return ['code' => 0, 'msg' => '复制成功'];
} }
return ['code' => -1, 'msg' => '没有权限修改']; return ['code' => -1, 'msg' => '没有权限复制'];
} }
} }
public function actionPackageBatchDel() public function actionPackageBatchDel()
{ {
if (Yii::$app->request->isAjax) { if (Yii::$app->request->isAjax) {
/* Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
$get = Yii::$app->request->get(); $get = Yii::$app->request->get();
$platform_id = $get['platform_id'] ?? ''; $platform_id = $get['platform_id'] ?? '';
$coin_ids = $get['coin_ids'] ?? ''; $coin_ids = $get['coin_ids'] ?? '';
...@@ -411,14 +410,14 @@ class CoinController extends BaseController ...@@ -411,14 +410,14 @@ class CoinController extends BaseController
$coin = Coin::getOneById($id); $coin = Coin::getOneById($id);
if($coin){ if($coin){
$platform_ids = explode(',',$coin->platform_id); $platform_ids = explode(',',$coin->platform_id);
$platform_ids = implode(',', array_unique(array_merge($platform_ids, [$platform_id]))); $platform_ids = implode(',', array_diff($platform_ids, [$platform_id]));
$coin->platform_id = $platform_ids; $coin->platform_id = $platform_ids;
$coin->save(); $coin->save();
} }
} }
return ['code' => 0, 'msg' => '复制成功']; return ['code' => 0, 'msg' => '批量删除成功'];
} }
return ['code' => -1, 'msg' => '没有权限修改'];*/ return ['code' => -1, 'msg' => '没有权限删除'];
} }
} }
} }
...@@ -217,27 +217,32 @@ table.on('toolbar(table1)', function(obj) { ...@@ -217,27 +217,32 @@ table.on('toolbar(table1)', function(obj) {
} }
}); });
}else if(event == 'batch_del'){ }else if(event == 'batch_del'){
var checkStatus = table.checkStatus('table1') var index = layer.confirm("确认删除?", {
,data = checkStatus.data; icon: 3,
var coin_ids = ""; title: '删除'
$.each(data,function(index,value){ }, function() {
if(coin_ids){ var checkStatus = table.checkStatus('table1')
coin_ids +=","+value.id ; ,data = checkStatus.data;
}else{ var coin_ids = "";
coin_ids = value.id; $.each(data,function(index,value){
} if(coin_ids){
}); coin_ids +=","+value.id ;
var platform_id = $("select[name='platform_id']").val(); }else{
$.get('/admin/coin/package-batch-del', {coin_ids:coin_ids,platform_id:platform_id}, function(rev) { coin_ids = value.id;
layer.msg(rev.msg); }
if (0 == rev.code) { });
layer.close(index); var platform_id = $("select[name='platform_id']").val();
table.reload('table1', { $.get('/admin/coin/package-batch-del', {coin_ids:coin_ids,platform_id:platform_id}, function(rev) {
page: { layer.msg(rev.msg);
curr: 1 if (0 == rev.code) {
} layer.close(index);
}); table.reload('table1', {
} page: {
curr: 1
}
});
}
});
}); });
} }
}); });
......
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