From 692a89bae6c48fc58b6a871f0cfdc65b7a62a381 Mon Sep 17 00:00:00 2001 From: hellcat <> Date: Sun, 13 Jul 2025 15:20:14 +0800 Subject: [PATCH] no message --- src/Services/Tg/Hook/Mod/Coupon.php | 79 ++++++++++++++++++++++++++--- src/Services/Tg/Hook/Mod/Mail.php | 4 +- 2 files changed, 74 insertions(+), 9 deletions(-) diff --git a/src/Services/Tg/Hook/Mod/Coupon.php b/src/Services/Tg/Hook/Mod/Coupon.php index f4175f9c..19d72171 100644 --- a/src/Services/Tg/Hook/Mod/Coupon.php +++ b/src/Services/Tg/Hook/Mod/Coupon.php @@ -14,12 +14,18 @@ final class Coupon extends Base $aCouponList = UserCoupon::orderBy("name")->get()->toArray(); + $aMsg = []; foreach ($aCouponList as $row) { $row = $this->ForMat($row); - $this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); + $aMsg[] = $this->toJson($row); +// $this->oTGHttp->sendToTG(json_encode($row, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); + + } - $this->oHttp::response(200, 'ok'); + return $aMsg; + +// $this->oHttp::response(200, 'ok'); } @@ -49,11 +55,70 @@ final class Coupon extends Base public function Like($aParam) { - $sFiled = $aParam['aOption'][1]; - $sLike = $aParam['aArg'][1]; + $sFiled = $aParam['aOption'][1] ?? false; + $sLike = $aParam['aArg'][1] ?? false; + + if ($sLike == "?") { + return "/coupon#like__{field} {like}"; + } + + if (!$sFiled) { + return "需要field"; + } + + if (!$sLike) { + return "需要like"; + } $aCoupon = UserCoupon::where($sFiled, 'like', '%'.$sLike.'%')->get()->toArray(); - tomd($aCoupon, 1); + + foreach ($aCoupon as &$aCouponRow) { + $aCouponRow = $this->ForMat($aCouponRow); + } + + return $this->toJson($aCoupon); + } + + public function SetJson($aParam) + { + $iId = $aParam["aOption"][1] ?? false; + $aJson = $aParam["aArg"] ?? false; + + if ($aJson == "?") { + return "/coupon#setJson__{id} {json}"; + } + + if (!$iId) { + return "需要id"; + } + + if (!$aJson) { + return "需要json"; + } + + $sJson = implode(" ", $aJson); + $aJson = json_decode($sJson, true); + + $oCoupon = UserCoupon::find($iId); + + if (!$oCoupon) { + return "没找到这个id"; + } + + $oCoupon->id = $aJson["id"]; + $oCoupon->name = $aJson["name"]; + $oCoupon->code = $aJson["code"]; + $oCoupon->content = json_encode($aJson["content"]); + $oCoupon->limit = json_encode($aJson["limit"]); + $oCoupon->create_time = $aJson["create_time"]; + $oCoupon->expire_time = $aJson["expire_time"]; + $oCoupon->front_show = $aJson["front_show"]; + $oCoupon->save(); + + + $aParam["aArg"][1] = $oCoupon->id; + + return $this->FindById($aParam); } public function Set($aParam) @@ -113,8 +178,8 @@ final class Coupon extends Base $aCoupon['content'] = json_decode($aCoupon['content'], 1); $aCoupon['limit'] = json_decode($aCoupon['limit'], 1); - $aCoupon['limit']['use_time'] = $aCoupon['limit']['use_time'] ? date("Y-m-d H:i:s", $aCoupon['limit']['use_time']) : false; - $aCoupon['limit']['total_use_time'] = $aCoupon['limit']['total_use_time'] ? date("Y-m-d H:i:s", $aCoupon['limit']['total_use_time']) : false; +// $aCoupon['limit']['use_time'] = $aCoupon['limit']['use_time'] ? date("Y-m-d H:i:s", $aCoupon['limit']['use_time']) : false; +// $aCoupon['limit']['total_use_time'] = $aCoupon['limit']['total_use_time'] ? date("Y-m-d H:i:s", $aCoupon['limit']['total_use_time']) : false; $aCoupon['create_time'] = date("Y-m-d H:i:s", $aCoupon['create_time']); $aCoupon['expire_time'] = date("Y-m-d H:i:s", $aCoupon['expire_time']); diff --git a/src/Services/Tg/Hook/Mod/Mail.php b/src/Services/Tg/Hook/Mod/Mail.php index ea054533..a9e160f0 100644 --- a/src/Services/Tg/Hook/Mod/Mail.php +++ b/src/Services/Tg/Hook/Mod/Mail.php @@ -272,11 +272,11 @@ final class Mail extends Base public function tmp() { - $subject = "福云 - 暑假礼盒"; + $subject = "福云 - 暑期礼盒"; // $text = "
原主域名fuuu.cloud被封禁,已更换为fuuuu.cloud(多了一个u)。

无法继续翻墙的用户需到网站上重新复制订阅。

很抱歉对您的使用造成影响,补偿有套餐用户30g流量。"; // $text = "
近期管控收紧,造成节点波动和不可用。已陆续恢复正常,补偿有套餐用户10g流量。

最新域名:fuuuu.cloud"; - $text = "
礼盒内容:
一批6折优惠码:zzxxss,仅限购买月套餐
10g流量,赠送给有套餐用户。
富云最新域名fuuuu.cloud"; + $text = "
礼盒内容:
一批6折优惠码:shuqi25,仅限购买月套餐。
10g流量,自动发送给有套餐用户。
福云最新域名fuuuu.cloud。"; $content = strip_tags( str_replace(