diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index f33dcd203..6ff2b63c5 100755 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -34,10 +34,20 @@ class Admin extends Common { // 调用父类前置方法 parent::__construct(); + + // 需要校验权限 + if(in_array($this->action_name, ['index', 'detail', 'delete'])) + { + // 登录校验 + $this->IsLogin(); + + // 权限校验 + $this->IsPower(); + } } /** - * 管理员列表 + * 列表 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 @@ -46,38 +56,6 @@ class Admin extends Common */ public function Index() { - // 登录校验 - $this->IsLogin(); - - // 权限校验 - $this->IsPower(); - - // 总数 - $total = AdminService::AdminTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/admin/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = AdminService::AdminList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -91,23 +69,6 @@ class Admin extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = AdminService::AdminList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } @@ -134,26 +95,21 @@ class Admin extends Common $this->IsPower(); } - // 管理员编辑 - $data = []; + // 数据 + $data = $this->data_detail; if(!empty($params['id'])) { - $data_params = [ - 'where' => ['id'=>$params['id']], - 'm' => 0, - 'n' => 1, - ]; - $ret = AdminService::AdminList($data_params); - if(empty($ret['data'][0])) + if(empty($data)) { return $this->error('管理员信息不存在', MyUrl('admin/index/index')); } - $data = $ret['data'][0]; } // 角色 $role_params = [ - 'where' => ['is_enable'=>1], + 'where' => [ + ['is_enable', '=', 1], + ], 'field' => 'id,name', ]; $role = AdminService::RoleList($role_params); @@ -231,12 +187,6 @@ class Admin extends Common return $this->error('非法访问'); } - // 登录校验 - $this->IsLogin(); - - // 权限校验 - $this->IsPower(); - // 开始操作 $params = $this->data_post; $params['admin'] = $this->admin; diff --git a/app/admin/controller/Answer.php b/app/admin/controller/Answer.php index 09be19a46..e8c77da54 100755 --- a/app/admin/controller/Answer.php +++ b/app/admin/controller/Answer.php @@ -41,7 +41,7 @@ class Answer extends Common } /** - * 问答列表 + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -49,33 +49,6 @@ class Answer extends Common */ public function Index() { - // 总数 - $total = AnswerService::AnswerTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/answer/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - ]; - $ret = AnswerService::AnswerList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -89,29 +62,11 @@ class Answer extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - ]; - $ret = AnswerService::AnswerList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -119,36 +74,21 @@ class Answer extends Common */ public function SaveInfo() { - // 参数 - $params = $this->data_request; - // 数据 - $data = []; - if(!empty($params['id'])) + $data = $this->data_detail; + if(!empty($data)) { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - 'is_public' => 0, - ); - $ret = AnswerService::AnswerList($data_params); - // 内容 - if(!empty($ret['data'][0]['content'])) + if(!empty($data['content'])) { - $ret['data'][0]['content'] = str_replace('
', "\n", $ret['data'][0]['content']); + $data['content'] = str_replace('
', "\n", $data['content']); } // 回复内容 - if(!empty($ret['data'][0]['reply'])) + if(!empty($data['reply'])) { - $ret['data'][0]['reply'] = str_replace('
', "\n", $ret['data'][0]['reply']); + $data['reply'] = str_replace('
', "\n", $data['reply']); } - - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; } MyViewAssign('data', $data); @@ -157,13 +97,14 @@ class Answer extends Common MyViewAssign('common_is_text_list', MyConst('common_is_text_list')); // 参数 + $params = $this->data_request; unset($params['id']); MyViewAssign('params', $params); return MyView(); } /** - * [Save 保存] + * 保存 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Appcenternav.php b/app/admin/controller/Appcenternav.php index cdd17f8e0..34b4352dc 100755 --- a/app/admin/controller/Appcenternav.php +++ b/app/admin/controller/Appcenternav.php @@ -42,7 +42,7 @@ class AppCenterNav extends Common } /** - * [Index 手机管理-首页导航列表] + * 列 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class AppCenterNav extends Common */ public function Index() { - // 总数 - $total = AppCenterNavService::AppCenterNavTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/appcenternav/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = AppCenterNavService::AppCenterNavList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,28 +62,11 @@ class AppCenterNav extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = AppCenterNavService::AppCenterNavList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -120,21 +77,6 @@ class AppCenterNav extends Common // 参数 $params = $this->data_request; - // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ); - $ret = AppCenterNavService::AppCenterNavList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } - // 静态数据 MyViewAssign('common_platform_type', MyConst('common_platform_type')); MyViewAssign('common_app_event_type', MyConst('common_app_event_type')); @@ -145,12 +87,11 @@ class AppCenterNav extends Common // 数据 unset($params['id']); MyViewAssign('params', $params); - MyViewAssign('data', $data); return MyView(); } /** - * [Save 手机管理-首页导航添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -170,7 +111,7 @@ class AppCenterNav extends Common } /** - * [Delete 手机管理-首页导航删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -191,7 +132,7 @@ class AppCenterNav extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Apphomenav.php b/app/admin/controller/Apphomenav.php index 2d9865a08..e2fd539d0 100755 --- a/app/admin/controller/Apphomenav.php +++ b/app/admin/controller/Apphomenav.php @@ -42,7 +42,7 @@ class AppHomeNav extends Common } /** - * [Index 手机管理-首页导航列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class AppHomeNav extends Common */ public function Index() { - // 总数 - $total = AppHomeNavService::AppHomeNavTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/apphomenav/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = AppHomeNavService::AppHomeNavList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,28 +62,11 @@ class AppHomeNav extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = AppHomeNavService::AppHomeNavList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -120,21 +77,6 @@ class AppHomeNav extends Common // 参数 $params = $this->data_request; - // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ); - $ret = AppHomeNavService::AppHomeNavList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } - // 静态数据 MyViewAssign('common_platform_type', MyConst('common_platform_type')); MyViewAssign('common_app_event_type', MyConst('common_app_event_type')); @@ -145,12 +87,11 @@ class AppHomeNav extends Common // 数据 unset($params['id']); MyViewAssign('params', $params); - MyViewAssign('data', $data); return MyView(); } /** - * [Save 手机管理-首页导航添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -170,7 +111,7 @@ class AppHomeNav extends Common } /** - * [Delete 手机管理-首页导航删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -191,7 +132,7 @@ class AppHomeNav extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index c07c92568..cc5613ac0 100755 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -42,7 +42,7 @@ class Article extends Common } /** - * [Index 文章列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class Article extends Common */ public function Index() { - // 总数 - $total = ArticleService::ArticleTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/article/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = ArticleService::ArticleList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,28 +62,11 @@ class Article extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = ArticleService::ArticleList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 文章添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -121,18 +78,7 @@ class Article extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - ); - $ret = ArticleService::ArticleList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $this->data_detail; // 文章分类 $article_category = ArticleService::ArticleCategoryList(['field'=>'id,name']); @@ -160,7 +106,7 @@ class Article extends Common } /** - * [Save 文章添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -180,7 +126,7 @@ class Article extends Common } /** - * [Delete 文章删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -201,7 +147,7 @@ class Article extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Brand.php b/app/admin/controller/Brand.php index a59fc9a39..99a44eb2b 100755 --- a/app/admin/controller/Brand.php +++ b/app/admin/controller/Brand.php @@ -43,7 +43,7 @@ class Brand extends Common } /** - * [Index 品牌列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -51,32 +51,6 @@ class Brand extends Common */ public function Index() { - // 总数 - $total = BrandService::BrandTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/brand/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = BrandService::BrandList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -89,25 +63,11 @@ class Brand extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => [ - ['id', '=', intval($this->data_request['id'])], - ], - ]; - $ret = BrandService::BrandList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -119,20 +79,7 @@ class Brand extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => [ - ['id', '=', intval($params['id'])] - ], - ]; - $ret = BrandService::BrandList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $this->data_detail; // 是否启用 MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list')); @@ -163,7 +110,7 @@ class Brand extends Common } /** - * [Save 品牌保存] + * 保存 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -183,7 +130,7 @@ class Brand extends Common } /** - * [Delete 品牌删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -204,7 +151,7 @@ class Brand extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php index b1b0f059d..621ebdadd 100755 --- a/app/admin/controller/Common.php +++ b/app/admin/controller/Common.php @@ -50,10 +50,6 @@ class Common extends BaseController protected $plugins_controller_name; protected $plugins_action_name; - // 分页信息 - protected $page; - protected $page_size; - // 动态表格 protected $form_table; protected $form_where; @@ -63,6 +59,18 @@ class Common extends BaseController protected $form_order_by; protected $form_error; + // 列表数据 + protected $data_total; + protected $data_list; + protected $data_detail; + + // 分页信息 + protected $page; + protected $page_start; + protected $page_size; + protected $page_html; + protected $page_url; + // 系统类型 protected $system_type; @@ -305,18 +313,38 @@ class Common extends BaseController $ret = (new FormHandleModule())->Run($module['module'], $module['action'], $params); if($ret['code'] == 0) { + // 表格数据 $this->form_table = $ret['data']['table']; $this->form_where = $ret['data']['where']; $this->form_params = $ret['data']['params']; $this->form_md5_key = $ret['data']['md5_key']; $this->form_user_fields = $ret['data']['user_fields']; $this->form_order_by = $ret['data']['order_by']; - MyViewAssign('form_table', $this->form_table); MyViewAssign('form_params', $this->form_params); MyViewAssign('form_md5_key', $this->form_md5_key); MyViewAssign('form_user_fields', $this->form_user_fields); MyViewAssign('form_order_by', $this->form_order_by); + + // 列表数据 + $this->data_total = $ret['data']['data_total']; + $this->data_list = $ret['data']['data_list']; + $this->data_detail = $ret['data']['data_detail']; + MyViewAssign('data_total', $this->data_total); + MyViewAssign('data_list', $this->data_list); + MyViewAssign('data', $this->data_detail); + + // 分页数据 + $this->page = $ret['data']['page']; + $this->page_start = $ret['data']['page_start']; + $this->page_size = $ret['data']['page_size']; + $this->page_html = $ret['data']['page_html']; + $this->page_url = $ret['data']['page_url']; + MyViewAssign('page', $this->page); + MyViewAssign('page_start', $this->page_start); + MyViewAssign('page_size', $this->page_size); + MyViewAssign('page_html', $this->page_html); + MyViewAssign('page_url', $this->page_url); } else { $this->form_error = $ret['msg']; MyViewAssign('form_error', $this->form_error); diff --git a/app/admin/controller/Customview.php b/app/admin/controller/Customview.php index e3606c90b..ea01b38bc 100755 --- a/app/admin/controller/Customview.php +++ b/app/admin/controller/Customview.php @@ -41,7 +41,7 @@ class CustomView extends Common } /** - * [Index 列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -49,32 +49,6 @@ class CustomView extends Common */ public function Index() { - // 总数 - $total = CustomViewService::CustomViewTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/customview/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = CustomViewService::CustomViewList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -87,28 +61,11 @@ class CustomView extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = CustomViewService::CustomViewList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -118,29 +75,13 @@ class CustomView extends Common { // 参数 $params = $this->data_request; - - // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ]; - $ret = CustomViewService::CustomViewList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } unset($params['id']); - MyViewAssign('data', $data); MyViewAssign('params', $params); return MyView(); } /** - * [Save 添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -160,7 +101,7 @@ class CustomView extends Common } /** - * [Delete 删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -181,7 +122,7 @@ class CustomView extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Design.php b/app/admin/controller/Design.php index 82416d329..71b64cd55 100644 --- a/app/admin/controller/Design.php +++ b/app/admin/controller/Design.php @@ -55,35 +55,9 @@ class Design extends Common */ public function Index() { - // 总数 - $total = DesignService::DesignTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/design/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'where' => $this->form_where, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = DesignService::DesignList($data_params); - // 应用商店 MyViewAssign('store_design_url', StoreService::StoreDesignUrl()); - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -97,8 +71,9 @@ class Design extends Common */ public function SaveInfo() { - // 是否指定id、不存在则增加数据 - if(empty($this->data_request['id'])) + // 数据 + $data = $this->data_detail; + if(empty($data)) { $ret = DesignService::DesignSave(); if($ret['code'] == 0) @@ -110,29 +85,11 @@ class Design extends Common } } - // 获取数据 - $data_params = [ - 'where' => [ - 'id' => intval($this->data_request['id']), - ], - 'm' => 0, - 'n' => 1, - ]; - $ret = DesignService::DesignList($data_params); - if(empty($ret['data']) || empty($ret['data'][0])) - { - MyViewAssign('to_title', '去添加 >>'); - MyViewAssign('to_url', MyUrl('admin/design/saveinfo')); - MyViewAssign('msg', '编辑数据为空、请重新添加'); - return MyView('public/tips_error'); - } - $data = $ret['data'][0]; - // 配置处理 $layout_data = BaseLayout::ConfigAdminHandle($data['config']); + unset($data['config']); MyViewAssign('layout_data', $layout_data); MyViewAssign('data', $data); - unset($data['config']); // 页面列表 $pages_list = BaseLayout::PagesList(); diff --git a/app/admin/controller/Goods.php b/app/admin/controller/Goods.php index 7d74643a5..b0df8c813 100755 --- a/app/admin/controller/Goods.php +++ b/app/admin/controller/Goods.php @@ -46,7 +46,7 @@ class Goods extends Common } /** - * [Index 商品列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -54,33 +54,6 @@ class Goods extends Common */ public function Index() { - // 总数 - $total = GoodsService::GoodsTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goods/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_category' => 1, - ]; - $ret = GoodsService::GoodsList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -93,49 +66,25 @@ class Goods extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) + $data = $this->data_detail; + if(!empty($data)) { - // 条件 - $where = [ - ['is_delete_time', '=', 0], - ['id', '=', intval($this->data_request['id'])], - ]; + // 获取商品编辑规格 + $specifications = GoodsService::GoodsEditSpecifications($data['id']); + MyViewAssign('specifications', $specifications); - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_photo' => 1, - 'is_content_app' => 1, - 'is_category' => 1, - ]; - $ret = GoodsService::GoodsList($data_params); - $data = []; - if(!empty($ret['data']) && !empty($ret['data'][0])) - { - $data = $ret['data'][0]; + // 获取商品编辑参数 + $parameters = GoodsService::GoodsEditParameters($data['id']); + MyViewAssign('parameters', $parameters); - // 获取商品编辑规格 - $specifications = GoodsService::GoodsEditSpecifications($data['id']); - MyViewAssign('specifications', $specifications); - - // 获取商品编辑参数 - $parameters = GoodsService::GoodsEditParameters($data['id']); - - // 商品参数类型 - MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list')); - - MyViewAssign('parameters', $parameters); - } - - MyViewAssign('data', $data); + // 商品参数类型 + MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list')); } return MyView(); } /** - * [SaveInfo 商品添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -147,30 +96,13 @@ class Goods extends Common $params = $this->data_request; // 商品信息 - $data = []; + $data = $this->data_detail; if(!empty($params['id'])) { - // 条件 - $where = [ - ['is_delete_time', '=', 0], - ['id', '=', intval($params['id'])], - ]; - - // 获取数据 - $data_params = [ - 'where' => $where, - 'm' => 0, - 'n' => 1, - 'is_photo' => 1, - 'is_content_app' => 1, - 'is_category' => 1, - ]; - $ret = GoodsService::GoodsList($data_params); - if(empty($ret['data'][0])) + if(empty($data)) { return $this->error('商品信息不存在', MyUrl('admin/goods/index')); } - $data = $ret['data'][0]; // 获取商品编辑规格 $specifications = GoodsService::GoodsEditSpecifications($data['id']); @@ -240,7 +172,7 @@ class Goods extends Common } /** - * [Save 商品添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -261,7 +193,7 @@ class Goods extends Common } /** - * [Delete 商品删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Goodsbrowse.php b/app/admin/controller/Goodsbrowse.php index 7b20f4df1..13d4f906b 100644 --- a/app/admin/controller/Goodsbrowse.php +++ b/app/admin/controller/Goodsbrowse.php @@ -51,34 +51,6 @@ class GoodsBrowse extends Common */ public function Index() { - // 总数 - $total = GoodsBrowseService::GoodsBrowseTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goodsbrowse/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = GoodsBrowseService::GoodsBrowseList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -92,25 +64,6 @@ class GoodsBrowse extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['b.id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = GoodsBrowseService::GoodsBrowseList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } diff --git a/app/admin/controller/Goodscomments.php b/app/admin/controller/Goodscomments.php index b307186a6..10b9e600f 100644 --- a/app/admin/controller/Goodscomments.php +++ b/app/admin/controller/Goodscomments.php @@ -41,7 +41,7 @@ class Goodscomments extends Common } /** - * 问答列表 + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -49,34 +49,6 @@ class Goodscomments extends Common */ public function Index() { - // 总数 - $total = GoodsCommentsService::GoodsCommentsTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goodscomments/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'is_goods' => 1, - ]; - $ret = GoodsCommentsService::GoodsCommentsList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -89,31 +61,12 @@ class Goodscomments extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_goods' => 1, - ]; - $ret = GoodsCommentsService::GoodsCommentsList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - - MyViewAssign('common_goods_comments_rating_list', MyConst('common_goods_comments_rating_list')); - } + MyViewAssign('common_goods_comments_rating_list', MyConst('common_goods_comments_rating_list')); return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -125,20 +78,7 @@ class Goodscomments extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'is_public' => 0, - 'is_goods' => 1, - ); - $ret = GoodsCommentsService::GoodsCommentsList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $this->data_detail; MyViewAssign('data', $data); // 静态数据 @@ -154,7 +94,7 @@ class Goodscomments extends Common } /** - * [Save 保存] + * 保存 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -174,7 +114,7 @@ class Goodscomments extends Common } /** - * 问答删除 + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -194,7 +134,7 @@ class Goodscomments extends Common } /** - * 问答回复处理 + * 回复 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 diff --git a/app/admin/controller/Goodsfavor.php b/app/admin/controller/Goodsfavor.php index 575ae933d..ed8e325d9 100644 --- a/app/admin/controller/Goodsfavor.php +++ b/app/admin/controller/Goodsfavor.php @@ -51,34 +51,6 @@ class Goodsfavor extends Common */ public function Index() { - // 总数 - $total = GoodsFavorService::GoodsFavorTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goodsfavor/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = GoodsFavorService::GoodsFavorList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -92,25 +64,6 @@ class Goodsfavor extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['f.id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = GoodsFavorService::GoodsFavorList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } diff --git a/app/admin/controller/Goodsparamstemplate.php b/app/admin/controller/Goodsparamstemplate.php index 6e13dd0ae..c8cb01c78 100755 --- a/app/admin/controller/Goodsparamstemplate.php +++ b/app/admin/controller/Goodsparamstemplate.php @@ -52,32 +52,6 @@ class GoodsParamsTemplate extends Common */ public function Index() { - // 总数 - $total = GoodsParamsService::GoodsParamsTemplateTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/goodsparamstemplate/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = GoodsParamsService::GoodsParamsTemplateList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -91,29 +65,15 @@ class GoodsParamsTemplate extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; + // 数据 + $data = $this->data_detail; - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = GoodsParamsService::GoodsParamsTemplateList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); + // 商品参数类型 + MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list')); - // 商品参数类型 - MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list')); + // 参数配置 + MyViewAssign('parameters', empty($data['config_data']) ? [] : $data['config_data']); - // 参数配置 - MyViewAssign('parameters', empty($data['config_data']) ? [] : $data['config_data']); - } return MyView(); } @@ -131,19 +91,7 @@ class GoodsParamsTemplate extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ); - $ret = GoodsParamsService::GoodsParamsTemplateList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $this->data_detail; // 商品参数类型 MyViewAssign('common_goods_parameters_type_list', MyConst('common_goods_parameters_type_list')); diff --git a/app/admin/controller/Integrallog.php b/app/admin/controller/Integrallog.php index a280b86e2..6daeb20fb 100755 --- a/app/admin/controller/Integrallog.php +++ b/app/admin/controller/Integrallog.php @@ -49,34 +49,6 @@ class IntegralLog extends Common */ public function Index() { - // 总数 - $total = IntegralService::IntegralLogTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/integrallog/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = IntegralService::IntegralLogList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -90,25 +62,6 @@ class IntegralLog extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = IntegralService::IntegralLogList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } } diff --git a/app/admin/controller/Link.php b/app/admin/controller/Link.php index 7685a4e22..c7bd3af0a 100755 --- a/app/admin/controller/Link.php +++ b/app/admin/controller/Link.php @@ -41,7 +41,7 @@ class Link extends Common } /** - * [Index 列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -49,13 +49,6 @@ class Link extends Common */ public function Index() { - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = LinkService::LinkList($data_params); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -68,28 +61,11 @@ class Link extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = LinkService::LinkList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [Save 数据保存] + * 保存 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -109,7 +85,7 @@ class Link extends Common } /** - * [Delete 删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -130,7 +106,7 @@ class Link extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Message.php b/app/admin/controller/Message.php index 21b1cfca6..93eb98814 100755 --- a/app/admin/controller/Message.php +++ b/app/admin/controller/Message.php @@ -49,34 +49,6 @@ class Message extends Common */ public function Index() { - // 总数 - $total = MessageService::MessageTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/message/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = MessageService::MessageList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -89,25 +61,6 @@ class Message extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = MessageService::MessageList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } diff --git a/app/admin/controller/Navigation.php b/app/admin/controller/Navigation.php index 46e82fa5d..212b2ab7d 100755 --- a/app/admin/controller/Navigation.php +++ b/app/admin/controller/Navigation.php @@ -50,7 +50,7 @@ class Navigation extends Common } /** - * [Index 导航列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -90,7 +90,7 @@ class Navigation extends Common } /** - * [Save 添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -111,7 +111,7 @@ class Navigation extends Common } /** - * [Delete 删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -131,7 +131,7 @@ class Navigation extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Order.php b/app/admin/controller/Order.php index 5f8d834e4..8959ee503 100755 --- a/app/admin/controller/Order.php +++ b/app/admin/controller/Order.php @@ -53,48 +53,18 @@ class Order extends Common */ public function Index() { - // 总数 - $total = OrderService::OrderTotal($this->form_where); - - // 提示信息 - $tips_msg = OrderService::OrderTipsMsg($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/order/index'), - 'tips_msg' => $tips_msg, - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'where' => $this->form_where, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'is_operate' => 1, - 'user_type' => 'admin', - ]; - $ret = OrderService::OrderList($data_params); - // 发起支付 - 支付方式 - $pay_where = [ - 'where' => ['is_enable'=>1, 'payment'=>MyConfig('shopxo.under_line_list')], + $pay_wparams = [ + 'where' => [ + ['is_enable', '=', 1], + ['payment', 'in', MyConfig('shopxo.under_line_list')], + ], ]; - MyViewAssign('buy_payment_list', PaymentService::BuyPaymentList($pay_where)); + MyViewAssign('buy_payment_list', PaymentService::BuyPaymentList($pay_wparams)); // 快递公司 MyViewAssign('express_list', ExpressService::ExpressList()); - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -108,26 +78,6 @@ class Order extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['is_delete_time', '=', 0], - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = OrderService::OrderList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } diff --git a/app/admin/controller/Orderaftersale.php b/app/admin/controller/Orderaftersale.php index 49efd3f2a..61613f44b 100644 --- a/app/admin/controller/Orderaftersale.php +++ b/app/admin/controller/Orderaftersale.php @@ -43,7 +43,7 @@ class Orderaftersale extends Common } /** - * 订单列表 + * 列表 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 @@ -52,36 +52,9 @@ class Orderaftersale extends Common */ public function Index() { - // 总数 - $total = OrderAftersaleService::OrderAftersaleTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/orderaftersale/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - ]; - $ret = OrderAftersaleService::OrderAftersaleList($data_params); - // 静态数据 MyViewAssign('common_order_aftersale_refundment_list', MyConst('common_order_aftersale_refundment_list')); - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -94,24 +67,6 @@ class Orderaftersale extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - ); - $ret = OrderAftersaleService::OrderAftersaleList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } @@ -180,7 +135,7 @@ class Orderaftersale extends Common } /** - * 订单取消 + * 取消 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 @@ -202,7 +157,7 @@ class Orderaftersale extends Common } /** - * 订单删除 + * 删除 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 diff --git a/app/admin/controller/Paylog.php b/app/admin/controller/Paylog.php index 5887b807d..c90fbb56b 100755 --- a/app/admin/controller/Paylog.php +++ b/app/admin/controller/Paylog.php @@ -40,74 +40,29 @@ class PayLog extends Common $this->IsPower(); } - /** - * [Index 支付日志列表] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 + /** + * 列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description */ public function Index() { - // 总数 - $total = PayLogService::PayLogTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/paylog/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = PayLogService::PayLogList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } /** * 详情 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2019-08-05T08:21:54+0800 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = PayLogService::PayLogList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } diff --git a/app/admin/controller/Payment.php b/app/admin/controller/Payment.php index e3fb9cd56..24ab34553 100755 --- a/app/admin/controller/Payment.php +++ b/app/admin/controller/Payment.php @@ -80,34 +80,27 @@ class Payment extends Common */ public function SaveInfo() { - // 参数 - $params = $this->data_request; - - // 商品信息 - if(!empty($params['id'])) + $data = []; + if(!empty($this->data_request['id'])) { $data_params = [ - 'where' => ['id'=>$params['id']], + 'where' => ['id'=>$this->data_request['id']], 'm' => 0, 'n' => 1, ]; $data = PaymentService::PaymentList($data_params); - if(empty($data[0])) + if(!empty($data) && !empty($data[0])) { - return $this->error('没有相关支付方式', MyUrl('admin/payment/index')); + $data = $data[0]; } - MyViewAssign('data', $data[0]); } + MyViewAssign('data', $data); // 适用平台 MyViewAssign('common_platform_type', MyConst('common_platform_type')); - // 参数 - MyViewAssign('params', $params); - // 编辑器文件存放地址 MyViewAssign('editor_path_type', ResourcesService::EditorPathTypeValue('payment')); - return MyView(); } diff --git a/app/admin/controller/Payrequestlog.php b/app/admin/controller/Payrequestlog.php index 203658fae..b1a5bfb45 100644 --- a/app/admin/controller/Payrequestlog.php +++ b/app/admin/controller/Payrequestlog.php @@ -10,8 +10,6 @@ // +---------------------------------------------------------------------- namespace app\admin\controller; -use app\service\PayRequestLogService; - /** * 支付请求日志管理 * @author Devil @@ -50,33 +48,6 @@ class PayRequestLog extends Common */ public function Index() { - // 总数 - $total = PayRequestLogService::PayRequestLogTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/payrequestlog/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'user_type' => 'admin', - ]; - $ret = PayRequestLogService::PayRequestLogList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -90,24 +61,6 @@ class PayRequestLog extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'user_type' => 'admin' - ]; - $ret = PayRequestLogService::PayRequestLogList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } } diff --git a/app/admin/controller/Quicknav.php b/app/admin/controller/Quicknav.php index 37f73979e..3390f2a67 100755 --- a/app/admin/controller/Quicknav.php +++ b/app/admin/controller/Quicknav.php @@ -42,7 +42,7 @@ class QuickNav extends Common } /** - * [Index 快捷导航列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class QuickNav extends Common */ public function Index() { - // 总数 - $total = QuickNavService::QuickNavTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/quicknav/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = QuickNavService::QuickNavList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,28 +62,11 @@ class QuickNav extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = QuickNavService::QuickNavList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -120,37 +77,21 @@ class QuickNav extends Common // 参数 $params = $this->data_request; - // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ); - $ret = QuickNavService::QuickNavList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } - MyViewAssign('data', $data); - // 静态数据 MyViewAssign('common_platform_type', MyConst('common_platform_type')); MyViewAssign('common_app_event_type', MyConst('common_app_event_type')); - // 参数 - MyViewAssign('params', $params); - // 编辑器文件存放地址 MyViewAssign('editor_path_type', ResourcesService::EditorPathTypeValue('quick_nav')); + // 数据 + unset($params['id']); + MyViewAssign('params', $params); return MyView(); } /** - * [Save 快捷导航添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -170,7 +111,7 @@ class QuickNav extends Common } /** - * [Delete 快捷导航删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -191,7 +132,7 @@ class QuickNav extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Refundlog.php b/app/admin/controller/Refundlog.php index 2e8b5dfd8..d58688f68 100644 --- a/app/admin/controller/Refundlog.php +++ b/app/admin/controller/Refundlog.php @@ -10,8 +10,6 @@ // +---------------------------------------------------------------------- namespace app\admin\controller; -use app\service\RefundLogService; - /** * 退款日志管理 * @author Devil @@ -41,73 +39,28 @@ class RefundLog extends Common } /** - * [Index 支付日志列表] - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 + * 列表 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description */ public function Index() { - // 总数 - $total = RefundLogService::RefundLogTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/refundlog/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = RefundLogService::RefundLogList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } /** * 详情 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @datetime 2019-08-05T08:21:54+0800 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - 'user_type' => 'admin', - ]; - $ret = RefundLogService::RefundLogList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } } diff --git a/app/admin/controller/Role.php b/app/admin/controller/Role.php index 1b20f038d..a0948a56a 100644 --- a/app/admin/controller/Role.php +++ b/app/admin/controller/Role.php @@ -41,7 +41,7 @@ class Role extends Common } /** - * [Index 角色组列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -49,32 +49,6 @@ class Role extends Common */ public function Index() { - // 总数 - $total = AdminRoleService::RoleTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/role/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = AdminRoleService::RoleList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -87,28 +61,11 @@ class Role extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = AdminRoleService::RoleList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 角色组添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -119,21 +76,12 @@ class Role extends Common // 参数 $params = $this->data_request; - // 角色组 - $data = []; - if(!empty($params['id'])) + // 数据 + $data = $this->data_detail; + if(!empty($data)) { - $data_params = [ - 'where' => ['id'=>intval($params['id'])], - ]; - $ret = AdminRoleService::RoleList($data_params); - if(!empty($ret['data'][0]) && !empty($ret['data'][0]['id'])) - { - $data = $ret['data'][0]; - - // 权限关联数据 - $params['role_id'] = $ret['data'][0]['id']; - } + // 权限关联数据 + $params['role_id'] = $data['id']; } // 权限列表 @@ -160,7 +108,7 @@ class Role extends Common } /** - * [Save 角色组添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -179,7 +127,7 @@ class Role extends Common } /** - * [Delete 角色删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -198,7 +146,7 @@ class Role extends Common } /** - * [StatusUpdate 角色状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Slide.php b/app/admin/controller/Slide.php index 4497a55ab..b6957bf83 100755 --- a/app/admin/controller/Slide.php +++ b/app/admin/controller/Slide.php @@ -42,7 +42,7 @@ class Slide extends Common } /** - * [Index 轮播图片列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class Slide extends Common */ public function Index() { - // 总数 - $total = SlideService::SlideTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/slide/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = SlideService::SlideList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,28 +62,11 @@ class Slide extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = SlideService::SlideList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -120,21 +77,6 @@ class Slide extends Common // 参数 $params = $this->data_request; - // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ]; - $ret = SlideService::SlideList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } - // 静态资源 MyViewAssign('common_is_enable_list', MyConst('common_is_enable_list')); MyViewAssign('common_platform_type', MyConst('common_platform_type')); @@ -146,12 +88,11 @@ class Slide extends Common // 数据 unset($params['id']); MyViewAssign('params', $params); - MyViewAssign('data', $data); return MyView(); } /** - * [Save 轮播图片添加/编辑] + * 添加/编辑 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -171,7 +112,7 @@ class Slide extends Common } /** - * [Delete 轮播图片删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -191,7 +132,7 @@ class Slide extends Common } /** - * [StatusUpdate 状态更新] + * 状态更新 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/User.php b/app/admin/controller/User.php index 442e4c446..f6ecf8a26 100755 --- a/app/admin/controller/User.php +++ b/app/admin/controller/User.php @@ -50,35 +50,9 @@ class User extends Common */ public function Index() { - // 总数 - $total = UserService::UserTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/user/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = UserService::UserList($data_params); - // Excel地址 MyViewAssign('excel_url', MyUrl('admin/user/excelexport', $this->data_request)); - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -91,23 +65,6 @@ class User extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = UserService::UserList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } return MyView(); } @@ -151,25 +108,17 @@ class User extends Common // 参数 $params = $this->data_request; - // 用户编辑 - $data = []; + // 数据 + $data = $this->data_detail; if(!empty($params['id'])) { - $data_params = [ - 'where' => ['id'=>$params['id']], - 'm' => 0, - 'n' => 1, - ]; - $ret = UserService::UserList($data_params); - if(empty($ret['data'][0])) + if(empty($data)) { return $this->error('用户信息不存在', MyUrl('admin/user/index')); } // 生日 - $ret['data'][0]['birthday_text'] = empty($ret['data'][0]['birthday']) ? '' : date('Y-m-d', $ret['data'][0]['birthday']); - - $data = $ret['data'][0]; + $data['birthday_text'] = empty($data['birthday']) ? '' : date('Y-m-d', $data['birthday']); } // 用户编辑页面钩子 diff --git a/app/admin/controller/Useraddress.php b/app/admin/controller/Useraddress.php index c558323dd..eeea2e16a 100644 --- a/app/admin/controller/Useraddress.php +++ b/app/admin/controller/Useraddress.php @@ -42,7 +42,7 @@ class UserAddress extends Common } /** - * [Index 列表] + * 列表 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -50,32 +50,6 @@ class UserAddress extends Common */ public function Index() { - // 总数 - $total = UserAddressService::UserAddressTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/useraddress/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = UserAddressService::UserAddressAdminList($data_params); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -88,29 +62,11 @@ class UserAddress extends Common */ public function Detail() { - $data = []; - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = UserAddressService::UserAddressAdminList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - } - MyViewAssign('data', $data); return MyView(); } /** - * [SaveInfo 添加/编辑页面] + * 添加/编辑页面 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -122,19 +78,7 @@ class UserAddress extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => ['id'=>intval($params['id'])], - 'field' => '*', - ); - $ret = UserAddressService::UserAddressAdminList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $data = $this->data_detail; MyViewAssign('data', $data); // 加载地图api @@ -152,7 +96,7 @@ class UserAddress extends Common } /** - * [Save 保存] + * 保存 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 @@ -178,7 +122,7 @@ class UserAddress extends Common } /** - * [Delete 删除] + * 删除 * @author Devil * @blog http://gong.gg/ * @version 0.0.1 diff --git a/app/admin/controller/Warehouse.php b/app/admin/controller/Warehouse.php index 6f9b24305..42acce4f5 100644 --- a/app/admin/controller/Warehouse.php +++ b/app/admin/controller/Warehouse.php @@ -53,16 +53,6 @@ class Warehouse extends Common */ public function Index() { - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = WarehouseService::WarehouseList($data_params); - MyViewAssign('data_list', $ret['data']); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); return MyView(); } @@ -75,24 +65,6 @@ class Warehouse extends Common */ public function Detail() { - $data = []; - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = WarehouseService::WarehouseList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - } - MyViewAssign('data', $data); return MyView(); } @@ -110,16 +82,7 @@ class Warehouse extends Common $params = $this->data_request; // 数据 - $data = []; - if(!empty($params['id'])) - { - // 获取列表 - $data_params = array( - 'where' => ['id'=>intval($params['id'])], - ); - $ret = WarehouseService::WarehouseList($data_params); - $data = empty($ret['data'][0]) ? [] : $ret['data'][0]; - } + $data = $this->data_detail; // 编辑页面钩子 $hook_name = 'plugins_view_admin_warehouse_save'; diff --git a/app/admin/controller/Warehousegoods.php b/app/admin/controller/Warehousegoods.php index d8a922231..b51b67944 100644 --- a/app/admin/controller/Warehousegoods.php +++ b/app/admin/controller/Warehousegoods.php @@ -54,28 +54,6 @@ class WarehouseGoods extends Common */ public function Index() { - // 总数 - $total = WarehouseGoodsService::WarehouseGoodsTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('admin/warehousegoods/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = WarehouseGoodsService::WarehouseGoodsList($data_params); - // 有效仓库列表 $data_params = [ 'field' => 'id,name', @@ -90,10 +68,6 @@ class WarehouseGoods extends Common // 商品分类 MyViewAssign('goods_category_list', GoodsService::GoodsCategoryAll()); - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -123,7 +97,7 @@ class WarehouseGoods extends Common // 详情数据 if(!empty($ret['data']['data'])) { - $ret = WarehouseGoodsService::DataHandle([$ret['data']['data']]); + $ret = WarehouseGoodsService::WarehouseGoodsListHandle([$ret['data']['data']]); $data = $ret[0]; } } diff --git a/app/admin/form/Admin.php b/app/admin/form/Admin.php index 7d1d957e5..22a1932c4 100644 --- a/app/admin/form/Admin.php +++ b/app/admin/form/Admin.php @@ -41,7 +41,6 @@ class Admin 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/admin/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/admin/delete'), 'delete_key' => 'ids', @@ -179,6 +178,12 @@ class Admin 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Admin', + 'data_handle' => 'AdminService::AdminListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/form/Answer.php b/app/admin/form/Answer.php index ccfa37d1f..3c8a5b5f8 100644 --- a/app/admin/form/Answer.php +++ b/app/admin/form/Answer.php @@ -42,7 +42,6 @@ class Answer 'key_field' => 'id', 'status_field' => 'is_show', 'is_search' => 1, - 'search_url' => MyUrl('admin/answer/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/answer/delete'), 'delete_key' => 'ids', @@ -193,6 +192,16 @@ class Answer 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Answer', + 'data_handle' => 'AnswerService::AnswerListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Appcenternav.php b/app/admin/form/Appcenternav.php index 9db6039df..a1d207b07 100644 --- a/app/admin/form/Appcenternav.php +++ b/app/admin/form/Appcenternav.php @@ -40,7 +40,6 @@ class AppCenterNav 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/appcenternav/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/appcenternav/delete'), 'delete_key' => 'ids', @@ -183,6 +182,13 @@ class AppCenterNav 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'AppCenterNav', + 'data_handle' => 'AppCenterNavService::AppCenterNavListHandle', + 'is_page' => 1, + 'order_by' => 'sort asc,id asc', + ], ]; } } diff --git a/app/admin/form/Apphomenav.php b/app/admin/form/Apphomenav.php index 443bf444d..e0144a51c 100644 --- a/app/admin/form/Apphomenav.php +++ b/app/admin/form/Apphomenav.php @@ -40,7 +40,6 @@ class AppHomeNav 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/apphomenav/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/apphomenav/delete'), 'delete_key' => 'ids', @@ -183,6 +182,13 @@ class AppHomeNav 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'AppHomeNav', + 'data_handle' => 'AppHomeNavService::AppHomeNavListHandle', + 'is_page' => 1, + 'order_by' => 'sort asc,id asc', + ], ]; } } diff --git a/app/admin/form/Article.php b/app/admin/form/Article.php index 64c39bb3a..fbd15c210 100644 --- a/app/admin/form/Article.php +++ b/app/admin/form/Article.php @@ -42,7 +42,6 @@ class Article 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/article/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/article/delete'), 'delete_key' => 'ids', @@ -172,6 +171,12 @@ class Article 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Article', + 'data_handle' => 'ArticleService::ArticleListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/form/Brand.php b/app/admin/form/Brand.php index 0021482e6..94f75e367 100644 --- a/app/admin/form/Brand.php +++ b/app/admin/form/Brand.php @@ -44,7 +44,6 @@ class Brand 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/brand/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/brand/delete'), 'delete_key' => 'ids', @@ -165,6 +164,12 @@ class Brand 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Brand', + 'data_handle' => 'BrandService::BrandListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/form/Customview.php b/app/admin/form/Customview.php index dc5ce0d9b..7ed23bab4 100644 --- a/app/admin/form/Customview.php +++ b/app/admin/form/Customview.php @@ -40,7 +40,6 @@ class CustomView 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/customview/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/customview/delete'), 'delete_key' => 'ids', @@ -177,6 +176,12 @@ class CustomView 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'CustomView', + 'data_handle' => 'CustomViewService::CustomViewListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/admin/form/Design.php b/app/admin/form/Design.php index 3a9443489..60b317348 100644 --- a/app/admin/form/Design.php +++ b/app/admin/form/Design.php @@ -40,7 +40,6 @@ class Design 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/design/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/design/delete'), 'delete_key' => 'ids', @@ -195,6 +194,12 @@ class Design 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Design', + 'data_handle' => 'DesignService::DesignListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/admin/form/Goods.php b/app/admin/form/Goods.php index 836953598..2c937c7a2 100644 --- a/app/admin/form/Goods.php +++ b/app/admin/form/Goods.php @@ -47,7 +47,6 @@ class Goods 'key_field' => 'id', 'status_field' => 'is_shelves', 'is_search' => 1, - 'search_url' => MyUrl('admin/goods/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/goods/delete'), 'delete_key' => 'ids', @@ -296,6 +295,20 @@ class Goods 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Goods', + 'data_handle' => 'GoodsService::GoodsDataHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_photo' => 1, + 'is_content_app' => 1, + 'is_category' => 1, + ], + 'detail_where' => [ + ['is_delete_time', '=', 0], + ], + ], ]; } diff --git a/app/admin/form/Goodsbrowse.php b/app/admin/form/Goodsbrowse.php index fd5dc4768..5b6dd9788 100644 --- a/app/admin/form/Goodsbrowse.php +++ b/app/admin/form/Goodsbrowse.php @@ -41,7 +41,6 @@ class GoodsBrowse 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/goodsbrowse/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/goodsbrowse/delete'), 'delete_key' => 'ids', @@ -124,6 +123,19 @@ class GoodsBrowse 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_obj' => Db::name('GoodsBrowse')->alias('b')->join('goods g', 'g.id=b.goods_id'), + 'select_field' => 'b.*, g.title, g.original_price, g.price, g.min_price, g.images', + 'order_by' => 'b.id desc', + 'detail_dkey' => 'b.id', + 'data_handle' => 'GoodsBrowseService::GoodsBrowseListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Goodscomments.php b/app/admin/form/Goodscomments.php index 85701f7c1..cd3ccd2a2 100644 --- a/app/admin/form/Goodscomments.php +++ b/app/admin/form/Goodscomments.php @@ -235,6 +235,16 @@ class GoodsComments 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'GoodsComments', + 'data_handle' => 'GoodsCommentsService::GoodsCommentsListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'is_goods' => 1, + ], + ], ]; } diff --git a/app/admin/form/Goodsfavor.php b/app/admin/form/Goodsfavor.php index c589ebb2f..352cea903 100644 --- a/app/admin/form/Goodsfavor.php +++ b/app/admin/form/Goodsfavor.php @@ -41,7 +41,6 @@ class GoodsFavor 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/goodsfavor/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/goodsfavor/delete'), 'delete_key' => 'ids', @@ -124,6 +123,19 @@ class GoodsFavor 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_obj' => Db::name('GoodsFavor')->alias('f')->join('goods g', 'g.id=f.goods_id'), + 'select_field' => 'f.*, g.title, g.original_price, g.price, g.min_price, g.images', + 'order_by' => 'f.id desc', + 'detail_dkey' => 'f.id', + 'data_handle' => 'GoodsFavorService::GoodsFavorListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Goodsparamstemplate.php b/app/admin/form/Goodsparamstemplate.php index 0297489cf..56195c9ae 100644 --- a/app/admin/form/Goodsparamstemplate.php +++ b/app/admin/form/Goodsparamstemplate.php @@ -40,7 +40,6 @@ class GoodsParamsTemplate 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/goodsparamstemplate/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/goodsparamstemplate/delete'), 'delete_key' => 'ids', @@ -118,6 +117,16 @@ class GoodsParamsTemplate 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'GoodsParamsTemplate', + 'data_handle' => 'GoodsParamsService::GoodsParamsTemplateListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } } diff --git a/app/admin/form/Integrallog.php b/app/admin/form/Integrallog.php index a72c67439..5ca444085 100644 --- a/app/admin/form/Integrallog.php +++ b/app/admin/form/Integrallog.php @@ -41,7 +41,6 @@ class IntegralLog 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/integrallog/index'), ], // 表单配置 'form' => [ @@ -141,6 +140,16 @@ class IntegralLog 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'UserIntegralLog', + 'data_handle' => 'IntegralService::IntegralLogListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Link.php b/app/admin/form/Link.php index c18625b7c..a39943f67 100644 --- a/app/admin/form/Link.php +++ b/app/admin/form/Link.php @@ -42,7 +42,6 @@ class Link 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/link/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/link/delete'), 'delete_key' => 'ids', @@ -157,6 +156,13 @@ class Link 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Link', + 'data_handle' => 'LinkService::LinkListHandle', + 'is_page' => 0, + 'order_by' => 'sort asc,id desc', + ], ]; } } diff --git a/app/admin/form/Message.php b/app/admin/form/Message.php index 45a0ae500..f4e429ee0 100644 --- a/app/admin/form/Message.php +++ b/app/admin/form/Message.php @@ -43,7 +43,6 @@ class Message 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/message/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/message/delete'), 'delete_key' => 'ids', @@ -174,6 +173,16 @@ class Message 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Message', + 'data_handle' => 'MessageService::MessageListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Order.php b/app/admin/form/Order.php index 62a1d79a8..d168fcf13 100644 --- a/app/admin/form/Order.php +++ b/app/admin/form/Order.php @@ -424,6 +424,21 @@ class Order 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Order', + 'page_tips_handle' => 'OrderService::OrderTipsMsg', + 'data_handle' => 'OrderService::OrderListHandle', + 'detail_where' => [ + ['is_delete_time', '=', 0], + ], + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'is_operate'=> 1, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Orderaftersale.php b/app/admin/form/Orderaftersale.php index c5dbdbb53..cfacc293c 100644 --- a/app/admin/form/Orderaftersale.php +++ b/app/admin/form/Orderaftersale.php @@ -41,7 +41,6 @@ class OrderAftersale 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/orderaftersale/index'), 'is_middle' => 0, ], // 表单配置 @@ -271,6 +270,16 @@ class OrderAftersale 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'OrderAftersale', + 'data_handle' => 'OrderAftersaleService::OrderAftersaleListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Paylog.php b/app/admin/form/Paylog.php index da1388ff4..fafdef703 100644 --- a/app/admin/form/Paylog.php +++ b/app/admin/form/Paylog.php @@ -42,7 +42,6 @@ class PayLog 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/paylog/index'), 'is_middle' => 0, ], // 表单配置 @@ -217,6 +216,16 @@ class PayLog 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'PayLog', + 'data_handle' => 'PayLogService::PayLogListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Payrequestlog.php b/app/admin/form/Payrequestlog.php index 00355225e..4130aadb2 100644 --- a/app/admin/form/Payrequestlog.php +++ b/app/admin/form/Payrequestlog.php @@ -41,7 +41,6 @@ class PayRequestLog 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/payrequestlog/index'), 'is_middle' => 0, ], // 表单配置 @@ -248,6 +247,12 @@ class PayRequestLog 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'PayRequestLog', + 'data_handle' => 'PayRequestLogService::PayRequestLogListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/form/Quicknav.php b/app/admin/form/Quicknav.php index 026b5ac00..9b03efbdc 100644 --- a/app/admin/form/Quicknav.php +++ b/app/admin/form/Quicknav.php @@ -40,7 +40,6 @@ class QuickNav 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/quicknav/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/quicknav/delete'), 'delete_key' => 'ids', @@ -167,6 +166,13 @@ class QuickNav 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'QuickNav', + 'data_handle' => 'QuickNavService::QuickNavListHandle', + 'is_page' => 1, + 'order_by' => 'sort asc,id asc', + ], ]; } } diff --git a/app/admin/form/Refundlog.php b/app/admin/form/Refundlog.php index cb6fda39f..d39893687 100644 --- a/app/admin/form/Refundlog.php +++ b/app/admin/form/Refundlog.php @@ -42,7 +42,6 @@ class RefundLog 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/refundlog/index'), ], // 表单配置 'form' => [ @@ -186,6 +185,16 @@ class RefundLog 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'RefundLog', + 'data_handle' => 'RefundLogService::RefundLogListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + 'user_type' => 'admin', + ], + ], ]; } diff --git a/app/admin/form/Role.php b/app/admin/form/Role.php index 8ca75f6f8..e6f7bc1c2 100644 --- a/app/admin/form/Role.php +++ b/app/admin/form/Role.php @@ -111,6 +111,12 @@ class Role 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Role', + 'data_handle' => 'AdminRoleService::RoleListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/admin/form/Slide.php b/app/admin/form/Slide.php index 381ab4be7..bbceaa917 100644 --- a/app/admin/form/Slide.php +++ b/app/admin/form/Slide.php @@ -40,7 +40,6 @@ class Slide 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/slide/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/slide/delete'), 'delete_key' => 'ids', @@ -166,6 +165,13 @@ class Slide 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Slide', + 'data_handle' => 'SlideService::SlideListHandle', + 'is_page' => 1, + 'order_by' => 'sort asc,id asc', + ], ]; } } diff --git a/app/admin/form/User.php b/app/admin/form/User.php index d76c208fb..5968b24cd 100644 --- a/app/admin/form/User.php +++ b/app/admin/form/User.php @@ -41,7 +41,6 @@ class User 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/user/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/user/delete'), 'delete_key' => 'ids', @@ -256,6 +255,12 @@ class User 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'User', + 'data_handle' => 'UserService::UserListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/form/Useraddress.php b/app/admin/form/Useraddress.php index 63457eee9..ec053ab8b 100644 --- a/app/admin/form/Useraddress.php +++ b/app/admin/form/Useraddress.php @@ -42,7 +42,6 @@ class UserAddress 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/useraddress/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/useraddress/delete'), 'delete_key' => 'ids', @@ -201,6 +200,15 @@ class UserAddress 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'UserAddress', + 'data_handle' => 'UserAddressService::UserAddressListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + ], + ], ]; } diff --git a/app/admin/form/Warehouse.php b/app/admin/form/Warehouse.php index 8d6a9cc2b..9e5fef3e5 100644 --- a/app/admin/form/Warehouse.php +++ b/app/admin/form/Warehouse.php @@ -46,7 +46,6 @@ class Warehouse 'key_field' => 'id', 'status_field' => 'is_enable', 'is_search' => 1, - 'search_url' => MyUrl('admin/warehouse/index'), 'is_delete' => 1, 'delete_url' => MyUrl('admin/warehouse/delete'), 'delete_key' => 'ids', @@ -209,6 +208,13 @@ class Warehouse 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Warehouse', + 'data_handle' => 'WarehouseService::WarehouseListHandle', + 'is_page' => 1, + 'order_by' => 'level desc, id desc', + ], ]; } diff --git a/app/admin/form/Warehousegoods.php b/app/admin/form/Warehousegoods.php index ff9f59737..539666bee 100644 --- a/app/admin/form/Warehousegoods.php +++ b/app/admin/form/Warehousegoods.php @@ -165,6 +165,15 @@ class WarehouseGoods 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_obj' => Db::name('WarehouseGoods')->alias('wg')->leftJoin('warehouse_goods_spec wgs', 'wg.id=wgs.warehouse_goods_id'), + 'select_field' => 'wg.*', + 'order_by' => 'wg.id desc', + 'detail_dkey' => 'wg.id', + 'data_handle' => 'WarehouseGoodsService::WarehouseGoodsListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/admin/view/default/payment/save_info.html b/app/admin/view/default/payment/save_info.html index 5d76d3d41..a4cc16fbe 100755 --- a/app/admin/view/default/payment/save_info.html +++ b/app/admin/view/default/payment/save_info.html @@ -9,160 +9,164 @@ 支付方式{{if empty($data['id'])}}添加{{else /}}编辑{{/if}} 返回 -
- - -
-
- - -
- -
- - -
+上传图片
-
- - - {{if !empty($data['element'])}} -
- - {{foreach $data.element as $element}} -
- {{if !empty($element['title'])}} - + {{if empty($data)}} + {{include file="public/not_data" /}} + {{else /}} +
+ + +
+
+ + +
- {{if isset($data['config'][$element['name']]) and in_array($element_data['value'], explode(',', $data['config'][$element['name']]))}} checked{{/if}} +
+ +
    + {{if !empty($data['logo'])}} +
  • + + + × +
  • + {{/if}} +
+
+上传图片
+
- {{if isset($element['minchecked']) and $element['type'] eq 'checkbox'}} minchecked="{{$element.minchecked}}"{{/if}} + + {{if !empty($data['element'])}} +
+ + {{foreach $data.element as $element}} +
+ {{if !empty($element['title'])}} + + {{/if}} + {{switch element.element}} + {{case input}} + {{if in_array($element['type'], ['radio', 'checkbox']) and !empty($element['element_data']) and is_array($element['element_data'])}} + {{foreach $element.element_data as $element_data_key=>$element_data}} + - {{/foreach}} - {{else /}} - + {{$element_data.name}} + + {{/foreach}} + {{else /}} + + {{/if}} + {{/case}} + {{case select}} + {{if !empty($element['element_data']) and is_array($element['element_data'])}} + + {{/if}} + {{/case}} + {{case textarea}} + + {{/case}} + {{case message}} +
+ {{$element.message|raw}} +
+ {{/case}} + {{/switch}} +
+ {{/foreach}} +
+ {{/if}} + - {{if isset($element['is_required']) and $element['is_required'] eq 1}}required{{/if}} - > - {{if !isset($element['is_multiple']) or $element['is_multiple'] neq 1}} - {{if !empty($element['placeholder'])}} - - {{/if}} - {{/if}} - {{foreach $element.element_data as $element_data_key=>$element_data}} - - {{/foreach}} - - {{/if}} - {{/case}} - {{case textarea}} - - {{/case}} - {{case message}} -
- {{$element.message|raw}} -
- {{/case}} - {{/switch}} -
- {{/foreach}} +
+ + +
+
+ +
{{/if}} - - -
- - -
- -
- - -
- -
- - -
-
- - -
diff --git a/app/admin/view/default/quicknav/module/operate.html b/app/admin/view/default/quicknav/module/operate.html index 089811889..272ec7558 100644 --- a/app/admin/view/default/quicknav/module/operate.html +++ b/app/admin/view/default/quicknav/module/operate.html @@ -3,7 +3,7 @@ 详情 - + 编辑 diff --git a/app/admin/view/default/warehouse/index.html b/app/admin/view/default/warehouse/index.html index 8f812c504..a8d29393f 100644 --- a/app/admin/view/default/warehouse/index.html +++ b/app/admin/view/default/warehouse/index.html @@ -10,8 +10,7 @@ {{block name="form_operate_bottom"}} -
- +

1. 权重数值越大代表权重越高、扣除库存按照权重依次扣除)

