Files
2020-08-06 15:26:41 +08:00

112 lines
3.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\system\controller;
use app\common\model\Member as MemberModel;
use app\common\model\Team as TeamModel;
use app\common\service\Team as TeamService;
use think\Request;
class Team extends _Init
{
/**
* 团队列表
* @param string $title 要搜索的团队标题
* @return [type] [description]
*/
public function index($title = '', $model = '')
{
$map['status'] = ['egt', 0];
if (!empty($title)) {
$map['title'] = ['like', "%$title%"];
}
if ($model) {
if ($model == 'Team') {
$map['uid'] = 0;
} else {
$map['uid'] = ['gt', 0];
}
}
$this->list = TeamModel::where($map)->paginate();
return $this->fetch();
}
/**
* 添加团队
* @param Request $Request 数据集
*/
public function add(Request $Request)
{
if (IS_POST) {
$data = $Request->post();
$result = TeamService::create($data);
return $this->back($result);
} else {
return $this->fetch();
}
}
/**
* 编辑团队
* @param Request $Request 数据集
* @param [type] $id 团队id
* @return [type] 返回 编辑的结果
*/
public function edit(Request $Request, $id)
{
if (IS_POST) {
$data = $Request->post();
$result = TeamService::edit($data);
return $this->back($result);
} else {
$this->info = TeamModel::get($id);
return $this->fetch('add');
}
}
/**
* 删除团队
* @param [type] $id 团队id
* @return [type] [description]
*/
public function del($id)
{
$result = TeamService::del($id);
return $this->back($result);
}
/**
* 修改团队状态
* @param [type] $id 团队id
* @param [type] $status 状态
* @return [type] 修改团队结果
*/
public function status($id, $status)
{
$result = TeamService::status($id, $status);
return $this->back($result);
}
public function check_team($team)
{
if ($team) {
$info = MemberModel::where('username', $team)->find();
if ($info) {
if ($info->status == 1) {
return $this->success('通过' . $info->username . "\n\r" . ' 姓名:' . $info->info->nickname, '', $info->id);
} else {
return $this->error('会员状态不正确');
}
} else {
return $this->error('会员不存在');
}
} else {
return $this->error('请输入会员手机号');
}
}
}