12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace App\Console\Commands\User;
- use App\Models\PartnerModel;
- use App\Models\User\UserModel;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Redis;
- /**
- * 补全信息提醒-运营端
- * Class CompleteInfoRemind
- * @package App\Console\Commands\User
- */
- class CompleteInfoRemind extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'operate:remindComplteInfo';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '运营:提醒补全信息';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $key = "fpdx:completeinfo:remind";
- $ids = Redis::smembers($key);
- $partners = PartnerModel::whereNotIn('id', $ids)->where([['feed_push_type', 5], ['score', 0]])->take(rand(
- 1,
- 3
- ))->get();
- $nicknames = UserModel::where('partner_id', '>', 0)->skip(rand(
- 10,
- 500
- ))->take(3)->get(['nickname'])->pluck('nickname');
- foreach ($partners as $partner) {
- try {
- /** @var UserModel $user */
- $user = UserModel::findOrFail($partner->uid);
- /** @var PartnerModel $partner */
- event(new \App\Events\CompleteInfoRemind($user, $nicknames[rand(0, count($nicknames) - 1)]));
- Redis::sadd($key, [$partner->id]);
- } catch (\Exception $exception) {
- }
- }
- }
- }
|