no message

This commit is contained in:
hellcat 2025-10-18 18:16:00 +08:00
parent a74ef3f56f
commit e9615488d8
3 changed files with 28 additions and 9 deletions

View File

@ -184,13 +184,20 @@ final class Cron
->count(),
];
$str = "# 付费用户计数";
$str = "# 付费用户计数 \n";
// $str .= "<table>";
foreach ($aCount as $k => $v) {
$str .= "\n".$k."".$v;
// $str .= "<tr>";
// $str .= "<td>".$k."</td>";
// $str .= "<td>".$v."</td>";
// $str .= "</tr>";
}
// $str .= "</table>";
// $str .= "\n\n----END--------";
$oTelegramV2 = new TelegramV2("base");
$oTelegramV2->setMsgType("html");
// $oTelegramV2->setMsgType("html");
$oTelegramV2->send($str, "str");
}
@ -955,6 +962,14 @@ final class Cron
$oOrder->update_time = time();
$oOrder->save();
$product = Product::where("code", $oOrder->product_code)->first();
if ($product) {
$product->sale_count -= 1;
$product->status = 1;
$product->save();
}
if ($invoice->money_use > 0) {
$iUserMoneyOld = $oUser->money;
$oUser->money += $invoice->money_use;

View File

@ -229,10 +229,7 @@ final class Payment
// tomd("redir:".$redir);
// exit;
////// 先创建订单
$product = (new Product())->find($product_id);
if ($product === null || $product->stock === 0) {
@ -242,6 +239,13 @@ final class Payment
]);
}
if ($product->sale_count >= $product->stock) {
return $response->withJson([
'ret' => 0,
'msg' => '商品不存在或库存不足',
]);
}
if ($product->end_time != 0 && $product->end_time < time()) {
return $response->withJson([
'ret' => 0,
@ -438,12 +442,11 @@ final class Payment
);
}
// if ($product->stock > 0) {
// if ($product->stock >= 1) { // 大于等于1说明有商品且限购
// $product->stock -= 1;
// }
// $product->sale_count += 1;
// $product->save();
$product->sale_count += 1;
$product->save();
if ($coupon_raw !== '') {
$coupon->use_count += 1;

View File

@ -171,6 +171,7 @@ final class Test extends Base
public function orderCombo()
{
$job = new Cron();
$job->productAuto();
$job->orderToPlan(); // 账单激活 用户当前class非2就进过期队列
$job->plan_expireToQueue(); // 标记过期队列
$job->planQueue_pendingToActivation(); // 队列排除 1 激活pending