You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
4.2 KiB
PHTML

5 years ago
<?php
namespace Admin\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class SupportController extends ThinkController {
public function lists($p=1){
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(I('promote_id')){
$map['promote_id']=I('promote_id');
}
if(I('game_id')){
$map['game_id']=I('game_id');
}
if(!empty(I('apply_type')) || I('apply_type')==='0'){
$map['apply_type']=I('apply_type');
}
//
if(!empty(I('apply_status')) || I('apply_status')==='0'){
$map['apply_status']=I('apply_status');
5 years ago
}
/* 获取频道列表 */
$list = M('test_resource','tab_')
->field('*')
5 years ago
->where($map)
->order('id desc')
->page($page,$row)
->select();
$count = M('test_resource','tab_')->where($map)->count();
5 years ago
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $list);
$this->assign('is_admin', is_administrator());
$this->meta_title = '资源发放';
5 years ago
$this->display();
}
//改变审核状态
// public function change(){
// if (empty(I('id'))) {
// $this->error('请选择要操作的数据!');
// }
// $map['id']=I('id');
// $data['status']=I('status');
// $data['check_time']=time();
// $res=M('support','tab_')->where($map)->save($data);
// if($res!==false){
// $this->success('操作成功');
// }else{
// $this->error('操作失败');
// }
// }
5 years ago
//通知渠道
public function notice_pro(){
if (empty(I('id'))) {
$this->ajaxReturn(['status'=>0,'msg'=>'请选择要操作的数据!']);
}
if( I('verify_resource') < 0){
5 years ago
$this->ajaxReturn(['status'=>0,'msg'=>'实际发放数量不正确!']);
}
$map['id']=I('id');
$support=M('test_resource','tab_')->field('apply_resource,apply_status')->find($map['id']);
if($support['apply_status'] !=0 ){
$this->ajaxReturn(['status'=>0,'msg'=>'请勿重复提交!']);
5 years ago
}
if($support['apply_resource'] < I('verify_resource') ){
5 years ago
$this->ajaxReturn(['status'=>0,'msg'=>'实际发放数量不能大于申请额度!']);
}
$data['verify_remark']=I('verify_remark');
$data['verify_resource']=I('verify_resource');
$data['verify_time']=time();
$data['apply_status']=2;
$res=M('test_resource','tab_')->where($map)->save($data);
5 years ago
if($res!==false){
$this->ajaxReturn(['status'=>1,'msg'=>'操作成功!']);
}else{
$this->ajaxReturn(['status'=>0,'msg'=>'操作失败!']);
}
}
//填写拒绝理由
public function refuse_notice(){
if (empty(I('id'))) {
$this->ajaxReturn(['status'=>0,'msg'=>'请选择要操作的数据!']);
}
$map['id']=I('id');
$support=M('test_resource','tab_')->field('verify_resource,apply_status')->find($map['id']);
if($support['apply_status'] !=0 ){
$this->ajaxReturn(['status'=>0,'msg'=>'请勿重复提交!']);
}
$data['verify_remark']=I('verify_remark');
$data['verify_time']=time();
$data['apply_status']=1;
$res=M('test_resource','tab_')->where($map)->save($data);
5 years ago
if($res!==false){
$this->ajaxReturn(['status'=>1,'msg'=>'操作成功!']);
}else{
$this->ajaxReturn(['status'=>0,'msg'=>'操作失败!']);
}
}
// //设置自动审核
// public function set_config_auto_audit($val='',$config_key='')
// {
// $config['value'] = $val;
// $res = M('config')->where(array('name'=>$config_key))->save($config);
// S('DB_CONFIG_DATA',null);
// if($res !== false){
// $this->success('操作成功');
// }else{
// $this->error('操作失败');
// }
// }
5 years ago
}