gate("订单管理-自动冻结"); $freezes = OrderFreeze::query()->with(["logistic:id,name","province:id,name","city:id,name","location:id,name"]) ->orderByDesc("id")->where("status",0) ->paginate(request("paginate") ?? 50); return view("order.index.freeze",compact("freezes")); } public function store() { $this->gate("订单管理-自动冻结"); $freeze = OrderFreeze::query()->where("logistic_id",request("logistic_id")) ->where("province_id",request("province_id")) ->where("city_id",request("city_id"))->where("status",0) ->where("location_id",request("location_id"))->first(); if ($freeze && $freeze->id!=request("id"))$this->error("已存在冻结选项,无需重复录入"); $obj = [ "logistic_id" => request("logistic_id"), "province_id" => request("province_id"), "city_id" => request("city_id"), "location_id" => request("location_id"), ]; if (request("id")){ $freeze = OrderFreeze::query()->find(request("id")); $freeze->update($obj); }else $freeze = OrderFreeze::query()->create($obj); app("OrderFreezeService")->refreshFreezes(); $freeze->load(["logistic:id,name","province:id,name","city:id,name","location:id,name"]); $this->success($freeze); } public function delFreeze() { $this->gate("订单管理-自动冻结"); if (!request("id"))$this->error("非法参数"); OrderFreeze::query()->where("id",request("id"))->update(["status"=>1]); app("OrderFreezeService")->refreshFreezes(); $this->success(); } }