123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace App\Console\Commands\Data;
- use App\Models\Common\CityModel;
- use App\Models\Fpdx\PairModel;
- use App\Models\PartnerModel;
- use Illuminate\Console\Command;
- class PartnerCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'data:partner';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'Command description';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $genders = [0, 1, 2];
- foreach ($genders as $sex) {
- $wheres = [
- "1 = 1",
- "(`qq`!= '' or `weixin`!= '')",
- "(`qq`!= '' or `weixin`!= '') AND (`photo_src` is NOT null or `photo_1`IS NOT NULL or `photo_2` IS NOT NULL or `photo_3` IS NOT NULL or `photo_4` IS NOT NULL or `voice` IS NOT NULL)",
- "`is_sell`= 1 ",
- "`is_sell`= 1 AND `score`> 0",
- "`is_sell`= 1 AND `feed_push_type`= 3",
- "`is_sell`= 1 AND `score`> 0 AND `feed_push_type`= 3",
- "`is_sell`= 1 AND `score`> 0 AND `feed_pool_level` != 'low' AND `feed_push_type` = 3"
- ];
- foreach ($wheres as $where) {
- echo PartnerModel::when($sex, function ($query) use ($sex) {
- $query->where('sex', $sex);
- })->whereRaw($where)->count();
- echo "\t";
- echo PartnerModel::when($sex, function ($query) use ($sex) {
- $query->where('sex', $sex);
- })->whereRaw("`uid` IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_c94c95866ca5' AND `subscribe`= 1)")->whereRaw($where)->count();
- echo "\t";
- echo PartnerModel::when($sex, function ($query) use ($sex) {
- $query->where('sex', $sex);
- })->whereRaw("`uid` IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_b598cb7474d8' AND `subscribe`= 1 )")->whereRaw($where)->count();
- echo "\t";
- echo PartnerModel::when($sex, function ($query) use ($sex) {
- $query->where('sex', $sex);
- })->whereRaw("`uid` IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_c94c95866ca5' AND `subscribe`= 1 AND `uid` NOT IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_b598cb7474d8') AND `uid`> 0 AND `subscribe`= 1 )")->whereRaw($where)->count();
- echo "\t";
- echo PartnerModel::when($sex, function ($query) use ($sex) {
- $query->where('sex', $sex);
- })->whereRaw("`uid` IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_c94c95866ca5' AND `subscribe`= 1 AND `uid` IN( SELECT `uid` FROM `koudai`.`kddx_user_openid` WHERE `public_id`= 'gh_b598cb7474d8') AND `uid`> 0 AND `subscribe`= 1 )")->whereRaw($where)->count();
- echo "\n";
- }
- echo "---------------\n\n";
- }
- }
- }
|