Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
bfe7df66
Commit
bfe7df66
authored
Nov 13, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
4251286d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
12 deletions
+47
-12
WxCallbackUntils.php
application/api/untils/WxCallbackUntils.php
+12
-3
ShareShop.php
application/index/controller/ShareShop.php
+35
-9
No files found.
application/api/untils/WxCallbackUntils.php
View file @
bfe7df66
...
...
@@ -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
;
}
/**
* 跳授权页
...
...
application/index/controller/ShareShop.php
View file @
bfe7df66
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment