Commit bfe7df66 authored by zhuwei's avatar zhuwei

bug

parent 4251286d
...@@ -20,11 +20,20 @@ class WxCallbackUntils ...@@ -20,11 +20,20 @@ class WxCallbackUntils
public function __construct() public function __construct()
{ {
// $this->appId = "wxbbeb8cd2f4b72aea"; if (strpos($this->http_host(), 'api') !== false) {
// $this->appSecret = "9ac6d1680553f4b554f3b46d263fbfb3"; $this->appId = "wxbbeb8cd2f4b72aea";
$this->appSecret = "9ac6d1680553f4b554f3b46d263fbfb3";
} else {
$this->appId = "wxd30d74d1126d3278";//测试
$this->appSecret = "f29c8c502549020d2193a464be9632dc";//测试
}
}
$this->appId = "wxd30d74d1126d3278";//测试 public function http_host()
$this->appSecret = "f29c8c502549020d2193a464be9632dc";//测试 {
$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,31 +29,38 @@ class ShareShop extends Basic ...@@ -29,31 +29,38 @@ class ShareShop extends Basic
public function shareShop() public function shareShop()
{ {
$browser_type = $this->isWeiChatBrowser();
$params = $this->params; $params = $this->params;
$code = empty($_GET['code']) ? null : $_GET['code']; if($browser_type == 1){
if (!$code) { dump('微信浏览器');
$this->_wxApi->getWxCodesnSapiBase($this->url); $code = empty($_GET['code']) ? null : $_GET['code'];
} else { if (!$code) {
$open_id = $this->_wxApi->getUserOpenId($code); $this->_wxApi->getWxCodesnSapiBase($this->url);
$user_service = new UserService(); } else {
$is_user = $user_service->isUserByweiXin($open_id); $open_id = $this->_wxApi->getUserOpenId($code);
$user_service = new UserService();
$is_user = $user_service->isUserByweiXin($open_id);
$data = [ }
'id' => '1', }else{
'housename' => '怡华苑路304号', dump('普通浏览器');
'user_tel' => '13918937741', $is_user = true;
'user_name' => '于盼盼',
'share' => '1',
'client' => 'b',
'is_user' => true
];
Log::write($data, 'shareShop'); //记录日志
$this->assign('data',json_encode($data));
dump($data);
return view("share_detail");
} }
/* $data = [
'id' => '1',
'housename' => '怡华苑路304号',
'user_tel' => '13918937741',
'user_name' => '于盼盼',
'share' => '1',
'client' => 'b',
'is_user' => true
];*/
$params['is_user'] = true;
dump($params);
Log::write($params, 'shareShop'); //记录日志
$this->assign('data',json_encode($params));
return view("share_detail");
} }
public function yindaoAndroid() public function yindaoAndroid()
...@@ -64,4 +71,23 @@ class ShareShop extends Basic ...@@ -64,4 +71,23 @@ class ShareShop extends Basic
{ {
return view("yindao_ios"); 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