[更新]修改微信商城菜单配置

This commit is contained in:
Anyon 2018-05-05 18:35:21 +08:00
parent 5ffe086ec1
commit 27cdcf7d05
2 changed files with 11 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class Index
{ {
public function index() public function index()
{ {
return 'fasdfas'; return '微信商城---开发中...';
} }
public function pay() public function pay()

View File

@ -17,16 +17,18 @@ use think\facade\Route;
use think\Request; use think\Request;
/* 注册微信端路由支持 */ /* 注册微信端路由支持 */
Route::rule('wx-<controller>-<action>', function (Request $request, $controller, $action) { Route::rule('wx', function (Request $request) {
$params = explode('-', $request->pathinfo()); $params = explode('-', $request->path());
[array_shift($params), array_shift($params), array_shift($params)]; array_shift($params);
$controller = array_shift($params) ?: config('app.default_controller');
$action = array_shift($params) ?: config('app.default_action');
return App::action("store/wechat.{$controller}/{$action}", $params); return App::action("store/wechat.{$controller}/{$action}", $params);
}); });
// 微信菜单链接配置 // 微信菜单链接配置
$GLOBALS['WechatMenuLink'][] = [ $GLOBALS['WechatMenuLink'][] = ['link' => 'wx', 'title' => '微信JSAPI支付测试'];
'link' => 'wx-demo-jsapi', $GLOBALS['WechatMenuLink'][] = ['link' => 'wx-demo-jsapi', 'title' => '微信JSAPI支付测试'];
'title' => '微信JSAPI支付测试',
];
// @todo 模块处理机制将写在下面(包括模块初始化及升级) // @todo 模块处理机制将写在下面(包括模块初始化及升级)
// @todo 模块权限处理,使用全局数组
// @todo 模板菜单处理,默认放到全局数组中,然后在菜单中可以快速编辑(还要考虑下)