find(); $cart_info=StoreOrderCartInfo::where('oid',$order['id'])->select()->each(function($item){ $find = StoreProduct::with('unitName')->withTrashed()->find(); $item['store_name']=$find['store_name']; return $item; }); $product_arr=[]; foreach ($cart_info as $k=>$v){ $product_arr[]=[ 'name'=>$v['name'], 'price'=>$v['price'].'元', 'quantity'=>$v['cart_num'], 'subtotal'=>$v['total_price'].'元' ]; } $api=new XpsdkPrintApi(); $order=[ 'system_store'=>$SystemStore['name']??'', 'system_phone'=>$SystemStore['phone']??'', 'verify_code'=>$order['verify_code'], 'order_id'=>$order['order_id'], 'create_time'=>$pay_time, 'pay_price'=>$pay_price, 'total_price'=>$total_price, 'deduction_price'=>$deduction_price, 'pay_type_name'=>$pay_type, 'product_arr'=>$product_arr ]; ($api->printFontAlign('74AMP5N6DP21148',$order)); } // 消费失败时 public function onConsumeFailure(\Throwable $exception, $package) { $package['max_attempts'] = 0; Log::error('推送订单失败', ['order_id' => $package['data'], 'error' => $package['error']]); return true; } }