1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace App\Console\Commands;
- use App\Modules\Channel\Services\ChannelService;
- use App\Modules\User\Services\UserSubscribeBehaviorStatsService;
- use Log;
- use Illuminate\Console\Command;
- use DB;
- class fansMaximumNotice extends Command
- {
-
- protected $signature = 'addFansMaximumNotice';
-
- protected $description = '渠道阈值提醒';
-
- public function handle()
- {
-
- $res = DB::select("select official_accounts.* from distribution_channels left join official_accounts
- on official_accounts.distribution_channel_id=distribution_channels.id
- where official_accounts.subscribe_day_maximum=0 and official_accounts.is_enabled=1
- and not exists( select fln.id from fans_limit_notice as fln
- where fln.distribution_channel_id=official_accounts.distribution_channel_id
- and fln.date='".date('Y-m-d')."' and fln.appid=official_accounts.appid)");
- $data = [];
- foreach ($res as $item){
- $data[] = array(
- 'distribution_channel_id'=>$item->distribution_channel_id,
- 'appid'=>$item->appid,
- 'title'=>'阈值提醒',
- 'account_nickname'=>$item->nickname,
- 'is_read'=>0,
- 'date'=>date('Y-m-d'),
- 'created_at'=>date('Y-m-d H:i:s'),
- 'updated_at'=>date('Y-m-d H:i:s')
- );
- }
- $inserted = DB::table('fans_limit_notice')->insert($data);
- }
- }
|