www_fpvone_cn/application/index/controller/Complain.php

63 lines
1.9 KiB
PHP

<?php
namespace app\index\controller;
use app\common\controller\Frontend;
use addons\third\library\Wechat;
use app\admin\model\Userwechat;
use think\Session;
use think\Config;
use app\admin\model\Renzheng;
use app\admin\model\ClubComplain;
use app\common\model\Players;
class Complain extends Frontend
{
protected $noNeedLogin = '*';
protected $noNeedRight = '*';
protected $layout = '';
public function index()
{
return $this->view->fetch();
}
public function confirmed_player(){
$user_id = $this->auth->id;
$player = new Players();
$player_info = $player->where("member_id", $user_id)->find();
if (empty($player_info)){
$this->error(__("请先申请成为飞手!"), url('players/registeredflyers')) ;
}
if ($player_info['player_status'] != 9){
$this->error(__("您还不是正式飞手!"), url('user/index'));
}
}
//飞手申诉
public function player_complain(){
$this->confirmed_player();
$user_id = $this->auth->id;
$player = new Players();
$player_info = $player->where("member_id", $user_id)->find();
$complain_text = $this->request->param('complain_text');
$clubcomplain = new ClubComplain();
$complain_res = $clubcomplain->where('player_id',$player_info['id'])->find();
// if(!empty($complain_res)) $this->error('您已提交过申诉');
if(empty($complain_text)) $this->error("申诉内容不能为空");
$clubcomplain->save([
'player_name' =>$player_info['real_name'],
'player_tel' => $player_info['phone'],
'player_id' => $player_info['id'],
'user_id' => $user_id,
'com_content'=> $complain_text,
'createtime' => time(),
]);
$this->success('提交成功',url('players/index'));
}
}