2. 仓库仅软删除、删除后将不可用、仅数据库中保留数据)可以自行删除关联的商品数据

3. 仓库停用和删除、关联的商品库存会立即释放

diff --git a/app/common.php b/app/common.php index d02b30b4c..7fb79ba44 100755 --- a/app/common.php +++ b/app/common.php @@ -1050,9 +1050,12 @@ function CallPluginsData($plugins, $attachment_field = [], $service_name = '', $ // 查看是否存在基础服务层并且定义获取基础配置方法 $plugins_class = 'app\plugins\\'.$plugins.'\service\BaseService'; - if(class_exists($plugins_class) && method_exists($plugins_class, 'BaseConfig')) + if(class_exists($plugins_class)) { - return $plugins_class::BaseConfig(); + if(ethod_exists($plugins_class, 'BaseConfig')) + { + return $plugins_class::BaseConfig(); + } } // 未指定附件字段则自动去获取 diff --git a/app/index/controller/Answer.php b/app/index/controller/Answer.php index ea185d613..c5e229db9 100755 --- a/app/index/controller/Answer.php +++ b/app/index/controller/Answer.php @@ -49,35 +49,8 @@ class Answer extends Common */ public function Index() { - // 总数 - $total = AnswerService::AnswerTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/answer/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = AnswerService::AnswerList($data_params); - // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('问答/留言', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -91,24 +64,7 @@ class Answer extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = AnswerService::AnswerList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } - + MyViewAssign('data', $this->data_detail); MyViewAssign('is_header', 0); MyViewAssign('is_footer', 0); return MyView(); diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php index 58e1306aa..2d1602875 100755 --- a/app/index/controller/Common.php +++ b/app/index/controller/Common.php @@ -59,10 +59,6 @@ class Common extends BaseController protected $plugins_controller_name; protected $plugins_action_name; - // 分页信息 - protected $page; - protected $page_size; - // 动态表格 protected $form_table; protected $form_where; @@ -72,6 +68,18 @@ class Common extends BaseController protected $form_order_by; protected $form_error; + // 列表数据 + protected $data_total; + protected $data_list; + protected $data_detail; + + // 分页信息 + protected $page; + protected $page_start; + protected $page_size; + protected $page_html; + protected $page_url; + // 系统类型 protected $system_type; @@ -400,18 +408,38 @@ class Common extends BaseController $ret = (new FormHandleModule())->Run($module['module'], $module['action'], $params); if($ret['code'] == 0) { + // 表格数据 $this->form_table = $ret['data']['table']; $this->form_where = $ret['data']['where']; $this->form_params = $ret['data']['params']; $this->form_md5_key = $ret['data']['md5_key']; $this->form_user_fields = $ret['data']['user_fields']; $this->form_order_by = $ret['data']['order_by']; - MyViewAssign('form_table', $this->form_table); MyViewAssign('form_params', $this->form_params); MyViewAssign('form_md5_key', $this->form_md5_key); MyViewAssign('form_user_fields', $this->form_user_fields); MyViewAssign('form_order_by', $this->form_order_by); + + // 列表数据 + $this->data_total = $ret['data']['data_total']; + $this->data_list = $ret['data']['data_list']; + $this->data_detail = $ret['data']['data_detail']; + MyViewAssign('data_total', $this->data_total); + MyViewAssign('data_list', $this->data_list); + MyViewAssign('data', $this->data_detail); + + // 分页数据 + $this->page = $ret['data']['page']; + $this->page_start = $ret['data']['page_start']; + $this->page_size = $ret['data']['page_size']; + $this->page_html = $ret['data']['page_html']; + $this->page_url = $ret['data']['page_url']; + MyViewAssign('page', $this->page); + MyViewAssign('page_start', $this->page_start); + MyViewAssign('page_size', $this->page_size); + MyViewAssign('page_html', $this->page_html); + MyViewAssign('page_url', $this->page_url); } else { $this->form_error = $ret['msg']; MyViewAssign('form_error', $this->form_error); diff --git a/app/index/controller/Message.php b/app/index/controller/Message.php index 302fec6ec..b910a1500 100755 --- a/app/index/controller/Message.php +++ b/app/index/controller/Message.php @@ -48,38 +48,11 @@ class Message extends Common */ public function Index() { - // 总数 - $total = MessageService::MessageTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/message/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = MessageService::MessageList($data_params); - // 消息更新未已读 MessageService::MessageRead(['user'=>$this->user]); // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('我的消息', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -93,24 +66,7 @@ class Message extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = MessageService::MessageList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } - + MyViewAssign('data', $this->data_detail); MyViewAssign('is_header', 0); MyViewAssign('is_footer', 0); return MyView(); diff --git a/app/index/controller/Order.php b/app/index/controller/Order.php index ebafeb9c1..48a02d89d 100755 --- a/app/index/controller/Order.php +++ b/app/index/controller/Order.php @@ -56,45 +56,15 @@ class Order extends Common */ public function Index() { - // 总数 - $total = OrderService::OrderTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/order/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'where' => $this->form_where, - 'order_by' => $this->form_order_by['data'], - 'is_orderaftersale' => 1, - 'is_operate' => 1, - 'user_type' => 'user', - ]; - $ret = OrderService::OrderList($data_params); - // 支付参数 $pay_params = OrderService::PayParamsHandle($this->data_request); + MyViewAssign('pay_params', $pay_params); // 发起支付 - 支付方式 MyViewAssign('buy_payment_list', PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1])); // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('我的订单', 1)); - - // 基础参数赋值 - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); - MyViewAssign('pay_params', $pay_params); - MyViewAssign('params', $this->data_request); return MyView(); } @@ -109,7 +79,7 @@ class Order extends Common public function Detail() { // 获取订单信息 - $data = $this->OrderFirst(); + $data = $this->data_detail; if(empty($data)) { MyViewAssign('msg', '没有相关数据'); @@ -125,13 +95,13 @@ class Order extends Common // 支付参数 $pay_params = OrderService::PayParamsHandle($this->data_request); + MyViewAssign('pay_params', $pay_params); // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单详情', 1)); // 数据赋值 MyViewAssign('data', $data); - MyViewAssign('pay_params', $pay_params); MyViewAssign('params', $this->data_request); return MyView(); } diff --git a/app/index/controller/Orderaftersale.php b/app/index/controller/Orderaftersale.php index 993887885..4a8c28dc1 100644 --- a/app/index/controller/Orderaftersale.php +++ b/app/index/controller/Orderaftersale.php @@ -49,36 +49,8 @@ class Orderaftersale extends Common */ public function Index() { - // 总数 - $total = OrderAftersaleService::OrderAftersaleTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/orderaftersale/index'), - ]; - $page = new \base\Page($page_params); - - // 获取数据列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - 'is_public' => 0, - ]; - $ret = OrderAftersaleService::OrderAftersaleList($data_params); - // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单售后', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } diff --git a/app/index/controller/Usergoodsbrowse.php b/app/index/controller/Usergoodsbrowse.php index f3b877d32..229ef304d 100755 --- a/app/index/controller/Usergoodsbrowse.php +++ b/app/index/controller/Usergoodsbrowse.php @@ -48,35 +48,8 @@ class UserGoodsBrowse extends Common */ public function Index() { - // 总数 - $total = GoodsBrowseService::GoodsBrowseTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/usergoodsbrowse/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = GoodsBrowseService::GoodsBrowseList($data_params); - // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('我的足迹', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -90,24 +63,7 @@ class UserGoodsBrowse extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['b.id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = GoodsBrowseService::GoodsBrowseList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } - + MyViewAssign('data', $this->data_detail); MyViewAssign('is_header', 0); MyViewAssign('is_footer', 0); return MyView(); diff --git a/app/index/controller/Usergoodsfavor.php b/app/index/controller/Usergoodsfavor.php index ab7bdf60e..a4e9ad2b2 100755 --- a/app/index/controller/Usergoodsfavor.php +++ b/app/index/controller/Usergoodsfavor.php @@ -48,35 +48,8 @@ class UserGoodsFavor extends Common */ public function Index() { - // 总数 - $total = GoodsFavorService::GoodsFavorTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/usergoodsfavor/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = GoodsFavorService::GoodsFavorList($data_params); - // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('商品收藏', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -90,24 +63,7 @@ class UserGoodsFavor extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['f.id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = GoodsFavorService::GoodsFavorList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } - + MyViewAssign('data', $this->data_detail); MyViewAssign('is_header', 0); MyViewAssign('is_footer', 0); return MyView(); diff --git a/app/index/controller/Userintegral.php b/app/index/controller/Userintegral.php index 16072c64f..96990c751 100755 --- a/app/index/controller/Userintegral.php +++ b/app/index/controller/Userintegral.php @@ -49,39 +49,12 @@ class UserIntegral extends Common */ public function Index() { - // 总数 - $total = IntegralService::IntegralLogTotal($this->form_where); - - // 分页 - $page_params = [ - 'number' => $this->page_size, - 'total' => $total, - 'where' => $this->data_request, - 'page' => $this->page, - 'url' => MyUrl('index/userintegral/index'), - ]; - $page = new \base\Page($page_params); - - // 获取列表 - $data_params = [ - 'where' => $this->form_where, - 'm' => $page->GetPageStarNumber(), - 'n' => $this->page_size, - 'order_by' => $this->form_order_by['data'], - ]; - $ret = IntegralService::IntegralLogList($data_params); - // 用户积分 $integral = IntegralService::UserIntegral($this->user['id']); MyViewAssign('user_integral_data', $integral); // 浏览器名称 MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('我的积分', 1)); - - // 基础参数赋值 - MyViewAssign('params', $this->data_request); - MyViewAssign('page_html', $page->GetPageHtml()); - MyViewAssign('data_list', $ret['data']); return MyView(); } @@ -95,24 +68,7 @@ class UserIntegral extends Common */ public function Detail() { - if(!empty($this->data_request['id'])) - { - // 条件 - $where = [ - ['id', '=', intval($this->data_request['id'])], - ]; - - // 获取列表 - $data_params = [ - 'm' => 0, - 'n' => 1, - 'where' => $where, - ]; - $ret = IntegralService::IntegralLogList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - MyViewAssign('data', $data); - } - + MyViewAssign('data', $this->data_detail); MyViewAssign('is_header', 0); MyViewAssign('is_footer', 0); return MyView(); diff --git a/app/index/form/Answer.php b/app/index/form/Answer.php index d563b6959..3e073f39f 100644 --- a/app/index/form/Answer.php +++ b/app/index/form/Answer.php @@ -58,7 +58,6 @@ class Answer 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('index/answer/index'), ], // 表单配置 'form' => [ @@ -132,6 +131,12 @@ class Answer 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Answer', + 'data_handle' => 'AnswerService::AnswerListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/index/form/Message.php b/app/index/form/Message.php index 5222b4209..9caf1033b 100644 --- a/app/index/form/Message.php +++ b/app/index/form/Message.php @@ -60,7 +60,6 @@ class Message 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('index/message/index'), ], // 表单配置 'form' => [ @@ -149,6 +148,12 @@ class Message 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'Message', + 'data_handle' => 'MessageService::MessageListHandle', + 'is_page' => 1, + ], ]; } diff --git a/app/index/form/Order.php b/app/index/form/Order.php index 70ba076db..eda91d60c 100644 --- a/app/index/form/Order.php +++ b/app/index/form/Order.php @@ -62,7 +62,6 @@ class Order $base = [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('index/order/index'), 'detail_title' => '基础信息', 'is_middle' => 0, ]; @@ -425,9 +424,26 @@ class Order ]); } + // 数据配置 + $data = [ + 'table_name' => 'Order', + 'page_tips_handle' => 'OrderService::OrderTipsMsg', + 'data_handle' => 'OrderService::OrderListHandle', + 'detail_where' => [ + ['is_delete_time', '=', 0], + ], + 'is_page' => 1, + 'data_params' => [ + 'is_operate' => 1, + 'is_orderaftersale' => 1, + 'user_type' => 'user', + ], + ]; + return [ 'base' => $base, 'form' => $form, + 'data' => $data, ]; } diff --git a/app/index/form/Orderaftersale.php b/app/index/form/Orderaftersale.php index 225a7eef4..b1cc8d7f2 100644 --- a/app/index/form/Orderaftersale.php +++ b/app/index/form/Orderaftersale.php @@ -58,7 +58,6 @@ class OrderAftersale 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('admin/orderaftersale/index'), 'is_middle' => 0, ], // 表单配置 @@ -257,6 +256,16 @@ class OrderAftersale 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'detail_action' => [], + 'table_name' => 'OrderAftersale', + 'data_handle' => 'OrderAftersaleService::OrderAftersaleListHandle', + 'is_page' => 1, + 'data_params' => [ + 'is_public' => 0, + ], + ], ]; } diff --git a/app/index/form/Usergoodsbrowse.php b/app/index/form/Usergoodsbrowse.php index cd5e2c412..c5da08802 100644 --- a/app/index/form/Usergoodsbrowse.php +++ b/app/index/form/Usergoodsbrowse.php @@ -58,7 +58,6 @@ class UserGoodsBrowse 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('index/usergoodsbrowse/index'), 'is_delete' => 1, 'delete_url' => MyUrl('index/usergoodsbrowse/delete'), 'delete_key' => 'ids', @@ -127,6 +126,15 @@ class UserGoodsBrowse 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_obj' => Db::name('GoodsBrowse')->alias('b')->join('goods g', 'g.id=b.goods_id'), + 'select_field' => 'b.*, g.title, g.original_price, g.price, g.min_price, g.images', + 'order_by' => 'b.id desc', + 'detail_dkey' => 'b.id', + 'data_handle' => 'GoodsBrowseService::GoodsBrowseListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/index/form/Usergoodsfavor.php b/app/index/form/Usergoodsfavor.php index a89ec977e..f2a9fb4d5 100644 --- a/app/index/form/Usergoodsfavor.php +++ b/app/index/form/Usergoodsfavor.php @@ -127,6 +127,15 @@ class UserGoodsFavor 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_obj' => Db::name('GoodsFavor')->alias('f')->join('goods g', 'g.id=f.goods_id'), + 'select_field' => 'f.*, g.title, g.original_price, g.price, g.min_price, g.images', + 'order_by' => 'f.id desc', + 'detail_dkey' => 'f.id', + 'data_handle' => 'GoodsFavorService::GoodsFavorListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/index/form/Userintegral.php b/app/index/form/Userintegral.php index a1b35d3f8..006b3bc2a 100644 --- a/app/index/form/Userintegral.php +++ b/app/index/form/Userintegral.php @@ -58,7 +58,6 @@ class UserIntegral 'base' => [ 'key_field' => 'id', 'is_search' => 1, - 'search_url' => MyUrl('index/userintegral/index'), ], // 表单配置 'form' => [ @@ -134,6 +133,12 @@ class UserIntegral 'fixed' => 'right', ], ], + // 数据配置 + 'data' => [ + 'table_name' => 'UserIntegralLog', + 'data_handle' => 'IntegralService::IntegralLogListHandle', + 'is_page' => 1, + ], ]; } } diff --git a/app/module/FormHandleModule.php b/app/module/FormHandleModule.php index ce913beb7..a7dfd68d1 100644 --- a/app/module/FormHandleModule.php +++ b/app/module/FormHandleModule.php @@ -10,6 +10,7 @@ // +---------------------------------------------------------------------- namespace app\module; +use think\facade\Db; use app\service\FormTableService; /** @@ -39,6 +40,28 @@ class FormHandleModule // 排序 public $order_by; + // 当前系统操作名称 + public $module_name; + public $controller_name; + public $action_name; + + // 当前插件操作名称 + public $plugins_module_name; + public $plugins_controller_name; + public $plugins_action_name; + + // 分页信息 + public $page; + public $page_start; + public $page_size; + public $page_html; + public $page_url; + + // 列表数据及详情 + public $data_total; + public $data_list; + public $data_detail; + /** * 运行入口 * @author Devil @@ -82,8 +105,8 @@ class FormHandleModule // 基础条件 $this->BaseWhereHandle(); - // 表格数据处理 - $this->FormDataHandle(); + // 表格配置处理 + $this->FormConfigHandle(); // 基础数据结尾处理 $this->FormBaseLastHandle(); @@ -94,6 +117,9 @@ class FormHandleModule // 排序字段处理 $this->FormOrderByHandle(); + // 数据列表处理 + $this->FormDataListHandle(); + // 数据返回 $data = [ 'table' => $this->form_data, @@ -102,6 +128,14 @@ class FormHandleModule 'md5_key' => $this->md5_key, 'user_fields' => $this->user_fields, 'order_by' => $this->order_by, + 'page' => $this->page, + 'page_start' => $this->page_start, + 'page_size' => $this->page_size, + 'page_url' => $this->page_url, + 'page_html' => $this->page_html, + 'data_total' => $this->data_total, + 'data_list' => $this->data_list, + 'data_detail' => $this->data_detail, ]; // 钩子-结束 @@ -192,6 +226,239 @@ class FormHandleModule $this->order_by['val'] = empty($this->out_params['fp_order_by_val']) ? '' : $this->out_params['fp_order_by_val']; $this->order_by['field'] = ''; $this->order_by['data'] = ''; + + // 分页信息 + $this->page = max(1, isset($this->out_params['page']) ? intval($this->out_params['page']) : 1); + $this->page_size = min(empty($this->out_params['page_size']) ? MyC('common_page_size', 10, true) : intval($this->out_params['page_size']), 1000); + + // 当前系统操作名称 + $this->module_name = RequestModule(); + $this->controller_name = RequestController(); + $this->action_name = RequestAction(); + + // 当前插件操作名称, 兼容插件模块名称 + if(empty($this->out_params['pluginsname'])) + { + // 默认插件模块赋空值 + $this->plugins_module_name = ''; + $this->plugins_controller_name = ''; + $this->plugins_action_name = ''; + + // 当前页面地址 + $this->page_url = MyUrl($this->module_name.'/'.$this->controller_name.'/'.$this->action_name); + } else { + // 处理插件页面模块 + $this->plugins_module_name = $this->out_params['pluginsname']; + $this->plugins_controller_name = empty($this->out_params['pluginscontrol']) ? 'index' : $this->out_params['pluginscontrol']; + $this->plugins_action_name = empty($this->out_params['pluginsaction']) ? 'index' : $this->out_params['pluginsaction']; + + // 当前页面地址 + if($this->module_name == 'admin') + { + $this->page_url = PluginsAdminUrl($this->plugins_module_name, $this->plugins_controller_name, $this->plugins_action_name); + } else { + $this->page_url = PluginsHomeUrl($this->plugins_module_name, $this->plugins_controller_name, $this->plugins_action_name); + } + } + + // 是否开启搜索 + if(isset($this->form_data['base']['is_search']) && $this->form_data['base']['is_search'] == 1) + { + // 是否设置搜索重置链接 + if(empty($this->form_data['base']['search_url'])) + { + $this->form_data['base']['search_url'] = $this->page_url; + } + } + } + + /** + * 数据列表处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + */ + public function FormDataListHandle() + { + if(!empty($this->form_data['data'])) + { + $form_data = $this->form_data['data']; + + // 列表和详情 + $list_action = isset($form_data['list_action']) ? (is_array($form_data['list_action']) ? $form_data['list_action'] : [$form_data['list_action']]) : ['index']; + $detail_action = isset($form_data['detail_action']) ? (is_array($form_data['detail_action']) ? $form_data['detail_action'] : [$form_data['detail_action']]) : ['detail', 'saveinfo']; + if(empty($this->plugins_module_name)) + { + $is_list = in_array($this->action_name, $list_action); + $is_detail = in_array($this->action_name, $detail_action); + } else { + $is_list = in_array($this->plugins_action_name, $list_action); + $is_detail = in_array($this->plugins_action_name, $detail_action); + } + // 非列表和详情则不处理 + if(!$is_list && !$is_detail) + { + return false; + } + + // 数据库对象 + $db = null; + if(!empty($form_data['table_obj']) && is_object($form_data['table_obj'])) + { + $db = $form_data['table_obj']; + } elseif(!empty($form_data['table_name'])) + { + $db = Db::name($form_data['table_name']); + } + if($db === null) + { + return false; + } + + // 读取字段 + $select_field = empty($form_data['select_field']) ? '*' : $form_data['select_field']; + $db->field($select_field); + + // 数据读取 + if($is_list) + { + // 加入条件 + $db->where($this->where); + + // 总数 + $this->data_total = (int) $db->count(); + if($this->data_total > 0) + { + // 是否使用分页 + $is_page = (!isset($form_data['is_page']) || $form_data['is_page'] == 1); + if($is_page) + { + // 是否定义分页提示信息 + $tips_msg = ''; + $m = $this->ServiceActionModule($form_data, 'page_tips_handle'); + if(!empty($m)) + { + $module = $m['module']; + $action = $m['action']; + $tips_msg = $module::$action($this->where); + } + + // 分页组件 + $page_params = [ + 'number' => $this->page_size, + 'total' => $this->data_total, + 'where' => $this->out_params, + 'page' => $this->page, + 'url' => $this->page_url, + 'tips_msg' => $tips_msg, + ]; + $page = new \base\Page($page_params); + $this->page_start = $page->GetPageStarNumber(); + $this->page_html = $page->GetPageHtml(); + + // 增加分页 + $db->limit($this->page_start, $this->page_size); + } + + // 增加排序、未设置则默认[ id desc ] + $order_by = empty($this->order_by['data']) ? (array_key_exists('order_by', $form_data) ? $form_data['order_by'] : 'id desc') : $this->order_by['data']; + if(!empty($order_by)) + { + $db->order($order_by); + } + + // 读取数据 + $this->data_list = $db->select()->toArray(); + } + } else { + // 默认条件 + $this->where = empty($form_data['detail_where']) ? [] : $form_data['detail_where']; + + // 单独处理条件 + $detail_dkey = empty($form_data['detail_dkey']) ? 'id' : $form_data['detail_dkey']; + $detail_pkey = empty($form_data['detail_pkey']) ? 'id' : $form_data['detail_pkey']; + $value = empty($this->out_params[$detail_pkey]) ? 0 : $this->out_params[$detail_pkey]; + $this->where[] = [$detail_dkey, '=', $value]; + $db->where($this->where); + + // 读取数据、仅读取一条 + $this->data_list = $db->limit(0, 1)->select()->toArray(); + } + + // 数据处理 + if(!empty($this->data_list)) + { + // 是否已定义数据处理、必须存在双冒号 + $m = $this->ServiceActionModule($form_data, 'data_handle'); + if(!empty($m)) + { + $module = $m['module']; + $action = $m['action']; + // 数据请求参数 + $data_params = empty($form_data['data_params']) ? [] : $form_data['data_params']; + $res = $module::$action($this->data_list, $data_params); + // 是否按照数据返回格式方法放回的数据 + if(isset($res['code']) && isset($res['msg']) && isset($res['data'])) + { + $this->data_list = $res['data']; + } else { + $this->data_list = $res; + } + } + + // 是否详情页 + if($is_detail) + { + $this->data_detail = $this->data_list[0]; + $this->data_list = []; + } + } + } + } + + /** + * 服务层方法模块 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-02 + * @desc description + * @param [string] $data [模块数据] + * @param [string] $field [字段] + */ + public function ServiceActionModule($data, $field) + { + $result = []; + if(!empty($data) && !empty($data[$field]) && stripos($data[$field], '::') !== false) + { + $arr = explode('::', $data[$field]); + // 是否存在命名空间反斜杠 + if(stripos($arr[0], '\\') === false) + { + if(empty($this->plugins_module_name)) + { + $module = 'app\service\\'.$arr[0]; + } else { + $module = 'app\plugins\\'.$this->plugins_module_name.'\service\\'.$arr[0]; + } + } else { + $module = $arr[0]; + } + $action = $arr[1]; + if(class_exists($module)); + { + if(method_exists($module, $action)) + { + $result = [ + 'module' => $module, + 'action' => $action, + ]; + } + } + } + return $result; } /** @@ -304,14 +571,14 @@ class FormHandleModule } /** - * 表格数据处理 + * 表格配置处理 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 * @date 2020-06-02 * @desc description */ - public function FormDataHandle() + public function FormConfigHandle() { foreach($this->form_data['form'] as $k=>&$v) { diff --git a/app/service/AdminRoleService.php b/app/service/AdminRoleService.php index de267e32d..5d6630fb8 100644 --- a/app/service/AdminRoleService.php +++ b/app/service/AdminRoleService.php @@ -41,6 +41,21 @@ class AdminRoleService // 获取角色列表 $data = Db::name('Role')->field($field)->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); + return DataReturn('处理成功', 0, self::RoleListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function RoleListHandle($data, $params = []) + { if(!empty($data)) { // 获取对应菜单权限数据 @@ -66,7 +81,6 @@ class AdminRoleService } } - // 是否存在超级管理角色组 // 超级管理员数据库中并没存储关联关系,所以这里直接读取全部权限菜单 if(in_array(1, $ids)) @@ -93,21 +107,7 @@ class AdminRoleService $v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']); } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 角色总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-07 - * @desc description - * @param [array] $where [条件] - */ - public static function RoleTotal($where = []) - { - return (int) Db::name('Role')->where($where)->count(); + return $data; } /** diff --git a/app/service/AdminService.php b/app/service/AdminService.php index 20683999b..882f18725 100755 --- a/app/service/AdminService.php +++ b/app/service/AdminService.php @@ -27,23 +27,17 @@ class AdminService public static $admin_login_key = 'admin_login_info'; /** - * 管理员列表 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 - * @param [array] $params [输入参数] + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] */ - public static function AdminList($params = []) + public static function AdminListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'id desc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取管理员列表 - $data = Db::name('Admin')->where($where)->field($field)->order($order_by)->limit($m, $n)->select()->toArray(); if(!empty($data)) { // 获取当前用户角色名称 @@ -69,20 +63,7 @@ class AdminService $v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']); } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 管理员总数 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - * @param [array] $where [条件] - */ - public static function AdminTotal($where) - { - return (int) Db::name('Admin')->where($where)->count(); + return $data; } /** diff --git a/app/service/AnswerService.php b/app/service/AnswerService.php index e609cceec..a22541789 100755 --- a/app/service/AnswerService.php +++ b/app/service/AnswerService.php @@ -57,6 +57,21 @@ class AnswerService // 获取数据列表 $data = Db::name('Answer')->field($field)->where($where)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::AnswerListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function AnswerListHandle($data, $params = []) + { if(!empty($data)) { // 用户默认头像 @@ -114,7 +129,7 @@ class AnswerService } } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/AppCenterNavService.php b/app/service/AppCenterNavService.php index bf4814a95..f0168aeda 100755 --- a/app/service/AppCenterNavService.php +++ b/app/service/AppCenterNavService.php @@ -24,23 +24,17 @@ use app\service\ResourcesService; class AppCenterNavService { /** - * 用户中心导航列表 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 - * @param [array] $params [输入参数] + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] */ - public static function AppCenterNavList($params = []) + public static function AppCenterNavListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'sort asc, id asc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取品牌列表 - $data = Db::name('AppCenterNav')->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); if(!empty($data)) { $common_platform_type = MyConst('common_platform_type'); @@ -76,20 +70,7 @@ class AppCenterNavService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 用户中心导航总数 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - * @param [array] $where [条件] - */ - public static function AppCenterNavTotal($where) - { - return (int) Db::name('AppCenterNav')->where($where)->count(); + return $data; } /** diff --git a/app/service/AppHomeNavService.php b/app/service/AppHomeNavService.php index bbd8d7f15..741be8134 100755 --- a/app/service/AppHomeNavService.php +++ b/app/service/AppHomeNavService.php @@ -24,23 +24,17 @@ use app\service\ResourcesService; class AppHomeNavService { /** - * 首页导航列表 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 - * @param [array] $params [输入参数] + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] */ - public static function AppHomeNavList($params = []) + public static function AppHomeNavListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取品牌列表 - $data = Db::name('AppHomeNav')->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); if(!empty($data)) { $common_platform_type = MyConst('common_platform_type'); @@ -76,20 +70,7 @@ class AppHomeNavService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 首页导航总数 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - * @param [array] $where [条件] - */ - public static function AppHomeNavTotal($where) - { - return (int) Db::name('AppHomeNav')->where($where)->count(); + return $data; } /** diff --git a/app/service/ArticleService.php b/app/service/ArticleService.php index 39e30091f..353b85e04 100755 --- a/app/service/ArticleService.php +++ b/app/service/ArticleService.php @@ -53,7 +53,7 @@ class ArticleService MyCache($key, $data, 180); } else { // 处理数据、由于平台不一样url地址或者其他数据也会不一样 - $data = self::DataHandle($data); + $data = self::ArticleListHandle($data); } return $data; } @@ -76,7 +76,7 @@ class ArticleService $n = isset($params['n']) ? intval($params['n']) : 10; $data = Db::name('Article')->field($field)->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); - return DataReturn('处理成功', 0, self::DataHandle($data)); + return DataReturn('处理成功', 0, self::ArticleListHandle($data, $params)); } /** @@ -86,9 +86,10 @@ class ArticleService * @version 1.0.0 * @date 2021-11-09 * @desc description - * @param [array] $data [文章数据] + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] */ - public static function DataHandle($data) + public static function ArticleListHandle($data, $params = []) { if(!empty($data)) { @@ -600,14 +601,14 @@ class ArticleService ['is_enable', '=', 1], ['id', '<', $article_id], ]; - $last = self::DataHandle(Db::name('Article')->where($where)->field($field)->order('id desc')->limit(1)->select()->toArray()); + $last = self::ArticleListHandle(Db::name('Article')->where($where)->field($field)->order('id desc')->limit(1)->select()->toArray()); // 下一条数据 $where = [ ['is_enable', '=', 1], ['id', '>', $article_id], ]; - $next = self::DataHandle(Db::name('Article')->where($where)->field($field)->order('id asc')->limit(1)->select()->toArray()); + $next = self::ArticleListHandle(Db::name('Article')->where($where)->field($field)->order('id asc')->limit(1)->select()->toArray()); return [ 'last' => empty($last) ? null : $last[0], diff --git a/app/service/BrandService.php b/app/service/BrandService.php index 120f58ae6..eb583dcec 100755 --- a/app/service/BrandService.php +++ b/app/service/BrandService.php @@ -54,9 +54,7 @@ class BrandService // 获取列表 $data = Db::name('Brand')->where($where)->field($field)->order($order_by)->limit($m, $n)->select()->toArray(); - - // 数据处理 - return DataReturn('处理成功', 0, self::DataHandle($data, $params)); + return DataReturn('处理成功', 0, self::BrandListHandle($data, $params)); } /** @@ -69,7 +67,7 @@ class BrandService * @param [array] $data [列表数据] * @param [array] $params [输入参数] */ - public static function DataHandle($data, $params = []) + public static function BrandListHandle($data, $params = []) { if(!empty($data)) { diff --git a/app/service/CustomViewService.php b/app/service/CustomViewService.php index 4fc502e24..1ae1e90bf 100755 --- a/app/service/CustomViewService.php +++ b/app/service/CustomViewService.php @@ -40,6 +40,21 @@ class CustomViewService $n = isset($params['n']) ? intval($params['n']) : 10; $data = Db::name('CustomView')->field($field)->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); + return DataReturn('处理成功', 0, self::CustomViewListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function CustomViewListHandle($data, $params = []) + { if(!empty($data)) { $common_is_enable_list = MyConst('common_is_enable_list'); @@ -79,21 +94,7 @@ class CustomViewService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-29 - * @desc description - * @param [array] $where [条件] - */ - public static function CustomViewTotal($where = []) - { - return (int) Db::name('CustomView')->where($where)->count(); + return $data; } /** diff --git a/app/service/DesignService.php b/app/service/DesignService.php index 516bab536..c0c3c9da8 100644 --- a/app/service/DesignService.php +++ b/app/service/DesignService.php @@ -42,6 +42,21 @@ class DesignService // 获取数据 $data = Db::name('Design')->where($where)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::DesignListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function DesignListHandle($data, $params = []) + { if(!empty($data)) { foreach($data as &$v) @@ -63,21 +78,7 @@ class DesignService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2021-06-16 - * @desc description - * @param [array] $where [条件] - */ - public static function DesignTotal($where = []) - { - return (int) Db::name('Design')->where($where)->count(); + return $data; } /** diff --git a/app/service/GoodsBrowseService.php b/app/service/GoodsBrowseService.php index 0593213f0..55bd2cb8e 100644 --- a/app/service/GoodsBrowseService.php +++ b/app/service/GoodsBrowseService.php @@ -139,6 +139,21 @@ class GoodsBrowseService // 获取数据 $data = Db::name('GoodsBrowse')->alias('b')->join('goods g', 'g.id=b.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::GoodsBrowseListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function GoodsBrowseListHandle($data, $params = []) + { if(!empty($data)) { // 商品数据处理 @@ -161,7 +176,7 @@ class GoodsBrowseService } } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/GoodsCommentsService.php b/app/service/GoodsCommentsService.php index f77356db3..12afe52b3 100644 --- a/app/service/GoodsCommentsService.php +++ b/app/service/GoodsCommentsService.php @@ -202,7 +202,7 @@ class GoodsCommentsService // 获取数据列表 $data = Db::name('GoodsComments')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); - return DataReturn('处理成功', 0, self::DataHandle($data, $params)); + return DataReturn('处理成功', 0, self::GoodsCommentsListHandle($data, $params)); } /** @@ -215,7 +215,7 @@ class GoodsCommentsService * @param [array] $data [数据] * @param [array] $params [输入参数] */ - public static function DataHandle($data, $params = []) + public static function GoodsCommentsListHandle($data, $params = []) { if(!empty($data)) { @@ -668,7 +668,7 @@ class GoodsCommentsService ['is_show', '=', 1], ]; $field = 'id,user_id,order_id,business_type,content,reply,is_reply,rating,images,is_anonymous,reply_time,add_time'; - return self::DataHandle(Db::name('GoodsComments')->where($where)->field($field)->limit(0, $number)->order('id desc')->select()->toArray()); + return self::GoodsCommentsListHandle(Db::name('GoodsComments')->where($where)->field($field)->limit(0, $number)->order('id desc')->select()->toArray()); } } ?> \ No newline at end of file diff --git a/app/service/GoodsFavorService.php b/app/service/GoodsFavorService.php index 97fd7dd72..6cbc1c18c 100644 --- a/app/service/GoodsFavorService.php +++ b/app/service/GoodsFavorService.php @@ -202,6 +202,21 @@ class GoodsFavorService // 获取数据 $data = Db::name('GoodsFavor')->alias('f')->join('goods g', 'g.id=f.goods_id')->field($field)->where($where)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::GoodsFavorListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function GoodsFavorListHandle($data, $params = []) + { if(!empty($data)) { // 商品数据处理 @@ -224,7 +239,7 @@ class GoodsFavorService } } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/GoodsParamsService.php b/app/service/GoodsParamsService.php index aeaffbffb..c826eabce 100755 --- a/app/service/GoodsParamsService.php +++ b/app/service/GoodsParamsService.php @@ -41,6 +41,21 @@ class GoodsParamsService // 获取列表 $data = Db::name('GoodsParamsTemplate')->where($where)->order($order_by)->field($field)->limit($m, $n)->select()->toArray(); + return DataReturn('处理成功', 0, self::GoodsParamsTemplateListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function GoodsParamsTemplateListHandle($data, $params = []) + { if(!empty($data)) { // 获取配置数据 @@ -70,21 +85,7 @@ class GoodsParamsService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-12-18 - * @desc description - * @param [array] $params [输入参数] - */ - public static function GoodsParamsTemplateTotal($where) - { - return (int) Db::name('GoodsParamsTemplate')->where($where)->count(); + return $data; } /** diff --git a/app/service/IntegralService.php b/app/service/IntegralService.php index 1761892f3..47bdd492d 100755 --- a/app/service/IntegralService.php +++ b/app/service/IntegralService.php @@ -79,6 +79,21 @@ class IntegralService // 获取数据列表 $data = Db::name('UserIntegralLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::IntegralLogListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function IntegralLogListHandle($data, $params = []) + { if(!empty($data)) { $integral_log_type_list = MyConst('common_integral_log_type_list'); @@ -101,7 +116,7 @@ class IntegralService $v['add_time_date'] = date('Y-m-d', $v['add_time']); } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/LinkService.php b/app/service/LinkService.php index 108edc9ba..9eb28bf59 100755 --- a/app/service/LinkService.php +++ b/app/service/LinkService.php @@ -69,6 +69,21 @@ class LinkService $where = empty($params['where']) ? [] : $params['where']; $order_by = empty($params['order_by']) ? 'sort asc,id desc' : trim($params['order_by']); $data = Db::name('Link')->field($field)->where($where)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::LinkListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function LinkListHandle($data, $params = []) + { if(!empty($data)) { foreach($data as &$v) @@ -84,7 +99,7 @@ class LinkService } } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/MessageService.php b/app/service/MessageService.php index 3b2651936..94191a37b 100755 --- a/app/service/MessageService.php +++ b/app/service/MessageService.php @@ -191,6 +191,21 @@ class MessageService // 获取数据列表 $data = Db::name('Message')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('处理成功', 0, self::MessageListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function MessageListHandle($data, $params = []) + { if(!empty($data)) { // 字段列表 @@ -229,7 +244,7 @@ class MessageService $v['add_time_date'] = date('Y-m-d', $v['add_time']); } } - return DataReturn('处理成功', 0, $data); + return $data; } /** diff --git a/app/service/OrderAftersaleService.php b/app/service/OrderAftersaleService.php index 2eac604ad..17710d374 100644 --- a/app/service/OrderAftersaleService.php +++ b/app/service/OrderAftersaleService.php @@ -396,6 +396,21 @@ class OrderAftersaleService // 获取数据列表 $data = Db::name('OrderAftersale')->field($field)->where($where)->limit($m, $n)->order($order_by)->select()->toArray(); + return DataReturn('获取成功', 0, self::OrderAftersaleListHandle($data, $params)); + } + + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function OrderAftersaleListHandle($data, $params = []) + { if(!empty($data)) { $type_list = MyConst('common_order_aftersale_type_list'); @@ -468,7 +483,7 @@ class OrderAftersaleService } } - return DataReturn('获取成功', 0, $data); + return $data; } /** diff --git a/app/service/OrderService.php b/app/service/OrderService.php index a14d257b3..28162f7ce 100755 --- a/app/service/OrderService.php +++ b/app/service/OrderService.php @@ -1204,7 +1204,7 @@ class OrderService $data = Db::name('Order')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); // 数据处理 - return self::OrderDataHandle($data, $params); + return self::OrderListHandle($data, $params); } /** @@ -1217,7 +1217,7 @@ class OrderService * @param [array] $data [订单数据] * @param [array] $params [输入参数] */ - public static function OrderDataHandle($data, $params = []) + public static function OrderListHandle($data, $params = []) { $result = []; if(!empty($data)) @@ -1251,7 +1251,7 @@ class OrderService if(in_array('warehouse_id', $keys)) { $we_ids = array_unique(array_column($data, 'warehouse_id')); - $warehouse_list = WarehouseService::DataHandle(Db::name('Warehouse')->where(['id'=>$we_ids])->field('id,name')->select()->toArray()); + $warehouse_list = WarehouseService::WarehouseListHandle(Db::name('Warehouse')->where(['id'=>$we_ids])->field('id,name')->select()->toArray()); if(!empty($warehouse_list)) { $warehouse_list = array_column($warehouse_list, null, 'id'); diff --git a/app/service/OrderSplitService.php b/app/service/OrderSplitService.php index 14098dfb5..36f65ec34 100644 --- a/app/service/OrderSplitService.php +++ b/app/service/OrderSplitService.php @@ -300,7 +300,7 @@ class OrderSplitService if(!array_key_exists($w['id'], $result)) { // 仓库 - $warehouse_handle = WarehouseService::DataHandle([$w]); + $warehouse_handle = WarehouseService::WarehouseListHandle([$w]); $result[$w['id']] = $warehouse_handle[0]; $result[$w['id']]['goods_items'] = []; unset($result[$w['id']]['is_default'], $result[$w['id']]['level'], $result[$w['id']]['inventory']); @@ -334,7 +334,7 @@ class OrderSplitService if(!array_key_exists($warehouse_default['id'], $result)) { // 仓库 - $warehouse_handle = WarehouseService::DataHandle([$warehouse_default]); + $warehouse_handle = WarehouseService::WarehouseListHandle([$warehouse_default]); $result[$warehouse_default['id']] = $warehouse_handle[0]; $result[$warehouse_default['id']]['goods_items'] = []; } diff --git a/app/service/PayLogService.php b/app/service/PayLogService.php index e8f85e95c..9160fcd6e 100755 --- a/app/service/PayLogService.php +++ b/app/service/PayLogService.php @@ -181,26 +181,19 @@ class PayLogService $data = Db::name('PayLog')->field('payment as id, payment_name as name')->group('payment,payment_name')->select()->toArray(); return DataReturn('处理成功', 0, $data); } - + /** - * 列表 - * @author Devil + * 列表数据处理 + * @author Devil * @blog http://gong.gg/ * @version 1.0.0 - * @date 2018-09-29 + * @date 2022-08-01 * @desc description + * @param [array] $data [数据列表] * @param [array] $params [输入参数] */ - public static function PayLogList($params = []) + public static function PayLogListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取数据列表 - $data = Db::name('PayLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); if(!empty($data)) { // 字段列表 @@ -244,21 +237,7 @@ class PayLogService $v['close_time'] = empty($v['close_time']) ? '' : date('Y-m-d H:i:s', $v['close_time']); } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-29 - * @desc description - * @param [array] $where [条件] - */ - public static function PayLogTotal($where = []) - { - return (int) Db::name('PayLog')->where($where)->count(); + return $data; } /** diff --git a/app/service/PayRequestLogService.php b/app/service/PayRequestLogService.php index f23532435..9205dd2d0 100644 --- a/app/service/PayRequestLogService.php +++ b/app/service/PayRequestLogService.php @@ -101,24 +101,17 @@ class PayRequestLogService } /** - * 列表 - * @author Devil + * 列表数据处理 + * @author Devil * @blog http://gong.gg/ * @version 1.0.0 - * @date 2018-09-29 + * @date 2022-08-01 * @desc description + * @param [array] $data [数据列表] * @param [array] $params [输入参数] */ - public static function PayRequestLogList($params = []) + public static function PayRequestLogListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取数据列表 - $data = Db::name('PayRequestLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); if(!empty($data)) { // 循环处理数据 @@ -129,21 +122,7 @@ class PayRequestLogService $v['upd_time'] = empty($v['upd_time']) ? '' : date('Y-m-d H:i:s', $v['upd_time']); } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-29 - * @desc description - * @param [array] $where [条件] - */ - public static function PayRequestLogTotal($where = []) - { - return (int) Db::name('PayRequestLog')->where($where)->count(); + return $data; } } ?> \ No newline at end of file diff --git a/app/service/QuickNavService.php b/app/service/QuickNavService.php index f40becbcc..65d681f17 100755 --- a/app/service/QuickNavService.php +++ b/app/service/QuickNavService.php @@ -23,24 +23,19 @@ use app\service\ResourcesService; */ class QuickNavService { - /** - * 首页导航列表 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-06T21:31:53+0800 - * @param [array] $params [输入参数] - */ - public static function QuickNavList($params = []) - { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'sort asc,id asc' : trim($params['order_by']); - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - // 获取品牌列表 - $data = Db::name('QuickNav')->where($where)->order($order_by)->limit($m, $n)->select()->toArray(); + /** + * 列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-08-01 + * @desc description + * @param [array] $data [数据列表] + * @param [array] $params [输入参数] + */ + public static function QuickNavListHandle($data, $params = []) + { if(!empty($data)) { $common_platform_type = MyConst('common_platform_type'); @@ -76,20 +71,7 @@ class QuickNavService } } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 首页导航总数 - * @author Devil - * @blog http://gong.gg/ - * @version 0.0.1 - * @datetime 2016-12-10T22:16:29+0800 - * @param [array] $where [条件] - */ - public static function QuickNavTotal($where) - { - return (int) Db::name('QuickNav')->where($where)->count(); + return $data; } /** diff --git a/app/service/RefundLogService.php b/app/service/RefundLogService.php index 56da85b7e..c222b79ac 100644 --- a/app/service/RefundLogService.php +++ b/app/service/RefundLogService.php @@ -76,26 +76,19 @@ class RefundLogService $data = Db::name('RefundLog')->field('payment as id, payment_name as name')->group('payment,payment_name')->select()->toArray(); return DataReturn('处理成功', 0, $data); } - + /** - * 列表 - * @author Devil + * 列表数据处理 + * @author Devil * @blog http://gong.gg/ * @version 1.0.0 - * @date 2018-09-29 + * @date 2022-08-01 * @desc description + * @param [array] $data [数据列表] * @param [array] $params [输入参数] */ - public static function RefundLogList($params = []) + public static function RefundLogListHandle($data, $params = []) { - $where = empty($params['where']) ? [] : $params['where']; - $field = empty($params['field']) ? '*' : $params['field']; - $order_by = empty($params['order_by']) ? 'id desc' : $params['order_by']; - $m = isset($params['m']) ? intval($params['m']) : 0; - $n = isset($params['n']) ? intval($params['n']) : 10; - - // 获取数据列表 - $data = Db::name('RefundLog')->where($where)->field($field)->limit($m, $n)->order($order_by)->select()->toArray(); if(!empty($data)) { $refundment_list = MyConst('common_order_aftersale_refundment_list'); @@ -118,21 +111,7 @@ class RefundLogService $v['add_time_date'] = date('Y-m-d', $v['add_time']); } } - return DataReturn('处理成功', 0, $data); - } - - /** - * 总数 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-09-29 - * @desc description - * @param [array] $where [条件] - */ - public static function RefundLogTotal($where = []) - { - return (int) Db::name('RefundLog')->where($where)->count(); + return $data; } } ?> \ No newline at end of file diff --git a/app/service/ResourcesService.php b/app/service/ResourcesService.php index 25158dcc5..196eb16f1 100755 --- a/app/service/ResourcesService.php +++ b/app/service/ResourcesService.php @@ -584,7 +584,7 @@ class ResourcesService '', '

'https://api.paypal.com/', + 1 => 'https://www.sandbox.paypal.com/', + ]; + + // 订单信息存储缓存key + private $pay_data_cache_key = 'payment_paypal_pay_data_'; + + // 返回地址存储缓存key + private $respond_url_cache_key = 'payment_paypal_respond_url_cache_key_'; + + /** + * 构造方法 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2021-02-07 + * @desc description + * @param [array] $params [输入参数(支付配置参数)] + */ + public function __construct($params = []) + { + $this->config = $params; + } + + /** + * 配置信息 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + */ + public function Config() + { + // 基础信息 + $base = [ + 'name' => 'PayPal', // 插件名称 + 'version' => '1.0.0', // 插件版本 + 'apply_version' => '不限', // 适用系统版本描述 + 'apply_terminal'=> ['pc', 'h5', 'ios', 'android'], // 适用终端 默认全部 ['pc', 'h5', 'ios', 'android', 'alipay', 'weixin', 'baidu', 'toutiao'] + 'desc' => '适配PC+H5+APP、国际主流支付方式,即时到帐支付方式,买家的交易资金直接打入卖家账户,快速回笼交易资金。 立即申请', // 插件描述(支持html) + 'author' => 'Devil', // 开发者 + 'author_url' => 'http://shopxo.net/', // 开发者主页 + ]; + + // 配置信息 + $element = [ + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'client_id', + 'placeholder' => 'ClientID', + 'title' => 'ClientID', + 'is_required' => 0, + 'message' => '请填写ClientID', + ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'client_secret', + 'placeholder' => 'ClientSecret', + 'title' => 'ClientSecret', + 'is_required' => 0, + 'message' => '请填写ClientSecret', + ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'webhook_id', + 'placeholder' => '订单WebhookID', + 'title' => '订单WebhookID', + 'is_required' => 0, + 'message' => '请填写订单WebhookID、配置异步通知地址后得到的id', + ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'wallet_webhook_id', + 'placeholder' => '钱包充值WebhookID', + 'title' => '钱包充值WebhookID', + 'is_required' => 0, + 'message' => '请填写钱包充值WebhookID、配置异步通知地址后得到的id', + ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'membershiplevelvip_webhook_id', + 'placeholder' => '会员购买WebhookID', + 'title' => '会员购买WebhookID', + 'is_required' => 0, + 'message' => '请填写会员购买WebhookID、配置异步通知地址后得到的id', + ], + [ + 'element' => 'input', + 'type' => 'text', + 'default' => '', + 'name' => 'app_agreement', + 'placeholder' => 'APP协议头、例如:shopxochuyin://', + 'title' => 'APP协议头(APP支付才需要配置)', + 'is_required' => 0, + 'message' => '请填写APP协议头', + ], + [ + 'element' => 'select', + 'title' => '货币', + 'message' => '请选择货币', + 'name' => 'currency_code', + 'is_multiple' => 0, + 'element_data' => [ + ['value'=>'CNY', 'name'=>'Chinese Renmenbi'], + ['value'=>'USD', 'name'=>'U.S. Dollar'], + ['value'=>'AUD', 'name'=>'Australian Dollar'], + ['value'=>'BRL', 'name'=>'Brazilian Real'], + ['value'=>'CAD', 'name'=>'Canadian Dollar'], + ['value'=>'CZK', 'name'=>'Czech Koruna'], + ['value'=>'DKK', 'name'=>'Danish Krone'], + ['value'=>'EUR', 'name'=>'Euro'], + ['value'=>'HKD', 'name'=>'Hong Kong Dollar'], + ['value'=>'HUF', 'name'=>'Hungarian Forint'], + ['value'=>'ILS', 'name'=>'Israeli New Sheqel'], + ['value'=>'JPY', 'name'=>'Japanese Yen'], + ['value'=>'MYR', 'name'=>'Malaysian Ringgit'], + ['value'=>'MXN', 'name'=>'Mexican Peso'], + ['value'=>'NOK', 'name'=>'Norwegian Krone'], + ['value'=>'NZD', 'name'=>'New Zealand Dollar'], + ['value'=>'PHP', 'name'=>'Philippine Peso'], + ['value'=>'PLN', 'name'=>'Polish Zloty'], + ['value'=>'GBP', 'name'=>'Pound Sterling'], + ['value'=>'RUB', 'name'=>'Russian Ruble'], + ['value'=>'SGD', 'name'=>'Singapore Dollar'], + ['value'=>'SEK', 'name'=>'Swedish Krona'], + ['value'=>'CHF', 'name'=>'Swiss Franc'], + ['value'=>'TWD', 'name'=>'Taiwan New Dollar'], + ['value'=>'THB', 'name'=>'Thai Baht'], + ], + ], + [ + 'element' => 'select', + 'title' => '是否沙盒环境', + 'message' => '请选择是否沙盒环境', + 'name' => 'is_dev_env', + 'is_multiple' => 0, + 'element_data' => [ + ['value'=>0, 'name'=>'否'], + ['value'=>1, 'name'=>'是'], + ], + ], + [ + 'element' => 'message', + 'message' => '1. 订单异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_order_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

