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
083630ce
Commit
083630ce
authored
Aug 30, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序客户查看商铺记录
parent
e42195de
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
175 additions
and
50 deletions
+175
-50
UserLookShop.php
application/api/controller/UserLookShop.php
+49
-0
WxSdk.php
application/api/controller/WxSdk.php
+0
-36
Basic.php
application/api/extend/Basic.php
+1
-0
UserLookShopService.php
application/api/service/UserLookShopService.php
+86
-0
WxSdkService.php
application/api/service/WxSdkService.php
+5
-10
UserLookShopValidate.php
application/api/validate/UserLookShopValidate.php
+28
-0
route.php
application/route.php
+6
-4
No files found.
application/api/controller/UserLookShop.php
0 → 100644
View file @
083630ce
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\api\service\UserLookShopService
;
use
app\model\UWxInfo
;
use
think\Exception
;
class
UserLookShop
extends
Basic
{
private
$wxInfoModel
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
wxInfoModel
=
new
UWxInfo
();
}
/**
* 小程序客户查看商铺记录
* @return \think\Response
*/
public
function
addUserLookShop
()
{
$params
=
$this
->
params
;
/* $params = array(
"wx_union_id" => "123132123123123",
"house_id" => "18",
);*/
$checkResult
=
$this
->
validate
(
$params
,
"UserLookShopValidate.addUserLookShop"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"101"
,
$checkResult
);
}
$s_user_look_shop
=
new
UserLookShopService
();
$res
=
$s_user_look_shop
->
addUserLookShop
(
$params
[
'wx_union_id'
],
$params
[
'house_id'
]);
if
(
$res
){
return
$this
->
response
(
"200"
,
"request success"
,
$res
);
}
else
{
return
$this
->
response
(
"101"
,
'失败'
);
}
}
}
application/api/controller/WxSdk.php
View file @
083630ce
...
@@ -215,7 +215,6 @@ class WxSdk extends Basic
...
@@ -215,7 +215,6 @@ class WxSdk extends Basic
}
}
if
(
$id
>
0
)
{
if
(
$id
>
0
)
{
$this
->
addUserLookShopV2
(
$id
,
$params
[
'house_id'
],
$params
[
'source'
],
1
);
return
$this
->
response
(
"200"
,
"request success"
);
return
$this
->
response
(
"200"
,
"request success"
);
}
else
{
}
else
{
return
$this
->
response
(
"101"
,
"request exception"
);
return
$this
->
response
(
"101"
,
"request exception"
);
...
@@ -224,39 +223,4 @@ class WxSdk extends Basic
...
@@ -224,39 +223,4 @@ class WxSdk extends Basic
}
}
/**
* 保存看铺数据
* @param $user_id
* @param $house_id
* @param $type
* @param $source
* @return bool
*/
public
function
addUserLookShopV2
(
$user_id
,
$house_id
,
$type
,
$source
)
{
$day
=
date
(
"Y-m-d"
,
time
());
$tModel
=
new
TLookShopUser
();
$params
[
"user_id"
]
=
$user_id
;
$params
[
"type"
]
=
$type
;
$params
[
"house_id"
]
=
$house_id
;
$params
[
"look_day"
]
=
$day
;
$params
[
"source"
]
=
$day
;
$result
=
$tModel
->
getList
(
$params
,
"a.id"
,
1
,
1
);
if
(
count
(
$result
)
>
0
)
{
return
false
;
}
$arr
=
array
(
"user_id"
=>
$user_id
,
"type"
=>
$type
,
"house_id"
=>
$house_id
,
"look_day"
=>
$day
,
"source"
=>
$day
,
"create_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
"update_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
);
$tModel
->
addLookShop
(
$arr
);
return
true
;
}
}
}
application/api/extend/Basic.php
View file @
083630ce
...
@@ -80,6 +80,7 @@ class Basic extends Controller
...
@@ -80,6 +80,7 @@ class Basic extends Controller
"office_api/getOfficeBuildingInfoShare"
,
"office_api/getOfficeBuildingInfoShare"
,
"api/getOpenidByCode"
,
"api/getOpenidByCode"
,
"api/saveWXInfoByPortableProgram"
,
"api/saveWXInfoByPortableProgram"
,
"api/addUserLookShop"
,
);
);
...
...
application/api/service/UserLookShopService.php
0 → 100644
View file @
083630ce
<?php
namespace
app\api\service
;
use
app\api_broker\service\LookShopService
;
use
app\api_broker\service\VerifyService
;
use
app\index\service\HouseService
;
use
app\model\AttentionModel
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\GImageDepot
;
use
app\model\GLabels
;
use
app\model\OBargainModel
;
use
app\model\OfficeGLabels
;
use
app\model\TLookShopUser
;
use
app\model\UWxInfo
;
class
UserLookShopService
{
private
$wxInfoModel
;
function
__construct
()
{
$this
->
wxInfoModel
=
new
UWxInfo
();
}
/**
* 小程序客户查看商铺记录
* @param $wx_union_id
* @param $house_id
* @return bool
*/
public
function
addUserLookShop
(
$wx_union_id
,
$house_id
)
{
// 验证open_id是否已经存在,存在则更新
$wxInfoObj
=
$this
->
wxInfoModel
->
getWxInfoByOpenId
(
$wx_union_id
);
if
(
$wxInfoObj
&&
count
(
$wxInfoObj
)
>
0
)
{
$user_id
=
$wxInfoObj
[
0
][
"id"
];
$res
=
$this
->
saveUserLookShop
(
$user_id
,
$house_id
,
2
,
1
);
if
(
$res
)
{
return
true
;
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
/**
* 保存看铺数据
* @param $user_id
* @param $house_id
* @param $type
* @param $source
* @return bool
*/
public
function
saveUserLookShop
(
$user_id
,
$house_id
,
$type
,
$source
)
{
$day
=
date
(
"Y-m-d"
,
time
());
$tModel
=
new
TLookShopUser
();
$params
[
"a.user_id"
]
=
$user_id
;
$params
[
"a.type"
]
=
$type
;
$params
[
"a.house_id"
]
=
$house_id
;
$params
[
"a.look_day"
]
=
$day
;
$params
[
"a.source"
]
=
$source
;
$result
=
$tModel
->
getList
(
$params
,
"a.id"
,
1
,
1
);
if
(
count
(
$result
)
>
0
)
{
return
false
;
}
$arr
=
array
(
"user_id"
=>
$user_id
,
"type"
=>
$type
,
"house_id"
=>
$house_id
,
"look_day"
=>
$day
,
"source"
=>
$source
,
"create_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
"update_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
);
$tModel
->
addLookShop
(
$arr
);
return
true
;
}
}
\ No newline at end of file
application/api/service/WxSdkService.php
View file @
083630ce
...
@@ -15,16 +15,8 @@ class WxSdkService{
...
@@ -15,16 +15,8 @@ class WxSdkService{
public
function
__construct
()
public
function
__construct
()
{
{
// $this->appId = "wxbbeb8cd2f4b72aea";
$this
->
appId
=
"wx1d1bc80d3d973199"
;
//测试
// $this->appSecret = "9ac6d1680553f4b554f3b46d263fbfb3";
$this
->
appSecret
=
"8062e6629ebd7ad70174a382263c9e25"
;
//测试
if
(
strpos
(
$this
->
http_host
(),
'api'
)
!==
false
)
{
$this
->
appId
=
"wxbbeb8cd2f4b72aea"
;
$this
->
appSecret
=
"9ac6d1680553f4b554f3b46d263fbfb3"
;
}
else
{
$this
->
appId
=
"wxd30d74d1126d3278"
;
//测试
$this
->
appSecret
=
"f29c8c502549020d2193a464be9632dc"
;
//测试
}
}
}
/**
/**
...
@@ -35,9 +27,12 @@ class WxSdkService{
...
@@ -35,9 +27,12 @@ class WxSdkService{
public
function
getOpenidByCode
(
$code
)
public
function
getOpenidByCode
(
$code
)
{
{
$curl
=
new
CurlUtil
();
$curl
=
new
CurlUtil
();
big_log
(
$this
->
appId
);
big_log
(
$this
->
appSecret
);
$url
=
"https://api.weixin.qq.com/sns/jscode2session?appid=
{
$this
->
appId
}
&secret=
{
$this
->
appSecret
}
&js_code=
{
$code
}
&grant_type=authorization_code"
;
$url
=
"https://api.weixin.qq.com/sns/jscode2session?appid=
{
$this
->
appId
}
&secret=
{
$this
->
appSecret
}
&js_code=
{
$code
}
&grant_type=authorization_code"
;
$result
=
$curl
->
get
(
$url
);
$result
=
$curl
->
get
(
$url
);
$result
=
json_decode
(
$result
,
"true"
);
$result
=
json_decode
(
$result
,
"true"
);
big_log
(
$result
);
return
$result
;
return
$result
;
}
}
...
...
application/api/validate/UserLookShopValidate.php
0 → 100644
View file @
083630ce
<?php
namespace
app\api\validate
;
use
think\Validate
;
class
UserLookShopValidate
extends
Validate
{
protected
$rule
=
[
'wx_union_id'
=>
'require|length:10,50'
,
'house_id'
=>
'require|number|gt:0'
,
];
protected
$message
=
[
'wx_union_id.require'
=>
'微信union_id不能为空'
,
'wx_union_id.length:10,50'
=>
'微信union_id错误'
,
'house_id.require'
=>
'house_id为必须字段'
,
'house_id.number'
=>
'house_id必须是数字'
,
'house_id.gt'
=>
'house_id必须大于0'
,
];
protected
$scene
=
[
'addUserLookShop'
=>
[
'wx_union_id'
,
'house_id'
],
];
}
\ No newline at end of file
application/route.php
View file @
083630ce
...
@@ -653,10 +653,12 @@ Route::group('api', [
...
@@ -653,10 +653,12 @@ Route::group('api', [
'getVersionNo'
=>
[
'api/Version/getVersionNo'
,
[
'method'
=>
'post|get'
]],
'getVersionNo'
=>
[
'api/Version/getVersionNo'
,
[
'method'
=>
'post|get'
]],
'getVersionNoV2'
=>
[
'api/version/getVersionNoV2'
,
[
'method'
=>
'post|get'
]],
'getVersionNoV2'
=>
[
'api/version/getVersionNoV2'
,
[
'method'
=>
'post|get'
]],
'saveWxInfo'
=>
[
'api/WxSdk/saveWxInfo'
,
[
'method'
=>
'POST'
]],
//wx
'saveWxInfo'
=>
[
'api/WxSdk/saveWxInfo'
,
[
'method'
=>
'POST'
]
],
//wx
'bindUserId'
=>
[
'api/WxSdk/bindUserId'
,
[
'method'
=>
'POST|GET'
]],
//wx
'bindUserId'
=>
[
'api/WxSdk/bindUserId'
,
[
'method'
=>
'POST|GET'
]
],
//wx
'getOpenidByCode'
=>
[
'api/WxSdk/getOpenidByCode'
,
[
'method'
=>
'POST'
]],
//wx
'getOpenidByCode'
=>
[
'api/WxSdk/getOpenidByCode'
,
[
'method'
=>
'post|get'
]
],
//wx
'saveWXInfoByPortableProgram'
=>
[
'api/WxSdk/saveWXInfoByPortableProgram'
,
[
'method'
=>
'POST'
]],
'saveWXInfoByPortableProgram'
=>
[
'api/WxSdk/saveWXInfoByPortableProgram'
,
[
'method'
=>
'post|get'
]
],
'addUserLookShop'
=>
[
'api/UserLookShop/addUserLookShop'
,
[
'method'
=>
'post|get'
]
],
'sendCode'
=>
[
'api/Register/registerSendCode'
,
[
'method'
=>
'POST'
]],
'sendCode'
=>
[
'api/Register/registerSendCode'
,
[
'method'
=>
'POST'
]],
...
...
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