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
fdf80277
Commit
fdf80277
authored
Dec 11, 2017
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预约看铺
parent
a2f1a092
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
3 deletions
+120
-3
AppointmentTime.php
application/api/controller/AppointmentTime.php
+81
-0
Shop.php
application/api/controller/Shop.php
+1
-1
Basic.php
application/api/extend/Basic.php
+7
-0
Index.php
application/index/controller/member/Index.php
+1
-2
AppointWatchShop.php
application/model/AppointWatchShop.php
+24
-0
HouseInfos.php
application/model/HouseInfos.php
+6
-0
No files found.
application/api/controller/AppointmentTime.php
0 → 100644
View file @
fdf80277
<?php
namespace
app\api\controller
;
use
app\api\extend\Basic
;
use
app\model\AppointWatchShop
;
use
app\model\HouseInfos
;
use
think\helper\Time
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/8
* Time : 17:18
* Intro: 预约看铺模块
*/
class
AppointmentTime
extends
Basic
{
protected
$db
;
protected
$appointmentTimeModel
;
protected
$houseInfoModel
;
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
appointmentTimeModel
=
new
AppointWatchShop
();
$this
->
houseInfoModel
=
new
HouseInfos
();
}
/**
* 增加预约楼盘信息
* @return \think\Response
*/
public
function
addAppointmentSeeShop
()
{
$params
=
$this
->
params
;
/* $params = array(
"user_id" => 1,
"house_id" => 1,
"house_title" => "楼盘1",
"appellation" => "张三",
"phone" => "13817616312",
"expect_time" => time(),
"other_require" => "没有其他要求"
);*/
//todo 验证楼盘信息
if
(
isset
(
$params
[
"house_id"
])
&&
isset
(
$params
[
"house_title"
]))
{
$where_
[
"house_id"
]
=
$params
[
"house_id"
];
$where_
[
"title"
]
=
$params
[
"title"
];
$houseInfo
=
$this
->
houseInfoModel
->
getHouseDetail
(
"id"
,
$where_
);
if
(
count
(
$houseInfo
)
<=
0
)
{
return
$this
->
response
(
"101"
,
"楼盘ID或楼盘名错误"
);
}
}
else
{
return
$this
->
response
(
"101"
,
"楼盘信息不能为空"
);
}
//todo 参数校验
if
(
!
isset
(
$params
[
"phone"
])
||
!
preg_match
(
'/1[345678]\d{9}/'
,
$params
[
"phone"
]))
{
return
$this
->
response
(
"101"
,
"手机号为空或手机号无效"
);
}
if
(
!
isset
(
$params
[
"expect_time"
])
||
$params
[
'expect_time'
]
<=
Time
::
today
())
{
return
$this
->
response
(
"101"
,
"预约时间为空,或者小于当前时间"
);
}
$result
=
$this
->
appointmentTimeModel
->
insertAppointWatchShop
(
$params
);
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"数据保存成功"
,
$result
[
"msg"
]);
}
return
$this
->
response
(
"101"
,
"数据保存失败"
);
}
public
function
getAppointmentSeeShopList
(){
}
}
\ No newline at end of file
application/api/controller/Shop.php
View file @
fdf80277
...
...
@@ -133,7 +133,7 @@ class Shop extends Basic
$conditions
[
'id'
]
=
array
(
"eq"
,
$params
[
"id"
]
);
$result
=
$this
->
db
->
getHouseDetail
(
$field
,
$conditions
);
if
(
$result
[
'room_num_left'
]
==
0
)
{
if
(
$result
[
0
][
'room_num_left'
]
==
0
)
{
return
$this
->
response
(
"101"
,
'此楼盘已下架'
);
}
return
$this
->
response
(
"200"
,
'request success'
,
$result
);
...
...
application/api/extend/Basic.php
View file @
fdf80277
...
...
@@ -45,6 +45,8 @@ class Basic extends Controller
ob_end_flush
();
ob_end_clean
();
ob_get_contents
();
// CORS 跨域 Options 检测响应
$this
->
corsOptionsHandler
();
// 输入对象
...
...
@@ -67,6 +69,7 @@ class Basic extends Controller
$this->userId = $result['data']["userId"];
$this->phone = $result['data']["phone"];
$this->timeStamp_ = $result["timeStamp_"];
$this->verifyTime();*/
}
...
...
@@ -79,6 +82,10 @@ class Basic extends Controller
$this
->
response
(
"101"
,
"AuthToken失效,请重新登录!"
);
}
}
public
function
verifyUserInfo
(){
//todo 待完成
return
true
;
}
/**
...
...
application/index/controller/member/Index.php
View file @
fdf80277
...
...
@@ -6,9 +6,8 @@ namespace app\index\controller\member;
* Date: 17-12-3
* Time: 下午1:03
*/
use
app\index\extend\Basic
;
class
Index
extends
Basic
{
class
Index
{
public
function
member
(){
return
view
(
'member/member'
,[
'title'
=>
'thinkphp'
]);
//$this->response('100',array(),'json');
...
...
application/model/AppointWatchShop.php
View file @
fdf80277
...
...
@@ -8,4 +8,28 @@ class AppointWatchShop extends Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'u_appoint_watch_shop'
;
protected
$db
;
function
__construct
()
{
$this
->
db
=
Db
(
$this
->
table
);
}
/** 保存预约看铺信息
* @param $arr
* @return array
*/
public
function
insertAppointWatchShop
(
$arr
)
{
$appointWatchShop
=
$this
->
db
;
Db
::
startTrans
();
try
{
$id
=
$appointWatchShop
->
save
(
$arr
);
Db
::
commit
();
return
[
"code"
=>
"200"
,
"msg"
=>
$id
];
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
}
return
[
"code"
=>
"101"
,
"msg"
=>
"数据保存异常,rollback"
];
}
}
application/model/HouseInfos.php
View file @
fdf80277
...
...
@@ -59,6 +59,12 @@ class HouseInfos extends Model
return
$averagePrice
;
}
/**
* 获取商铺详情
* @param $field
* @param $params
* @return mixed
*/
function
getHouseDetail
(
$field
,
$params
)
{
return
$data
=
$this
->
dbHouseInfo
...
...
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