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]); //获取预约信息 //预约的用户推送消息 } } }