find(); $cart_info = StoreOrderCartInfo::where('oid', $order['id'])->select()->each(function ($item) { $find = StoreProduct::where('id', $item['product_id'])->withTrashed()->find(); $item['store_name'] = $find['store_name']; return $item; }); $product_arr = []; foreach ($cart_info as $k => $v) { $product_arr[] = [ 'name' => $v['store_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 ]; $value=DictData::where('name','xprinter_'.$store_id)->value('value'); if($value){ $res = ($api->printFontAlign($value, $order)); } } // 消费失败时 public function onConsumeFailure(\Throwable $exception, $package) { $package['max_attempts'] = 0; Log::error('推送订单失败', ['order_id' => $package['data'], 'error' => $package['error']]); return true; } }