更新
This commit is contained in:
parent
e06dc2a1f7
commit
7cbcebe14b
@ -7,7 +7,9 @@ use app\admin\controller\BaseAdminController;
|
|||||||
use app\admin\lists\operation\OpurchaseclassLists;
|
use app\admin\lists\operation\OpurchaseclassLists;
|
||||||
use app\admin\logic\operation\OpurchaseclassLogic;
|
use app\admin\logic\operation\OpurchaseclassLogic;
|
||||||
use app\admin\validate\operation\OpurchaseclassValidate;
|
use app\admin\validate\operation\OpurchaseclassValidate;
|
||||||
|
use app\common\model\goods\Goods;
|
||||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||||
|
use app\common\model\opurchase\Opurchaseinfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购订单控制器
|
* 采购订单控制器
|
||||||
@ -38,6 +40,7 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
*/
|
*/
|
||||||
public function add()
|
public function add()
|
||||||
{
|
{
|
||||||
|
return $this->success('不能添加');
|
||||||
$params = (new OpurchaseclassValidate())->post()->goCheck('add');
|
$params = (new OpurchaseclassValidate())->post()->goCheck('add');
|
||||||
$result = OpurchaseclassLogic::add($params);
|
$result = OpurchaseclassLogic::add($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
@ -55,6 +58,7 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
*/
|
*/
|
||||||
public function edit()
|
public function edit()
|
||||||
{
|
{
|
||||||
|
return $this->success('不能编辑');
|
||||||
$params = (new OpurchaseclassValidate())->post()->goCheck('edit');
|
$params = (new OpurchaseclassValidate())->post()->goCheck('edit');
|
||||||
$result = OpurchaseclassLogic::edit($params);
|
$result = OpurchaseclassLogic::edit($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
@ -72,6 +76,7 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
*/
|
*/
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
|
return $this->success('不能删除');
|
||||||
$params = (new OpurchaseclassValidate())->post()->goCheck('delete');
|
$params = (new OpurchaseclassValidate())->post()->goCheck('delete');
|
||||||
OpurchaseclassLogic::delete($params);
|
OpurchaseclassLogic::delete($params);
|
||||||
return $this->success('删除成功', [], 1, 1);
|
return $this->success('删除成功', [], 1, 1);
|
||||||
@ -91,6 +96,21 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 采购订单列表
|
||||||
|
*/
|
||||||
|
public function opurchaseinfo_list(){
|
||||||
|
$id=$this->request->get('id');
|
||||||
|
$page_no=$this->request->get('page_no',1);
|
||||||
|
$res=Opurchaseinfo::where('pid',$id)->page($page_no,25)->select()->each(function ($item) {
|
||||||
|
$find=Goods::where('id', $item['goods'])->with('unitName')->find();
|
||||||
|
$item['goods_name']=$find['name'];
|
||||||
|
$item['unit_name']=$find['unit_name'];
|
||||||
|
});
|
||||||
|
return $this->success('ok',$res?->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 推送给供应商报价
|
* @notes 推送给供应商报价
|
||||||
* @return \think\response\Json
|
* @return \think\response\Json
|
||||||
@ -98,6 +118,7 @@ class OpurchaseclassController extends BaseAdminController
|
|||||||
* @date 2024/04/27 11:26
|
* @date 2024/04/27 11:26
|
||||||
*/
|
*/
|
||||||
public function createSupplierGoods(){
|
public function createSupplierGoods(){
|
||||||
|
return $this->success('禁止后台推送');
|
||||||
$params=$this->request->post();
|
$params=$this->request->post();
|
||||||
$result = OpurchaseclassLogic::createSupplierGoods($params);
|
$result = OpurchaseclassLogic::createSupplierGoods($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
|
@ -91,21 +91,24 @@ class OpurchaseclassLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
$data = Opurchaseclass::findOrEmpty($params['id'])->toArray();
|
$data = Opurchaseclass::findOrEmpty($params['id'])->toArray();
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$data['info'] = Opurchaseinfo::where('pid', $params['id'])->select()->each(function ($item) {
|
$data['goods_info'] = Opurchaseinfo::where('pid', $params['id'])->limit(25)->select()->each(function ($item) {
|
||||||
$sys_labels = Goods::where('id', $item['goods'])->value('sys_labels');
|
$find=Goods::where('id', $item['goods'])->with('unitName')->find();
|
||||||
$supplier_arr=[];
|
$item['goods_name']=$find['name'];
|
||||||
if($sys_labels){
|
$item['unit_name']=$find['unit_name'];
|
||||||
$arr = explode(',', $sys_labels);
|
// $sys_labels = Goods::where('id', $item['goods'])->value('sys_labels');
|
||||||
foreach ($arr as $k => $v) {
|
// $supplier_arr=[];
|
||||||
if($v>0){
|
// if($sys_labels){
|
||||||
$supplier=Supplier::whereLike('sys_labels', "%," . $v . ",%")->field('id,mer_name')->find();
|
// $arr = explode(',', $sys_labels);
|
||||||
if($supplier){
|
// foreach ($arr as $k => $v) {
|
||||||
$supplier_arr[]=$supplier;
|
// if($v>0){
|
||||||
}
|
// $supplier=Supplier::whereLike('sys_labels', "%," . $v . ",%")->field('id,mer_name')->find();
|
||||||
}
|
// if($supplier){
|
||||||
}
|
// $supplier_arr[]=$supplier;
|
||||||
}
|
// }
|
||||||
$item['supplier'] = array_unique($supplier_arr);
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// $item['supplier'] = array_unique($supplier_arr);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -118,10 +121,24 @@ class OpurchaseclassLogic extends BaseLogic
|
|||||||
* @return bool
|
* @return bool
|
||||||
* @date 2024/04/27 11:26
|
* @date 2024/04/27 11:26
|
||||||
*/
|
*/
|
||||||
public static function createSupplierGoods($params){
|
public static function createSupplierGoods($goods){
|
||||||
try{
|
try{
|
||||||
$goods_offer=[];
|
$sys_labels = Goods::where('id', $goods['goods'])->value('sys_labels');
|
||||||
foreach($params['goods_info'] as $k=>$v){
|
$supplier_arr=[];
|
||||||
|
$goods_offer=[];
|
||||||
|
|
||||||
|
if ($sys_labels) {
|
||||||
|
$sys_labels_arr = explode(',', $sys_labels);
|
||||||
|
foreach ($sys_labels_arr as $k => $v) {
|
||||||
|
if ($v > 0) {
|
||||||
|
$supplier = Supplier::whereLike('sys_labels', "%," . $v . ",%")->field('id,mer_name')->find();
|
||||||
|
if ($supplier) {
|
||||||
|
$supplier_arr[] = $supplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($supplier_arr as $k=>$v){
|
||||||
$goods_offer[]=[
|
$goods_offer[]=[
|
||||||
'supplier_id'=>$v['supplier'],
|
'supplier_id'=>$v['supplier'],
|
||||||
'goods_id'=>$v['goods'],
|
'goods_id'=>$v['goods'],
|
||||||
|
@ -23,7 +23,7 @@ class IndexController extends BaseApiController
|
|||||||
// 投递消息
|
// 投递消息
|
||||||
Redis::send($queue, $data);
|
Redis::send($queue, $data);
|
||||||
// 投递延迟消息,消息会在60秒后处理
|
// 投递延迟消息,消息会在60秒后处理
|
||||||
Redis::send($queue, $data, 60);
|
// Redis::send($queue, $data, 5);
|
||||||
|
|
||||||
return json(['msg' =>create_password(123456, '11d3')]);
|
return json(['msg' =>create_password(123456, '11d3')]);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ class OpurchaseOrderController extends BaseApiController
|
|||||||
if($order==false){
|
if($order==false){
|
||||||
return $this->fail(OrderLogic::getError());
|
return $this->fail(OrderLogic::getError());
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
return $this->success('支付成功');
|
return $this->success('支付成功');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ namespace app\api\lists\goods;
|
|||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
use app\common\model\goods\Goodsclass;
|
use app\common\model\goods\Goodsclass;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
use app\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品分类列表
|
* 商品分类列表
|
||||||
@ -42,19 +42,29 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
*/
|
*/
|
||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
$lists = Goodsclass::where($this->searchWhere)
|
$pid=Request()->get('pid',0);
|
||||||
|
if($pid==0){
|
||||||
|
$lists = Goodsclass::where($this->searchWhere)
|
||||||
->where('pid', 0)
|
->where('pid', 0)
|
||||||
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) {
|
->select()->toArray();
|
||||||
$a = Goodsclass::where('pid', $item['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
|
}else{
|
||||||
$item['children'] = $a;
|
$lists = Goodsclass::where($this->searchWhere)
|
||||||
foreach ($a as $k => &$v) {
|
->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])
|
||||||
$b = Goodsclass::where('pid', $v['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
$v['children'] = $b;
|
->order(['id' => 'desc'])
|
||||||
}
|
->select()->toArray();
|
||||||
})->toArray();
|
}
|
||||||
|
// ->each(function ($item) {
|
||||||
|
// $a = Goodsclass::where('pid', $item['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
|
||||||
|
// $item['children'] = $a;
|
||||||
|
// foreach ($a as $k => &$v) {
|
||||||
|
// $b = Goodsclass::where('pid', $v['id'])->field(['id', 'pid', 'name', 'data', 'pic', 'sort'])->select();
|
||||||
|
// $v['children'] = $b;
|
||||||
|
// }
|
||||||
|
// })->toArray();
|
||||||
return $lists;
|
return $lists;
|
||||||
// return linear_to_tree($lists, 'children');
|
// return linear_to_tree($lists, 'children');
|
||||||
|
|
||||||
@ -69,8 +79,15 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface
|
|||||||
*/
|
*/
|
||||||
public function count(): int
|
public function count(): int
|
||||||
{
|
{
|
||||||
return Goodsclass::where($this->searchWhere)->where('pid', 0)
|
$pid=Request()->get('pid',0);
|
||||||
|
if($pid==0){
|
||||||
|
return Goodsclass::where($this->searchWhere)->where('pid', 0)
|
||||||
->count();
|
->count();
|
||||||
|
}else{
|
||||||
|
return Goodsclass::where($this->searchWhere)
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ use think\facade\Db;
|
|||||||
*/
|
*/
|
||||||
class OrderLogic extends BaseLogic
|
class OrderLogic extends BaseLogic
|
||||||
{
|
{
|
||||||
|
public static $total;
|
||||||
/**
|
/**
|
||||||
* @notes 获取购物车商品信息
|
* @notes 获取购物车商品信息
|
||||||
* @param $params
|
* @param $params
|
||||||
@ -37,6 +38,7 @@ class OrderLogic extends BaseLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
self::$total = 0;
|
||||||
/** 计算价格 */
|
/** 计算价格 */
|
||||||
foreach ($cart_select as $k => $v) {
|
foreach ($cart_select as $k => $v) {
|
||||||
$find = Goods::where(['id' => $v['goods']])->field('name,imgs,unit,sell')->find();
|
$find = Goods::where(['id' => $v['goods']])->field('name,imgs,unit,sell')->find();
|
||||||
@ -48,11 +50,12 @@ class OrderLogic extends BaseLogic
|
|||||||
$cart_select[$k]['name'] = $find['name'];
|
$cart_select[$k]['name'] = $find['name'];
|
||||||
$cart_select[$k]['imgs'] = $find['imgs'];
|
$cart_select[$k]['imgs'] = $find['imgs'];
|
||||||
$cart_select[$k]['unit_name'] = Unit::where(['id' => $find['unit']])->value('name');
|
$cart_select[$k]['unit_name'] = Unit::where(['id' => $find['unit']])->value('name');
|
||||||
|
self::$total=bcadd(self::$total, $cart_select[$k]['total'], 2);
|
||||||
}
|
}
|
||||||
$order = [
|
$order = [
|
||||||
'time' => time(),
|
'time' => time(),
|
||||||
'number' => static::getNewOrderId('PF'),
|
'number' => static::getNewOrderId('PF'),
|
||||||
'total' => array_sum(array_column($cart_select, 'total')),
|
'total' => self::$total,
|
||||||
'pay_type' => $params['pay_type'] ?? 0,
|
'pay_type' => $params['pay_type'] ?? 0,
|
||||||
'cart_id' => implode(',', $cartId),
|
'cart_id' => implode(',', $cartId),
|
||||||
'delivery_msg'=>' 预计48小时发货 '
|
'delivery_msg'=>' 预计48小时发货 '
|
||||||
|
@ -8,6 +8,7 @@ use app\common\model\order\Cart;
|
|||||||
use app\common\model\recharge\RechargeOrder;
|
use app\common\model\recharge\RechargeOrder;
|
||||||
use app\common\model\retail\Cashierclass;
|
use app\common\model\retail\Cashierclass;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
use app\common\service\PushService;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
Cart::whereIn('cart_id', $order['cart_id'])->update(['is_pay' => 1]);
|
Cart::whereIn('cart_id', $order['cart_id'])->update(['is_pay' => 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PushService::push('cash_register_'.$order['user_id'], $order['user_id'], '您有一笔订单已支付');
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
28
app/common/service/PushService.php
Normal file
28
app/common/service/PushService.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\service;
|
||||||
|
|
||||||
|
use Webman\Push\Api;
|
||||||
|
|
||||||
|
class PushService
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送消息
|
||||||
|
* @param $subscription 订阅
|
||||||
|
* @param $uid 用户id
|
||||||
|
* @param $content 消息内容
|
||||||
|
*/
|
||||||
|
public static function push($subscription, $uid, $content)
|
||||||
|
{
|
||||||
|
$api = new Api(
|
||||||
|
'http://127.0.0.1:3232',
|
||||||
|
config('plugin.webman.push.app.app_key'),
|
||||||
|
config('plugin.webman.push.app.app_secret')
|
||||||
|
);
|
||||||
|
$api->trigger($subscription, 'message', [
|
||||||
|
'from_uid' => $uid,
|
||||||
|
'content' => $content
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -48,7 +48,7 @@ class PayService extends BasePayService
|
|||||||
* @param $terminal //用户终端
|
* @param $terminal //用户终端
|
||||||
* @param null $userId //用户id(获取授权openid)
|
* @param null $userId //用户id(获取授权openid)
|
||||||
*/
|
*/
|
||||||
public function __construct($terminal, $userId = null)
|
public function __construct($terminal=0, $userId = null)
|
||||||
{
|
{
|
||||||
$this->terminal = $terminal;
|
$this->terminal = $terminal;
|
||||||
$config = Config::get('payment');
|
$config = Config::get('payment');
|
||||||
|
56
app/queue/redis/CodePaySend.php
Normal file
56
app/queue/redis/CodePaySend.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\queue\redis;
|
||||||
|
|
||||||
|
use app\common\logic\PayNotifyLogic;
|
||||||
|
use app\common\model\retail\Cashierclass;
|
||||||
|
use app\common\service\pay\PayService;
|
||||||
|
use app\common\service\PushService;
|
||||||
|
use Webman\RedisQueue\Consumer;
|
||||||
|
use support\exception\BusinessException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信条码支付队列消费
|
||||||
|
*/
|
||||||
|
class CodePaySend implements Consumer
|
||||||
|
{
|
||||||
|
// 要消费的队列名
|
||||||
|
public $queue = 'send-code-pay';
|
||||||
|
|
||||||
|
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
|
||||||
|
public $connection = 'default';
|
||||||
|
|
||||||
|
// 消费
|
||||||
|
public function consume($data)
|
||||||
|
{
|
||||||
|
$pay = new PayService();
|
||||||
|
$order = [
|
||||||
|
'out_trade_no' => $data['number'],
|
||||||
|
];
|
||||||
|
$res = $pay->wechat->query($order);
|
||||||
|
if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') {
|
||||||
|
PayNotifyLogic::handle('cashierclass', $res['out_trade_no'], $res);
|
||||||
|
}else{
|
||||||
|
throw new BusinessException('订单支付中', 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 消费失败时
|
||||||
|
public function onConsumeFailure(\Throwable $exception, $package)
|
||||||
|
{
|
||||||
|
// 直接更改消息队列数据结构,将最大重试次数max_attempts字段设置为0,即不再重试。
|
||||||
|
if($package['attempts'] ==$exception['max_attempts']){
|
||||||
|
$data = [
|
||||||
|
'number' => $package['data']['number'],
|
||||||
|
'paid' => 0,
|
||||||
|
];
|
||||||
|
$find=Cashierclass::where($data)->find();
|
||||||
|
if($find){
|
||||||
|
$order = Cashierclass::update($data);
|
||||||
|
if($order){
|
||||||
|
PushService::push('cash_register_'.$package['data']['user_id'], $package['data']['user_id'], '支付超时,订单已被取消,请重新提交订单');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $package;
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ namespace app\queue\redis;
|
|||||||
|
|
||||||
use Webman\RedisQueue\Consumer;
|
use Webman\RedisQueue\Consumer;
|
||||||
use Webman\Push\Api;
|
use Webman\Push\Api;
|
||||||
|
use support\exception\BusinessException;
|
||||||
|
|
||||||
class MyMailSend implements Consumer
|
class MyMailSend implements Consumer
|
||||||
{
|
{
|
||||||
@ -16,18 +17,19 @@ class MyMailSend implements Consumer
|
|||||||
// 消费
|
// 消费
|
||||||
public function consume($data)
|
public function consume($data)
|
||||||
{
|
{
|
||||||
$api = new Api(
|
// $api = new Api(
|
||||||
'http://127.0.0.1:3232',
|
// 'http://127.0.0.1:3232',
|
||||||
config('plugin.webman.push.app.app_key'),
|
// config('plugin.webman.push.app.app_key'),
|
||||||
config('plugin.webman.push.app.app_secret')
|
// config('plugin.webman.push.app.app_secret')
|
||||||
);
|
// );
|
||||||
// 给订阅 user-1 的所有客户端推送 message 事件的消息
|
// // 给订阅 user-1 的所有客户端推送 message 事件的消息
|
||||||
$api->trigger('user-1', 'message', [
|
// $api->trigger('user-1', 'message', [
|
||||||
'from_uid' => 2,
|
// 'from_uid' => 2,
|
||||||
'content' => '你好,这个是消息内容'
|
// 'content' => '你好,这个是消息内容'
|
||||||
]);
|
// ]);
|
||||||
// 无需反序列化
|
// 无需反序列化
|
||||||
var_export($data); // 输出 ['to' => 'tom@gmail.com', 'content' => 'hello']
|
var_export($data); // 输出 ['to' => 'tom@gmail.com', 'content' => 'hello']
|
||||||
|
throw new BusinessException('参数错误', 3000);
|
||||||
}
|
}
|
||||||
// 消费失败回调
|
// 消费失败回调
|
||||||
/*
|
/*
|
||||||
|
49
app/queue/redis/PushSupplierProductsSend.php
Normal file
49
app/queue/redis/PushSupplierProductsSend.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\queue\redis;
|
||||||
|
|
||||||
|
use app\admin\logic\operation\OpurchaseclassLogic;
|
||||||
|
use app\common\model\opurchase\Opurchaseinfo;
|
||||||
|
use Webman\RedisQueue\Consumer;
|
||||||
|
use Webman\Push\Api;
|
||||||
|
use support\exception\BusinessException;
|
||||||
|
use support\Log;
|
||||||
|
|
||||||
|
class PushSupplierProductsSend implements Consumer
|
||||||
|
{
|
||||||
|
// 要消费的队列名
|
||||||
|
public $queue = 'send-mail';
|
||||||
|
|
||||||
|
// 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接`
|
||||||
|
public $connection = 'default';
|
||||||
|
|
||||||
|
// 消费
|
||||||
|
public function consume($data)
|
||||||
|
{
|
||||||
|
$order_id=$data['order_id'];
|
||||||
|
$select=Opurchaseinfo::where('pid',$order_id)->where('is_push',0)->select();
|
||||||
|
foreach ($select as $key => $arr) {
|
||||||
|
OpurchaseclassLogic::createSupplierGoods($arr);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 消费失败回调
|
||||||
|
/*
|
||||||
|
$package = [
|
||||||
|
'id' => 1357277951, // 消息ID
|
||||||
|
'time' => 1709170510, // 消息时间
|
||||||
|
'delay' => 0, // 延迟时间
|
||||||
|
'attempts' => 2, // 消费次数
|
||||||
|
'queue' => 'send-mail', // 队列名
|
||||||
|
'data' => ['to' => 'tom@gmail.com', 'content' => 'hello'], // 消息内容
|
||||||
|
'max_attempts' => 5, // 最大重试次数
|
||||||
|
'error' => '错误信息' // 错误信息
|
||||||
|
]
|
||||||
|
*/
|
||||||
|
public function onConsumeFailure(\Throwable $e, $package)
|
||||||
|
{
|
||||||
|
$package['max_attempts']=0;
|
||||||
|
Log::error('添加推送给供应商报价失败order_id'.$package['data']['order_id']);
|
||||||
|
return $package;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user