123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Console\Commands\User;
- use App\Jobs\MockThumbJob;
- use App\Models\User\UserModel;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Redis;
- /**
- * 用户模拟点赞定时触发任务
- * Class MockThumbNoLoginJob
- * @package App\Console\Commands\User
- */
- class MockThumbTimingJob extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'mockthumb:timing';
- /**
- * 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()
- {
- try {
- $key = "fpdx:mockthumb:timing";
- $uids = Redis::smembers($key);
- $user = UserModel::join("kdgx_user_auth_key", 'kdgx_partner_charge_user.uid', '=', 'kdgx_user_auth_key.uid')
- ->join('kddx_user_openid', 'kdgx_user_auth_key.auth_key', '=', 'kddx_user_openid.unionid')
- ->where(array(
- ['partner_id', 0],
- ['kdgx_user_auth_key.auth_type', 'kdgx_unionid']
- ))->whereIn('kddx_user_openid.public_id', ['gh_b598cb7474d8', 'gh_c94c95866ca5'])
- ->whereNotIn('kdgx_user_auth_key.uid', $uids)->first([
- 'kdgx_user_auth_key.uid',
- 'kddx_user_openid.subscribe'
- ]);
- dump($user->uid);
- if (1 == $user->subscribe) {
- MockThumbJob::dispatch($user->uid, 1, 1);
- } else {
- MockThumbJob::dispatch($user->uid, 1, 2);
- }
- Redis::sadd($key, [$user->uid]);
- } catch (\Exception $exception) {
- }
- }
- }
|