fix(printer): 修复小票打印商品名称错误
- 在 PayNotifyLogic 中添加 XpsdkPrintApi 类的引用 - 在 OrderXprinterPushSend 中修正商品名称的获取方式 - 优化代码格式和结构,提高可读性
This commit is contained in:
parent
df8f3523f6
commit
2be22adcb3
@ -32,6 +32,7 @@ use app\common\model\user_sign\UserSign;
|
|||||||
use app\common\model\vip_flow\VipFlow;
|
use app\common\model\vip_flow\VipFlow;
|
||||||
use app\common\service\Curl;
|
use app\common\service\Curl;
|
||||||
use app\common\service\PushService;
|
use app\common\service\PushService;
|
||||||
|
use app\common\service\xpyun\XpsdkPrintApi;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -54,6 +55,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Db::rollback();
|
Db::rollback();
|
||||||
|
d($e);
|
||||||
Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
|
Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
|
||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class OrderXprinterPushSend implements Consumer
|
|||||||
$pay_type = PayEnum::getPaySceneDesc($order['pay_type']);
|
$pay_type = PayEnum::getPaySceneDesc($order['pay_type']);
|
||||||
$SystemStore = SystemStore::where('id', $order['store_id'])->find();
|
$SystemStore = SystemStore::where('id', $order['store_id'])->find();
|
||||||
$cart_info = StoreOrderCartInfo::where('oid', $order['id'])->select()->each(function ($item) {
|
$cart_info = StoreOrderCartInfo::where('oid', $order['id'])->select()->each(function ($item) {
|
||||||
$find = StoreProduct::with('unitName')->withTrashed()->find();
|
$find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find();
|
||||||
$item['store_name'] = $find['store_name'];
|
$item['store_name'] = $find['store_name'];
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
@ -41,7 +41,7 @@ class OrderXprinterPushSend implements Consumer
|
|||||||
$product_arr = [];
|
$product_arr = [];
|
||||||
foreach ($cart_info as $k => $v) {
|
foreach ($cart_info as $k => $v) {
|
||||||
$product_arr[] = [
|
$product_arr[] = [
|
||||||
'name'=>$v['name'],
|
'name' => $v['store_name'],
|
||||||
'price' => $v['price'] . '元',
|
'price' => $v['price'] . '元',
|
||||||
'quantity' => $v['cart_num'],
|
'quantity' => $v['cart_num'],
|
||||||
'subtotal' => $v['total_price'] . '元'
|
'subtotal' => $v['total_price'] . '元'
|
||||||
@ -61,7 +61,7 @@ class OrderXprinterPushSend implements Consumer
|
|||||||
'pay_type_name' => $pay_type,
|
'pay_type_name' => $pay_type,
|
||||||
'product_arr' => $product_arr
|
'product_arr' => $product_arr
|
||||||
];
|
];
|
||||||
($api->printFontAlign('74AMP5N6DP21148',$order));
|
$res = ($api->printFontAlign('74AMP5N6DP21148', $order));
|
||||||
}
|
}
|
||||||
// 消费失败时
|
// 消费失败时
|
||||||
public function onConsumeFailure(\Throwable $exception, $package)
|
public function onConsumeFailure(\Throwable $exception, $package)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user