no message

This commit is contained in:
hellcat 2026-01-11 15:39:52 +08:00
parent 423850da60
commit 9db649d8b9

View File

@ -186,27 +186,26 @@ class ExecController extends Controller
public function likeAuto()
{
echo "\n#start# like auto \n";
$iRand = rand(0, 3);
$today = date('Ymd');
if ($iRand > 0) {
$article = ArticleList::where('code', date('Ymd'))->first();
// 1. 抓取模型实例
$article = ArticleList::where('code', $today)->first();
if ($article) {
// 使用 updateQuietly 避免触发 updated_at
$article->updateQuietly([
'like' => $article->like + $iRand
]);
if ($article) {
// 2. 关键动作:关闭时间戳维护
$article->timestamps = false;
echo "like +{$iRand}\n";
} else {
echo "no article found\n";
}
// 3. 执行自增increment 内部会自动 save
$r = $article->increment('like', $iRand);
echo "Code: {$today}, Added: {$iRand}, Result: " . ($r ? 'Success' : 'Fail');
} else {
echo "skip, rand=0\n";
echo "No record found for today.";
}
echo "#end# like auto \n";
echo "\n#end# like auto \n";
}
// 点赞初始