<?php

use AlicFeng\IdentityCard\Birthday;
use Illuminate\Support\Facades\Artisan;

Artisan::command('pair:account', function () {
    \App\Http\Controllers\Fpdx\Media::autoCpAccount();
})->describe('72小时活动-结算');

Artisan::command('pair:pipei', function () {
    $pairObj = new \App\Http\Controllers\Crontab\Pair();
    $pairObj->index();
})->describe('72小时活动-匹配');
Artisan::command('pair:prepipei', function () {
    $pairObj = new \App\Http\Controllers\Crontab\Pair();
    $pairObj->prePipei();
    // 恢复
    $pairObj->preRestore();
})->describe('72小时活动-预匹配');
Artisan::command('pair:rematch', function () {
    $ms = new \App\Services\Pair\MatchService();
    $ms->rematch();
})->describe("72小时活动:重新匹配");

Artisan::command('order:refund {order_id}', function (int $order_id) {
    $order = new \App\Http\Controllers\Order();
    $order->requestRefund($order_id);
})->describe('72小时活动:订单退款');

Artisan::command('fixbug:pair:nodeed', function () {
    $ps = new \App\Console\Commands\Upgrade\V20181205Command();
    $ps->addPairDeed();
})->describe("bug修复:72小时报名:修复没有契约的bug");

Artisan::command('goodnight:push', function () {
    $subObj = new App\Services\Goodnight\SubscribeService();
    $subObj->pushload();
})->describe('晚安伴侣:订阅推送');
Artisan::command('goodnight:match', function () {
    $ms = new App\Services\Goodnight\MatchService();
    $ms->run();
})->describe('晚安伴侣:匹配伴侣');

Artisan::command('wxkf:hourqueue:add', function () {
    $kfs = new \App\Services\App\KfService();
    $kfs->wxkfHourQueue();
})->describe("运营:微信客服管理:添加每小时二维码数量");

Artisan::command('clean:wxkf:daycnt', function () {
    $kfs = new \App\Services\App\KfService();
    $kfs->clearWxkf();
})->describe("清理脚本:微信客服管理:每日发码和加好友数量");

Artisan::command("clean:debug:feed:redis {uid}", function (int $uid) {
    \Illuminate\Support\Facades\Redis::del(["charge_feed_{$uid}"]);
    \Illuminate\Support\Facades\Redis::del(["session_msy_{$uid}"]);
    \Illuminate\Support\Facades\Redis::del(["fpdx:feed:recommend:{$uid}"]);
})->describe("清理脚本:开发测试:信息流缓存");

Artisan::command('supervip:remindexpire', function () {
    $vs = new \App\Services\User\VipService();
    $vs->remindExpire();
})->describe("超级会员:过期通知");

Artisan::command('partner:thumbme:notice:dely', function () {
    $ns = new \App\Services\User\NoticeService();
    $ns->thumbMeDelay();
})->describe("心动通知:夜间通知延迟发送");

Artisan::command('invitation:notice:dely', function () {
    $ns = new \App\Services\Deed\NoticeService();
    $ns->invitationDelay();
})->describe("心动邀请通知:夜间通知延迟发送");

Artisan::command('popularity:share:flower:expire', function () {
    $vs = new \App\Services\User\HomeService();
    $vs->popularityExpire();
})->describe("人气值:好友助力和小fa:过期通知");

Artisan::command('popularity:todaylog:save', function () {
    $ps = new \App\Services\User\HomeService();
    $ps->logTodayPopularity();
})->describe("人气值:存储用户今日人气值");

Artisan::command('popularity:daiyuser:load', function () {
    $ps = new \App\Services\Notice\PopularityService();
    $ps->loadPushUsers();
})->describe("人气值:加载人气值日报推送用户");

Artisan::command('popularity:daiyuser:push', function () {
    $ps = new \App\Services\Notice\PopularityService();
    $ps->daiyPush();
})->describe("人气值:发送日报");

Artisan::command('friendslist:unreadnotice:load', function () {
    $fs = new \App\Services\Notice\FriendsListUnreadMsgService();
    $fs->loadSendQueue();
})->describe("好友列表:未读消息通知:加载通知用户");

Artisan::command('friendslist:unreadnotice:send', function () {
    $fs = new \App\Services\Notice\FriendsListUnreadMsgService();
    $fs->push();
})->describe("好友列表:未读消息通知:发送通知");

Artisan::command('user:tmp', function () {
    \App\Models\User\UserModel::whereNotNull('age')->where('star',
        '')->each(function (/** @var \App\Models\User\UserModel $item */ $item) {
        $star = Birthday::star(strtotime($item->age));
        \App\Models\User\UserModel::where('uid', $item->uid)->update(['star' => $star]);
        if ($item->partner_id > 0) {
            \App\Models\PartnerModel::where('id', $item->partner_id)->update(['star' => $star]);
        }
    });
})->describe("用户信息-星座");

