screenService = new ScreenService(); } public function addScreen() { $param['title'] = $this->request->param("title"); $param['look_pwd'] = $this->request->param("password"); $param['match_id'] = $this->request->param("match_id"); $param['backound_img'] = $this->request->param("backound_img", ""); $param['nopass'] = $this->request->param("nopass"); $param['font_rgb'] = $this->request->param("font_rgb"); $param['type'] = $this->request->param("type"); $rule = [ 'title' => 'require', 'match_id' => 'require', ]; $msg = [ 'title.require' => '标题不可为空', 'match_id.require' => '赛程数据不可为空', ]; $validate = new Validate($rule, $msg); $result = $validate->check($param); if (!$result) { $this->error(__($validate->getError()), null, ['token' => $this->request->token()]); } $res = $this->screenService->addScreen($param); if (!empty($res)) { $row['code'] = 1; $row['data'] = []; $row['msg'] = "保存成功"; } else { $row['code'] = 0; $row['data'] = []; $row['msg'] = "保存失败"; } return json($row); } public function getScreen() { $param['match_id'] = $this->request->param("match_id"); $param['type'] = $this->request->param("type"); $res = $this->screenService->getScreen($param); if (!empty($res)) { $row['code'] = 1; $row['data'] = $res; $row['msg'] = "获取成功"; } else { $row['code'] = 0; $row['data'] = []; $row['msg'] = "获取失败"; } return json($row); } }