[], ]; } public function queryWhere() { // 指定销售 $sale_id = SaleLogic::getSaleIdByToken($this->params['sale_token']??'00000'); $where[] = ['b.sale_id', '=', $sale_id]; if (isset($this->params['start_time']) && !empty($this->params['start_time'])) { $monthStart = strtotime(date("Y-m-01",strtotime($this->params['start_time']))); $monthEnd = strtotime(date("Y-m-t 23:59:59",strtotime($this->params['start_time']))); $where[] = ['start_time', 'between', [$monthStart, $monthEnd]]; } return $where; } /** * @notes 获取列表 * @return array */ public function lists(): array { $lists = GroupActivityCategory::alias("a") ->leftJoin("property_head b","a.property_head_id=b.id") ->where($this->queryWhere()) ->field('a.id,a.title,a.start_time,a.end_time,a.service_time') ->limit($this->limitOffset, $this->limitLength) ->order('a.id', 'desc') ->select() ->toArray(); foreach($lists as &$item) { $item['start_time'] = date('Y-m-d', strtotime($item['start_time'])); $item['end_time'] = date('m-d', $item['end_time']); $item['service_time'] = date('Y-m-d', strtotime($item['service_time'])); } return $lists; } /** * @notes 获取数量 * @return int */ public function count(): int { return GroupActivityCategory::alias("a") ->leftJoin("property_head b","a.property_head_id=b.id") ->where($this->queryWhere()) ->count(); } }