Commit b86340a8 authored by clone's avatar clone

预约看铺bug

parent 193be7ef
......@@ -38,21 +38,21 @@ class AppointmentTime extends Basic
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" => "没有其他要求"
);*/
/* $params = array(
"user_id" => 1,
"house_id" => 1,
"house_title" => "楼盘1",
"appellation" => "张三",
"phone" => "13817616312",
"expect_time" => time() + 1000,
"other_require" => "没有其他要求"
);*/
//todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) {
$where_["id"] = $params["house_id"];
$where_["title"] = $params["title"];
$where_['show_all'] = array( 'eq', 0 );
//$where_["title"] = $params["title"];
// $where_['show_all'] = array( 'eq', 0 );
$houseInfo = $this->houseInfoModel->getHouseDetail("id", $where_);
if (count($houseInfo) <= 0) {
return $this->response("101", "楼盘ID或楼盘名错误");
......@@ -65,7 +65,7 @@ class AppointmentTime extends Basic
return $this->response("101", "手机号为空或手机号无效");
}
if (!isset($params["expect_time"]) || $params['expect_time'] <= Time::today()) {
if (!isset($params["expect_time"]) || $params['expect_time'] <= time()) {
return $this->response("101", "预约时间为空,或者小于当前时间");
}
$result = $this->appointmentTimeModel->insertAppointWatchShop($params);
......@@ -115,16 +115,16 @@ class AppointmentTime extends Basic
//获取图片信息
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图
$param["house_id"] = $val["house_id"];
$param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
}
if(count($result) > 0 ){
return $this->response("200","request success" ,$result);
}else{
return $this->response("200","此条件没有找到数据" );
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "此条件没有找到数据");
}
}
......
......@@ -3,6 +3,7 @@
namespace app\model;
use think\Model;
use think\Db;
class AppointWatchShop extends Model
{
......@@ -21,10 +22,9 @@ class AppointWatchShop extends Model
*/
public function insertAppointWatchShop($arr)
{
$appointWatchShop = $this->db;
Db::startTrans();
try {
$id = $appointWatchShop->save($arr);
$id = $this->save($arr);
Db::commit();
return [ "code" => "200", "msg" => $id ];
} catch (\Exception $e) {
......@@ -43,7 +43,7 @@ class AppointWatchShop extends Model
*/
public function getAppointWatchShopList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params)
{
return $this->db
return $this
->field($field)
->where($params)
->order($order_)
......
......@@ -95,7 +95,7 @@ Route::group('api', [
//post AppointmentTime
'getAppointmentSeeShopList' => [ 'api/appointmentTime/getAppointmentSeeShopList', [ 'method' => 'post' ] ],
'addAppointmentSeeShop' => [ 'api/appointmentTime/addAppointmentSeeShop', [ 'method' => 'post' ] ],
'addAppointmentSeeShop' => [ 'api/appointmentTime/addAppointmentSeeShop', [ 'method' => 'post|get' ] ],
//tradeLog
......
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