<?php

namespace app\api\controller;

use app\admin\command\Api;
use app\common\model\unishop\WholesaleGoods;
use think\Db;

/**
 * 定时任务模块
 */
class Task extends Api
{
    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
        parent::_initialize();
    }
    public function sale(){

      $shop_days = Db::name('config')->where("name","shop_days")->value('value');
      $shop_days = isset($shop_days)?$shop_days:7;

      //到时商品自动售出
        $WholesaleGoods_model = new WholesaleGoods();
        $WholesaleGoods_model->sale($shop_days);

        echo "执行完成";
        exit();
    }

}