Commit 42721446 by shz

tospur

parent 48e530a6
......@@ -8,9 +8,10 @@ class House extends Tospur_House{
public static function init_view(){
wp_enqueue_script('jquery-ui');
wp_enqueue_script('bootstrapjs');
wp_enqueue_script('publicjs');
wp_enqueue_script('validate');
wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapcss');
wp_enqueue_style('bootstrapMinCss');
global $wpdb;
......@@ -41,12 +42,12 @@ class House extends Tospur_House{
'plate_id' => $_POST["basePlateId"],
'room_id' => $_POST['baseRoom'],
"location" => $_POST["location"],
'status' =>$_POST['status'],
"property_money" => $_POST["property_money"],
'community_name' => $_POST["community_name"],
);
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 203){
$wpdb->query("ROLLBACK");
......@@ -57,6 +58,7 @@ class House extends Tospur_House{
echo "新房房源修改成功";
}
}else{
$insert_tospur_house_array['status'] = $_POST['status'];
$result = House::data_insert($insert_tospur_house_array);
if($result != 200){
$wpdb->query("ROLLBACK");
......@@ -74,8 +76,9 @@ class House extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],1);
}
$context['role'] = SecHandHouse::getCurrentRole();
$context['role'] = House::getCurrentRole();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
......
......@@ -38,18 +38,13 @@ class feature
public static function add_feature_html()
{
$context = array();
$context['url'] = home_url();
$context['admin_url'] = admin_url();
Timber::render('add_feature.html', $context);
}
public static function feature_list_html()
{
wp_enqueue_style('bootstrapMinCss');
$context = array();
$context['view'] = plugins_url() . '/tospur/Admin/views';
$context['result'] = feature::search_feature();
Timber::render('feature_list.html', $context);
$context['url'] = home_url();
$context['admin_url'] = admin_url();
Timber::render('feature.html', $context);
}
}
......
......@@ -6,7 +6,10 @@ class RentHouse extends Tospur_House{
//二手房信息
public static function rentHouse_html(){
wp_enqueue_script('bootstrapjs');
wp_enqueue_style('bootstrapcss');
wp_enqueue_script('publicjs');
wp_enqueue_script('validate');
wp_enqueue_style('bootstrapMinCss');
global $wpdb;
$type = $_POST["type"];
$context = array();
......@@ -33,14 +36,27 @@ class RentHouse extends Tospur_House{
'community_name'=>$_POST['community_name'],
'traffic' => $_POST['traffic'],
'periphery' => $_POST['periphery'],
'status' =>$_POST['status'],
'owner_name'=>$_POST['owner_name'],
'owner_phone'=>$_POST['owner_phone'],
"location" => $_POST["location"],
"totalFloor"=>$_POST["totalFloor"],
"useArea"=>$_POST["useArea"],
"street"=>$_POST["street"],
"propertyProof"=>$_POST["propertyProof"],
"roomNum"=>$_POST["roomNum"],
"livingRoom"=>$_POST["livingRoom"],
"bathRoom"=>$_POST["bathRoom"],
"kitchen"=>$_POST["kitchen"],
"balcony"=>$_POST["balcony"],
"propertyRight"=>$_POST["propertyRight"],
"structure"=>$_POST["structure"],
"key"=>$_POST["key"],
"garage"=>$_POST["garage"]
);
if($type==3){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 202){
$wpdb->query("ROLLBACK");
......@@ -52,10 +68,11 @@ class RentHouse extends Tospur_House{
}
}else {
$insert_tospur_house_array['status'] = $_POST['status'];
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
$wpdb->query("ROLLBACK");
print_r($result);;
print_r($result);
echo "租房房源新增失败";
} else {
$wpdb->query("COMMIT");
......@@ -69,13 +86,18 @@ class RentHouse extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
$context["rent"] = SearchDao::searchRent($_GET['id']);
}
$context['role'] = SecHandHouse::getCurrentRole();
$context['role'] = RentHouse::getCurrentRole();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
for($i = 1981; $i<= 2020; $i++){
$context["age"][]=$i;
}
Timber::render("rentHouse.html",$context);
}
......
......@@ -6,7 +6,9 @@ class SecHandHouse extends Tospur_House{
//二手房信息
public static function secHandHouse_html(){
wp_enqueue_script('bootstrapjs');
wp_enqueue_style('bootstrapcss');
wp_enqueue_script('publicjs');
wp_enqueue_script('validate');
wp_enqueue_style('bootstrapMinCss');
global $wpdb;
$type = $_POST["type"];
......@@ -33,14 +35,28 @@ class SecHandHouse extends Tospur_House{
'community_name'=>$_POST['community_name'],
'traffic' => $_POST['traffic'],
'periphery' => $_POST['periphery'],
'status' =>$_POST['status'],
'owner_name'=>$_POST['owner_name'],
'owner_phone'=>$_POST['owner_phone'],
"location" => $_POST["location"],
"totalFloor"=>$_POST["totalFloor"],
"useArea"=>$_POST["useArea"],
"street"=>$_POST["street"],
"propertyProof"=>$_POST["propertyProof"],
"roomNum"=>$_POST["roomNum"],
"livingRoom"=>$_POST["livingRoom"],
"bathRoom"=>$_POST["bathRoom"],
"kitchen"=>$_POST["kitchen"],
"balcony"=>$_POST["balcony"],
"propertyRight"=>$_POST["propertyRight"],
"structure"=>$_POST["structure"],
"key"=>$_POST["key"],
"matching_facilities"=>$_POST["matching_facilities"],
"garage"=>$_POST["garage"]
);
if($type==2){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
$insert_tospur_house_array['status'] = 0;
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if($result != 201){
$wpdb->query("ROLLBACK");
......@@ -52,6 +68,7 @@ class SecHandHouse extends Tospur_House{
}
}else {
$insert_tospur_house_array['status'] = $_POST['status'];
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if ($result != 200) {
$wpdb->query("ROLLBACK");
......@@ -69,7 +86,8 @@ class SecHandHouse extends Tospur_House{
$context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id,$context['result']->district_id);
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["featureOld"] = SearchDao::searchFeatureByHouse($_GET['id']);
$context['featureOld'] = SearchDao::searchFeatureOld($_GET['id']);
$context["searchStatus"] = SearchDao::searchStatus($_GET['id'],2);
}
$context['role'] = SecHandHouse::getCurrentRole();
......@@ -79,6 +97,9 @@ class SecHandHouse extends Tospur_House{
$context["photoType"] = SearchDao::searchPhotoType();
$context["status"] = searchDao::searchStatusType(2);
$context["feature"] = searchDao::searchFeature();
for($i = 1981; $i<= 2020; $i++){
$context["age"][]=$i;
}
Timber::render("secHandHouse.html",$context);
}
......
<h2>添加特色</h2>
<label for="feature">特色:</label>
<input id="feature" type="text">
<input type="submit" id="submit" class="button">
<h2>特色列表</h2>
<table class="table">
<thead>
</thead>
<tbody>
{% for item in result %}
{% if loop.index0%4 == 0%}
<tr>
{% endif %}
<td>{{ item.name }}</td>
{% if loop.index0%4 == 3%}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<script>
var admin_url = '{{ admin_url }}';
(function ($) {
$(document).ready(function () {
$('#submit').click(function () {
var name = $('#feature').val();
if (name.trim() != '') {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name,
success: function (data) {
switch (data.code) {
case 2000:
window.location.href = admin_url + 'admin.php?page=add_feature';
break;
case 2001:
alert('不能重复添加特色');
break;
default:
break;
}
}
});
} else {
alert('请输入特色');
}
});
});
})(jQuery);
</script>
\ No newline at end of file
<link rel="stylesheet" type="text/css" href="{{ view }}/css/bootstrap.min.css">
<h2>特色列表</h2>
<table class="table">
<thead>
<tr>
<th style="">
<div class="th-inner">ID</div>
<div class="fht-cell"></div>
</th>
<th style="">
<div class="th-inner">名称</div>
<div class="fht-cell"></div>
</th>
</tr>
</thead>
<tbody>
{% for item in result %}
<tr>
<td>{{ item.id }}</td>
<td>{{ item.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
\ No newline at end of file
(function($){
function searchConsultant(consulCityId,consultantName){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: "action=searchConsultant&consulCityId="+consulCityId+"&consultantName="+consultantName,
success:function(json){
for(var i = 0; i <=json.length-1; i++){
var name = json[i]["consultantName"];
var imgUrl = json[i]["imageUrl"];
var img = $("<img>").attr({"src":imgUrl,"height":100,"width":100,"style":"margin-right:50px"});
var li = $("<li>").attr("id",json[i]["id"]).append(img).append(name).addClass("consultantImg");
$("#consultantList").append(li);
}
}
});
}
})(jQuery);
\ No newline at end of file
......@@ -115,7 +115,7 @@ class InsertDao{
}
//房源类型、面积与图片关联表
if($data[$key]["type"] == "0"){
if($data[$key]["mainHouse"] == "0"){
$houseTypeArea = array(
'house_id' => $houseId,
"buildproperty_id" => $data["$key"]["buildProperty"],
......
......@@ -387,6 +387,7 @@ class SearchDao
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id
where ada.house_id = %d";
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
foreach($mainImage as $key => $value){
$value->path = Image::getImage($value->path,'big');
}
......@@ -461,4 +462,28 @@ class SearchDao
return $results;
}
public static function searchFeatureOld($hid){
global $wpdb;
$featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from tospur_tag) tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid));
return $feature;
}
public static function searchStatus($hid,$statusType){
global $wpdb;
$statusSql = "select status_id as id from tospur_house th
left join(select status_type,status_id,status_name from tospur_status) ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
$status = $wpdb->get_row($statusSql);
return $status;
}
public static function searchRent($hid){
global $wpdb;
$rentSql = "select rent as value from tospur_house where id = %d";
$results = $wpdb->get_row($wpdb->prepare($rentSql,$hid));
return $results;
}
}
\ No newline at end of file
......@@ -73,6 +73,8 @@ function tospur_register_script_style(){
wp_register_script('jquery-ui',plugins_url('Admin/views', __FILE__)."/js/jquery-ui.js");
wp_register_script('validate',plugins_url('Admin/views', __FILE__)."/js/jquery.validate.js");
wp_register_script('bootstrapjs',plugins_url('Admin/views', __FILE__)."/js/bootstrap.min.js");
wp_register_script('publicjs',plugins_url('Admin/views', __FILE__)."/js/public.js");
wp_register_style('jquery-ui_css', plugins_url('Admin/views', __FILE__)."/css/jquery-ui.css");
wp_register_style('bootstrapcss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.css");
wp_register_style('bootstrapMinCss', plugins_url('Admin/views', __FILE__)."/css/bootstrap.min.css");
......@@ -146,7 +148,6 @@ function reset_menu()
add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view');
add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '特色列表', '特色列表', 'moderate_comments', 'feature_list', 'feature::feature_list_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'moderate_comments', 'add_feature', 'feature::add_feature_html');
add_menu_page('rentHouseList','租房列表', 'moderate_comments', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'moderate_comments', 'rentHouse', 'RentHouse::rentHouse_html');
......
......@@ -442,13 +442,14 @@ a:hover {
height: 45px;
background-color: #f9f9f9;
}
.footer .btn {
width: 94%;
display: block;
.footer .btn-group {
border-spacing: 10px 5px;
}
.footer .btn-group .btn {
color: #ffffff;
font-weight: bold;
margin: 5px auto;
padding: 1px;
margin: 0;
padding: 2px 12px 0;
background-color: #008cd7;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
......@@ -461,28 +462,40 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.footer .btn:active {
.footer .btn-group .btn:active {
background-color: #117bb9;
}
.footer .btn:focus {
.footer .btn-group .btn:focus {
outline: 0;
}
.footer .btn.btn-wechat span {
.footer .btn-group .btn.btn-phone span {
width: 30px;
height: 30px;
background: url("../img/white_wechat_icon.png") no-repeat;
background: url("../img/white_phone_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
margin-right: 6px;
}
.footer .btn.btn-phone span {
.footer .btn-group .btn.btn-wechat span {
width: 30px;
height: 30px;
background: url("../img/white_phone_icon.png") no-repeat;
background: url("../img/white_wechat_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
margin-right: 6px;
}
.footer .btn-group .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.footer .btn-group .btn:last-child:not(:first-child) {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
}
......@@ -577,6 +577,12 @@ body {
.detail_row.recommend .recommendCont {
margin: 0 -10px;
}
.detail_row.recommend .recommendCont ul {
font-size: 14px;
}
.detail_row.recommend .recommendCont ul .address span:nth-child(1) {
font-size: 16px;
}
.detail_row .peopleCont li {
width: 100%;
height: 60px;
......
......@@ -573,3 +573,12 @@ a:hover {
font-weight: bold;
display: block;
}
.footer a span {
width: 30px;
height: 30px;
background: url("../img/blue_phone_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
}
......@@ -32,9 +32,6 @@
</div>
<p>同策房屋</p>
</li>
<li class="col-xs-3">
<a class="btn btn-block" data-toggle="modal" data-target="#scoreDiv">评分</a>
</li>
</ul>
<h4>诚信宣言</h4>
<div id="people_wrapper">
......@@ -63,9 +60,14 @@
</div>
</div>
<footer class="footer navbar-fixed-bottom">
<a href="tel:{{ consultant_mobile }}" class="btn btn-phone">
<span></span>电话联系
</a>
<div class="btn-group btn-group-justified">
<a href="tel:{{ consultant_mobile }}" class="btn btn-phone">
<span></span>电话联系
</a>
<a data-toggle="modal" data-target="#scoreDiv" class="btn btn-phone">
评分
</a>
</div>
</footer>
<div class="loading" id="loading" style="display: none;">
<ul class="list-unstyled">
......@@ -238,7 +240,7 @@
ajax_get_house('{{ url }}', loading, searchData, tabPane);
}, 200);
}
});
})
});
</script>
</body>
......
......@@ -274,10 +274,10 @@
{% else %}
<a href="tel:{{item.mobile}}" class="btn btn-xs btn-phone">
{% endif %}
<span></span>电话联系
<span></span>电话
</a>
<a href="{{siteUrl}}?page=view&house_id={{hid}}&consultant_id={{item.id}}" class="btn btn-xs btn-booking">
<span></span>一键预约
<span></span>预约
</a>
</ol>
</li>
......
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