www_fpvone_cn/application/admin/controller/user/Club.php

161 lines
4.9 KiB
PHP
Raw Normal View History

2024-12-20 12:29:51 +08:00
<?php
namespace app\admin\controller\user;
use app\common\controller\Backend;
use app\admin\model\User;
/**
*
*
* @icon fa fa-circle-o
*/
class Club extends Backend
{
/**
* Club模型对象
* @var \app\admin\model\user\Club
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\user\Club;
}
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
public function show($ids = null){
$row = $this->model->get($ids);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
// if ($this->request->isPost()) {
// $this->token();
// }
// if ($this->request->param('player_id')){
// $ids = $this->request->param('player_id');
// }
$row = $this->model->get($ids);
// var_dump( $rows);exit;
if ($this->request->isAjax()) {
$audit_status = $this->request->post('status');
$reason = $this->request->post('reject_reason', null);
if ($audit_status != 0 && $reason == null){
$this->error("请填写审核内容!");
}
switch ($audit_status){
case 0:
$audit_status = 9; //通过
// $user = new User();
// $user_res = $user->where('id',$row['user_id'])->find();
// // var_dump($user_res->nickname);exit;
// if (!empty($user_res->mobile)) {
// $alisms = new \addons\alisms\library\Alisms();
// $config = get_addon_config('alisms');
// $template = "SMS_465371899";
// $sign = $config['sign'];
// // var_dump($sign);exit;
// $param = [
// 'nickname' => $user_res->nickname,
// // 'content' => "已经过确认和审核,你可以进行赛事报名。"
// ];
// $res = $alisms->mobile($user_res->mobile)
// ->template($template)
// ->sign($sign)
// ->param($param)
// ->send();
// // var_dump($res);exit;
// }
$this->model->update(['id' => $ids, 'status' => $audit_status, 'reject_reason' => '']);
break;
case 1:
$audit_status = 2; //退回修改
$this->model->update(['id' => $ids, 'status' => $audit_status, 'reject_reason' => $reason]);
break;
case 2:
$audit_status = 3; //拒绝
$this->model->update(['id' => $ids, 'status' => $audit_status, 'reject_reason' => $reason]);
break;
}
// $this->model->update(['id' => $ids, 'status' => $audit_status]);
$this->success();
}
// if ($row['status'] == 9 ){
// $row['status'] = 0;
// }
// if ($row['status'] == 2 ){
// $row['status'] = 1;
// }
// if ($row['status'] == 3 ){
// $row['status'] = 2;
// }
if ($this->request->param('player_id')){
$row['is_show'] = 1;
}
$this->modelValidate = true;
if (!$row) {
$this->error(__('No Results were found'));
}
// $this->view->assign('groupList', build_select('row[group_id]', \app\admin\model\UserGroup::column('id,name'), $row['member']['group_id'], ['class' => 'form-control selectpicker']));
$this->view->assign('row', $row);
return $this->view->fetch();
}
public function save_asfc_cert()
{
$id = $this->request->post("id");
$photo = $this->request->post("style_photo");
$row = $this->model->update(['id' => $id, 'asfc_cert' => $photo]);
if ($row) {
$this->success("保存成功");
} else {
$this->error("保存失败");
}
}
}