params['hdImgHost'] . $filePath; // $audio = base64_encode($audio); $data = ['type' => 'money', 'url' => $url, 'msg' => $msg, 'money' => $money]; $dataString = json_encode($data); goWs::sendToUid($adminId, $dataString); //判断是否在线 // $online = Gateway::isUidOnline($adminId); //Gateway::sendToUid($adminId, json_encode($data)); //$client = Gateway::getClientIdByUid($adminId); //Yii::info("getClientIdByUid res :".json_encode($client)); } catch (\Exception $exception) { Yii::warning("ws arrivalNotice error " . $exception->getMessage()); } } else { Yii::warning("到账通知 语音获取失败" . json_encode($audio)); } return true; } //零售端采购时,提示供货商(下所有有开启通知的员工),你有新订单 //商城客户下单时,提示零售花店(下所有有开启通知的员工) 你有新的订单 public static function newOrderNotice($shopAdminId) { return true; $shopAdmin = ShopAdminClass::getById($shopAdminId, true); if (empty($shopAdmin)) { return false; } $sjId = $shopAdmin->sjId; $sj = SjClass::getById($sjId, true); $ptStyle = $sj->style ?? dict::getDict('ptStyle', 'hd'); $prefix = ''; if ($ptStyle == dict::getDict('ptStyle', 'hd')) { $prefix = Yii::$app->params['hdImgHost']; } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) { $prefix = Yii::$app->params['ghsImgHost']; } elseif ($ptStyle == dict::getDict('ptStyle', 'mall')) { $prefix = Yii::$app->params['mallImgHost']; } else { util::fail('平台无效'); } $url = $prefix . 'audio/new_order0.mp3'; $data = [ 'type' => 'new_order', 'url' => $url, ]; Yii::info("触发订单通知:" . $shopAdminId); try { //判断是否在线 //$online = Gateway::isUidOnline($shopAdminId); $dataString = json_encode($data); goWs::sendToUid($shopAdminId, $dataString); //Gateway::sendToUid($shopAdminId, json_encode($data)); // if($online){ // // }else{ // Yii::info("用户不在线:".$shopAdminId); // } } catch (\Exception $exception) { Yii::warning("ws arrivalNotice error " . $exception->getMessage()); } return true; } }