From 5746143e219548a4f8fe09eb88c16563bcd8b229 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Thu, 20 Dec 2018 20:02:19 +0800 Subject: [PATCH] admin --- application/admin/controller/Answer.php | 6 +- application/admin/controller/Brand.php | 158 ++++++------------ .../admin/controller/BrandCategory.php | 1 - application/admin/controller/CustomView.php | 16 +- application/admin/controller/Order.php | 6 +- application/admin/controller/Slide.php | 16 +- .../admin/view/default/brand/index.html | 52 +++--- application/index/controller/Index.php | 2 +- application/index/controller/Message.php | 6 +- application/index/controller/Order.php | 18 +- application/index/controller/User.php | 18 +- application/index/controller/UserFavor.php | 6 +- .../index/controller/UserGoodsBrowse.php | 6 +- application/index/controller/UserIntegral.php | 6 +- application/service/AnswerService.php | 36 +--- application/service/BannerService.php | 33 +--- application/service/BrandService.php | 97 ++++++++++- application/service/GoodsService.php | 72 +------- application/service/IntegralService.php | 36 +--- application/service/MessageService.php | 36 +--- application/service/OrderService.php | 36 +--- application/service/SlideService.php | 3 +- public/core.php | 2 +- 23 files changed, 247 insertions(+), 421 deletions(-) diff --git a/application/admin/controller/Answer.php b/application/admin/controller/Answer.php index b0d42fe1f..72bfe702d 100755 --- a/application/admin/controller/Answer.php +++ b/application/admin/controller/Answer.php @@ -65,9 +65,9 @@ class Answer extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = AnswerService::AnswerList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/admin/controller/Brand.php b/application/admin/controller/Brand.php index 297fc7626..51c90e8b1 100755 --- a/application/admin/controller/Brand.php +++ b/application/admin/controller/Brand.php @@ -1,7 +1,8 @@ GetIndexWhere(); + $where = BrandService::BrandListListWhere($params); + + // 获取总数 + $total = BrandService::BrandTotal($where); // 分页 - $number = MyC('admin_page_number'); - $page_param = array( + $page_params = array( 'number' => $number, - 'total' => $m->where($where)->count(), - 'where' => $param, - 'url' => url('Admin/Brand/Index'), + 'total' => $total, + 'where' => $params, + 'page' => isset($params['page']) ? intval($params['page']) : 1, + 'url' => url('admin/brand/index'), ); - $page = new \base\Page($page_param); + $page = new \base\Page($page_params); + $this->assign('page_html', $page->GetPageHtml()); // 获取列表 - $list = $this->SetDataHandle($m->where($where)->limit($page->GetPageStarNumber(), $number)->order('id desc')->select()); - - // 参数 - $this->assign('param', $param); - - // 分页 - $this->assign('page_html', $page->GetPageHtml()); + $data_params = array( + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, + 'field' => '*', + ); + $data = BrandService::BrandList($data_params); + $this->assign('data_list', $data['data']); // 是否启用 $this->assign('common_is_enable_list', lang('common_is_enable_list')); // 品牌分类 - $brand_category = db('BrandCategory')->where(['is_enable'=>1])->field('id,name')->select(); - $this->assign('brand_category', $brand_category); + $brand_category = BrandService::BrandCategoryList(['field'=>'id,name']); + $this->assign('brand_category', $brand_category['data']); - // 数据列表 - $this->assign('list', $list); - $this->display('Index'); + // 参数 + $this->assign('params', $params); + return $this->fetch(); } - /** - * [SetDataHandle 数据处理] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-29T21:27:15+0800 - * @param [array] $data [轮播图片数据] - * @return [array] [处理好的数据] - */ - private function SetDataHandle($data) - { - if(!empty($data)) - { - $common_is_enable_tips = lang('common_is_enable_tips'); - foreach($data as &$v) - { - // 是否启用 - $v['is_enable_text'] = $common_is_enable_tips[$v['is_enable']]['name']; - - // 分类名称 - $v['brand_category_text'] = db('BrandCategory')->where(['id'=>$v['brand_category_id']])->getField('name'); - - // logo - $v['logo'] = empty($v['logo']) ? '' : config('IMAGE_HOST').$v['logo']; - - // 添加时间 - $v['add_time_text'] = date('Y-m-d H:i:s', $v['add_time']); - - // 更新时间 - $v['upd_time_text'] = date('Y-m-d H:i:s', $v['upd_time']); - } - } - return $data; - } - - /** - * [GetIndexWhere 列表条件] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - */ - private function GetIndexWhere() - { - $where = array(); - - // 模糊 - if(!empty($_REQUEST['keyword'])) - { - $where['name'] = array('like', '%'.I('keyword').'%'); - } - - // 是否更多条件 - if(I('is_more', 0) == 1) - { - if(I('is_enable', -1) > -1) - { - $where['is_enable'] = intval(I('is_enable', 0)); - } - if(I('brand_category_id', -1) > -1) - { - $where['brand_category_id'] = intval(I('brand_category_id', 0)); - } - - // 表达式 - if(!empty($_REQUEST['time_start'])) - { - $where['add_time'][] = array('gt', strtotime(I('time_start'))); - } - if(!empty($_REQUEST['time_end'])) - { - $where['add_time'][] = array('lt', strtotime(I('time_end'))); - } - } - return $where; - } - /** * [SaveInfo 添加/编辑页面] * @author Devil @@ -165,21 +94,34 @@ class Brand extends Common */ public function SaveInfo() { - // 轮播图片信息 - $data = empty($_REQUEST['id']) ? array() : db('Brand')->find(I('id')); - $this->assign('data', $data); + // 参数 + $params = input(); + + // 数据 + if(!empty($params['id'])) + { + // 获取列表 + $data_params = array( + 'm' => 0, + 'n' => 1, + 'where' => ['id'=>intval($params['id'])], + 'field' => '*', + ); + $data = BrandService::BrandList($data_params); + $this->assign('data', empty($data['data'][0]) ? [] : $data['data'][0]); + } // 是否启用 $this->assign('common_is_enable_list', lang('common_is_enable_list')); // 品牌分类 - $brand_category = db('BrandCategory')->where(['is_enable'=>1])->field('id,name')->select(); - $this->assign('brand_category', $brand_category); + $brand_category = BrandService::BrandCategoryList(['field'=>'id,name']); + $this->assign('brand_category', $brand_category['data']); // 参数 - $this->assign('param', array_merge($_POST, $_GET)); + $this->assign('params', $params); - $this->display('SaveInfo'); + return $this->fetch(); } /** diff --git a/application/admin/controller/BrandCategory.php b/application/admin/controller/BrandCategory.php index 3f380897a..e15ad6533 100755 --- a/application/admin/controller/BrandCategory.php +++ b/application/admin/controller/BrandCategory.php @@ -1,5 +1,4 @@ $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, - 'field' => '*', + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, + 'field' => '*', ); $data = CustomViewService::CustomViewList($data_params); $this->assign('data_list', $data['data']); @@ -107,10 +107,10 @@ class CustomView extends Common { // 获取列表 $data_params = array( - 'limit_start' => 0, - 'limit_number' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', + 'm' => 0, + 'n' => 1, + 'where' => ['id'=>intval($params['id'])], + 'field' => '*', ); $data = CustomViewService::CustomViewList($data_params); $this->assign('data', empty($data['data'][0]) ? [] : $data['data'][0]); diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 4fc67a2f3..3f775b905 100755 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -69,9 +69,9 @@ class Order extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = OrderService::OrderList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/admin/controller/Slide.php b/application/admin/controller/Slide.php index 2f454c31b..37e05da42 100755 --- a/application/admin/controller/Slide.php +++ b/application/admin/controller/Slide.php @@ -65,10 +65,10 @@ class Slide extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, - 'field' => '*', + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, + 'field' => '*', ); $data = SlideService::SlideList($data_params); $this->assign('data_list', $data['data']); @@ -104,10 +104,10 @@ class Slide extends Common { // 获取列表 $data_params = array( - 'limit_start' => 0, - 'limit_number' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', + 'm' => 0, + 'n' => 1, + 'where' => ['id'=>intval($params['id'])], + 'field' => '*', ); $data = SlideService::SlideList($data_params); $this->assign('data', empty($data['data'][0]) ? [] : $data['data'][0]); diff --git a/application/admin/view/default/brand/index.html b/application/admin/view/default/brand/index.html index 3d9fd28c8..d77416cdf 100755 --- a/application/admin/view/default/brand/index.html +++ b/application/admin/view/default/brand/index.html @@ -4,33 +4,33 @@
-
+
- value="{{$param.keyword}}"{{/if}} /> + -
+
-
+
+ ~ - +
@@ -38,13 +38,13 @@ -
新增 + - @@ -57,9 +57,9 @@ - {{if !empty($list)}} - - + {{if !empty($data_list)}} + {{foreach $data_list as $v}} + - + - + @@ -101,8 +101,8 @@ - {{if !empty($list)}} - {{$page_html}} + {{if !empty($data_list)}} + {{$page_html|raw}} {{/if}} diff --git a/application/index/controller/Index.php b/application/index/controller/Index.php index 24760ce87..07b51f067 100755 --- a/application/index/controller/Index.php +++ b/application/index/controller/Index.php @@ -51,7 +51,7 @@ class Index extends Common // 首页轮播 - $this->assign('banner_list', BannerService::PC()); + $this->assign('banner_list', BannerService::Banner()); // 楼层数据 $this->assign('goods_floor_list', GoodsService::HomeFloorList()); diff --git a/application/index/controller/Message.php b/application/index/controller/Message.php index c3768518d..481fe0b33 100755 --- a/application/index/controller/Message.php +++ b/application/index/controller/Message.php @@ -68,9 +68,9 @@ class Message extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = MessageService::MessageList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/index/controller/Order.php b/application/index/controller/Order.php index 94716240c..2581c20d8 100755 --- a/application/index/controller/Order.php +++ b/application/index/controller/Order.php @@ -66,9 +66,9 @@ class Order extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = OrderService::OrderList($data_params); $this->assign('data_list', $data['data']); @@ -110,9 +110,9 @@ class Order extends Common // 获取列表 $data_params = array( - 'limit_start' => 0, - 'limit_number' => 1, - 'where' => $where, + 'm' => 0, + 'n' => 1, + 'where' => $where, ); $data = OrderService::OrderList($data_params); if(!empty($data['data'][0])) @@ -151,9 +151,9 @@ class Order extends Common // 获取列表 $data_params = array( - 'limit_start' => 0, - 'limit_number' => 1, - 'where' => $where, + 'm' => 0, + 'n' => 1, + 'where' => $where, ); $data = OrderService::OrderList($data_params); if(!empty($data['data'][0])) diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 827ecd318..ad4c8c387 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -91,9 +91,9 @@ class User extends Common $params['user_type'] = 'user'; $where = OrderService::OrderListWhere($params); $order_params = array( - 'limit_start' => 0, - 'limit_number' => 3, - 'where' => $where, + 'm' => 0, + 'n' => 3, + 'where' => $where, ); $order = OrderService::OrderList($order_params); $this->assign('order_list', $order['data']); @@ -107,9 +107,9 @@ class User extends Common $params['user'] = $this->user; $where = GoodsService::UserGoodsFavorListWhere($params); $favor_params = array( - 'limit_start' => 0, - 'limit_number' => 8, - 'where' => $where, + 'm' => 0, + 'n' => 8, + 'where' => $where, ); $favor = GoodsService::GoodsFavorList($favor_params); $this->assign('goods_favor_list', $favor['data']); @@ -119,9 +119,9 @@ class User extends Common $params['user'] = $this->user; $where = GoodsService::UserGoodsBrowseListWhere($params); $browse_params = array( - 'limit_start' => 0, - 'limit_number' => 6, - 'where' => $where, + 'm' => 0, + 'n' => 6, + 'where' => $where, ); $data = GoodsService::GoodsBrowseList($browse_params); $this->assign('goods_browse_list', $data['data']); diff --git a/application/index/controller/UserFavor.php b/application/index/controller/UserFavor.php index 66f550848..6592096da 100755 --- a/application/index/controller/UserFavor.php +++ b/application/index/controller/UserFavor.php @@ -64,9 +64,9 @@ class UserFavor extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = GoodsService::GoodsFavorList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/index/controller/UserGoodsBrowse.php b/application/index/controller/UserGoodsBrowse.php index 3d0d76980..890af0565 100755 --- a/application/index/controller/UserGoodsBrowse.php +++ b/application/index/controller/UserGoodsBrowse.php @@ -64,9 +64,9 @@ class UserGoodsBrowse extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = GoodsService::GoodsBrowseList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/index/controller/UserIntegral.php b/application/index/controller/UserIntegral.php index c02d84c89..490052ca9 100755 --- a/application/index/controller/UserIntegral.php +++ b/application/index/controller/UserIntegral.php @@ -64,9 +64,9 @@ class UserIntegral extends Common // 获取列表 $data_params = array( - 'limit_start' => $page->GetPageStarNumber(), - 'limit_number' => $number, - 'where' => $where, + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, ); $data = IntegralService::UserIntegralLogList($data_params); $this->assign('data_list', $data['data']); diff --git a/application/service/AnswerService.php b/application/service/AnswerService.php index c284a1a06..97f52e2a9 100644 --- a/application/service/AnswerService.php +++ b/application/service/AnswerService.php @@ -37,41 +37,13 @@ class AnswerService */ public static function AnswerList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 - $data = db('Answer')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('Answer')->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $common_is_show_list = lang('common_is_show_list'); diff --git a/application/service/BannerService.php b/application/service/BannerService.php index 6e89839db..ed4a2da98 100755 --- a/application/service/BannerService.php +++ b/application/service/BannerService.php @@ -1,5 +1,4 @@ field('name,jump_url,images_url,bg_color')->where(['is_enable'=>1])->order('sort asc')->select(); - if(!empty($banner)) - { - $images_host = config('IMAGE_HOST'); - foreach($banner as &$v) - { - $v['images_url_old'] = $v['images_url']; - $v['images_url'] = $images_host.$v['images_url']; - $v['jump_url'] = empty($v['jump_url']) ? null : $v['jump_url']; - } - } - return $banner; - } - - /** - * 获取轮播 - APP - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-08-29 - * @desc description - * @param [array] $params [输入参数] - */ - public static function App($params = []) - { - $banner = db('AppSlide')->field('name,images_url,event_value,event_type')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select(); + $banner = db('Slide')->field('name,images_url,event_value,event_type,bg_color')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select(); if(!empty($banner)) { $images_host = config('IMAGE_HOST'); diff --git a/application/service/BrandService.php b/application/service/BrandService.php index 82e99d770..1dc845cde 100755 --- a/application/service/BrandService.php +++ b/application/service/BrandService.php @@ -38,22 +38,38 @@ class BrandService foreach($data as &$v) { // 是否启用 - $v['is_enable_text'] = $common_is_enable_tips[$v['is_enable']]['name']; + if(isset($v['is_enable'])) + { + $v['is_enable_text'] = $common_is_enable_tips[$v['is_enable']]['name']; + } // 分类名称 - $v['brand_category_name'] = db('BrandCategory')->where(['id'=>$v['brand_category_id']])->value('name'); + if(isset($v['brand_category_id'])) + { + $v['brand_category_name'] = db('BrandCategory')->where(['id'=>$v['brand_category_id']])->value('name'); + } // logo - $v['logo'] = empty($v['logo']) ? '' : $images_host.$v['logo']; + if(isset($v['logo'])) + { + $v['logo_old'] = $v['logo']; + $v['logo'] = empty($v['logo']) ? '' : $images_host.$v['logo']; + } - // 添加时间 - $v['add_time'] = date('Y-m-d H:i:s', $v['add_time']); - - // 更新时间 - $v['upd_time'] = date('Y-m-d H:i:s', $v['upd_time']); + // 时间 + if(isset($v['add_time'])) + { + $v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']); + $v['add_time_date'] = date('Y-m-d', $v['add_time']); + } + if(isset($v['upd_time'])) + { + $v['upd_time_time'] = date('Y-m-d H:i:s', $v['upd_time']); + $v['upd_time_date'] = date('Y-m-d', $v['upd_time']); + } } } - return $data; + return DataReturn('处理成功', 0, $data); } /** @@ -69,6 +85,50 @@ class BrandService return (int) db('Brand')->where($where)->count(); } + /** + * 列表条件 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-29 + * @desc description + * @param [array] $params [输入参数] + */ + public static function BrandListListWhere($params = []) + { + $where = []; + + if(!empty($params['keywords'])) + { + $where[] = ['name', 'like', '%'.$params['keywords'].'%']; + } + + // 是否更多条件 + if(isset($params['is_more']) && $params['is_more'] == 1) + { + // 等值 + if(isset($params['is_enable']) && $params['is_enable'] > -1) + { + $where[] = ['is_enable', '=', intval($params['is_enable'])]; + } + if(isset($params['brand_category_id']) && $params['brand_category_id'] > -1) + { + $where[] = ['brand_category_id', '=', intval($params['brand_category_id'])]; + } + + if(!empty($params['time_start'])) + { + $where[] = ['add_time', '>', strtotime($params['time_start'])]; + } + if(!empty($params['time_end'])) + { + $where[] = ['add_time', '<', strtotime($params['time_end'])]; + } + } + + return $where; + } + /** * 获取所有分类及下面品牌 * @author Devil @@ -138,5 +198,24 @@ class BrandService { return empty($brand_id) ? null : db('Brand')->where(['id'=>intval($brand_id)])->value('name'); } + + /** + * 品牌分类 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-08-29 + * @desc description + * @param [array] $params [输入参数] + */ + public static function BrandCategoryList($params = []) + { + $field = empty($params['field']) ? '*' : $params['field']; + $order_by = empty($params['order_by']) ? 'sort asc' : trim($params['order_by']); + + $data = db('BrandCategory')->where(['is_enable'=>1])->field($field)->order($order_by)->select(); + + return DataReturn('处理成功', 0, $data); + } } ?> \ No newline at end of file diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index 95af7ced5..a28b8136a 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -552,42 +552,14 @@ class GoodsService */ public static function GoodsFavorList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'f.id desc' : $params['order_by']; $field = 'f.*, g.title, g.original_price, g.price, g.images'; // 获取数据 - $data = db('GoodsFavor')->alias('f')->join(['__GOODS__'=>'g'], 'g.id=f.goods_id')->field($field)->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('GoodsFavor')->alias('f')->join(['__GOODS__'=>'g'], 'g.id=f.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $images_host = config('IMAGE_HOST'); @@ -727,42 +699,14 @@ class GoodsService */ public static function GoodsBrowseList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'b.id desc' : $params['order_by']; $field = 'b.*, g.title, g.original_price, g.price, g.images'; // 获取数据 - $data = db('GoodsBrowse')->alias('b')->join(['__GOODS__'=>'g'], 'g.id=b.goods_id')->field($field)->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('GoodsBrowse')->alias('b')->join(['__GOODS__'=>'g'], 'g.id=b.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $images_host = config('IMAGE_HOST'); diff --git a/application/service/IntegralService.php b/application/service/IntegralService.php index a084fc664..55c59a31d 100755 --- a/application/service/IntegralService.php +++ b/application/service/IntegralService.php @@ -120,41 +120,13 @@ class IntegralService */ public static function UserIntegralLogList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 - $data = db('UserIntegralLog')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('UserIntegralLog')->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $common_integral_log_type_list = lang('common_integral_log_type_list'); diff --git a/application/service/MessageService.php b/application/service/MessageService.php index 9c71ada36..709c60756 100755 --- a/application/service/MessageService.php +++ b/application/service/MessageService.php @@ -162,41 +162,13 @@ class MessageService */ public static function MessageList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; // 获取数据列表 - $data = db('Message')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('Message')->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $common_business_type_list = lang('common_business_type_list'); diff --git a/application/service/OrderService.php b/application/service/OrderService.php index ccf00ac82..098a600f0 100755 --- a/application/service/OrderService.php +++ b/application/service/OrderService.php @@ -525,42 +525,14 @@ class OrderService */ public static function OrderList($params = []) { - // 请求参数 - $p = [ - [ - 'checked_type' => 'empty', - 'key_name' => 'where', - 'error_msg' => '条件不能为空', - ], - [ - 'checked_type' => 'is_array', - 'key_name' => 'where', - 'error_msg' => '条件格式有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_start', - 'error_msg' => '分页起始值有误', - ], - [ - 'checked_type' => 'isset', - 'key_name' => 'limit_number', - 'error_msg' => '分页数量不能为空', - ], - ]; - $ret = params_checked($params, $p); - if($ret !== true) - { - return DataReturn($ret, -1); - } - - $limit_start = max(0, intval($params['limit_start'])); - $limit_number = max(1, intval($params['limit_number'])); + $where = empty($params['where']) ? [] : $params['where']; + $m = isset($params['m']) ? intval($params['m']) : 0; + $n = isset($params['n']) ? intval($params['n']) : 10; $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; $is_items = isset($params['is_items']) ? intval($params['is_items']) : 1; // 获取订单 - $data = db('Order')->where($params['where'])->limit($limit_start, $limit_number)->order($order_by)->select(); + $data = db('Order')->where($where)->limit($m, $n)->order($order_by)->select(); if(!empty($data)) { $detail_field = 'id,goods_id,title,images,original_price,price,spec,buy_number'; diff --git a/application/service/SlideService.php b/application/service/SlideService.php index 9ced2cbe7..8541e7c6c 100644 --- a/application/service/SlideService.php +++ b/application/service/SlideService.php @@ -166,6 +166,7 @@ class SlideService 'checked_type' => 'in', 'key_name' => 'event_type', 'checked_data' => array_column(lang('common_app_event_type'), 'value'), + 'is_checked' => 2, 'error_msg' => '事件值类型有误', ], [ @@ -201,7 +202,7 @@ class SlideService $data = [ 'name' => $params['name'], 'platform' => $params['platform'], - 'event_type' => intval($params['event_type']), + 'event_type' => isset($params['event_type']) ? intval($params['event_type']) : -1, 'event_value' => $params['event_value'], 'images_url' => $attachment['data']['images_url'], 'bg_color' => isset($params['bg_color']) ? $params['bg_color'] : '', diff --git a/public/core.php b/public/core.php index 27b20bc40..da8cfb803 100755 --- a/public/core.php +++ b/public/core.php @@ -62,7 +62,7 @@ define('APPLICATION', empty($_REQUEST['application']) ? 'web' : trim($_REQUEST[' // 请求客户端 [default, ...] 默认default define('APPLICATION_CLIENT', empty($_REQUEST['application_client']) ? 'default' : trim($_REQUEST['application_client'])); -// 请求客户端 [pc, wap/h5, alipay, wechat, baidu] 默认pc +// 请求客户端 [pc, h5, alipay, wechat, baidu] 默认pc define('APPLICATION_CLIENT_TYPE', empty($_REQUEST['application_client_type']) ? 'pc' : trim($_REQUEST['application_client_type'])); // 是否ajax
名称
{{$v.name}} {{if !empty($v['logo'])}} @@ -70,7 +70,7 @@ 暂无图片 {{/if}} {{$v.brand_category_text}}{{$v.brand_category_name}} {{$v.website_url}} {{if !empty($v['website_url'])}} @@ -80,15 +80,15 @@ {{/if}} - {{$v.add_time_text}}{{$v.add_time_time}} - + - {{if $v['is_enable'] eq 0)}} - + {{if $v['is_enable'] eq 0}} + {{/if}}