提交 827d57fc 编写于 作者: D devil_gong

去除多余中间件

上级 ed3f9c7a
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\http\middleware;
/**
* 访问环境检查
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class AccessInAppCheck
{
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-01-16
* @desc description
* @param [object] $request [请求对象]
* @param \Closure $next [闭包]
* @return [object] [请求对象]
*/
public function handle($request, \Closure $next)
{
// 是否微信
if(preg_match('~micromessenger~i', $request->header('user-agent')))
{
$request->in_app = 'weixin';
// 是否支付宝
} else if (preg_match('~alipay~i', $request->header('user-agent')))
{
$request->in_app = 'alipay';
// 默认app
} else {
$request->in_app = 'app';
}
return $next($request);
}
}
?>
\ No newline at end of file
......@@ -13,8 +13,5 @@
return [
// 系统环境检查
app\http\middleware\SystemEnvCheck::class,
// 访问环境检查
app\http\middleware\AccessInAppCheck::class,
];
?>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册