params[ 'card_type' ]) ? $this->params[ 'card_type' ] : ''; $page = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1; $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS; $search_text = isset($this->params[ 'search_text' ]) ? $this->params[ 'search_text' ] : ''; $category_id = isset($this->params[ 'category_id' ]) ? $this->params[ 'category_id' ] : 0; $condition = array ( [ 'site_id', '=', $this->site_id ], [ 'status', '', '1' ] ); if (!empty($search_text)) { $condition[] = [ 'card_name', 'like', '%' . $search_text . '%' ]; } if (!empty($card_type)) { $condition[] = [ 'card_type', '=', $card_type ]; } if ($category_id > 0) { $condition[] = [ 'category_id', '=', $category_id ]; } $giftcard_model = new GiftCardModel(); $list = $giftcard_model->getGiftcardDetailPageList($condition, $page, $page_size, 'sort desc'); return $this->response($list); } /** * 活动详情 */ public function detail() { $giftcard_id = isset($this->params[ 'giftcard_id' ]) ? $this->params[ 'giftcard_id' ] : 0; $giftcard_model = new GiftCardModel(); $media_model = new Media(); $detail = $giftcard_model->getGiftcardDetail([ 'giftcard_id' => $giftcard_id, 'site_id' => $this->site_id ])[ 'data' ] ?? []; $detail[ 'media_list' ] = $media_model->getList([ [ 'media_id', 'in', $detail[ 'media_ids' ] ] ])[ 'data' ] ?? []; $detail[ 'mobile' ] = ( new Shop() )->getShopInfo([ [ 'site_id', '=', $this->site_id ] ], 'mobile')[ 'data' ][ 'mobile' ] ?? ''; $detail[ 'giftcard_desc' ] = $giftcard_model->giftcardDesc($detail) ?? ''; return $this->response($this->success($detail)); } }