scheduleService = new ScheduleService(); } public function getSchedule() { // 解决跨域请求接口问题 header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies header('Access-Control-Expose-Headers: *'); //服务器 headers 白名单,可以让客户端进行访问 header('Access-Control-Allow-Headers: *'); $param['match_id'] = $this->request->param('match_id'); if (!$param['match_id']) { $this->error(__('赛事id不可为空!')); } $matchSchedules = $this->scheduleService->getByWhere($param); if (@$matchSchedules) { $result['code'] = 1; $result['data'] = $matchSchedules; $result['msg'] = "获取成功"; } else { $result['code'] = 1; $result['data'] = $matchSchedules; $result['msg'] = "获取失败"; } return json($result); } }