123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?php
- namespace App\Console\Commands\Notices;
- use App\Models\Fpdx\PairModel;
- use App\Models\User\UserModel;
- use App\Models\PartnerModel;
- use App\Models\User\Openid;
- use Illuminate\Console\Command;
- class OldDataCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'notice:data';
- /**
- * 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()
- {
- //
- $this->vip();
- $this->fpdx();
- $this->visitor();
- $this->recommendCancel();
- $this->phoneNotCard();
- $this->oncePair();
- }
- public function vip()
- {
- dump("老用户召回-激活会员通知");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '老用户召回-激活会员通知')
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- $vip_count = UserModel::where('be_vip_at', '>', 0)->whereIn('uid', $uids)->count();
- dump("取关人数{$unsubscribe_count}");
- dump("会员人数{$vip_count}");
- }
- public function fpdx()
- {
- dump("老用户召回-对象包分配通知");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '老用户召回-对象包分配通知')
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- $pair_count = PairModel::where('uid', $uids)->distinct('uid')->count();
- dump("取关人数{$unsubscribe_count}");
- dump("匹配人数{$pair_count}");
- }
- public function visitor()
- {
- dump("老用户召回-访客通知");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '老用户召回-访客通知')
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- dump("取关人数{$unsubscribe_count}");
- }
- public function recommendCancel()
- {
- dump("交友卡片-卡片取消推荐通知");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '交友卡片-卡片取消推荐通知')
- ->where('result', 1)
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- $number = $uids->count();
- $card = PartnerModel::where('upload_at', '>', 1560873600)->whereIn('uid', $uids)->count();
- dump("发送人数{$number}");
- dump("取关人数{$unsubscribe_count}");
- dump("更换照片人数{$card}");
- }
- public function phoneNotCard()
- {
- dump("老用户召回-有手机号但无卡片者通知");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '老用户召回-有手机号但无卡片者通知')
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- $number = $uids->count();
- $card_count = UserModel::where('partner_id', '>', 0)->whereIn('uid', $uids)->count();
- dump("发送人数{$number}");
- dump("取关人数{$unsubscribe_count}");
- dump("交友卡片人数{$card_count}");
- }
- public function oncePair()
- {
- dump("老用户召回-仅参与过一次活动的用户");
- $uids = \DB::connection('mysql_datalog')
- ->table("notice_logs")
- ->where('title', '老用户召回-仅参与过一次活动的用户')
- ->distinct()
- ->pluck('uid');
- $unsubscribe_count = Openid::whereIn('uid', $uids)
- ->where('public_id', 'gh_b598cb7474d8')
- ->where('subscribe', 0)
- ->count();
- $pair_count = PairModel::where('create_time', '>', 1560787200)
- ->whereIn('uid', $uids)
- ->distinct()
- ->count();
- dump("取关人数{$unsubscribe_count}");
- dump("报名人数{$pair_count}");
- }
- }
|