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.

115 lines
3.9 KiB
PHP

<?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('support_type')) || I('support_type')==='0'){
$map['support_type']=I('support_type');
}
/* 获取频道列表 */
$list = M('support','tab_')
->field('id,promote_id,promote_account,user_id,user_account,game_id,game_name,server_name,role_name,support_num,support_type,create_time,status,notice_status,remarks,real_support_num')
->where($map)
->order('id desc')
->page($page,$row)
->select();
$count = M('support','tab_')->where($map)->count();
//分页
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $list);
$this->meta_title = '扶持发放';
$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('操作失败');
}
}
//通知渠道
public function notice_pro(){
if (empty(I('id'))) {
$this->ajaxReturn(['status'=>0,'msg'=>'请选择要操作的数据!']);
}
if( I('real_support_num') < 0){
$this->ajaxReturn(['status'=>0,'msg'=>'实际发放数量不正确!']);
}
$map['id']=I('id');
$support=M('support','tab_')->field('support_num,status')->find($map['id']);
if($support['status'] !=2 ){
$this->ajaxReturn(['status'=>0,'msg'=>'未审核通过!']);
}
if($support['support_num'] < I('real_support_num') ){
$this->ajaxReturn(['status'=>0,'msg'=>'实际发放数量不能大于申请额度!']);
}
$data['opinion']=I('opinion');
$data['notice_status']=1;
$data['real_support_num']=I('real_support_num');
$res=M('support','tab_')->where($map)->save($data);
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('support','tab_')->field('support_num,status')->find($map['id']);
$data['opinion']=I('opinion');
$data['notice_status']=1;
$data['status']=0;
$data['check_time']=time();
$res=M('support','tab_')->where($map)->save($data);
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('操作失败');
}
}
}