192 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			192 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace app\api\controller\school\newactivity;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\api\controller\school\Base;
							 | 
						||
| 
								 | 
							
								use app\common\model\school\activity\Join;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 用户参加成员管理
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class ActivityJoin extends Base
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    protected $noNeedLogin = [];
							 | 
						||
| 
								 | 
							
								    protected $noNeedRight = '*';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    protected $model = null;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 初始化操作
							 | 
						||
| 
								 | 
							
								     * @access protected
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    protected function _initialize()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								//        $this->transactionCheck();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->model = new Join;
							 | 
						||
| 
								 | 
							
								        parent::_initialize();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//        $this->setUrlLock();
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle( 成员列表接口)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(成员列表接口)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(GET)
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "page", type = "string",required=true,description = "页数")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function people_list()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $user_id = 0;
							 | 
						||
| 
								 | 
							
								        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $params = [];
							 | 
						||
| 
								 | 
							
								        $params['user_id'] = $user_id;
							 | 
						||
| 
								 | 
							
								        $page  =  $this->request->get('page/d', 0); //页数
							 | 
						||
| 
								 | 
							
								        $limit =  $this->request->get('limit/d', 0); //条数
							 | 
						||
| 
								 | 
							
								        $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//        $params["time"] =  $this->request->get('time/s', ''); //时间
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            //当前申请状态
							 | 
						||
| 
								 | 
							
								            $res = $this->model::joinList($page, $limit,$params);
							 | 
						||
| 
								 | 
							
								//            if($user_id =='670153'){
							 | 
						||
| 
								 | 
							
								//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
							 | 
						||
| 
								 | 
							
								//            }
							 | 
						||
| 
								 | 
							
								        }catch (\Exception $e){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('查询成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle( 成员详情)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(成员详情)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(GET)
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "id", type = "int",required=true,description = "成员id")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function detail(){
							 | 
						||
| 
								 | 
							
								        $id = $this->request->get('id/d','');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if(empty($id)){
							 | 
						||
| 
								 | 
							
								            $this->error(__('缺少必要参数'));
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try {
							 | 
						||
| 
								 | 
							
								            $res =  $this->model->detail($id);
							 | 
						||
| 
								 | 
							
								        } catch (\Exception $e){
							 | 
						||
| 
								 | 
							
								//            Log::log($e->getMessage());
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage(),['errcode'=>$e->getCode()]);
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('获取成功', ['detail' => $res]);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * 删除成员
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @ApiMethod (POST)
							 | 
						||
| 
								 | 
							
								     * @ApiParams (name="ids", type="string", required=true, description="要删除的ids")
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function del()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								//        $admin_id = $this->auth->id;
							 | 
						||
| 
								 | 
							
								        $ids = $this->request->post('ids/s');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $menulist = $this->model->del($ids,true);
							 | 
						||
| 
								 | 
							
								        } catch (\Exception $e) {
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $this->success('删除成功', $menulist);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle(添加成员)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(添加成员)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(POST)
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "name", type = "int",required=true,description = "姓名")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function add(){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $user_id = 0;
							 | 
						||
| 
								 | 
							
								        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        $params = [];
							 | 
						||
| 
								 | 
							
								        $params["user_id"]  = $user_id; //老师id
							 | 
						||
| 
								 | 
							
								        $params["name"] =  $this->request->post('name/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								        $params["idnum"] =  $this->request->post('idnum/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $res = $this->model->add($params,true);
							 | 
						||
| 
								 | 
							
								        }catch (\Throwable $e){
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('添加成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @ApiTitle(编辑成员)
							 | 
						||
| 
								 | 
							
								     * @ApiSummary(编辑成员)
							 | 
						||
| 
								 | 
							
								     * @ApiMethod(POST)
							 | 
						||
| 
								 | 
							
								     * @ApiRoute    (/api/school.newactivity.activity_join/edit/ids/{ids})
							 | 
						||
| 
								 | 
							
								     * @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "name", type = "int",required=true,description = "姓名")
							 | 
						||
| 
								 | 
							
								     * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号")
							 | 
						||
| 
								 | 
							
								     * @ApiReturn({
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     *})
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function edit($ids = null){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        $user_id = 0;
							 | 
						||
| 
								 | 
							
								        $user = $this->auth->getUser();//登录用户
							 | 
						||
| 
								 | 
							
								        if($user)$user_id = $user['id'];
							 | 
						||
| 
								 | 
							
								        $params = [];
							 | 
						||
| 
								 | 
							
								        $params["user_id"]  = $user_id; //老师id
							 | 
						||
| 
								 | 
							
								        $params["name"] =  $this->request->post('name/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								        $params["idnum"] =  $this->request->post('idnum/s', ''); //课程标签
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try{
							 | 
						||
| 
								 | 
							
								            $res = $this->model->edit($ids,$params,true);
							 | 
						||
| 
								 | 
							
								        }catch (\Throwable $e){
							 | 
						||
| 
								 | 
							
								            $this->error($e->getMessage());
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $this->success('编辑成功', $res);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |