option('d'); $npassDatas = FeedcheckLogModel::where([['is_pass', 0], ['expire_at', 0]]) ->groupBy('partner_id') ->orderBy('partner_id', 'asc')->select([DB::raw("`partner_id`, COUNT(*) * 5 as cnt")])->get(); $passDatas = FeedcheckLogModel::where([['is_pass', 1], ['expire_at', 0]]) ->groupBy('partner_id') ->orderBy('partner_id', 'asc')->select([DB::raw("`partner_id`, COUNT(*) * 5 as cnt")])->get(); $bar = null; if (!$deamon) { $bar = $this->output->createProgressBar($npassDatas->count() + $passDatas->count()); $bar->start(); } foreach ($npassDatas as $data) { PartnerModel::where([ ['id', $data->partner_id], ['feed_tag_cnt', 0] ])->update([ 'feed_tag_cnt' => $data->cnt ]); if (!$deamon) { $bar->advance(1); } } foreach ($passDatas as $data) { PartnerModel::where([ ['id', $data->partner_id], ['feed_tag_like', 0] ])->increment('feed_tag_cnt', $data->cnt); PartnerModel::where([ ['id', $data->partner_id], ['feed_tag_like', 0] ])->increment('feed_tag_like', $data->cnt); if (!$deamon) { $bar->advance(1); } } $sql = "UPDATE `kdgx_partner_charge_partner` set `feed_tag_cnt`= 100, `feed_tag_like`= IF(1= `sex`, 30, 60) where `is_recommend`= 1"; DB::statement($sql); if (!$deamon) { $bar->finish(); } } }