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/timer/model/bargain/Task.php

47 lines
1.6 KiB

<?php
// +----------------------------------------------------------------------
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
// +----------------------------------------------------------------------
// | Author: 萤火科技 <admin@yiovo.com>
// +----------------------------------------------------------------------
declare (strict_types=1);
namespace app\timer\model\bargain;
use app\common\model\bargain\Task as TaskModel;
/**
* 砍价任务模型
* Class Task
* @package app\api\model\bargain
*/
class Task extends TaskModel
{
/**
* 获取已过期但未结束的砍价任务
* @param int $storeId
* @return array
*/
public function getEndTaskIds(int $storeId): array
{
return $this->where('end_time', '<=', time())
->where('status', '=', 1)
->where('is_delete', '=', 0)
->where('store_id', '=', $storeId)
->column('task_id');
}
/**
* 将砍价任务标记为已结束(批量)
* @param array $taskIds 砍价任务ID集
* @return bool
*/
public function setIsEnd(array $taskIds): bool
{
return static::updateBase(['status' => 0], [['task_id', 'in', $taskIds]]);
}
}