|
@@ -78,6 +78,43 @@ class Pub extends BaseController
|
|
|
$data = empty($data)?[]:$data;
|
|
|
return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取轮播图
|
|
|
+ * @param Request $request
|
|
|
+ */
|
|
|
+ public function getBannerList(Request $request){
|
|
|
+ $post = UtilService::getMore([
|
|
|
+ ['type', ''],
|
|
|
+ ['page', 1],
|
|
|
+ ['pageSize', 50],
|
|
|
+ ], $request);
|
|
|
+ $post["pageSize"] = $post["pageSize"]>50 ? 50 : (int)$post["pageSize"];
|
|
|
+ $post["page"] = $post["page"]<=0 ? 1 : (int)$post["page"];
|
|
|
+ $where=[];
|
|
|
+ $where[]=["status","=",1];
|
|
|
+ if((int)$post["is_hot"]==1){
|
|
|
+ $where[]=["is_hot","=",1];
|
|
|
+ }
|
|
|
+ if((int)$post["is_recommend"]==1){
|
|
|
+ $where[]=["is_recommend","=",1];
|
|
|
+ }
|
|
|
+
|
|
|
+ $totalCount = (new ShowTemplate)->where($where)->count();
|
|
|
+ $data=null;
|
|
|
+ if($totalCount>0){
|
|
|
+ $data = (new ShowTemplate)
|
|
|
+ ->field("id,title,price,old_price,status,img,is_hot,is_recommend")
|
|
|
+ ->where($where)
|
|
|
+ ->order("id", "desc")
|
|
|
+ ->page((int)$page, $post["pageSize"])
|
|
|
+ ->select();
|
|
|
+ foreach($data as $k=>$v){
|
|
|
+ $data[$k]["is_use"] = 0;//是否已经购买或者可以使用
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data = empty($data)?[]:$data;
|
|
|
+ return app('json')->success(["list" => $data, "pageSize" => $post["pageSize"],"page"=>$post["page"],"totalCount"=>$totalCount]);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|