diff --git a/application/api/config/app.php b/application/api/config/app.php new file mode 100644 index 000000000..adc6d3ccd --- /dev/null +++ b/application/api/config/app.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/application/api/controller/Banner.php b/application/api/controller/Banner.php new file mode 100644 index 000000000..8b37744b4 --- /dev/null +++ b/application/api/controller/Banner.php @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/application/api/controller/Common.php b/application/api/controller/Common.php new file mode 100755 index 000000000..cb2bf7d77 --- /dev/null +++ b/application/api/controller/Common.php @@ -0,0 +1,138 @@ +SystemInit(); + + // 网站状态 + $this->SiteStstusCheck(); + + // 公共数据初始化 + $this->CommonInit(); + + // 输入参数 + $this->data_post = input('post.'); + $this->data_get = input('get.'); + $this->data_request = input(); + } + + /** + * 系统初始化 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-12-07 + * @desc description + */ + private function SystemInit() + { + // 配置信息初始化 + ConfigService::ConfigInit(); + + // url模式,后端采用兼容模式 + \think\facade\Url::root(__MY_ROOT__.'index.php?s='); + } + + /** + * [SiteStstusCheck 网站状态] + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2018-04-18T16:20:58+0800 + */ + private function SiteStstusCheck() + { + if(MyC('home_site_state') != 1) + { + die(json_encode(DataReturn(MyC('home_site_close_reason', '网站维护中...'), -10000))); + } + } + + /** + * [Is_Login 登录校验] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-03-09T11:43:48+0800 + */ + protected function Is_Login() + { + if(empty($this->user)) + { + exit(json_encode(DataReturn('登录失效,请重新登录', -400))); + } + } + + /** + * [CommonInit 公共数据初始化] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-03-09T11:43:48+0800 + */ + private function CommonInit() + { + // 用户数据 + if(!empty($this->data_request['user_id'])) + { + $this->user = UserService::UserLoginRecord($this->data_request['user_id']); + } + } + + /** + * [_empty 空方法操作] + * @author Devil + * @blog http://gong.gg/ + * @version 0.0.1 + * @datetime 2017-02-25T15:47:50+0800 + * @param [string] $name [方法名称] + */ + protected function _empty($name) + { + exit(json_encode(DataReturn($name.' 非法访问', -1000))); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php new file mode 100755 index 000000000..342195e9c --- /dev/null +++ b/application/api/controller/Index.php @@ -0,0 +1,48 @@ + GoodsService::HomeFloorList(), + 'common_shop_notice' => MyC('common_shop_notice', null, true), + 'common_app_is_enable_search' => (int) MyC('common_app_is_enable_search', 1), + 'common_app_is_enable_answer' => (int) MyC('common_app_is_enable_answer', 1), + ]; + + // 返回数据 + return json(DataReturn('success', 0, $result)); + } +} +?> \ No newline at end of file diff --git a/application/api/controller/Navigation.php b/application/api/controller/Navigation.php new file mode 100644 index 000000000..c70386346 --- /dev/null +++ b/application/api/controller/Navigation.php @@ -0,0 +1,44 @@ + \ No newline at end of file diff --git a/application/api/controller/index.html b/application/api/controller/index.html new file mode 100755 index 000000000..0519ecba6 --- /dev/null +++ b/application/api/controller/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/application/api/index.html b/application/api/index.html new file mode 100755 index 000000000..0519ecba6 --- /dev/null +++ b/application/api/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 9ce4e6358..a9e75dde5 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -44,7 +44,7 @@ class Common extends Controller $this->SystemInit(); // 站点状态校验 - $this->SiteStateCheck(); + $this->SiteStstusCheck(); // 公共数据初始化 $this->CommonInit(); @@ -106,7 +106,7 @@ class Common extends Controller private function CommonInit() { // 用户数据 - if(!empty(session('user'))) + if(session('user') != null) { $this->user = session('user'); } @@ -259,15 +259,15 @@ class Common extends Controller } /** - * [SiteStateCheck 站点状态校验] + * [SiteStstusCheck 站点状态校验] * @author Devil * @blog http://gong.gg/ * @version 0.0.1 * @datetime 2017-02-25T21:43:07+0800 */ - private function SiteStateCheck() + private function SiteStstusCheck() { - if(MyC('home_site_state') == 0) + if(MyC('home_site_state') != 1) { // 是否ajax请求 if(IS_AJAX) diff --git a/application/service/AppNavService.php b/application/service/AppNavService.php index 7f9e795ab..57d9210f4 100755 --- a/application/service/AppNavService.php +++ b/application/service/AppNavService.php @@ -304,5 +304,30 @@ class AppNavService } return DataReturn('编辑失败或数据未改变', -100); } + + /** + * APP获取首页导航 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2018-11-19 + * @desc description + * @param array $params [description] + */ + public static function AppHomeNav($params = []) + { + $data = Db::name('AppHomeNav')->field('id,name,images_url,event_value,event_type,bg_color')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select(); + if(!empty($data)) + { + $images_host = config('images_host'); + foreach($data as &$v) + { + $v['images_url_old'] = $v['images_url']; + $v['images_url'] = $images_host.$v['images_url']; + $v['event_value'] = empty($v['event_value']) ? null : $v['event_value']; + } + } + return $data; + } } ?> \ No newline at end of file diff --git a/application/service/ResourcesService.php b/application/service/ResourcesService.php index 96244bb0e..57d8899b8 100755 --- a/application/service/ResourcesService.php +++ b/application/service/ResourcesService.php @@ -75,31 +75,5 @@ class ResourcesService return DataReturn('success', 0, $result); } - - /** - * APP获取首页导航 - * @author Devil - * @blog http://gong.gg/ - * @version 1.0.0 - * @date 2018-11-19 - * @desc description - * @param array $params [description] - */ - public static function AppHomeNav($params = []) - { - $data = Db::name('AppHomeNav')->field('id,name,images_url,event_value,event_type,bg_color')->where(['platform'=>APPLICATION_CLIENT_TYPE, 'is_enable'=>1])->order('sort asc')->select(); - if(!empty($data)) - { - $images_host = config('images_host'); - foreach($data as &$v) - { - $v['images_url_old'] = $v['images_url']; - $v['images_url'] = $images_host.$v['images_url']; - $v['event_value'] = empty($v['event_value']) ? null : $v['event_value']; - } - } - return $data; - } - } ?> \ No newline at end of file diff --git a/public/appmini/old/alipay/app.js b/public/appmini/old/alipay/app.js index 6ca42220b..c8d3da263 100755 --- a/public/appmini/old/alipay/app.js +++ b/public/appmini/old/alipay/app.js @@ -49,9 +49,9 @@ App({ }, // 请求地址 - request_url: "{{request_url}}", + //request_url: "{{request_url}}", //request_url: "https://demo.shopxo.net/", - //request_url: 'http://localhost/project/shopxo/', + request_url: 'http://tp5-dev.com/index.php?s=', // 基础信息 application_title: "{{application_title}}", @@ -154,9 +154,9 @@ App({ * 请求地址生成 */ get_request_url(a, c, m, params) { - a = a || "Index"; - c = c || "Index"; - m = m || "Api"; + a = a || "index"; + c = c || "index"; + m = m || "api"; params = params || ""; if (params != "" && params.substr(0, 1) != "&") { params = "&" + params; @@ -167,12 +167,7 @@ App({ var nickname = user == false ? "" : user.nickname; return ( this.data.request_url + - "api.php?m=" + - m + - "&c=" + - c + - "&a=" + - a + + "/" + m + "/" + c + "/" + a + "&application_client=default&&application=app&application_client_type=alipay&application_user_id=" + app_client_user_id + "&user_id=" + diff --git a/public/appmini/old/alipay/components/home-banner/home-banner.js b/public/appmini/old/alipay/components/home-banner/home-banner.js index ae7707d40..d585db9f8 100755 --- a/public/appmini/old/alipay/components/home-banner/home-banner.js +++ b/public/appmini/old/alipay/components/home-banner/home-banner.js @@ -27,7 +27,7 @@ Component({ // 加载loding my.httpRequest({ - url: app.get_request_url("HomeBanner", "Resources"), + url: app.get_request_url("index", "banner"), method: "POST", data: {}, dataType: "json", diff --git a/public/appmini/old/alipay/components/home-nav/home-nav.js b/public/appmini/old/alipay/components/home-nav/home-nav.js index f28f2ca8a..7f4e195c5 100755 --- a/public/appmini/old/alipay/components/home-nav/home-nav.js +++ b/public/appmini/old/alipay/components/home-nav/home-nav.js @@ -21,7 +21,7 @@ Component({ // 加载loding my.httpRequest({ - url: app.get_request_url("HomeNav", "Resources"), + url: app.get_request_url("index", "navigation"), method: "POST", data: {}, dataType: "json", diff --git a/public/appmini/old/alipay/pages/index/index.js b/public/appmini/old/alipay/pages/index/index.js index e3e555ce2..5d09e4486 100755 --- a/public/appmini/old/alipay/pages/index/index.js +++ b/public/appmini/old/alipay/pages/index/index.js @@ -30,7 +30,7 @@ Page({ // 加载loding my.httpRequest({ - url: app.get_request_url("Index", "Index"), + url: app.get_request_url("index", "index"), method: "POST", data: {}, dataType: "json", diff --git a/public/core.php b/public/core.php index 083ebb526..47f5664f3 100755 --- a/public/core.php +++ b/public/core.php @@ -77,6 +77,6 @@ define('APPLICATION_CLIENT', empty($_REQUEST['application_client']) ? 'default' define('APPLICATION_CLIENT_TYPE', empty($_REQUEST['application_client_type']) ? 'pc' : trim($_REQUEST['application_client_type'])); // 是否ajax -define('IS_AJAX', (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'xmlhttprequest' == strtolower($_SERVER['HTTP_X_REQUESTED_WITH']))); +define('IS_AJAX', ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'xmlhttprequest' == strtolower($_SERVER['HTTP_X_REQUESTED_WITH'])) || isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 'ajax')); ?> \ No newline at end of file