function ($params) { return [ 'filters' => [ // ['field' => '***', 'operator' => '=', 'value' => '***'] ], 'fields' => ['id', 'vehicle_data_id', 'apply_status', 'desc', 'created_at', 'updated_at'], 'relations' => [ 'vehicleDataInfo.translation' => ['vehicle_id', 'name'] ], 'sorts' => [ ['field' => 'id', 'direction' => 'desc'] ], 'pagination' => [ 'page' => $params['page'] ?? 1, 'per_page' => $params['per_page'] ?? 10, ] ]; } ]; } /** * 操作审核 */ public function doApply(array $data, int $id): bool { $info = $this->model->where('id', $id)->first(); if (!$info) { throw new BusinessException('未找到待审核信息', 404); } $info->apply_status = $data['apply_status']; $info->desc = $data['desc']; $info->admin_id = 1; $vDataInfo = VehicleDataModel::where('id', $info->vehicle_data_id)->first(); if (!$vDataInfo) { throw new BusinessException('未找到审核信息关联的车辆信息', 404); } $vDataInfo->info_status = $data['apply_status']; if (!$info->save() || !$vDataInfo->save()) { throw new BusinessException('审核失败,请重试', 500); } return true; } }