mainId ?? 0; $staffList = StaffClass::getAllByCondition(['mainId' => $mainId], null, 'adminId'); $merchant = WxOpenClass::getWxInfo(); $ptStyle = dict::getDict('ptStyle', 'hd'); if (getenv('YII_ENV') == 'production') { $msgList = dict::getDict('hdMiniMessage'); } else { $msgList = dict::getDict('hdMiniMessageDev'); } $msgId = $msgList['afterSale']['msgId'] ?? ''; if (empty($msgId)) { return $result; } if (!empty($staffList)) { $ids = array_column($staffList, 'adminId'); if (!empty($ids)) { $adminList = AdminClass::getByIds($ids); if (!empty($adminList)) { $orderSn = $refund->orderSn ?? ''; $refundType = $refund->refundType ?? 1; $name = $refundType == 1 ? '退货退款' : '只退款'; $addTime = $refund->addTime ?? ''; $status = $refund->status ?? 0; $statusName = '已通过'; if ($status == 2) { $statusName = '已驳回'; } foreach ($adminList as $admin) { $miniOpenId = $admin['miniOpenId'] ?? ''; if (!empty($miniOpenId)) { $msg = [ "thing4" => ["value" => $name], "time5" => ["value" => $addTime], "character_string3" => ["value" => $orderSn], "phrase2" => ["value" => $statusName], "thing6" => ["value" => "点击查看详情"], ]; $page = 'pagesPurchase/refundDetail?id=' . $refund->id; Yii::info(json_encode($msg)); $respond = miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg); if (isset($respond['errcode']) && $respond['errcode'] === 0) { $result['hasNotice'] = 1; } } } } } } return $result; } //有新的结账单 ssh 20230514 public static function newClearNotice($shop, $clear) { $result = []; $mainId = $shop->mainId ?? 0; $staffList = StaffClass::getAllByCondition(['mainId' => $mainId], null, 'adminId'); $merchant = WxOpenClass::getWxInfo(); $ptStyle = dict::getDict('ptStyle', 'hd'); if (getenv('YII_ENV') == 'production') { $msgList = dict::getDict('hdMiniMessage'); } else { $msgList = dict::getDict('hdMiniMessageDev'); } $msgId = $msgList['remindHdClear']['msgId'] ?? ''; if (empty($msgId)) { return $result; } $num = $clear->num ?? 0; $actPrice = $clear->actPrice ?? 0; $ghsName = $clear->ghsName ?? '没有'; if (!empty($staffList)) { $ids = array_column($staffList, 'adminId'); if (!empty($ids)) { $adminList = AdminClass::getByIds($ids); if (!empty($adminList)) { foreach ($adminList as $admin) { $miniOpenId = $admin['miniOpenId'] ?? ''; if (!empty($miniOpenId)) { $msg = [ "thing5" => ["value" => $ghsName], "short_thing2" => ["value" => $num . "笔"], "amount3" => ["value" => $actPrice], "thing4" => ["value" => "点击帮我结下款哦"], ]; $page = 'admin/clear/info?id=' . $clear->id; Yii::info(json_encode($msg)); $respond = miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg); if (isset($respond['errcode']) && $respond['errcode'] === 0) { $result['hasNotice'] = 1; } } } } } } return $result; } //采购成功之后小程序通知 public static function cgSuccessMiniNotice($cgShop, $cg) { $result = []; $mainId = $cgShop->mainId ?? 0; $staffList = StaffClass::getAllByCondition(['mainId' => $mainId], null, 'adminId'); $merchant = WxOpenClass::getWxInfo(); $ptStyle = dict::getDict('ptStyle', 'hd'); if (getenv('YII_ENV') == 'production') { $msgList = dict::getDict('hdMiniMessage'); } else { $msgList = dict::getDict('hdMiniMessageDev'); } $msgId = $msgList['cgSuccess']['msgId'] ?? ''; if (empty($msgId)) { return $result; } $ghsName = $cg->ghsName ?? ''; $bigNum = $cg->bigNum ?? 0; $num = ''; if ($bigNum > 0) { $num = $bigNum . '扎'; } $smallNum = $cg->smallNum ?? 0; if ($smallNum > 0) { $num .= $smallNum . '支'; } $name = "花材" . $num; $actPrice = $cg->actPrice ?? 0; $payTime = $cg->payTime ?? ''; $remark = "点击查看详情"; if (isset($cg->debt) && $cg->debt == 1) { $remark = "====点击付款===="; $name = $name . '【赊账】'; } if (!empty($staffList)) { $ids = array_column($staffList, 'adminId'); if (!empty($ids)) { $adminList = AdminClass::getByIds($ids); if (!empty($adminList)) { foreach ($adminList as $admin) { $miniOpenId = $admin['miniOpenId'] ?? ''; if (!empty($miniOpenId)) { $msg = [ "thing1" => ["value" => $ghsName], "thing2" => ["value" => $name], "amount3" => ["value" => $actPrice], "date4" => ["value" => $payTime], "thing5" => ["value" => $remark] ]; $page = 'pagesPurchase/purDetails?id=' . $cg->id; $respond = miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg); if (isset($respond['errcode']) && $respond['errcode'] === 0) { $result['hasNotice'] = 1; } } } } } } return $result; } //订单发货后小程序通知 public static function orderFhMiniNotice($order) { $cgId = $order->purchaseId ?? 0; $cg = PurchaseClass::getById($cgId, true); if (empty($cg)) { return false; } $result = []; $mainId = $cg->mainId ?? 0; $staffList = StaffClass::getAllByCondition(['mainId' => $mainId], null, 'adminId'); $merchant = WxOpenClass::getWxInfo(); $ptStyle = dict::getDict('ptStyle', 'hd'); if (getenv('YII_ENV') == 'production') { $msgList = dict::getDict('hdMiniMessage'); } else { $msgList = dict::getDict('hdMiniMessageDev'); } $msgId = $msgList['fhNotice']['msgId'] ?? ''; if (empty($msgId)) { return $result; } $ghsName = $cg->ghsName ?? ''; $bigNum = $cg->bigNum ?? 0; $num = ''; if ($bigNum > 0) { $num = $bigNum . '扎'; } $smallNum = $cg->smallNum ?? 0; if ($smallNum > 0) { $num .= $smallNum . '支'; } $name = "花材" . $num; $orderSn = $cg->orderSn ?? ''; $sendTime = date("Y-m-d H:i:s"); $remark = "点击查看详情"; if (isset($cg->debt) && $cg->debt == 1) { $remark = "===点击查看详情==="; } if (!empty($staffList)) { $ids = array_column($staffList, 'adminId'); if (!empty($ids)) { $adminList = AdminClass::getByIds($ids); if (!empty($adminList)) { foreach ($adminList as $admin) { $miniOpenId = $admin['miniOpenId'] ?? ''; if (!empty($miniOpenId)) { $msg = [ "thing12" => ["value" => $ghsName], "thing1" => ["value" => $name], "character_string2" => ["value" => $orderSn], "date3" => ["value" => $sendTime], "thing6" => ["value" => $remark] ]; $page = 'pagesPurchase/purDetails?id=' . $cg->id; $respond = miniUtil::commonSendSubscribeMessage($merchant, $ptStyle, $msgId, $miniOpenId, $page, $msg); if (isset($respond['errcode']) && $respond['errcode'] === 0) { $result['hasNotice'] = 1; } } } } } } return $result; } }