order('id', 'desc'); if($username = $request->get('username')) { $query->where('username', $username); } if($status = $request->get('status')) { $query->where('status', $status); } if($is_order = $request->get('is_order')) { $query->where('is_order', $is_order); } $list = $query->with(['orderInfo'])->paginate($request->get('limit',10)); foreach ($list as &$val) { if ($val['code_pic']) { $val['code_pic'] = json_decode($val['code_pic'], true); $val['code_pic_show'] = $val['code_pic'][0]; } } return $this->success($list,null,['oss' => array_values(array_map(function ($os, $k) { return ['id' => $k, 'os' => $os]; }, Orders::OSS, array_keys(Orders::OSS)))]); } /** * @param Request $request * @return \support\Response * @throws \think\db\exception\DbException */ public function updateStatus(Request $request) { if (!$request->post('id')) { return $this->error('请选择预约记录'); } OrderBooks::where('id', $request->post('id'))->update(['status' => 1]); return $this->success([]); } }