m_title = '用户提现'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'UserWithdraw/lists','status'=>1])->find()); $this->meta_title = '用户提现'; $wgc = D(self::model_name); $data = $wgc->lists($_GET['p'],$extend); $this->assign('list_data',$data['data']); $this->assign('_page',$data['page']); $map = array('status'=>1,'admin_status'=>0); $total = null_to_0($wgc->where($map)->sum('coin')); $ttotal = null_to_0($wgc->where('create_time' . total(1))->where($map)->sum('coin')); $mtotal = null_to_0($wgc->where('create_time' . total(3))->where($map)->sum('coin')); $poundage = null_to_0($wgc->where($map)->sum('poundage')); $this->assign('total', $total); $this->assign('ttotal', $ttotal); $this->assign('mtotal', $mtotal); $this->assign('poundage', $poundage); $this->display(); } public function del() { $this->update_status(I('request.ids'),-2); } public function set() { if(IS_POST) { $_POST['status']=1; $_POST['name']='withdraw'; R('Tool/saveTool'); } else { $tool = M('tool',"tab_")->where(['name'=>'withdraw'])->find(); if(empty($tool)){$this->error('没有此设置');} $this->assign('data',json_decode($tool['config'],true)); $this->m_title = '提现设置'; $this->meta_title = '提现设置'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'UserWithdraw/set','status'=>1])->find()); $this->display(); } } /** * 提现记录状态 */ public function update_status($ids='',$status=0){ $ids = $ids?$ids:I('request.ids'); $field = 'status'; if(empty($ids)){ $this->error('请选择要操作的数据'); } $map['id'] = array('in',$ids); switch ($status){ case -2 : /* 删除 */ $data = ['admin_status'=>1]; $msg = array('success'=>'删除成功','error'=>'删除失败'); break; case 0 : /* 禁用 */ $data = [$field=>0,'audit_time'=>0]; $msg = array('success'=>'禁用成功','error'=>'禁用失败'); break; case 1 : /* 成功 */ $data = [$field=>1,'audit_time'=>time()]; $msg = array('success'=>'打款成功','error'=>'打款失败'); break; case 2 : /* 驳回/拒绝 */ $data = [$field=>2,'audit_time'=>time()]; $msg = array('success'=>'驳回成功','error'=>'驳回失败'); //用户返回金币 $withdraw = D(self::model_name)->where(['id'=>$ids])->find(); $result = M('User','tab_')->where(['id'=>$withdraw['user_id']])->setInc('gold_coin',$withdraw['coin']); if(!$result){ $this->error('操作失败'); } break; default : $this->error('参数错误'); break; } if( D(self::model_name)->where($map)->save($data)!==false ) { $this->success($msg['success'],'',IS_AJAX); }else{ $this->error($msg['error'],'',IS_AJAX); } } }