success('获取成功',TrainingModel::lst($where)); } public function apply(Request $request) { $where = UtilService::postMore( [ ['training_id',0], ['user_id',$this->auth->getUserinfo()['id']], ['cid',$this->cid], ['name',''], ['Phone',''], ['num',0], ],$request ); if($where['training_id']==0) $this->error('活动编号不能为空'); if($where['name']=='') $this->error('姓名不能为空'); if($where['Phone']=='') $this->error('电话不能为空'); if($where['num']==0) $this->error('人数不能为0'); if(TrainingInfo::Where('training_id',$where['training_id'])->where('user_id',$where['user_id'])->find()) $this->error('已报名,不能重复报名!'); $rs = TrainingInfo::create($where); $this->success('创建成功',$rs); } public function mylst(Request $request) { $where = UtilService::getMore( [ ['cid',$this->cid], ['user_id',$this->auth->getUserinfo()['id']], ['page',1], ['limit',10], ] ); return $this->success('获取成功',TrainingInfo::lst($where)); } public function view() { $id = input('id',0); if($id==0) $this->error('参数错误!'); $rs = TrainingModel::info($id); if(!$rs)$this->error(TrainingModel::getErrorInfo()); return $this->success('获取成功',$rs); } }