From 4cd3eed06ae4f532da1d5f414624d5ac8213d72a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 10 May 2024 18:05:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/goods/GoodsclassLists.php | 10 ++++++++-- app/admin/logic/operation/OpurchaseclassLogic.php | 2 ++ app/api/controller/order/OpurchaseOrderController.php | 5 +++-- app/queue/redis/PushSupplierProductsSend.php | 3 +-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/admin/lists/goods/GoodsclassLists.php b/app/admin/lists/goods/GoodsclassLists.php index fec990d..c204ddc 100644 --- a/app/admin/lists/goods/GoodsclassLists.php +++ b/app/admin/lists/goods/GoodsclassLists.php @@ -47,14 +47,20 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() - // ->each(function ($item) { + ->each(function ($item) { + $id=Goodsclass::where('pid',$item['id'])->value('id'); + if($id){ + $item['is_menu'] = 1; + }else{ + $item['is_menu'] = 0; + } // $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 linear_to_tree($lists, 'children'); diff --git a/app/admin/logic/operation/OpurchaseclassLogic.php b/app/admin/logic/operation/OpurchaseclassLogic.php index 58170b7..3ff1bc8 100644 --- a/app/admin/logic/operation/OpurchaseclassLogic.php +++ b/app/admin/logic/operation/OpurchaseclassLogic.php @@ -9,6 +9,7 @@ use app\common\model\goods\Goods; use app\common\model\opurchase\OpurchaseGoodsOffer; use app\common\model\opurchase\Opurchaseinfo; use app\common\model\supplier\Supplier; +use support\Log; use think\facade\Db; @@ -154,6 +155,7 @@ class OpurchaseclassLogic extends BaseLogic } }catch (\Exception $e){ self::setError($e->getMessage()); + Log::error('添加采购订单报价失败:'.$e->getMessage()); return false; } } diff --git a/app/api/controller/order/OpurchaseOrderController.php b/app/api/controller/order/OpurchaseOrderController.php index 00e8371..94ac6cd 100644 --- a/app/api/controller/order/OpurchaseOrderController.php +++ b/app/api/controller/order/OpurchaseOrderController.php @@ -4,7 +4,7 @@ namespace app\api\controller\order; use app\api\logic\order\OrderLogic; use app\api\controller\BaseApiController; - +use Webman\RedisQueue\Redis; /** * 采购单控制器 @@ -31,7 +31,8 @@ class OpurchaseOrderController extends BaseApiController if($order==false){ return $this->fail(OrderLogic::getError()); }else{ - + //推送队列 + Redis::send('push-supplier-products', ['order_id'=>$order['id']]); return $this->success('支付成功'); } } diff --git a/app/queue/redis/PushSupplierProductsSend.php b/app/queue/redis/PushSupplierProductsSend.php index 6ba8728..434f463 100644 --- a/app/queue/redis/PushSupplierProductsSend.php +++ b/app/queue/redis/PushSupplierProductsSend.php @@ -12,7 +12,7 @@ use support\Log; class PushSupplierProductsSend implements Consumer { // 要消费的队列名 - public $queue = 'send-mail'; + public $queue = 'push-supplier-products'; // 连接名,对应 plugin/webman/redis-queue/redis.php 里的连接` public $connection = 'default'; @@ -24,7 +24,6 @@ class PushSupplierProductsSend implements Consumer $select=Opurchaseinfo::where('pid',$order_id)->where('is_push',0)->select(); foreach ($select as $key => $arr) { OpurchaseclassLogic::createSupplierGoods($arr); - } } // 消费失败回调