Commit 4bdef15d authored by luhongguang's avatar luhongguang

update:拼单活动活动状态

parent d4930521
......@@ -10,6 +10,10 @@ class MarketingPindan extends MysqlBase
const CONFIG_INDEX = 'marketing';
const PRIMARY_KEY = 'marketing_pindan_id';
const ACTIVITY_STATUS_NO_START = 1;
const ACTIVITY_STATUS_IN_PROGRESS = 2;
const ACTIVITY_STATUS_FINISHED = 3;
public static function getRecord($where, $colums = [])
{
if (empty($colums)) {
......
......@@ -205,6 +205,7 @@ class MarketingService
*/
private static function pindanMarketingList($params)
{
$params['activity_status'] = !empty($params['activity_status']) ? $params['activity_status'] : 0;
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
......@@ -217,6 +218,16 @@ class MarketingService
$where['online_status'] = $params['online_status'];
}
$now = date("Y-m-d H:i:s");
if ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_NO_START) {
$where["start_time[>]"] = $now;
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_IN_PROGRESS) {
$where["start_time[<=]"] = $now;
$where["end_time[>=]"] = $now;
} elseif ($params["activity_status"] == MarketingPindan::ACTIVITY_STATUS_FINISHED) {
$where["end_time[<]"] = $now;
}
$where['ORDER'] = ["update_time" => "DESC"];
$where['LIMIT'] = [$page, $limit];
$list = Marketing::select(["marketing_id", "marketing_name", "start_time", "end_time",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment