no message
This commit is contained in:
parent
d5d89ed3ec
commit
c3d963b37b
@ -183,20 +183,29 @@ class ExecController extends Controller
|
||||
}
|
||||
|
||||
// 自动点赞 @cron
|
||||
public function likeAuto ()
|
||||
public function likeAuto()
|
||||
{
|
||||
echo "\n#start# like auto \n";
|
||||
|
||||
$iRand = rand(0, 3);
|
||||
|
||||
// if ($iRand === 1) {
|
||||
|
||||
$r = ArticleList::where('code', date('Ymd'))
|
||||
->increment('like', $iRand);
|
||||
|
||||
echo $r;
|
||||
|
||||
// }
|
||||
echo '\n';
|
||||
|
||||
if ($iRand > 0) {
|
||||
$article = ArticleList::where('code', date('Ymd'))->first();
|
||||
|
||||
if ($article) {
|
||||
// 使用 updateQuietly 避免触发 updated_at
|
||||
$article->updateQuietly([
|
||||
'like' => $article->like + $iRand
|
||||
]);
|
||||
|
||||
echo "like +{$iRand}\n";
|
||||
} else {
|
||||
echo "no article found\n";
|
||||
}
|
||||
} else {
|
||||
echo "skip, rand=0\n";
|
||||
}
|
||||
|
||||
echo "#end# like auto \n";
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user