企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ public function index(Request $request) { if (request()->user->notCanPermission('course_order')) { throw new NotPermissionException(); } $company_id = $request->user->company_id?:$request->param('company_id'); $fitness_id = $request->user->fitness_id?:$request->param('fitness_id'); $type = 1; $mobile = $request->param('mobile'); $status = $request->param('status'); $list_rows = $request->param('list_rows')?:10; $condition_where = ''; if (!empty($fitness_id)) $condition_where .= " and a.fitness_id = ".$fitness_id; if (!empty($company_id)) $condition_where .= " and c.company_id = ".$company_id; if (!empty($type)) $condition_where .= " and a.type = ".$type; $query = CourseOrders::alias('a') ->field('a.id,a.user_id,a.order_id,a.order_time,a.course_plan_id,a.type,a.sign_time,a.trainer_id,a.fitness_id,a.status,a.is_star') // ->field('a.*') ->field('b.name as user_name,b.mobile') ->field('d.trainername as trainer_name') ->field('f.name as course_types_name') ->field('e.start_time,e.end_time') ->join('xa_ninty9_user b','a.user_id = b.id') ->join('xa_fitness c','a.fitness_id = c.id'.$condition_where) ->join('xa_trainer d','a.trainer_id = d.id') ->join('xa_course_group_plans e','a.course_plan_id = e.id') ->join('xa_course_types f','e.course_type_id = f.id'); if (!empty($mobile)) { $query->where('b.mobile','like','%'.$mobile.'%'); } if (!empty($status)) { $query->where('a.status','=',$status); } $courseOrders = $query->paginate($list_rows); foreach ($courseOrders as $courseOrder) { $courseOrder->user_name = htmlentities(base64_decode($courseOrder->user_name)); $courseOrder->start_time_date = $courseOrder->start_time?date('Y-m-d H:i:s',$courseOrder->start_time):'未预约'; $courseOrder->sign_time_date = $courseOrder->sign_time?date('Y-m-d H:i:s',$courseOrder->sign_time):'未签到'; $courseOrder->end_time_date = $courseOrder->end_time?date('Y-m-d H:i:s',$courseOrder->end_time):'未结束'; } $this->success($courseOrders); } ~~~