mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-07-07 06:15:29 +08:00
支付宝小程序
This commit is contained in:
44
application/api/controller/Banner.php
Normal file
44
application/api/controller/Banner.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\service\BannerService;
|
||||
|
||||
/**
|
||||
* 轮播
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class Banner extends Common
|
||||
{
|
||||
/**
|
||||
* [_initialize 前置操作-继承公共前置方法]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 入口]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-05-25T11:03:59+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 获取轮播
|
||||
$data = BannerService::Banner();
|
||||
|
||||
// 返回数据
|
||||
return json(DataReturn('success', 0, $data));
|
||||
}
|
||||
}
|
||||
?>
|
||||
138
application/api/controller/Common.php
Executable file
138
application/api/controller/Common.php
Executable file
@ -0,0 +1,138 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
use app\service\ConfigService;
|
||||
use app\service\UserService;
|
||||
|
||||
/**
|
||||
* 接口公共控制器
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class Common extends Controller
|
||||
{
|
||||
// 用户信息
|
||||
protected $user;
|
||||
|
||||
// 输入参数 post
|
||||
protected $data_post;
|
||||
|
||||
// 输入参数 get
|
||||
protected $data_get;
|
||||
|
||||
// 输入参数 request
|
||||
protected $data_request;
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-11-30
|
||||
* @desc description
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// 是否ajax请求
|
||||
if(!IS_AJAX)
|
||||
{
|
||||
exit(json_encode(DataReturn('非法访问', -500)));
|
||||
}
|
||||
|
||||
// 系统初始化
|
||||
$this->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)));
|
||||
}
|
||||
}
|
||||
?>
|
||||
48
application/api/controller/Index.php
Executable file
48
application/api/controller/Index.php
Executable file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\service\GoodsService;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class Index extends Common
|
||||
{
|
||||
/**
|
||||
* [_initialize 前置操作-继承公共前置方法]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 入口]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-05-25T11:03:59+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
$result = [
|
||||
'data_list' => 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));
|
||||
}
|
||||
}
|
||||
?>
|
||||
44
application/api/controller/Navigation.php
Normal file
44
application/api/controller/Navigation.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\service\AppNavService;
|
||||
|
||||
/**
|
||||
* 导航
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class Navigation extends Common
|
||||
{
|
||||
/**
|
||||
* [_initialize 前置操作-继承公共前置方法]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-03T12:39:08+0800
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// 调用父类前置方法
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* [Index 入口]
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @datetime 2018-05-25T11:03:59+0800
|
||||
*/
|
||||
public function Index()
|
||||
{
|
||||
// 获取轮播
|
||||
$data = AppNavService::AppHomeNav();
|
||||
|
||||
// 返回数据
|
||||
return json(DataReturn('success', 0, $data));
|
||||
}
|
||||
}
|
||||
?>
|
||||
1
application/api/controller/index.html
Executable file
1
application/api/controller/index.html
Executable file
@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user