value('name');
$cart_info=StoreOrderCartInfo::where('oid',$order['id'])->field('cart_info')->select();
$product_info="\r\n>商品信息:------------------";
foreach($cart_info as $k=>$v['cart_info']){
$unit_name=$v['cart_info']['cart_info']['unit_name']??'';
$a=$v['cart_info']['cart_info']['name'].' 数量:'.$v['cart_info']['cart_info']['cart_num'].$unit_name.' 价格:'.$v['cart_info']['cart_info']['pay_price'].'元';
$product_info.="\r\n>$a";
}
$arr = ["msgtype" => "markdown", "markdown" => ["content" => "有新的订单请及时跟踪
>订单号:$order_id
>门店信息:$store_name"
.$product_info
."\r\n>下单时间:$pay_time
>订单金额:$total_price
>支付金额:$pay_price
>支付方式:$pay_type
>下单用户手机号:$phone"]];
(new Curl())->postJson($url, json_encode($arr));
}
}
// 消费失败时
public function onConsumeFailure(\Throwable $exception, $package)
{
$package['max_attempts'] = 0;
Log::error('推送订单失败', ['order_id' => $package['data'], 'error' => $package['error']]);
return true;
}
}