1], [['limit',], 'default', 'value' => 12], [['sort', 'sort_type', 'recommend_count'], 'integer',], [['sort',], 'default', 'value' => 0], [['goods_id', 'start_time', 'end_time', 'searchType'], 'string'], ]; } public function getMchId() { return empty($this->mch_id) ? 0 : $this->mch_id; } public function search() { if (!$this->validate()) return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0] ]; $query = Goods::find()->alias('g')->where([ 'g.status' => 1, 'g.is_delete' => 0, 'g.md_food_id' => 0 ])->andWhere(['!=', 'g.product_type', Goods::GOODS_TYPE_ADOPT]); if (get_md_id()) { $md = Md::findOne(get_md_id()); if ($md->is_single) { $query->leftJoin(['mdg' => MdGoods::tableName()], 'mdg.goods_id=g.id'); $query->andWhere(['g.product_type' => 0, 'mdg.status' => 1, 'mdg.md_id' => get_md_id()]); } } if ($this->store_id) $query->andWhere(['g.store_id' => $this->store_id]); if ($this->cat_id && $this->getMchId() == 0) { $cat = Cat::find()->select('id')->where(['is_delete' => 0,])->andWhere(['OR', ['parent_id' => $this->cat_id], ['id' => $this->cat_id],])->column(); $query->leftJoin(['gc' => GoodsCat::tableName()], 'gc.goods_id=g.id'); $query->andWhere(['or', ['gc.is_delete' => 0], 'isnull(gc.id)']); $query->andWhere( [ 'OR', ['g.cat_id' => $cat], ['gc.cat_id' => $cat], ] ); } if ($this->goods_id) { $arr = explode(',', $this->goods_id); $query->andWhere(['in', 'g.id', $arr]); } if ($this->keyword) $query->andWhere(['LIKE', 'g.name', $this->keyword]); $count = $query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit, 'page' => $this->page - 1]); if ($this->sort == 0) { //综合,自定义排序+时间最新 $query->orderBy('g.sort DESC, g.created_at DESC'); } if ($this->sort == 1) { //时间最新 $query->orderBy('g.created_at DESC'); } if ($this->sort == 2) { //价格 if ($this->sort_type == 0) { $query->orderBy('g.price ASC'); } else { $query->orderBy('g.price DESC'); } } if ($this->sort == 3) { //销量 $query->orderBy([ '( IF(gn.num, gn.num, 0) + virtual_sales)' => SORT_DESC, 'g.created_at' => SORT_DESC, ]); } $od_query = OrderDetail::find()->alias('od') ->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where(['od.is_delete' => 0, 'o.store_id' => $this->store_id, 'o.is_pay' => 1, 'o.is_delete' => 0])->groupBy('od.goods_id')->select('SUM(od.num) num,od.goods_id'); $select = 'g.goods_num, g.status, g.id, g.name,g.use_attr,g.price,g.original_price,g.cover_pic pic_url,gn.num,g.virtual_sales,g.unit,g.is_negotiable,g.attr,g.mch_id,g.is_level,g.product_type'; if (get_md_id() && $md->is_single) { $select .= ',mdg.virtual_sales as mdg_virtual_sales,mdg.attr as mdg_attr,mdg.price as mdg_price, mdg.status as mdg_status, mdg.goods_num as mdg_goods_num'; } $list = $query ->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id') ->select($select) ->limit($pagination->limit) ->offset($pagination->offset) ->asArray()->groupBy('g.id')->all(); $md_id = get_md_id(); foreach ($list as $i => $item) { if (!$item['pic_url']) { $list[$i]['pic_url'] = Goods::getGoodsPicStatic($item['id']); } if ($item['is_negotiable']) { $list[$i]['price'] = Goods::GOODS_NEGOTIABLE; } $list[$i]['sales'] = $this->numToW($item['num'] + $item['virtual_sales']) . $item['unit']; $res = CommonGoods::getMemberPrice([ 'attr' => $item['attr'], 'price' => $item['price'], 'mch_id' => $item['mch_id'], 'is_level' => $item['is_level'], ]); $goodsMemberPrice = $res['min_member_price'] ? $res['min_member_price'] : $item['price']; $list[$i]['goods_member_price'] = round($goodsMemberPrice,2); $list[$i]['comment'] = OrderComment::find()->where(['store_id' => $this->store_id, 'goods_id' => $item['id'], 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE])->count(); $goods_comment_count = OrderComment::find()->where(['store_id' => $this->store_id, 'goods_id' => $item['id'], 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE]); $goods_count = $goods_comment_count->andWhere(['>', 'score', 2])->count(); $list[$i]['rank_good_percent'] = $goods_count > 0 ? round(($goods_count / $list[$i]['comment']) * 100) . '%' : 0 . '%'; if ($md_id && $md->is_single) { $list[$i]['attr'] = $item['mdg_attr']; $list[$i]['virtual_sales'] = $item['mdg_virtual_sales']; $list[$i]['goods_num'] = $item['mdg_goods_num']; $list[$i]['price'] = $item['mdg_price']; $list[$i]['status'] = $item['mdg_status']; } } $data = [ 'row_count' => $count, 'page_count' => $pagination->pageCount, 'list' => $list, ]; return [ 'code' => 0, 'data' => $data ]; } public function recommend() { if (!$this->validate()) return $this->errorResponse; $goods_id = $this->goods_id; if (!$goods_id) { return [ 'code' => 1, 'msg' => 'err' ]; } $cat_ids = []; $goods = Goods::find()->select('*')->where(['store_id' => $this->store_id, 'is_delete' => 0, 'type' => get_plugin_type(), 'md_food_id' => 0])->andWhere('id=:id', [':id' => $goods_id])->one(); $cat_id = $goods->cat_id; if ($goods->mch_id > 0) { if ($cat_id == 0) { $goodsCat = MchGoodsCat::find()->select('cat_id')->where(['goods_id' => $goods_id])->all(); $goods_cat = []; foreach ($goodsCat as $v) { $goods_cat[] = $v->cat_id; } } else { $goods_cat = array(intval($cat_id)); } $cat_ids = $goods_cat; //查询 $goodscat_list = MchGoodsCat::find()->select(['goods_id'])->andWhere(['in', 'cat_id', $cat_ids])->all(); }else { if ($cat_id == 0) { $goodsCat = GoodsCat::find()->select('cat_id')->where(['store_id' => $this->store_id, 'goods_id' => $goods_id, 'is_delete' => 0])->all(); $goods_cat = []; foreach ($goodsCat as $v) { $goods_cat[] = $v->cat_id; } } else { $goods_cat = array(intval($cat_id)); } $cat_ids = $goods_cat; //查询 $goodscat_list = GoodsCat::find()->select(['goods_id'])->where(['store_id' => $this->store_id, 'is_delete' => 0])->andWhere(['in', 'cat_id', $cat_ids])->all(); } $cats = []; foreach ($goodscat_list as $v) { $cats[] = $v->goods_id; } $query = Goods::find()->alias('g') ->where(['and', "g.id!=$goods_id", 'cat_id=0', "g.store_id=$this->store_id", 'g.is_delete=0', 'g.status=1', ['in', 'g.id', $cats]]) ->orWhere(['and', "g.id!=$goods_id", "g.store_id=$this->store_id", 'g.is_delete=0', 'g.status=1', ['in', 'g.cat_id', $cat_ids]]) ->andWhere(['g.type' => get_plugin_type()]) ->andWhere(['not like', 'g.name', '当面付']) ->leftJoin(['m' => Mch::tableName()], 'm.id=g.mch_id') ->andWhere([ 'or', ['g.mch_id' => 0], ['m.is_delete' => 0] ]); $count = $query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit, 'page' => $this->page - 1]); $query->orderBy('g.sort DESC'); $od_query = OrderDetail::find()->alias('od') ->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where(['od.is_delete' => 0, 'o.store_id' => $this->store_id, 'o.is_pay' => 1, 'o.is_delete' => 0])->groupBy('od.goods_id')->select('SUM(od.num) num,od.goods_id'); $limit = $pagination->limit; $offset = $pagination->offset; $recommend_count = $this->recommend_count; if ($offset > $recommend_count) { return [ 'code' => 1, 'msg' => 'err' ]; } else if ($offset + $limit > $recommend_count) { $limit = $recommend_count - $offset; } $list = $query ->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id') ->select('g.id,g.name,g.price,g.original_price,g.cover_pic pic_url,gn.num,g.virtual_sales,g.unit') ->limit($limit) ->offset($pagination->offset) ->asArray()->groupBy('g.id')->all(); foreach ($list as $i => $item) { if (!$item['pic_url']) { $list[$i]['pic_url'] = Goods::getGoodsPicStatic($item['id'])->pic_url; } $list[$i]['sales'] = $this->numToW($item['num'] + $item['virtual_sales']) . $item['unit']; } $data = [ 'row_count' => $count, 'page_count' => $pagination->pageCount, 'list' => $list, ]; return [ 'code' => 0, 'data' => $data ]; } private function numToW($sales) { if ($sales < 10000) { return $sales; } else { return round($sales / 10000, 2) . 'W'; } } public function couponSearch() { $arr = explode(",", $this->goods_id); $query = Goods::find()->where(['store_id' => $this->store_id, 'is_delete' => 0, 'status' => 1])->andWhere(['in', 'id', $arr]); $count = $query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit, 'page' => $this->page - 1]); if ($this->sort == 0) { //综合,自定义排序+时间最新 $query->orderBy('sort ASC,created_at DESC'); } if ($this->sort == 1) { //时间最新 $query->orderBy('created_at DESC'); } if ($this->sort == 2) { //价格 if ($this->sort_type == 0) { $query->orderBy('price ASC'); } else { $query->orderBy('price DESC'); } } if ($this->sort == 3) { //销量 $query->orderBy([ 'virtual_sales' => SORT_DESC, 'created_at' => SORT_DESC, ]); } $list = $query ->select(['id', 'name', 'cover_pic as pic_url', 'price', 'original_price', 'virtual_sales as sales', 'unit']) ->limit($pagination->limit) ->offset($pagination->offset) ->asArray()->all(); return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'row_count' => $count, 'page_count' => $pagination->pageCount, 'list' => $list, ], ]; } public function newSearch() { if (!$this->validate()) return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0] ]; $start_time = $this->start_time; $end_time = $this->end_time; //查找出存在关键词商品的商城 只查找出商城页码 根据商城再通过关键词查出商城中商品 $front_query = Goods::find()->alias('g')->where([ 'g.status' => 1, 'g.is_delete' => 0, 'g.md_food_id' => 0, 's.is_delete' => 0, ])->andWhere(['!=', 'g.product_type', Goods::GOODS_TYPE_ADOPT]); $front_query->leftJoin(['s' => Store::tableName()], 's.id=g.store_id'); $front_query->andWhere(['s.business_model' => [2, 3, 4], 's.is_delete' => 0]); if ($this->keyword) { if ($this->searchType === 'store') { $front_query->andWhere([ 'like', 's.name', $this->keyword ]); } if ($this->searchType === 'goods') { $front_query->andWhere([ 'or', ['like', 'g.name', $this->keyword], ['like', 'g.key_word', $this->keyword] ]); } } if ($this->store_id != '-1') { $front_query->andWhere(['g.store_id' => $this->store_id]); } if (in_array($this->type, Goods::$validProductType)) { $front_query->andWhere(['g.product_type' => $this->type]); } $front_query->groupBy('g.store_id'); $count = $front_query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit, 'page' => $this->page - 1]); $od_query = OrderDetail::find()->alias('od') ->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where(['od.is_delete' => 0, 'o.is_pay' => 1, 'o.is_delete' => 0])->groupBy('od.goods_id')->select('SUM(od.num) num, od.goods_id'); $select = 'g.store_id'; if ($this->type != Goods::GOODS_TYPE_DATE) { $front_query->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id'); } $list = $front_query ->select($select) ->limit($pagination->limit) ->offset($pagination->offset) ->column(); $store_list = []; foreach ($list as $index => $item) { $store = Store::findOne($item); $wechatInfo = WechatConfig::find()->where(['store_id' => $item, 'is_delete' => 0, 'type' => 1])->asArray()->one(); $wechat_app_id = ''; $gh_wechat_app_id = ''; if($wechatInfo){ $wechat_app_id = $wechatInfo['app_id']; $gh_wechat_app_id = $wechatInfo['gh_wechat_app_id']; } $category_name = ''; $category = SaasCategory::findOne($store->category_id); if ($category) { $category_name = $category->name; } $store_list[$index] = [ 'id' => $store->id, 'logo' => $store->logo, 'name' => $store->name, 'address' => $store->address, 'business_model' => $store->business_model, 'category_id' => $store->category_id, 'category_name' => $category_name, 'coordinate' => $store->coordinate, 'distance' => 0, 'gh_wechat_app_id' => $gh_wechat_app_id, 'per_spend' => $store->per_spend, 'rank' => $store->rank, 'sales' => $store->sales, 'wechat_app_id' => $wechat_app_id, ]; $query = Goods::find()->alias('g')->where([ 'g.status' => 1, 'g.is_delete' => 0, 'g.md_food_id' => 0, 'g.store_id' => $item ])->andWhere(['!=', 'g.product_type', Goods::GOODS_TYPE_ADOPT]); $query->leftJoin(['s' => Store::tableName()], 's.id=g.store_id'); $query->andWhere(['s.business_model' => 2]); if (in_array($this->type, Goods::$validProductType)) { $query->andWhere(['g.product_type' => $this->type]); } if ($this->keyword) { if ($this->searchType === 'store') { $query->andWhere([ 'like', 's.name', $this->keyword ]); } if ($this->searchType === 'goods') { $query->andWhere([ 'or', ['like', 'g.name', $this->keyword], ['like', 'g.key_word', $this->keyword] ]); } } // if (get_md_id()) { // $md = Md::findOne(get_md_id()); // if ($md->is_single) { // $query->leftJoin(['mdg' => MdGoods::tableName()], 'mdg.goods_id=g.id'); // $query->andWhere(['g.product_type' => 0, 'mdg.status' => 1, 'mdg.md_id' => get_md_id()]); // } // } $count = $query->count(); $pagination = new Pagination(['totalCount' => $count, 'pageSize' => $this->limit, 'page' => $this->page - 1]); if ($this->sort == 0) { //综合,自定义排序+时间最新 $query->orderBy('g.sort DESC, g.created_at DESC'); } if ($this->sort == 1) { //时间最新 $query->orderBy('g.created_at DESC'); } if ($this->sort == 2) { // if (get_md_id()) { // //价格 // if ($this->sort_type == 0) { // $query->orderBy('mdg.price ASC'); // } else { // $query->orderBy('mdg.price DESC'); // } // } else { //价格 if ($this->sort_type == 0) { $query->orderBy('g.price ASC'); } else { $query->orderBy('g.price DESC'); } // } } if ($this->sort == 3) { // if (get_md_id()) { // //销量 // if ($md->is_single) { // $query->orderBy([ // '( IF(gn.num, gn.num, 0) + mdg.virtual_sales)' => SORT_DESC, // 'g.created_at' => SORT_DESC, // ]); // } else { // $query->orderBy([ // '( IF(gn.num, gn.num, 0) + g.virtual_sales)' => SORT_DESC, // 'g.created_at' => SORT_DESC, // ]); // } // } else { //销量 $query->orderBy([ '( IF(gn.num, gn.num, 0) + g.virtual_sales)' => SORT_DESC, 'g.created_at' => SORT_DESC, ]); // } } $od_query = OrderDetail::find()->alias('od') ->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where(['od.is_delete' => 0, 'o.is_pay' => 1, 'o.is_delete' => 0, 'o.store_id' => $item])->groupBy('od.goods_id')->select('SUM(od.num) num,od.goods_id'); $select = 'g.status, g.goods_num, gn.num, g.id,g.name,g.price,g.original_price,g.cover_pic pic_url,g.virtual_sales,g.unit,g.store_id'; // if (get_md_id()) { // if ($md->is_single) { // $select .= ',mdg.price as mdg_price,mdg.virtual_sales as mdg_virtual_sales, mdg.status as mdg_status, mdg.goods_num as mdg_goods_num, mdg.attr as mdg_attr'; // } // } $list = $query ->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id') ->select($select) ->limit($pagination->limit) ->offset($pagination->offset) ->orderBy('g.sort DESC') ->asArray()->all(); if (empty($list)) { $list = Goods::find()->alias('g')->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id')->select($select) ->limit($pagination->limit) ->offset($pagination->offset) ->orderBy('g.sort DESC') ->asArray()->all(); } if ($this->type === Goods::GOODS_TYPE_DATE) { foreach ($list as $goods_index => $goods_item) { $goods_id = $goods_item['id']; $goods = Goods::findOne($goods_id); $goods_del_open = true; $goodsDateNum = Goods::getGoodsNum($goods); if ($goodsDateNum['code'] === 0) { foreach ($goodsDateNum['data'] as $date_goods_item) { if (strtotime($date_goods_item['date']) === strtotime($start_time) && $date_goods_item['num'] > 0) { $goods_del_open = false; } } } if ($goods_del_open) { unset($list[$goods_index]); } } } if (in_array($store_list[$index]['business_model'], [3, 4])) { $list = []; } $store_list[$index]['goods_info'] = $list; // $store_list = []; // $md_id = get_md_id(); // //排序,整合商城 // $store_ids = array_column($list,'store_id'); // $store_ids = array_values(array_unique($store_ids)); // // // foreach ($store_ids as $index => $value) { // $store = Store::findOne($value); // $wechatInfo = WechatConfig::find()->where(['store_id' => $value, 'is_delete' => 0, 'type' => 1])->asArray()->one(); // $wechat_app_id = ''; // $gh_wechat_app_id = ''; // if($wechatInfo){ // $wechat_app_id = $wechatInfo['app_id']; // $gh_wechat_app_id = $wechatInfo['gh_wechat_app_id']; // } // $category_name = ''; // $category = SaasCategory::findOne($store->category_id); // if ($category) { // $category_name = $category->name; // } // $store_list[$index] = [ // 'id' => $store->id, // 'logo' => $store->logo, // 'name' => $store->name, // 'address' => $store->address, // 'business_model' => $store->business_model, // 'category_id' => $store->category_id, // 'category_name' => $category_name, // 'coordinate' => $store->coordinate, // 'distance' => 0, // 'gh_wechat_app_id' => $gh_wechat_app_id, // 'per_spend' => $store->per_spend, // 'rank' => $store->rank, // 'sales' => $store->sales, // 'wechat_app_id' => $wechat_app_id, // ]; // foreach ($list as $i => $item) { // if (!$item['pic_url']) { // $list[$i]['pic_url'] = Goods::getGoodsPicStatic($item['id']); // } // $list[$i]['sales'] = $this->numToW($item['num'] + $item['virtual_sales']) . $item['unit']; // $list[$i]['comment'] = OrderComment::find()->where(['goods_id' => $item['id'], // 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE])->count(); // $goods_comment_count = OrderComment::find()->where(['goods_id' => $item['id'], // 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE]); // $goods_count = $goods_comment_count->andWhere(['>', 'score', 2])->count(); // $list[$i]['rank_good_percent'] = $goods_count > 0 ? round(($goods_count / $list[$i]['comment']) * 100) . '%' : 0 . '%'; // if ($md_id && $md->is_single) { // $list[$i]['price'] = $item['mdg_price']; // $list[$i]['virtual_sales'] = $item['mdg_virtual_sales']; // $list[$i]['goods_num'] = $item['mdg_goods_num']; // $list[$i]['attr'] = $item['mdg_attr']; // $list[$i]['status'] = $item['mdg_status']; // } // if ((int)$item['store_id'] === (int)$value) { // $store_list[$index]['goods_info'][] = $list[$i]; // } // } // } } $data = [ 'row_count' => $count, 'page_count' => $pagination->pageCount, 'list' => $store_list, // 'store_list' => $store_list ]; return [ 'code' => 0, 'data' => $data ]; } /** * 酒店商品搜索 */ public function searchHotel() { if (!$this->validate()) return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0] ]; $query = Goods::find()->alias('g')->where([ 'g.store_id' => $this->store_id, 'g.status' => 1, 'g.is_delete' => 0, 'g.md_food_id' => 0, 'g.product_type' => Goods::GOODS_TYPE_DATE ])->leftJoin(['gb' => GoodsBook::tableName()], 'gb.goods_id = g.id'); if ($this->keyword) { $query->andWhere([ 'or', ['like', 'g.name', $this->keyword], ['like', 'g.key_word', $this->keyword] ]); } if ($this->sort == 0) { //综合,自定义排序+时间最新 $query->orderBy('g.sort DESC, g.created_at DESC'); } if ($this->sort == 1) { //时间最新 $query->orderBy('g.created_at DESC'); } if ($this->sort == 2) { //价格 if ($this->sort_type == 0) { $query->orderBy('g.price ASC'); } else { $query->orderBy('g.price DESC'); } } if ($this->sort == 3) { //销量 $query->orderBy([ '( IF(gn.num, gn.num, 0) + g.virtual_sales)' => SORT_DESC, 'g.created_at' => SORT_DESC, ]); } $od_query = OrderDetail::find()->alias('od') ->leftJoin(['o' => Order::tableName()], 'od.order_id=o.id') ->where(['od.is_delete' => 0, 'o.store_id' => $this->store_id, 'o.is_pay' => 1, 'o.is_delete' => 0])->groupBy('od.goods_id')->select('SUM(od.num) num,od.goods_id'); $select = 'gb.date_book, g.status, g.goods_num, gn.num, g.id,g.name,g.price,g.original_price,g.cover_pic pic_url,g.virtual_sales,g.unit'; $list = $query ->leftJoin(['gn' => $od_query], 'gn.goods_id=g.id') ->select($select) ->asArray()->all(); foreach ($list as $i => $item) { if ($this->start_time && $this->end_time) { $date_book = Json::decode($item['date_book']); if (is_array($date_book)) { $date_book = array_column($date_book, 'date'); $first_date = array_shift($date_book); $last_date = array_pop($date_book); if ((strtotime($this->start_time) < strtotime($first_date) && strtotime($this->end_time) < strtotime($first_date)) || (strtotime($this->start_time) > strtotime($last_date) && strtotime($this->end_time) > strtotime($last_date))) { unset($list[$i]); continue; } } } if (!$item['pic_url']) { $list[$i]['pic_url'] = Goods::getGoodsPicStatic($item['id']); } $list[$i]['sales'] = $this->numToW($item['num'] + $item['virtual_sales']) . $item['unit']; $list[$i]['comment'] = OrderComment::find()->where(['store_id' => $this->store_id, 'goods_id' => $item['id'], 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE])->count(); $goods_comment_count = OrderComment::find()->where(['store_id' => $this->store_id, 'goods_id' => $item['id'], 'is_hide' => 0, 'is_delete' => OrderComment::IS_DELETE_FALSE]); $goods_count = $goods_comment_count->andWhere(['>', 'score', 2])->count(); $list[$i]['rank_good_percent'] = $goods_count > 0 ? round(($goods_count / $list[$i]['comment']) * 100) . '%' : 0 . '%'; $list[$i]['product_type'] = Goods::GOODS_TYPE_DATE; $list[$i]['goods_info'] = []; } $data = array_slice($list, ($this->page - 1) * $this->limit, $this->limit); return [ 'code' => 0, 'msg' => 'success', 'data' => [ 'row_count' => count($list), 'page_count' => ceil(count($list) / $this->limit), 'list' => $data, ] ]; } }