Commit bfe7df66 authored by zhuwei's avatar zhuwei

bug

parent 4251286d
......@@ -20,12 +20,21 @@ class WxCallbackUntils
public function __construct()
{
// $this->appId = "wxbbeb8cd2f4b72aea";
// $this->appSecret = "9ac6d1680553f4b554f3b46d263fbfb3";
if (strpos($this->http_host(), 'api') !== false) {
$this->appId = "wxbbeb8cd2f4b72aea";
$this->appSecret = "9ac6d1680553f4b554f3b46d263fbfb3";
} else {
$this->appId = "wxd30d74d1126d3278";//测试
$this->appSecret = "f29c8c502549020d2193a464be9632dc";//测试
}
}
public function http_host()
{
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
$host=$http_type.$_SERVER['HTTP_HOST'];
return $host;
}
/**
* 跳授权页
......
......@@ -29,7 +29,10 @@ class ShareShop extends Basic
public function shareShop()
{
$browser_type = $this->isWeiChatBrowser();
$params = $this->params;
if($browser_type == 1){
dump('微信浏览器');
$code = empty($_GET['code']) ? null : $_GET['code'];
if (!$code) {
$this->_wxApi->getWxCodesnSapiBase($this->url);
......@@ -37,9 +40,13 @@ class ShareShop extends Basic
$open_id = $this->_wxApi->getUserOpenId($code);
$user_service = new UserService();
$is_user = $user_service->isUserByweiXin($open_id);
}
}else{
dump('普通浏览器');
$is_user = true;
}
$data = [
/* $data = [
'id' => '1',
'housename' => '怡华苑路304号',
'user_tel' => '13918937741',
......@@ -47,12 +54,12 @@ class ShareShop extends Basic
'share' => '1',
'client' => 'b',
'is_user' => true
];
Log::write($data, 'shareShop'); //记录日志
$this->assign('data',json_encode($data));
dump($data);
];*/
$params['is_user'] = true;
dump($params);
Log::write($params, 'shareShop'); //记录日志
$this->assign('data',json_encode($params));
return view("share_detail");
}
}
......@@ -64,4 +71,23 @@ class ShareShop extends Basic
{
return view("yindao_ios");
}
}
\ No newline at end of file
/**
* 浏览器判断
* @return int
*/
function isWeiChatBrowser(){
$ua = $_SERVER['HTTP_USER_AGENT'];
//MicroMessenger 是android/iphone版微信所带的
//Windows Phone 是winphone版微信带的 (这个标识会误伤winphone普通浏览器的访问)
if(strpos($ua, 'MicroMessenger') == false && strpos($ua, 'Windows Phone') == false){
return 0; //普通浏览器
}else{
return 1; //微信浏览器
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment