diff --git a/app/admin/controller/retail/CashierclassController.php b/app/admin/controller/retail/CashierclassController.php index b936312..d9707ce 100644 --- a/app/admin/controller/retail/CashierclassController.php +++ b/app/admin/controller/retail/CashierclassController.php @@ -7,7 +7,7 @@ use app\admin\controller\BaseAdminController; use app\admin\lists\retail\CashierclassLists; use app\admin\logic\retail\CashierclassLogic; use app\admin\validate\retail\CashierclassValidate; - +use app\common\model\retail\Cashierclass; /** * 零售订单控制器 @@ -107,5 +107,21 @@ class CashierclassController extends BaseAdminController return $this->data($result); } + /** + * @notes 设置打印 + * @return \think\response\Json + * @author likeadmin + * @date 2024/04/24 09:57 + */ + public function set_print(){ + $id=$this->request->get('id'); + if($id){ + $res=Cashierclass::where('id',$id)->update(['is_print'=>1]); + if($res){ + return $this->success('设置成功', [], 1, 1); + } + } + return $this->fail('设置失败'); + } } \ No newline at end of file diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 112525b..7093ebb 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -111,6 +111,7 @@ class PayNotifyLogic extends BaseLogic PushService::push('store_merchant_' . $order['merchant'], $order['merchant'], ['type'=>'cash_register','msg'=>'您有一笔订单已支付','data'=>$extra]); } else { PushService::push('store_merchant_' . $order['merchant'], $order['merchant'], ['type'=>'store_merchant','msg'=>'您有一笔新的订单']); + Redis::send('push-platform-print', ['order_id' => $order['id']], 60); } if (!empty($extra['payer']['openid']) && $order->pay_type != 9) { Redis::send('push-delivery', ['order_id' => $orderSn, 'openid' => $extra['payer']['openid']], 5); diff --git a/app/queue/redis/PushPlatformPrintSend.php b/app/queue/redis/PushPlatformPrintSend.php new file mode 100644 index 0000000..7334e61 --- /dev/null +++ b/app/queue/redis/PushPlatformPrintSend.php @@ -0,0 +1,63 @@ +where('is_print',0)->field('id,merchant,real_name,user_phone,user_address,uid,number,total,actual,create_time')->find(); + if ($find) { + $merchant = Merchant::where('mer_id', $find['merchant'])->field('mer_name,uid,service_phone')->find(); + $mer_user_info = User::where('id', $merchant['uid'])->field('real_name,mobile')->find(); + $user = User::where('id', $find['uid'])->field('nickname,mobile')->find(); + $find['mer_name'] = $merchant['mer_name']; + $find['mer_phone'] = $merchant['service_phone']; + $find['mer_nickname'] = $mer_user_info['real_name']; + $find['mer_user_mobile'] = $mer_user_info['mobile']; + $find['nickname'] = $user['nickname']; + $find['user_mobile'] = $user['mobile']; + $find['info'] = Cashierinfo::where('pid', 445)->field('goods,nums,price,total')->select()->each(function ($item) { + $goods = Goods::where('id', $item['goods'])->field('name,unit')->find(); + $item['unit_name'] = Unit::where('id', $goods['unit'])->value('name'); + $item['goods_name'] = $goods['name']; + return $item; + }); + PushService::push('platform_1', 1, ['type'=>'platform_print','msg'=>'打印队列','data'=>$find]); + } + } + public function onConsumeFailure(\Throwable $exception, $package) + { + if($package['attempts'] ==$exception['max_attempts']){ + Log::error('打印队列推送失败。order_id:'. $package['data']['order_id']??0); + } + return $package; + } +} \ No newline at end of file