"宝时单号", * "destination" =>"目的地", * "recipient" =>"收件人", * "recipient_mobile"=>"收件人电话", * "carrier_bill"=>"承运商单号", * "carrier_name"=>"承运商", * "warehouse_weight"=>"预估体积", * "carrier_weight"=>"实际体积", * "inquire_tel"=>"查件电话", * "warehouse_weight_other"=>"预估重量", * "carrier_weight_other"=>"实际重量", * "amount"=>"数量", * "amount_unit_name"=>"数量单位", * "origination"=>"提货仓" * "subjoin_fee"=>"附加费" * } * ] * } */ public function getData(AndroidGateRequest $request) { $search = $request->input("search"); $deliverAt = $request->input("deliver_at"); $page = $request->input("page",1); $paginate = $request->input("paginate",20); /** @var WaybillService $service */ $service = app("WaybillService"); $query = $service->getDispatchQuery()->orderByDesc("deliver_at"); if ($search)$query->where(function ($query)use($search){ $query->where("waybill_number","like","%{$search}%") ->orWhere("carrier_bill","like","%{$search}%"); }); if ($deliverAt)$query->where("deliver_at","like",$deliverAt."%"); /** @var Collection $waybills */ $waybills = $query->paginate($paginate,'*', 'page',$page)->append(["carrier_name","amount_unit_name","remove_relation"]); $result = []; if ($waybills->count()>0){ $startDate = substr($waybills->first()->deliver_at,0,10); $endDate = substr($waybills->last()->deliver_at,0,10); $sql = <<date] = $item->sum!==null ? round((double)$item->sum) : 0.0; } } $this->response(["waybills"=>$waybills,"mapping"=>$result]); } /** * @api {post} /waybill/dispatch 修改调度信息 * @apiName updateDispatch * @apiGroup Waybill * * @apiParam {int} id 唯一码 * @apiParam {string} carrier_bill 物流单号 * @apiParam {string} inquire_tel 查件电话 * @apiParam {int} amount 货品数量 * @apiParam {string} amount_unit_name 数量单位(件/托) * @apiParam {number} carrier_weight_other 重量/KG * @apiParam {number} carrier_weight 体积/M³ * @apiParam {string} subjoin_fee 附加费描述 * * @apiSuccess {string} message 响应描述 * @apiSuccess {int} status_code HTTP响应码 * @apiSuccess {bool} data 结果 * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * { * "message": "请求成功", * "status_code": "200" * "data":true * } * */ public function dispatch(WaybillDispatch $request) { $result = Waybill::query()->where("id",$request->input("id")) ->update($request->validated()); if ($result==0)$this->response(false,204,"单据状态发生变化,修改失败"); $this->response(true); } /** * @api {post} /waybill/dispatch/dailyBilling 修改每日专线费 * @apiName dailyBilling * @apiGroup Waybill * * @apiParam {string} deliver_at 发货时间 * @apiParam {number} fee 费用 * * @apiSuccess {string} message 响应描述 * @apiSuccess {int} status_code HTTP响应码 * @apiSuccess {bool} data 结果 * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * { * "message": "请求成功", * "status_code": "200" * "data":true * } */ public function dailyBilling(AndroidGateRequest $request) { $deliverAt = $request->input("deliver_at"); $fee = $request->input("fee"); if (!$deliverAt || !$fee || !is_numeric($fee) || !$fee<0) $this->response(false,400,"非法参数或不满足需求"); $param=array('screenDate'=>$deliverAt,'billing'=>$fee); $waybills=app('waybillService')->dailyBilling($param,true); if ($waybills===0 || $waybills===1 || !isset($waybills)) $this->response(false); $this->response(true); } }