comment_id = $comment_id; $this->need_like = $need_like; } /** * Execute the job. * * @return void */ public function handle() { if( $this->need_like <= 0 ){ return; } global $__MINI_GLOBAL_REQUEST_ENV__; $__MINI_GLOBAL_REQUEST_ENV__ = 'api'; $comment = WxComment::find($this->comment_id); if(!$comment){ return; } if($comment->comment_state != 1){ return; } if(WxPost::where('id', $comment->posts_id)->where('is_examine', 1)->where('posts_state', 0)->exists()){ $uid = UserUtils::get_a_random_robot_uid(); if($uid > 0){ $comment_author_id = WxComment::where('id', $this->comment_id)->value('user_id'); global $__MINI_GLOBAL_IS_ADMIN_SUPER__; if($comment_author_id > 0 && in_array($comment_author_id, explode(',', env('APP_SUPER_ADMIN_USER_ID', '')))){ $__MINI_GLOBAL_IS_ADMIN_SUPER__ = true; } CommentUtils::comment_like($uid, $this->comment_id); $__MINI_GLOBAL_IS_ADMIN_SUPER__ = false; if($comment_author_id > 0){ $follow_rate = _between_(Settings::get('robot_action_follow_rate', 100), 0, 100) / 100; if($follow_rate != 0){ ImitateUserFollowsStepJob::dispatch($comment_author_id, mini_rand(0, 2))->delay(now()->addMinutes(mini_rand(1, 20))); } } ImitateCommentlikesStepJob::dispatch($this->comment_id, ($this->need_like - 1))->delay(now()->addMinutes(mini_rand(6, 30))); } } } }