redis->executeCommand('LLEN', [$noticeKey])) { $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]); //$json = '{"id":163,"num":"1","shopId":36523}'; if (!empty($json)) { $arr = json_decode($json, true); $id = $arr['id'] ?? 0; $num = $arr['num'] ?? 0; $shopId = $arr['shopId'] ?? 0; $res = BookItemCustomClass::getById($id, true); if (!empty($res)) { $shop = \biz\shop\classes\ShopClass::getById($shopId, true); WxMessageClass::bookChangeOutStockInform($shop, $res, $num); } } } } //花店采购通知供货商 ssh 20230805 public function actionHdCgNoticeGhs() { $noticeKey = "hdCgNoticeGhs"; while ($count = Yii::$app->redis->executeCommand('LLEN', [$noticeKey])) { $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]); if (!empty($json)) { $arr = json_decode($json, true); $orderId = $arr['orderId'] ?? 0; if (!empty($orderId)) { $order = OrderClass::getById($orderId, true); $shopId = $order->shopId ?? 0; $shop = ShopClass::getById($shopId, true); if (!empty($shop)) { WxMessageClass::ghsHasNewOrderInform($shop, $order); // 向供货商App发通知 $cgId = $order->purchaseId ?? 0; $cg = PurchaseClass::getById($cgId, true); $cgShop = ShopClass::getById($cg->shopId, true, 'shopName, merchantName'); $push = new push('ghs', push::MSG_TYPE_ORDER); $push->ghsOrderMessage($shop, $cgShop, $order); } } } } } //预订增加减少通知 ssh 20240820 public function actionBookChangeNotice() { $noticeKey = "bookChangeNoticeStaff"; while ($count = Yii::$app->redis->executeCommand('LLEN', [$noticeKey])) { $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]); if (!empty($json)) { $arr = json_decode($json, true); $shopId = $arr['shopId'] ?? 0; if (!empty($shopId)) { $shop = ShopClass::getById($shopId, true); if (!empty($shop)) { WxMessageClass::bookChangeInform($shop, $arr); } } } } } //供货商开单通知花店员工 ssh 20231129 public function actionGhsKdNoticeHd() { $noticeKey = "ghsKdNoticeHd"; while ($count = Yii::$app->redis->executeCommand('LLEN', [$noticeKey])) { $json = Yii::$app->redis->executeCommand('RPOP', [$noticeKey]); if (!empty($json)) { $arr = json_decode($json, true); $id = $arr['id'] ?? 0; if (!empty($id)) { $cg = PurchaseClass::getById($id, true); $shopId = $cg->shopId ?? 0; $shop = ShopClass::getById($shopId, true); if (!empty($shop)) { $allDevices = \bizHd\device\classes\HdDeviceClass::getAllByCondition(['shopId'=>$shopId, 'status' => 1]); $cids = array_column($allDevices, 'clientId'); $title = '买花成功'; $shopName = $shop->merchantName . ($shop->shopName != '首店' ? '(' . $shop->shopName . ')' : ''); $content = $shopName . ' ¥' . $cg->actPrice; $payload = [ "page" => "pagesPurchase/purDetails", "params" => ["id" => $id] ]; $push = new push('hd', push::MSG_TYPE_ORDER); $push->pushByCloud($cids, $title, $content, $payload); } } } } } }