Commit 25baa234 authored by clone's avatar clone

我的成交记录

parent 129473fc
...@@ -12,17 +12,20 @@ namespace app\api\controller; ...@@ -12,17 +12,20 @@ namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\HouseImgs; use app\model\HouseImgs;
use app\model\HouseInfos; use app\model\HouseInfos;
use app\model\Labels;
class Shop extends Basic class Shop extends Basic
{ {
protected $db; protected $db;
protected $dbImg; protected $dbImg;
protected $labels;
function __construct($request = null) function __construct($request = null)
{ {
parent::__construct($request); parent::__construct($request);
$this->db = new HouseInfos(); $this->db = new HouseInfos();
$this->dbImg = new HouseImgs(); $this->dbImg = new HouseImgs();
$this->labels = new Labels();
} }
/** /**
...@@ -35,6 +38,7 @@ class Shop extends Basic ...@@ -35,6 +38,7 @@ class Shop extends Basic
"site_area" => 2, //来源 1首页 2搜索 "site_area" => 2, //来源 1首页 2搜索
"title" => "尚美", "title" => "尚美",
"carefully_chosen" => 0, "carefully_chosen" => 0,
"disc" => "黄浦区",
"yetai" => "休闲娱乐", "yetai" => "休闲娱乐",
"area_start" => 45,//面积起始范围 room_area2 "area_start" => 45,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围 "area_end" => 65,//面积结束范围
...@@ -155,6 +159,10 @@ class Shop extends Basic ...@@ -155,6 +159,10 @@ class Shop extends Basic
} }
/**
* 搜索页搜索条件
* @return \think\Response
*/
public function filtrateCondition() public function filtrateCondition()
{ {
$field = "city,disc"; $field = "city,disc";
...@@ -162,21 +170,45 @@ class Shop extends Basic ...@@ -162,21 +170,45 @@ class Shop extends Basic
$param['room_num_left'] = array( '<>', 0 ); $param['room_num_left'] = array( '<>', 0 );
$group_ = "disc"; $group_ = "disc";
$cityList = $this->db->getCityList($field, $param, $group_); $cityList = $this->db->getCityList($field, $param, $group_);
print_r($cityList);exit;
/* $return['data']['yetai'] = array( '全部', '餐饮美食', '零售', '休闲娱乐', '其他' );//业态 foreach ($cityList as $k => $v) {
$return['data']['money'] = array( array( 'id' => '', 'value' => '全部' ), array( 'id' => '0', 'value' => '3万以上' ), array( 'id' => '1', 'value' => '1万-3万' ), array( 'id' => '2', 'value' => '1万以下' ) );//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万) $cityArr[] = $v["city"];
$return['data']['more'] = array( '全部' );//更多 }
$return['data']['acreage'] = array( array( 'id' => '', 'value' => '全部' ), array( 'id' => '0', 'value' => '30m²以内' ), array( 'id' => '1', 'value' => '30-60m²' ), array( 'id' => '2', 'value' => '60-100m²' ), array( 'id' => '3', 'value' => '100m²以上' ) );//面积 $cityArr = array_unique($cityArr);
$Label = $this->Label->find("all"); $i = 0;
if ($Label) { $result["area"][$i]["city"] = "全部";
foreach ($Label AS $k3 => $v3) { $result["area"][$i]["disc"][] = "全部";
if ($v3['Label']['name']) { foreach ($cityArr as $key => $val) {
$return['data']['more'][] = $v3['Label']['name']; $i++;
$result["area"][$i]["city"] = $val;
$result["area"][$i]["disc"][] = "全" . $val;
foreach ($cityList as $k => $v) {
if ($val == $v["city"]) {
$result["area"][$i]["disc"][] = $v["disc"];
}
}
}
$result['yetai'] = array( '全部', '餐饮美食', '零售', '休闲娱乐', '其他' );
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
$result['money'] = array( array( 'id' => '-1', 'value' => '全部' ), array( 'id' => '0', 'value' => '3万以上' ),
array( 'id' => '1', 'value' => '1万-3万' ), array( 'id' => '2', 'value' => '1万以下' ) );
//面积
$result['acreage'] = array( array( 'id' => '-1', 'value' => '全部' ), array( 'id' => '0', 'value' => '30m²以内' ),
array( 'id' => '1', 'value' => '30-60m²' ), array( 'id' => '2', 'value' => '60-100m²' ), array( 'id' => '3', 'value' => '100m²以上' ) );
$result['more'][] = "更多";
$labelsResult = $this->labels->getLabels();
if (count($labelsResult) > 0) {
foreach ($labelsResult as $labelsKey => $labelsVal) {
if ($labelsVal['name']) {
$result['more'][] = $labelsVal['name'];
}
} }
} }
}*/
return $this->response("200", "request success", $result);
} }
} }
\ No newline at end of file
...@@ -23,29 +23,57 @@ class Sublet extends Basic ...@@ -23,29 +23,57 @@ class Sublet extends Basic
$this->subletMode = new SubletModel(); $this->subletMode = new SubletModel();
} }
public function addSublet(){ public function addSublet()
//$params = $this->params; {
/** $params = $this->params;
* `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '我的转租记录表', /* $params = array(
`user_id` int(10) DEFAULT NULL COMMENT '用户id', "user_id" => 1,
`manage_status` tinyint(3) DEFAULT '0' COMMENT '经营状态 0:餐饮美食 1:零售 2:休闲娱乐 3:其他', "manage_type" => 0,
`address_detail` varchar(255) DEFAULT '' COMMENT '详细地址', "address_detail" => "shanghaishi",
`province` varchar(125) DEFAULT NULL COMMENT '省', "province" => "湖南省",
`province_code` int(10) DEFAULT NULL COMMENT '省code 对应regions表code', "province_code" => "10001",
`city` varchar(125) DEFAULT '' COMMENT '市', "city" => "长沙市",
`city_id` int(10) DEFAULT NULL COMMENT '市id', "city_code" => "200001",
`district` varchar(125) DEFAULT '' COMMENT '区', "district" => "芙蓉区",
`district_id` int(10) DEFAULT NULL COMMENT '区id', "district_code" => "300001",
`expected_rent` int(11) DEFAULT '0' COMMENT '期望租金 存分', "expected_rent" => 2000,
`appellation` varchar(125) DEFAULT '' COMMENT '称呼', "appellation" => "zhangsan",
`tel` varchar(20) DEFAULT '' COMMENT '联系方式', "tel" => 13817616162,
`status` tinyint(3) DEFAULT '0' COMMENT '状态 0:已发布 1:电话核实 2:商铺上架', );*/
`agents_id` int(10) DEFAULT NULL COMMENT '经纪人 对应agents表(对接经纪人)',
`create_time` timestamp NULL DEFAULT NULL, if (!isset($params["manage_type"])) {
`update_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, $this->response("101", "经营业态不能为空");
*/ }
$params = array(
); if (!isset($params["address_detail"])) {
$this->response("101", "详细地址不能为空");
}
if (!isset($params["province"]) || !isset($params["province_code"]) || !isset($params["city"]) ||
!isset($params["city_code"]) || !isset($params["district"]) || !isset($params["district_code"])) {
$this->response("101", "省市区不能为空");
}
if (!isset($params["expected_rent"])) {
$this->response("101", "期望租金不能为空");
}
if (!isset($params["appellation"])) {
$this->response("101", "称呼不能为空");
}
if (!isset($params["tel"]) || !preg_match('/1[345678]\d{9}/', $params["phone"])) {
$this->response("101", "手机号检验错误");
}
$params["create_time"] = time();
$params["update_time"] = time();
$result = $this->subletMode->addSublet($params);
if ($result["code"] == 200) {
return $this->response("200", "数据保存成功", $result["msg"]);
}
return $this->response("101", "数据保存失败");
} }
} }
<?php
namespace app\api\controller;
use app\api\extend\Basic;
use app\model\HouseImgs;
use app\model\JournalAccounts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/12
* Time : 17:24
* Intro:
*/
class TradeLog extends Basic
{
protected $journalAccountsMode;
protected $dbImg;
public function __construct($request = null)
{
parent::__construct($request);
$this->journalAccountsMode = new JournalAccounts();
$this->dbImg = new HouseImgs();
}
public function getTradeList()
{
$params = $this->params;
$param = array(
"phone" => "158****6165",
"pageNo" => 1,
"pageSize" => 15,
);
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$order_ = 'a.created desc';
$field = "a.id,a.tradecode,a.singntime,b.phpone,b.house_id";
$result = $this->journalAccountsMode->getJournalAccountsList($pageNo, $pageSize, $order_, $field, $param);
foreach ($result as $key => $val) {
$result[$key]["api_path"] = IMG_PATH;
$param["house_id"] = $val["id"];
$param["imgtype"] = 1; //默认主图
$result[$key]["images"] = $this->dbImg->getHouseImages($param, 1);
}
}
}
\ No newline at end of file
...@@ -78,7 +78,7 @@ class HouseInfos extends Model ...@@ -78,7 +78,7 @@ class HouseInfos extends Model
return $data = $this->dbHouseInfo return $data = $this->dbHouseInfo
->field($field) ->field($field)
->where($params) ->where($params)
->group() ->group($group)
->select(); ->select();
} }
......
...@@ -6,5 +6,19 @@ use think\Model; ...@@ -6,5 +6,19 @@ use think\Model;
class Labels extends Model class Labels extends Model
{ {
// // 设置当前模型对应的完整数据表名称
protected $table = 'labels';
protected $db;
function __construct()
{
$this->db = Db($this->table);
}
public function getLabels()
{
return $data = $this->db
->field("id,name")
->select();
}
} }
...@@ -15,11 +15,17 @@ class SubletModel extends Model ...@@ -15,11 +15,17 @@ class SubletModel extends Model
$this->db = Db($this->table); $this->db = Db($this->table);
} }
public function addSublet($params) public function addSublet($param)
{ {
Db::startTrans();
try {
//todo 新增 $id = $this->save($param);
Db::commit();
return [ "code" => "200", "msg" => $id ];
} catch (\Exception $e) {
Db::rollback();
return [ "code" => "101", "msg" => "失败,数据异常" ];
}
} }
......
...@@ -65,7 +65,7 @@ Route::group('api',[ ...@@ -65,7 +65,7 @@ Route::group('api',[
// shop // shop
'shopList' => ['api/shop/getShopList', ['method' => 'post']], 'shopList' => ['api/shop/getShopList', ['method' => 'post']],
'filtrateCondition' => ['api/shop/filtrateCondition', ['method' => 'post']], 'filtrateCondition' => ['api/shop/filtrateCondition', ['method' => 'get | post']],
'shopDetail' => ['api/shop/getShopDetail', ['method' => 'get']], 'shopDetail' => ['api/shop/getShopDetail', ['method' => 'get']],
//get banner //get banner
...@@ -79,6 +79,10 @@ Route::group('api',[ ...@@ -79,6 +79,10 @@ Route::group('api',[
'getAppointmentSeeShopList' => ['api/appointmentTime/getAppointmentSeeShopList',['method' => 'post']], 'getAppointmentSeeShopList' => ['api/appointmentTime/getAppointmentSeeShopList',['method' => 'post']],
//tradeLog
'getTradeList' => ['api/TradeLog/getTradeList',['method' => 'get']],
......
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