12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Console\Commands\Welfare;
- use App\Services\Welfare\NoticeService;
- use Illuminate\Console\Command;
- use App\Models\Welfare\LotteryModel;
- use App\Models\Welfare\TicketModel;
- class NoticeCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'welfare:notice';
- /**
- * 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()
- {
- $lottery = LotteryModel::whereRaw("from_unixtime(`drawed_at`, '%Y-%m-%d %H:00:00') = ?", [
- date('Y-m-d H:00:00')
- ])->first();
- if (!$lottery) {
- dd('活动不存在');
- }
- $ns = new NoticeService();
- $users = TicketModel::where('lottery_id', $lottery->id)->whereNotIn('uid', [20000001, 20010000])
- ->distinct()
- ->pluck('uid');
- foreach ($users as $uid) {
- $ns->beforeLottery($uid, $lottery->id);
- }
- }
- }
|