You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/command/test.php

55 lines
1.3 KiB

10 months ago
<?php
declare (strict_types=1);
namespace app\command;
use think\console\Command;
use think\console\Output;
use think\console\Input;
use think\facade\Db;
10 months ago
use app\api\model\{Goods as GoodsModel};
use app\api\model\PreSale;
10 months ago
use app\api\model\PreSaleMessage;
use app\api\model\PreSaleLog;
10 months ago
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test
class test extends Command
{
protected function configure()
{
// 指令配置
$this->setName('test')
10 months ago
->setDescription('预售到期自动上架');
10 months ago
}
protected function execute(Input $input, Output $output)
{
10 months ago
$info = PreSale::where('status', 1)
->where('p_time', '<=', date('Y-m-d H:i:s'))
->where('is_change', '=', 0)
->select();
foreach ($info as $v) {
//所有商品直接上架
if (!empty($v['goods_list'])) {
$goodslist = explode(',', $v['goods_list']);
GoodsModel::where('store_id', $v['store_id'])
->whereIn('goods_id', $goodslist)
->update(['status' => 10]);
}
//更改预售状态
PreSale::where('id', $v['id'])
->update(['is_change' => 1]);
10 months ago
//获取预约信息
10 months ago
//预约的用户推送消息
}
10 months ago
}
}