全部
常见问题
产品动态
精选推荐

配送消息参数有误

管理 管理 编辑 删除

订单配送订阅消息参数有误修改

修改文件:app\services\order\StoreOrderDeliveryServices

修改方法:doDelivery()

6433e202408211741465281.png

    public function doDelivery(int $id, $orderInfo, array $data)
    {
        $type = (int)$data['type'];
        unset($data['type']);
        //获取购物车内的商品标题
        /** @var StoreOrderCartInfoServices $orderInfoServices */
        $orderInfoServices = app()->make(StoreOrderCartInfoServices::class);
        $storeName = $orderInfoServices->getCarIdByProductTitle((int)$orderInfo['id']);
		//修改返回数据
		$res = [];
        switch ($type) {
            case 1://快递发货
                $res = $this->orderDeliverGoods($id, $data, $orderInfo, $storeName);
				if (isset($res['kuaidinum']) && $res['kuaidinum']) {
					$data['delivery_id'] = $res['kuaidinum'];
				}
                break;
            case 2://配送
                $data['delivery_name'] = $data['sh_delivery_name'];
                $data['delivery_id'] = $data['sh_delivery_id'];
                $data['delivery_uid'] = $data['sh_delivery_uid'];
                $this->orderDelivery($id, $data, $orderInfo);
                break;
            case 3://虚拟发货
                $this->orderVirtualDelivery($id, $data);
                break;
            case 4://门店收银订单自动发货
                $this->dao->update($orderInfo['id'], ['delivery_type' => 'cashier']);
                /** @var StoreOrderStatusServices $statusService */
                $statusService = app()->make(StoreOrderStatusServices::class);
                $statusService->save([
                    'oid' => $orderInfo['id'],
                    'change_type' => 'delivery_cashier',
                    'change_message' => '门店收银台核销',
                    'change_time' => time()
                ]);
                break;
            default:
                throw new ValidateException('暂时不支持其他发货类型');
        }
        //跟新完成后重新赋值订单信息
        $orderInfo = $this->dao->get($id, ['*'], ['pink']);
        event('order.delivery', [$orderInfo, $storeName, $data, $type]);
        return $res;
    }


修改文件:app\services\order\StoreOrderDeliveryServices

修改方法:orderDelivery()

4852b202408211743347298.png

public function orderDelivery(int $id, array $data, $orderInfo = [])
    {
		$delivery_type = $data['delivery_type'] ?? 1;
		$delivery_type = $delivery_type ? $delivery_type : 1;
		$station_type = $data['station_type'] ?? 1;
		unset($data['delivery_type'], $data['station_type']);
		switch ($delivery_type) {
			case 1://自己配送
				if (!$data['delivery_name']) {
					throw new ValidateException('请输入送货人姓名');
				}
				if (!$data['delivery_id']) {
					throw new ValidateException('请输入送货人电话号码');
				}
				if (!$data['delivery_uid']) {
					throw new ValidateException('请输入送货人信息');
				}
				if (!check_phone($data['delivery_id'])) {
					throw new ValidateException('请输入正确的送货人电话号码');
				}
				//获取核销码
				/** @var StoreOrderCreateServices $storeOrderCreateService */
				$storeOrderCreateService = app()->make(StoreOrderCreateServices::class);
				$data['verify_code'] = $storeOrderCreateService->getStoreCode();
				$data['delivery_type'] = 'send';
				break;
			case 2://第三方配送
				if (!isset($data['cargo_weight']) || !$data['cargo_weight']) {
					throw new ValidateException('请填写配送商品重量');
				}
				$data['delivery_type'] = 'city_delivery';
				/** @var StoreDeliveryOrderServices $storeDeliverOrderServices */
				$storeDeliverOrderServices = app()->make(StoreDeliveryOrderServices::class);
				$storeDeliverOrderServices->create($id, $data, $station_type, $orderInfo);
				break;
		}
		$data['status'] = 1;

        unset($data['sh_delivery_name'], $data['sh_delivery_id'], $data['sh_delivery_uid'], $data['delivery_remark']);

        /** @var StoreOrderStatusServices $services */
        $services = app()->make(StoreOrderStatusServices::class);
        $this->transaction(function () use ($id, $data, $services, $delivery_type, $station_type) {
			//修改订单发货信息
            $this->dao->update($id, $data);
			if ($delivery_type == 1) {
				$message = '已配送 发货人:' . $data['delivery_name'] . ' 发货人电话:' . $data['delivery_id'];
			} else {
				$message = '已'. ($station_type == 1 ? '达达' : 'UU跑腿') .'同城配送';
			}
            //记录订单状态
            $services->save([
                'oid' => $id,
                'change_type' => $delivery_type == 1 ? 'delivery' : 'city_delivery',
                'change_time' => time(),
                'change_message' => $message
            ]);
        });
        return true;
    }


请登录后查看

全 最后编辑于2024-08-21 17:44:34

快捷回复
回复
回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
排序 默认正序 回复倒序 点赞倒序

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}} LV.{{ item.user_info.bbs_level }}

作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest == 1? '取消推荐': '推荐'}}
{{item.is_suggest == 1? '取消推荐': '推荐'}}
沙发 板凳 地板 {{item.floor}}#
{{item.user_info.title || '暂无简介'}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
{{item.like_count}}
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
查看更多
634
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

快速安全登录

使用微信扫码登录
{{item.label}} 加精
{{item.label}} {{item.label}} 板块推荐 常见问题 产品动态 精选推荐 首页头条 首页动态 首页推荐
取 消 确 定
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定

微信登录/注册

切换手机号登录

{{ bind_phone ? '绑定手机' : '手机登录'}}

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 源码下载 CRMEB帮助文档 帮助文档
返回顶部 返回顶部
CRMEB客服