diff --git a/Application/Admin/Controller/TestResourceController.class.php b/Application/Admin/Controller/TestResourceController.class.php index 16f50df8b..22169c4a3 100644 --- a/Application/Admin/Controller/TestResourceController.class.php +++ b/Application/Admin/Controller/TestResourceController.class.php @@ -112,6 +112,60 @@ class TestResourceController extends ThinkController } + public function batchFreeze() { + + if (I('id','')) { + $id =I('id',''); + } else { + $this->error('请选择资源后再进行操作'); + } + + $resourceData = M('test_resource','tab_') + ->field("promote_id") + ->where(['id'=>['in',$id]]) + ->select(); + + $resourceData = array_column($resourceData,'promote_id'); + + $promoteId = []; + + foreach ($resourceData as $key => $value) { + + $promoteData = M('promote','tab_') + ->field('id') + ->where("chain like '%/{$value}/%' or id = {$value}") + ->select(); + $promoteId = array_merge($promoteData, $promoteId); + } + + $promoteId = implode(',',array_column($promoteId,'id')); + + $testResource = M('test_resource','tab_') + ->field("user_id") + ->where(['promote_id'=>['in',$promoteId]]) + ->group('user_id') + ->select(); + + $data = [ + 'lock_status' => 0 + ]; + + $user_id = implode(',',array_column($testResource,'user_id')); + + $isFreeze = M('user','tab_')->where(['id'=>['in',$user_id]])->save($data); + + if ($isFreeze) { + + $this->success('冻结成功',U('index')); + + } else { + + $this->error('冻结失败',U('index')); + + } + + } + public function freezeSupport() { $supportId = I('support_id', 0); if ($supportId == 0) { diff --git a/Application/Admin/View/TestResource/index.html b/Application/Admin/View/TestResource/index.html index cfa496488..483c0b212 100644 --- a/Application/Admin/View/TestResource/index.html +++ b/Application/Admin/View/TestResource/index.html @@ -92,8 +92,10 @@
@@ -471,6 +473,35 @@ window.location.href = url; }); + + $('#batch_freeze').click(function () { + var ids = $('.ids:checked'); + + if (ids.length > 0) { + var str = new Array(); + ids.each(function () { + str.push($(this).val()); + }); + param = str.join(','); + } else { + layer.msg('请选择要操作的数据',{skin:'textColor'}); + return false; + } + var url = "{:U('batchFreeze','','')}" + '/id/' + param; + + layer.confirm('是否冻结整个渠道链的资源账号?', { + title:'冻结该渠道', + icon:0, + btn: ['删除','取消'] //按钮 + }, function(){ + + window.location.href = url; + + }, function(){ + layer.close(); + }); + + });