From 584ed8a0199716edd23c7ad6c096f2d5f3cee138 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Mon, 24 Dec 2018 02:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=92=EF=BC=8C=E7=A7=AF=E5=88=86?= =?UTF-8?q?=EF=BC=8C=E5=9C=B0=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Admin.php | 2 +- .../admin/controller/AlipayLifeMenu.php | 2 +- .../admin/controller/AlipayLifeMessage.php | 2 +- .../admin/controller/AlipayLifeStatus.php | 2 +- .../admin/controller/AlipayLifeUser.php | 2 +- application/admin/controller/Coupon.php | 4 +- application/admin/controller/Express.php | 102 +++-------- application/admin/controller/Goods.php | 2 +- application/admin/controller/IntegralLog.php | 88 ++++++++++ application/admin/controller/Message.php | 3 - application/admin/controller/Region.php | 109 ++---------- application/admin/controller/User.php | 2 +- .../admin/controller/UserIntegralLog.php | 163 ------------------ .../admin/view/default/express/index.html | 25 +-- .../index.html | 38 ++-- .../admin/view/default/region/index.html | 10 +- application/service/ArticleService.php | 2 +- application/service/BrandService.php | 2 +- application/service/ExpressService.php | 130 ++++++++++++++ application/service/GoodsService.php | 2 +- application/service/IntegralService.php | 98 +++++++++++ application/service/RegionService.php | 126 ++++++++++++++ application/service/ScreeningPriceService.php | 2 +- public/install/shopxo_tp5.sql | 126 +++++++++++--- public/static/admin/default/css/express.css | 1 + .../{userintegrallog.css => integrallog.css} | 0 public/static/admin/default/js/admin.js | 4 - public/static/admin/default/js/article.js | 4 - public/static/admin/default/js/customview.js | 0 public/static/admin/default/js/message.js | 4 - public/static/admin/default/js/paylog.js | 4 - public/static/admin/default/js/slide.js | 4 - public/static/admin/default/js/user.js | 4 - .../admin/default/js/userintegrallog.js | 4 - .../express/2018/08/20180807143522649704.jpeg | Bin 844045 -> 0 bytes 35 files changed, 630 insertions(+), 443 deletions(-) create mode 100755 application/admin/controller/IntegralLog.php delete mode 100755 application/admin/controller/UserIntegralLog.php rename application/admin/view/default/{userIntegrallog => integrallog}/index.html (55%) create mode 100644 public/static/admin/default/css/express.css rename public/static/admin/default/css/{userintegrallog.css => integrallog.css} (100%) delete mode 100755 public/static/admin/default/js/admin.js delete mode 100755 public/static/admin/default/js/article.js delete mode 100755 public/static/admin/default/js/customview.js delete mode 100755 public/static/admin/default/js/message.js delete mode 100755 public/static/admin/default/js/paylog.js delete mode 100755 public/static/admin/default/js/slide.js delete mode 100755 public/static/admin/default/js/user.js delete mode 100755 public/static/admin/default/js/userintegrallog.js delete mode 100755 public/static/upload/images/express/2018/08/20180807143522649704.jpeg diff --git a/application/admin/controller/Admin.php b/application/admin/controller/Admin.php index b9df509b3..641cacb0a 100755 --- a/application/admin/controller/Admin.php +++ b/application/admin/controller/Admin.php @@ -50,7 +50,7 @@ class Admin extends Common $total = AdminService::AdminTotal($where); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_params = array( 'number' => $number, 'total' => $total, diff --git a/application/admin/controller/AlipayLifeMenu.php b/application/admin/controller/AlipayLifeMenu.php index 829a875bc..a0d66026c 100755 --- a/application/admin/controller/AlipayLifeMenu.php +++ b/application/admin/controller/AlipayLifeMenu.php @@ -51,7 +51,7 @@ class AlipayLifeMenu extends Common $where = $this->GetIndexWhere(); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->where($where)->count(), diff --git a/application/admin/controller/AlipayLifeMessage.php b/application/admin/controller/AlipayLifeMessage.php index 176ea62f0..169935cf2 100755 --- a/application/admin/controller/AlipayLifeMessage.php +++ b/application/admin/controller/AlipayLifeMessage.php @@ -51,7 +51,7 @@ class AlipayLifeMessage extends Common $where = $this->GetIndexWhere(); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->where($where)->count(), diff --git a/application/admin/controller/AlipayLifeStatus.php b/application/admin/controller/AlipayLifeStatus.php index 007a727c3..60be73b50 100755 --- a/application/admin/controller/AlipayLifeStatus.php +++ b/application/admin/controller/AlipayLifeStatus.php @@ -51,7 +51,7 @@ class AlipayLifeStatus extends Common $where = $this->GetIndexWhere(); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->where($where)->count(), diff --git a/application/admin/controller/AlipayLifeUser.php b/application/admin/controller/AlipayLifeUser.php index dbf8b691b..c92706b30 100755 --- a/application/admin/controller/AlipayLifeUser.php +++ b/application/admin/controller/AlipayLifeUser.php @@ -49,7 +49,7 @@ class AlipayLifeUser extends Common $m = db('AlipayLifeUser'); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->alias('au')->where($where)->join('INNER JOIN __USER__ AS u ON u.id=au.user_id')->count(), diff --git a/application/admin/controller/Coupon.php b/application/admin/controller/Coupon.php index ac465ae12..19d6dd480 100755 --- a/application/admin/controller/Coupon.php +++ b/application/admin/controller/Coupon.php @@ -49,7 +49,7 @@ class Coupon extends Common $where = $this->GetIndexWhere(); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->where($where)->count(), @@ -480,7 +480,7 @@ class Coupon extends Common $where = $this->GetUserWhere($param); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_param = array( 'number' => $number, 'total' => $m->alias('uc')->join('__USER__ AS u ON u.id=uc.user_id')->where($where)->count(), diff --git a/application/admin/controller/Express.php b/application/admin/controller/Express.php index 7a7e25bc1..b6f7be75d 100755 --- a/application/admin/controller/Express.php +++ b/application/admin/controller/Express.php @@ -1,7 +1,8 @@ assign('common_is_enable_list', lang('common_is_enable_list')); - $this->display('Index'); + + // 编辑器文件存放地址 + $this->assign('editor_path_type', 'express'); + + return $this->fetch(); } /** @@ -59,23 +64,9 @@ class Express extends Common $this->error('非法访问'); } - // 获取数据 - $field = array('id', 'icon', 'name', 'sort', 'is_enable'); - $data = db('Express')->field($field)->select(); - if(!empty($data)) - { - $image_host = config('IMAGE_HOST'); - foreach($data as &$v) - { - $v['is_son'] = 'no'; - $v['ajax_url'] = url('Admin/Express/GetNodeSon', array('id'=>$v['id'])); - $v['delete_url'] = url('Admin/Express/Delete'); - $v['icon_url'] = empty($v['icon']) ? '' : $image_host.$v['icon']; - $v['json'] = json_encode($v); - } - } - $msg = empty($data) ? '没有相关数据' : '操作成功'; - $this->ajaxReturn($msg, 0, $data); + // 开始操作 + $ret = ExpressService::ExpressNodeSon(input()); + return json($ret); } /** @@ -93,53 +84,9 @@ class Express extends Common $this->error('非法访问'); } - // 图片 - $this->FileSave('icon', 'file_icon', 'express'); - - // id为空则表示是新增 - $m = D('Express'); - - // 公共额外数据处理 - $m->sort = intval(I('sort')); - - // 添加 - if(empty($_POST['id'])) - { - if($m->create($_POST, 1)) - { - // 额外数据处理 - $m->add_time = time(); - $m->name = I('name'); - - // 写入数据库 - if($m->add()) - { - $this->ajaxReturn('新增成功'); - } else { - $this->ajaxReturn('新增失败', -100); - } - } - } else { - // 编辑 - if($m->create($_POST, 2)) - { - // 额外数据处理 - $m->name = I('name'); - $m->upd_time = time(); - - // 移除 id - unset($m->id); - - // 更新数据库 - if($m->where(array('id'=>I('id')))->save()) - { - $this->ajaxReturn('编辑成功'); - } else { - $this->ajaxReturn('编辑失败或数据未改变', -100); - } - } - } - $this->ajaxReturn($m->getError(), -1); + // 开始操作 + $ret = ExpressService::ExpressSave(input()); + return json($ret); } /** @@ -151,26 +98,17 @@ class Express extends Common */ public function Delete() { + // 是否ajax if(!IS_AJAX) { - $this->error('非法访问'); + return $this->error('非法访问'); } - $m = D('Express'); - if($m->create($_POST, 5)) - { - $id = I('id'); - - // 删除 - if($m->delete($id)) - { - $this->ajaxReturn('删除成功'); - } else { - $this->ajaxReturn('删除失败或资源不存在', -100); - } - } else { - $this->ajaxReturn($m->getError(), -1); - } + // 开始操作 + $params = input('post.'); + $params['admin'] = $this->admin; + $ret = ExpressService::ExpressDelete($params); + return json($ret); } } ?> \ No newline at end of file diff --git a/application/admin/controller/Goods.php b/application/admin/controller/Goods.php index aa59dfa29..d7d4b2341 100755 --- a/application/admin/controller/Goods.php +++ b/application/admin/controller/Goods.php @@ -53,7 +53,7 @@ class Goods extends Common $total = GoodsService::GoodsTotal($where); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_params = array( 'number' => $number, 'total' => $total, diff --git a/application/admin/controller/IntegralLog.php b/application/admin/controller/IntegralLog.php new file mode 100755 index 000000000..d9c616159 --- /dev/null +++ b/application/admin/controller/IntegralLog.php @@ -0,0 +1,88 @@ +Is_Login(); + + // 权限校验 + $this->Is_Power(); + } + + /** + * [Index 用户积分日志列表] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2016-12-06T21:31:53+0800 + */ + public function Index() + { + // 参数 + $params = input(); + $params['user'] = $this->admin; + $params['user_type'] = 'admin'; + + // 分页 + $number = MyC('admin_page_number', 10, true); + + // 条件 + $where = IntegralService::AdminIntegralListWhere($params); + + // 获取总数 + $total = IntegralService::AdminIntegralTotal($where); + + // 分页 + $page_params = array( + 'number' => $number, + 'total' => $total, + 'where' => $params, + 'page' => isset($params['page']) ? intval($params['page']) : 1, + 'url' => url('admin/integrallog/index'), + ); + $page = new \base\Page($page_params); + $this->assign('page_html', $page->GetPageHtml()); + + // 获取列表 + $data_params = array( + 'm' => $page->GetPageStarNumber(), + 'n' => $number, + 'where' => $where, + ); + $data = IntegralService::AdminIntegralList($data_params); + $this->assign('data_list', $data['data']); + + // 性别 + $this->assign('common_gender_list', lang('common_gender_list')); + + // 操作类型 + $this->assign('common_integral_log_type_list', lang('common_integral_log_type_list')); + + // 参数 + $this->assign('params', $params); + return $this->fetch(); + } +} +?> \ No newline at end of file diff --git a/application/admin/controller/Message.php b/application/admin/controller/Message.php index 3c513d7d7..b99ce004d 100755 --- a/application/admin/controller/Message.php +++ b/application/admin/controller/Message.php @@ -45,9 +45,6 @@ class Message extends Common $params['user'] = $this->admin; $params['user_type'] = 'admin'; - // 消息更新未已读 - MessageService::MessageRead($params); - // 分页 $number = MyC('admin_page_number', 10, true); diff --git a/application/admin/controller/Region.php b/application/admin/controller/Region.php index 09c3e0498..21481e7e0 100755 --- a/application/admin/controller/Region.php +++ b/application/admin/controller/Region.php @@ -1,7 +1,8 @@ assign('common_is_enable_list', lang('common_is_enable_list')); - $this->display('Index'); + + return $this->fetch(); } /** @@ -59,39 +61,9 @@ class Region extends Common $this->error('非法访问'); } - // 获取数据 - $field = array('id', 'pid', 'name', 'sort', 'is_enable'); - $data = db('Region')->field($field)->where(array('pid'=>intval(I('id', 0))))->select(); - if(!empty($data)) - { - foreach($data as $k=>$v) - { - $data[$k]['is_son'] = $this->IsExistSon($v['id']); - $data[$k]['ajax_url'] = url('Admin/Region/GetNodeSon', array('id'=>$v['id'])); - $data[$k]['delete_url'] = url('Admin/Region/Delete'); - $data[$k]['json'] = json_encode($v); - } - } - $msg = empty($data) ? '没有相关数据' : '操作成功'; - $this->ajaxReturn($msg, 0, $data); - } - - /** - * [IsExistSon 节点是否存在子数据] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-25T15:22:47+0800 - * @param [int] $id [节点id] - * @return [string] [有数据ok, 则no] - */ - private function IsExistSon($id) - { - if(!empty($id)) - { - return (db('Region')->where(array('pid'=>$id))->count() > 0) ? 'ok' : 'no'; - } - return 'no'; + // 开始操作 + $ret = RegionService::RegionNodeSon(input()); + return json($ret); } /** @@ -109,50 +81,9 @@ class Region extends Common $this->error('非法访问'); } - // id为空则表示是新增 - $m = D('Region'); - - // 公共额外数据处理 - $m->sort = intval(I('sort')); - - // 添加 - if(empty($_POST['id'])) - { - if($m->create($_POST, 1)) - { - // 额外数据处理 - $m->add_time = time(); - $m->name = I('name'); - - // 写入数据库 - if($m->add()) - { - $this->ajaxReturn('新增成功'); - } else { - $this->ajaxReturn('新增失败', -100); - } - } - } else { - // 编辑 - if($m->create($_POST, 2)) - { - // 额外数据处理 - $m->name = I('name'); - $m->upd_time = time(); - - // 移除 id - unset($m->id, $m->pid); - - // 更新数据库 - if($m->where(array('id'=>I('id')))->save()) - { - $this->ajaxReturn('编辑成功'); - } else { - $this->ajaxReturn('编辑失败或数据未改变', -100); - } - } - } - $this->ajaxReturn($m->getError(), -1); + // 开始操作 + $ret = RegionService::RegionSave(input()); + return json($ret); } /** @@ -164,23 +95,17 @@ class Region extends Common */ public function Delete() { + // 是否ajax if(!IS_AJAX) { - $this->error('非法访问'); + return $this->error('非法访问'); } - $m = D('Region'); - if($m->create($_POST, 5)) - { - if($m->delete(I('id'))) - { - $this->ajaxReturn('删除成功'); - } else { - $this->ajaxReturn('删除失败或资源不存在', -100); - } - } else { - $this->ajaxReturn($m->getError(), -1); - } + // 开始操作 + $params = input('post.'); + $params['admin'] = $this->admin; + $ret = RegionService::RegionDelete($params); + return json($ret); } } ?> \ No newline at end of file diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index a32f1a32c..dcd6b0d24 100755 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -51,7 +51,7 @@ class User extends Common $total = UserService::UserTotal($where); // 分页 - $number = MyC('admin_page_number'); + $number = MyC('admin_page_number', 10, true); $page_params = array( 'number' => $number, 'total' => $total, diff --git a/application/admin/controller/UserIntegralLog.php b/application/admin/controller/UserIntegralLog.php deleted file mode 100755 index b5b6c06ea..000000000 --- a/application/admin/controller/UserIntegralLog.php +++ /dev/null @@ -1,163 +0,0 @@ -Is_Login(); - - // 权限校验 - $this->Is_Power(); - } - - /** - * [Index 用户积分日志列表] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 - */ - public function Index() - { - // 参数 - $param = array_merge($_POST, $_GET); - - // 条件 - $where = $this->GetIndexWhere(); - - // 模型 - $m = db('UserIntegralLog'); - - // 分页 - $number = MyC('admin_page_number'); - $page_param = array( - 'number' => $number, - 'total' => $m->alias('ui')->join('__USER__ AS u ON u.id=ui.user_id')->where($where)->count(), - 'where' => $param, - 'url' => url('Admin/UserIntegralLog/Index'), - ); - $page = new \base\Page($page_param); - - // 获取列表 - $field = 'ui.*,u.username,u.nickname,u.mobile,u.gender'; - $list = $this->SetDataHandle($m->alias('ui')->join('__USER__ AS u ON u.id=ui.user_id')->field($field)->where($where)->limit($page->GetPageStarNumber(), $number)->order('ui.id desc')->select()); - - // 性别 - $this->assign('common_gender_list', lang('common_gender_list')); - - // 操作类型 - $this->assign('common_integral_log_type_list', lang('common_integral_log_type_list')); - - // 参数 - $this->assign('param', $param); - - // 分页 - $this->assign('page_html', $page->GetPageHtml()); - - // 数据列表 - $this->assign('list', $list); - $this->display('Index'); - } - - /** - * [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_gender_list = lang('common_gender_list'); - $common_integral_log_type_list = lang('common_integral_log_type_list'); - foreach($data as &$v) - { - // 操作类型 - $v['type_text'] = $common_integral_log_type_list[$v['type']]['name']; - - // 性别 - $v['gender_text'] = $common_gender_list[$v['gender']]['name']; - - // 添加时间 - $v['add_time'] = date('Y-m-d H:i:s', $v['add_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'])) - { - $like_keyword = array('like', '%'.I('keyword').'%'); - $where[] = array( - 'u.username' => $like_keyword, - 'u.nickname' => $like_keyword, - 'u.mobile' => $like_keyword, - 'ui.msg' => $like_keyword, - '_logic' => 'or', - ); - } - - // 是否更多条件 - if(I('is_more', 0) == 1) - { - // 等值 - if(I('type', -1) > -1) - { - $where['ui.type'] = intval(I('type', 0)); - } - if(I('gender', -1) > -1) - { - $where['u.gender'] = intval(I('gender', 0)); - } - - // 表达式 - if(!empty($_REQUEST['time_start'])) - { - $where['ui.add_time'][] = array('gt', strtotime(I('time_start'))); - } - if(!empty($_REQUEST['time_end'])) - { - $where['ui.add_time'][] = array('lt', strtotime(I('time_end'))); - } - } - - return $where; - } -} -?> \ No newline at end of file diff --git a/application/admin/view/default/express/index.html b/application/admin/view/default/express/index.html index 76e2ee2d2..bd4925be6 100755 --- a/application/admin/view/default/express/index.html +++ b/application/admin/view/default/express/index.html @@ -18,16 +18,17 @@