因快递100接口指定打印机现在无法购买,导致电子面单无法使用;
因此升级电子面单打印相关功能,升级后打印机选择更多,只要是能打印 80mm的热敏打印机都可以,我们使用的是汉印 -N31C。
使用文档: https://doc.crmeb.com/mer/mer2/8518 ,
升级方法:
1. 修改电子面单打印接口: app\controller\merchant\store\order\Order line 196
$res = $this->repository->runDelivery($id,$this->request->merId(), $data, $split, $method);
return app('json')->success('发货成功',$res);
2. 路径:app\common\repositories\store\order\StoreOrderRepository line 1228
'kuaidi_label' => $result['label'] ?? '',
3. 路径 : crmeb\services\express\storage\Express line 122
public function dump($merId,$data)
{
if (!$data['count']) throw new ValidateException('商品数量缺失');
if (!$data['temp_id']) throw new ValidateException('电子面单模板ID缺失');
if (!$data['to_addr'] || !$data['to_tel'] || !$data['to_name']) throw new ValidateException('寄件人信息缺失');
if (!$data['from_name'] || !$data['from_tel'] || !$data['from_addr']) throw new ValidateException('收件人信息缺失');
if (!$data['com']) throw new ValidateException('快递公司编码缺失');
$param = $data;
$vserion = [];
//修改没有打印机的时候print_type=IMAGE,就会返回面单图片
if (!$data['siid']) {
$vserion = ['version:v1.1'];
$param['print_type'] = 'IMAGE';
}
$exp = app()->make(ExpressRepository::class)->getWhere(['code' => $data['com']]);
$expressData = app()->make(ExpressPartnerRepository::class)->getSearch(['express_id' => $exp['id'], 'mer_id' => $merId,])->find();
if ($exp['partner_id'] == 1) {
if (!$expressData) throw new ValidateException('未查询到快递公司的月结账号');
$param['partner_id'] = $expressData['account'];
}
if ($exp['partner_key'] == 1) $param['partner_key'] = $expressData['key'];
if ($exp['net'] == 1) $param['net'] = $expressData['net_name'];
if ($exp['check_man'] == 1) $param['checkMan'] = $expressData['check_man'];
if ($exp['partner_name'] == 1) $param['partner_name'] = $expressData['partner_name'];
if ($exp['is_code'] == 1) $param['code'] = $expressData['code'];
//修改增加header版本号,兼容旧版和新版
return $this->accessToken->httpRequest(self::EXPRESS_DUMP, $param, 'POST', true, $vserion);
}
4.修改请求 ,路径:crmeb\services\AccessTokenServeService line 149
$header = array_merge(['Authorization:Bearer-' . $this->accessToken] , $header);
5. 修改获取模板接口,路径: crmeb\services\express\storage\Express line 81
,true, ['version:v1.1']
后端就修改完成了,还需要前端代码修改的配合: https://www.crmeb.com/ask/thread/30982
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}