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
67ad384b
Commit
67ad384b
authored
Nov 13, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shareShop
parent
87371e77
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
25 deletions
+91
-25
ShareShop.php
application/index/controller/ShareShop.php
+59
-0
WxAuthorization.php
application/index/controller/WxAuthorization.php
+0
-24
UserService.php
application/index/service/UserService.php
+16
-0
Users.php
application/model/Users.php
+15
-0
route.php
application/route.php
+1
-1
No files found.
application/index/controller/ShareShop.php
0 → 100644
View file @
67ad384b
<?php
namespace
app\index\controller
;
use
app\api\controller\WxSdk
;
use
app\api\untils\WxCallbackUntils
;
use
app\index\extend\Basic
;
use
app\index\service\UserService
;
use
Think\Log
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/6/4
* Time : 18:06
* Intro:
*/
class
ShareShop
extends
Basic
{
private
$url
;
private
$_wxApi
;
public
function
__construct
()
{
parent
::
__construct
();
$this
->
_wxApi
=
new
WxCallbackUntils
();
$this
->
url
=
CURRENT_URL
.
"/index/shareShop"
;
}
public
function
shareShop
()
{
$params
=
$this
->
params
;
$code
=
empty
(
$_GET
[
'code'
])
?
null
:
$_GET
[
'code'
];
if
(
!
$code
)
{
$this
->
_wxApi
->
getWxCodesnSapiBase
(
$this
->
url
);
}
else
{
$open_id
=
$this
->
_wxApi
->
getUserOpenId
(
$code
);
$user_service
=
new
UserService
();
$is_user
=
$user_service
->
isUserByweiXin
(
$open_id
);
$data
=
[
'id'
=>
'1'
,
'housename'
=>
'怡华苑路304号'
,
'user_tel'
=>
'13918937741'
,
'user_name'
=>
'于盼盼'
,
'share'
=>
'1'
,
'client'
=>
'b'
,
'client'
=>
'b'
,
'is_user'
=>
$is_user
,
];
$this
->
assign
(
'data'
,
json_encode
(
$data
));
return
view
(
"share_detail"
);
}
}
}
\ No newline at end of file
application/index/controller/WxAuthorization.php
View file @
67ad384b
...
@@ -21,7 +21,6 @@ class WxAuthorization extends Basic
...
@@ -21,7 +21,6 @@ class WxAuthorization extends Basic
public
function
__construct
()
public
function
__construct
()
{
{
parent
::
__construct
();
$this
->
_wxApi
=
new
WxCallbackUntils
();
$this
->
_wxApi
=
new
WxCallbackUntils
();
$this
->
url
=
CURRENT_URL
.
"/index/getWxInfo"
;
$this
->
url
=
CURRENT_URL
.
"/index/getWxInfo"
;
}
}
...
@@ -49,26 +48,4 @@ class WxAuthorization extends Basic
...
@@ -49,26 +48,4 @@ class WxAuthorization extends Basic
}
}
public
function
getWxInfoV2
()
{
$code
=
empty
(
$_GET
[
'code'
])
?
null
:
$_GET
[
'code'
];
if
(
!
$code
)
{
$this
->
_wxApi
->
getWxCodesnSapiBase
(
CURRENT_URL
.
"/index/getWxInfoV2"
);
}
else
{
$userInfo
=
$this
->
_wxApi
->
getUserOpenId
(
$code
);
$data
=
[
'id'
=>
'2'
,
'housename'
=>
'怡华苑路304号'
,
'user_tel'
=>
'13918937741'
,
'user_name'
=>
'于盼盼'
,
'share'
=>
'1'
,
'client'
=>
'b'
,
];
$this
->
assign
(
'data'
,
json_encode
(
$data
));
return
view
(
"share_detail"
);
}
}
}
}
\ No newline at end of file
application/index/service/UserService.php
View file @
67ad384b
...
@@ -442,4 +442,19 @@ class UserService
...
@@ -442,4 +442,19 @@ class UserService
}
}
}
}
public
function
isUserByweiXin
(
$open_id
){
if
(
!
$open_id
){
return
false
;
}
$param
[
'wx_open_id'
]
=
$open_id
;
$fields
=
'a.user_phone'
;
$result
=
$this
->
user
->
getUserInfoByOpenId
(
$param
,
$fields
);
if
(
$result
)
{
return
true
;
}
else
{
return
false
;
}
}
}
}
\ No newline at end of file
application/model/Users.php
View file @
67ad384b
...
@@ -969,5 +969,20 @@ class Users extends Model
...
@@ -969,5 +969,20 @@ class Users extends Model
//echo $this->getLastSql();
//echo $this->getLastSql();
return
$result
;
return
$result
;
}
}
public
function
getUserInfoByOpenId
(
$param
,
$fields
)
{
$where_
=
[];
if
(
isset
(
$param
[
"wx_open_id"
]))
{
$where_
[
"b.wx_open_id"
]
=
$param
[
"wx_open_id"
];
}
$data
=
$this
->
field
(
$fields
)
->
alias
(
"a"
)
->
join
(
"u_wx_info b"
,
"a.buyer_id=b.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
return
$data
;
}
}
}
application/route.php
View file @
67ad384b
...
@@ -280,7 +280,7 @@ Route::group('index', [
...
@@ -280,7 +280,7 @@ Route::group('index', [
'addNotice'
=>
[
'index/notice/addNotice'
,
[
'method'
=>
'POST'
]],
//新增公告
'addNotice'
=>
[
'index/notice/addNotice'
,
[
'method'
=>
'POST'
]],
//新增公告
'addNoticeView'
=>
[
'index/notice/addNoticeView'
,
[
'method'
=>
'GET'
]],
//新增公告
'addNoticeView'
=>
[
'index/notice/addNoticeView'
,
[
'method'
=>
'GET'
]],
//新增公告
'getWxInfo'
=>
[
'index/WxAuthorization/getWxInfo'
,
[
'method'
=>
'POST|GET'
]],
//wx
'getWxInfo'
=>
[
'index/WxAuthorization/getWxInfo'
,
[
'method'
=>
'POST|GET'
]],
//wx
'
getWxInfoV2'
=>
[
'index/WxAuthorization/getWxInfoV2
'
,
[
'method'
=>
'POST|GET'
]],
//wx
'
shareShop'
=>
[
'index/ShareShop/shareShop
'
,
[
'method'
=>
'POST|GET'
]],
//wx
'evaluationList'
=>
[
'index/Evaluation/evaluationList'
,
[
'method'
=>
'POST|GET'
]],
//评价列表 朱伟 2018-06-13
'evaluationList'
=>
[
'index/Evaluation/evaluationList'
,
[
'method'
=>
'POST|GET'
]],
//评价列表 朱伟 2018-06-13
...
...
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