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.
54 lines
1.3 KiB
54 lines
1.3 KiB
<?php
|
|
|
|
declare (strict_types=1);
|
|
|
|
namespace app\command;
|
|
|
|
use think\console\Command;
|
|
use think\console\Output;
|
|
use think\console\Input;
|
|
use think\facade\Db;
|
|
use app\api\model\{Goods as GoodsModel};
|
|
use app\api\model\PreSale;
|
|
use app\api\model\PreSaleMessage;
|
|
use app\api\model\PreSaleLog;
|
|
|
|
// /www/server/php/74/bin/php /server/wwwroot/yanzong/think test
|
|
class test extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
// 指令配置
|
|
$this->setName('test')
|
|
->setDescription('预售到期自动上架');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$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]);
|
|
//获取预约信息
|
|
|
|
//预约的用户推送消息
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|