2. 钱包充值异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_wallet_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

3. 会员等级购买异步通知地址,将该地址配置到支付后台异步通知
'.__MY_URL__.'payment_default_membershiplevelvip_'.strtolower(str_replace(['payment', '\\'], '', get_class($this))).'_notify.php

异步通知类型勾选【Payment capture completed】即可', + ], + ]; + + return [ + 'base' => $base, + 'element' => $element, + ]; + } + + /** + * 支付入口 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + * @param [array] $params [输入参数] + */ + public function Pay($params = []) + { + // 参数 + if(empty($params)) + { + return DataReturn('参数不能为空', -1); + } + + // 配置信息 + if(empty($this->config) || empty($this->config['client_id']) || empty($this->config['client_secret'])) + { + return DataReturn('支付缺少配置', -1); + } + + // token + $token = $this->HttpRequest('v1/oauth2/token', 'grant_type=client_credentials'); + if($token['code'] != 0) + { + return $token; + } + // 设置请求token + $this->access_token = $token['data']['access_token']; + + // 创建订单 + $parameter = [ + 'intent' => 'CAPTURE', + 'purchase_units' => [ + [ + 'amount' => [ + 'currency_code' => $this->config['currency_code'], + 'value' => PriceNumberFormat($params['total_price']), + ], + 'description' => $params['name'], + 'custom_id' => $params['order_no'], + ], + ], + 'application_context'=> [ + 'cancel_url' => $params['call_back_url'], + 'return_url' => $params['call_back_url'], + ], + ]; + $result = $this->HttpRequest('v2/checkout/orders', $parameter); + if($result['code'] != 0) + { + return $result; + } + + // 是否存在返回地址 + if(!empty($params['params']) && !empty($params['params']['respond_url'])) + { + MyCache($this->respond_url_cache_key.$params['order_no'], base64_decode(urldecode($params['params']['respond_url'])), 3600); + } + + // 订单信息存储缓存 + $key = $this->pay_data_cache_key.$result['data']['id']; + MyCache($key, [ + 'params' => $params, + 'token' => $token['data'], + 'respond' => $result['data'], + 'client_type' => APPLICATION_CLIENT_TYPE, + ], 3600); + + // 直接返回支付url地址 + return DataReturn('success', 0, $result['data']['links'][1]['href']); + } + + /** + * 同步回调处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + * @param [array] $params [输入参数] + */ + public function Respond($params = []) + { + // 回调处理 + $ret = $this->RespondHandle($params); + + // 是否APP + if(isset($ret['data']['pay_data']['client_type']) && in_array($ret['data']['pay_data']['client_type'], ['ios', 'android'])) + { + die(' + + + PayPal安全支付 + + + +

