fhWlNo; $data = [ 'delivery_id' => $deliveryId, 'waybill_id' => $wayBillId, ]; return expressUtil::getPath($merchant, $data, $ptStyle); } public static function testUpdate($params, $order) { $merchant = WxOpenClass::getGhsWxInfo(); $ptStyle = dict::getDict('ptStyle', 'ghs'); $deliveryId = $params['deliveryId']; $wayBillId = $params['wayBillId']; $orderSn = $params['orderSn']; $bizId = $params['bizId']; $actionType = $params['actionType']; $actionTime = $params['actionTime']; $actionMsg = $params['actionMsg']; $data = [ 'delivery_id' => $deliveryId, 'waybill_id' => $wayBillId, 'order_id' => $orderSn, 'biz_id' => $bizId, 'action_time' => $actionTime, 'action_type' => $actionType, 'action_msg' => $actionMsg, ]; $ret = expressUtil::testUpdateOrder($merchant, $data, $ptStyle); print_r($ret); } public static function cancel($params, $order) { $cgId = $order->purchaseId; $cg = PurchaseClass::getById($cgId, true); if (empty($cg)) { util::fail('订单信息缺失'); } $merchant = WxOpenClass::getGhsWxInfo(); $ptStyle = dict::getDict('ptStyle', 'ghs'); $deliveryId = $params['deliveryId']; $wayBillId = $order->fhWlNo ?? ''; $orderSn = $order->orderSn; $data = [ 'delivery_id' => $deliveryId, 'waybill_id' => $wayBillId, 'order_id' => $orderSn ]; $ret = expressUtil::cancelOrder($merchant, $data, $ptStyle); if ($ret['errcode'] == 0) { $order->fhWlStatus = 2; $order->save(); $cg->fhWlStatus = 2; $cg->save(); util::complete('取消成功'); } else { $code = $ret['errcode'] ?? ''; $msg = $ret['errmsg'] ?? ''; util::fail('取消失败,原因:' . $code . ' / ' . $msg); } } //新增运单 ssh 20250703 public static function addWayBill($params, $order) { $cgId = $order->purchaseId; $cg = PurchaseClass::getById($cgId, true); if (empty($cg)) { util::fail('订单信息缺失'); } $merchant = WxOpenClass::getGhsWxInfo(); $ptStyle = dict::getDict('ptStyle', 'ghs'); $orderSn = $params['orderSn']; //$openId = $params['openId']; $deliveryId = $params['deliveryId']; $bizId = $params['bizId']; $customRemark = $params['customRemark']; $senderName = $params['senderName']; $senderMobile = $params['senderMobile']; $senderProvince = $params['senderProvince']; $senderCity = $params['senderCity']; $senderAddress = $params['senderAddress']; $receiverName = $params['receiverName']; $receiverMobile = $params['receiverMobile']; $receiverProvince = $params['receiverProvince']; $receiverCity = $params['receiverCity']; $receiverAddress = $params['receiverAddress']; $receiverFloor = $params['receiverFloor']; $goodsCount = $params['goodsCount']; $goodsName = $params['goodsName']; $weight = $params['weight']; $height = $params['height']; $length = $params['length']; $width = $params['width']; $packageNum = $params['packageNum']; $serviceType = $params['serviceType']; $serviceName = $params['serviceName']; $shopImgUrl = $params['shopImgUrl']; $wxAppId = $params['wxAppId']; $data = [ // 订单信息 'order_id' => $orderSn, // 商家订单ID,需唯一 //'openid' => $openId, // 用户openid 'delivery_id' => $deliveryId, // 快递公司ID 'biz_id' => $bizId, // 快递公司客户编码或月结账号 'custom_remark' => $customRemark, // 备注 //0表示已事先约定取件时间;否则请传预期揽件时间戳,需大于当前时间 'expect_time' => 0, //订单来源,0为小程序订单,2为App或H5订单,填2则不发送物流服务通知 'add_source' => 2, 'wx_appid' => $wxAppId, // 发件人信息 'sender' => [ 'name' => $senderName, // 发件人姓名 'mobile' => $senderMobile, // 发件人手机号 'province' => $senderProvince, // 发件人省份 'city' => $senderCity, // 发件人城市 'address' => $senderAddress, // 发件人详细地址 ], // 收件人信息 'receiver' => [ 'name' => $receiverName, // 收件人姓名 'mobile' => $receiverMobile, // 收件人手机号 'province' => $receiverProvince, // 收件人省份 'city' => $receiverCity, // 收件人城市 'address' => $receiverAddress . $receiverFloor, // 收件人详细地址 ], // 商品信息 'shop' => [ 'goods_name' => $goodsName, // 商品名称 'goods_count' => $goodsCount, // 商品数量 'img_url' => $shopImgUrl, ], // 货物信息 'cargo' => [ 'count' => $packageNum, // 货物数量 'weight' => $weight, // 货物总重量,单位kg 'space_x' => $length, // 货物长度,单位cm 'space_y' => $width, // 货物宽度,单位cm 'space_z' => $height, // 货物高度,单位cm 'detail_list' => [ [ 'name' => '鲜花花材', // 货物名称 'count' => $packageNum, // 货物数量 ], ], ], // 保价信息 'insured' => [ 'use_insured' => 0, // 是否保价,0-否,1-是 ], // 服务类型 'service' => [ 'service_type' => $serviceType, // 服务类型,0-标准快递 'service_name' => $serviceName, // 服务名称 ], ]; $ret = expressUtil::addOrder($merchant, $data, $ptStyle); if ($ret['errcode'] == 0) { $wayBillId = $ret['waybill_id'] ?? 0; $wayBillName = '顺丰速运'; $order->fhWlSn = $deliveryId; $order->fhWl = $wayBillName; $order->fhWlNo = $wayBillId; $order->fhWlStatus = 1;//已经叫物流 $order->save(); $cg->fhWlSn = $deliveryId; $cg->fhWl = $wayBillName; $cg->fhWlNo = $wayBillId; $cg->fhWlStatus = 1;//已经叫物流 $cg->save(); if ($order->status == 2) { $staffId = $params['staffId']; $staffName = $params['staffName']; $params = [ 'fhType' => 0, 'fhWl' => '', 'fhWlNo' => '', 'staffId' => $staffId, 'staffName' => $staffName, ]; OrderClass::orderSend($order, $params); } $order->fhType = 1; $order->save(); $cg->fhType = 1; $cg->save(); } else { $code = $ret['errcode'] ?? ''; $msg = $ret['errmsg'] ?? ''; util::fail('提交失败,原因:' . $code . ' / ' . $msg); } } }