'.$ret['msg'].'

+
点击回到APP
+ + + '); + } + + // 成功 + if($ret['code'] == 0) + { + // 是否自定义返回地址 + $respond_url = MyCache($this->respond_url_cache_key.$ret['data']['out_trade_no']); + if(!empty($respond_url)) + { + MyCache($this->respond_url_cache_key.$ret['data']['out_trade_no'], null); + MyRedirect($respond_url, true); + } + } + + // 移除多余的数据 + if(!empty($ret['data']) && is_array($ret['data']) && isset($ret['data']['pay_data'])) + { + unset($ret['data']['pay_data']); + } + return $ret; + } + + /** + * 回调数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-07-16 + * @desc description + * @param [array] $params [输入参数] + */ + public function RespondHandle($params = []) + { + // 回调token + if(empty($params['token'])) + { + return DataReturn('回调token为空', -1); + } + $pay_data = MyCache($this->pay_data_cache_key.$params['token']); + if(empty($pay_data)) + { + return DataReturn('支付数据失效、请重新发起支付', -1); + } + MyCache($this->pay_data_cache_key.$params['token'], null); + + // 设置请求token + $this->access_token = $pay_data['token']['access_token']; + + // 捕获订单 + $result = $this->HttpRequest($pay_data['respond']['links'][3]['href'], ''); + if($result['code'] != 0) + { + return $result; + } + + // 返回数据固定基础参数 + $data = $result['data']; + $captures = $data['purchase_units'][0]['payments']['captures'][0]; + $gross_amount = $captures['seller_receivable_breakdown']['gross_amount']; + $data['trade_no'] = $captures['id']; // 支付平台 - 订单号 + $data['buyer_user'] = $data['payer']['email_address']; // 支付平台 - 用户 + $data['out_trade_no'] = $captures['custom_id']; // 本系统发起支付的 - 订单号 + $data['subject'] = $data['id']; // 本系统发起支付的 - 商品名称 + $data['pay_price'] = $gross_amount['value']; // 本系统发起支付的 - 总价 + + // 当前支付插件需要返回的数据 + $data['pay_data'] = $pay_data; + + // 默认返回固定格式 + return DataReturn('支付成功', 0, $data); + } + + /** + * 异步回调处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-09-19 + * @desc description + * @param [array] $params [输入参数] + */ + public function Notify($params = []) + { + if(empty($params['event_type'])) + { + return DataReturn('事件类型为空', -1); + } + if(!in_array($params['event_type'], ['PAYMENT.CAPTURE.COMPLETED'])) + { + return DataReturn('其他事件('.$params['event_type'].':'.$params['summary'].')', -1); + } + + // 判断webhookid、默认订单 + $pluginsname = MyInput('pluginsname'); + $arr = ['wallet'=>'wallet_webhook_id', 'membershiplevelvip'=>'membershiplevelvip_webhook_id']; + $webhook_field = empty($arr[$pluginsname]) ? 'webhook_id' : $arr[$pluginsname]; + + // 签名验证 + if(empty($this->config[$webhook_field])) + { + return DataReturn('未配置webhookid', -1); + } + $crc32 = crc32(file_get_contents('php://input')); + if (empty($_SERVER['HTTP_PAYPAL_TRANSMISSION_ID']) || empty($_SERVER['HTTP_PAYPAL_TRANSMISSION_TIME']) || empty($crc32)) + { + return DataReturn('签名数据为空', -1); + } + $sign_string = $_SERVER['HTTP_PAYPAL_TRANSMISSION_ID'].'|'.$_SERVER['HTTP_PAYPAL_TRANSMISSION_TIME'].'|'.$this->config[$webhook_field].'|'.$crc32; + + // 通过PAYPAL-CERT-URL头信息去拿公钥 + $public_key = openssl_pkey_get_public($this->HttpCurlCert($_SERVER['HTTP_PAYPAL_CERT_URL'])); + $details = openssl_pkey_get_details($public_key); + $verify = openssl_verify($sign_string, base64_decode($_SERVER['HTTP_PAYPAL_TRANSMISSION_SIG']), $details['key'], 'SHA256'); + if($verify != 1) + { + return DataReturn('签名验证失败', -1); + } + + // 返回数据固定基础参数 + $resource = $params['resource']; + $params['trade_no'] = $resource['id']; // 支付平台 - 订单号 + $params['buyer_user'] = $params['id']; // 支付平台 - 用户 + $params['out_trade_no'] = $resource['custom_id']; // 本系统发起支付的 - 订单号 + $params['subject'] = $params['summary']; // 本系统发起支付的 - 商品名称 + $params['pay_price'] = $resource['amount']['value']; // 本系统发起支付的 - 总价 + return DataReturn('支付成功', 0, $params); + } + + /** + * 退款处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-05-28 + * @desc description + * @param [array] $params [输入参数] + */ + public function Refund($params = []) + { + // 参数 + $p = [ + [ + 'checked_type' => 'empty', + 'key_name' => 'order_no', + 'error_msg' => '订单号不能为空', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'trade_no', + 'error_msg' => '交易平台订单号不能为空', + ], + [ + 'checked_type' => 'empty', + 'key_name' => 'refund_price', + 'error_msg' => '退款金额不能为空', + ], + ]; + $ret = ParamsChecked($params, $p); + if($ret !== true) + { + return DataReturn($ret, -1); + } + + // token + $token = $this->HttpRequest('v1/oauth2/token', 'grant_type=client_credentials'); + if($token['code'] != 0) + { + return $token; + } + // 设置请求token + $this->access_token = $token['data']['access_token']; + + // 退款原因 + $refund_reason = empty($params['refund_reason']) ? $params['order_no'].'订单退款'.$params['refund_price'].'元' : $params['refund_reason']; + + // 退款操作 + $parameter = [ + 'amount' => [ + 'currency' => $this->config['currency_code'], + 'total' => $params['refund_price'], + ], + 'description' => $refund_reason, + ]; + $result = $this->HttpRequest('v1/payments/sale/'.$params['trade_no'].'/refund', $parameter); + if($result['code'] != 0) + { + // 是否已完成退款 + if($result['data'] == 'TRANSACTION_ALREADY_REFUNDED') + { + // 统一返回格式 + $data = [ + 'out_trade_no' => $params['order_no'], + 'trade_no' => '', + 'buyer_user' => '', + 'refund_price' => $params['refund_price'], + 'return_params' => $result['data'], + ]; + return DataReturn('退款成功', 0, $data); + } + + return $result; + } + if(isset($result['data']['state']) && $result['data']['state'] == 'completed') + { + // 统一返回格式 + $data = [ + 'out_trade_no' => $params['order_no'], + 'trade_no' => $result['data']['id'], + 'buyer_user' => $result['data']['sale_id'], + 'refund_price' => $result['data']['total_refunded_amount']['value'], + 'return_params' => $result['data'], + ]; + return DataReturn('退款成功', 0, $data); + } + } + + /** + * 证书下载 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-07-13 + * @desc description + * @param [string] $url [url地址] + */ + public static function HttpCurlCert($url) + { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $output = curl_exec($ch); + curl_close($ch); + return $output; + } + + /** + * 网络请求 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2017-09-25T09:10:46+0800 + * @param [string] $query [请求参数] + * @param [array|string] $data [发送数据] + * @param [int] $second [超时] + * @return [mixed] [请求返回数据] + */ + private function HttpRequest($query, $data, $second = 30) + { + // 是否完整的url地址 + if(in_array(substr($query, 0, 6), ['https:', 'http:/'])) + { + $url = $query; + } else { + // 是否测试环境 + $is_dev_env = isset($this->config['is_dev_env']) ? $this->config['is_dev_env'] : 0; + $url = $this->url[$is_dev_env].$query; + } + + // 头信息 + $header = [ + 'Accept: application/json', + 'Content-Type: application/json', + ]; + // 是否存在access_token + if(!empty($this->access_token)) + { + $header[] = 'Authorization: Bearer '.$this->access_token; + } + // 数据为数组则转json + $data = is_array($data) ? json_encode($data) : $data; + + // 初始化curl + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_HTTPHEADER, $header); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); + curl_setopt($ch, CURLOPT_TIMEOUT, $second); + // 获取token + if($data == 'grant_type=client_credentials') + { + curl_setopt($ch, CURLOPT_USERPWD, $this->config['client_id'].':'.$this->config['client_secret']); + } + $result = curl_exec($ch); + + //返回结果 + if($result) + { + curl_close($ch); + $result = json_decode($result, true); + if(empty($result)) + { + return DataReturn('返回数据有误:'.$result, -1); + } + if(!empty($result['error_description'])) + { + return DataReturn('返回失败:'.$result['error_description'].'('.$result['error'].')', -1, $result['error']); + } + if(!empty($result['message'])) + { + return DataReturn('异常错误:'.$result['message'].'('.$result['name'].')', -1, $result['name']); + } + return DataReturn('success', 0, $result); + } else { + $error = curl_errno($ch); + curl_close($ch); + return DataReturn('curl出错,错误码:'.$error, -1); + } + } +} +?> \ No newline at end of file