Commit 41f15dae by felix

Merge branch 'felix' into 'dev'

Felix

See merge request !2
parents 361cd587 4aa30a4b
<?php
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
class House {
public static function init_view(){
wp_enqueue_script('jquery-ui');
wp_enqueue_script('bootstrapjs');
wp_enqueue_style('jquery-ui_css');
wp_enqueue_style('bootstrapcss');
if(isset($_GET["updated"])){
echo "updated success";
}else{
global $wpdb;
$context = array();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
$context["photoType"] = SearchDao::searchPhotoType();
House::data_insert();
Timber::render("newhouse.html",$context);
}
}
public static function data_insert(){
global $wpdb;
date_default_timezone_set("Etc/GMT-8");;
//图片信息
$uploadedfile = $_FILES['files'];
//房源与类型以及面积信息
$data = $_POST["data"];
//获取新房信息,存入tospur_house表
$insert_tospur_house_array = array(
'name' => $_POST['name'],
'average_price' => $_POST['average_price'],
'latest_news' => $_POST['event'],
'address' => $_POST['address'],
'traffic' => $_POST['traffic'],
'periphery' => $_POST['periphery'],
'developer' => $_POST['developers'],
'check_in_time' => $_POST['check_in_time'],
'building_type' => $_POST['building_type'],
'property_age' => $_POST['property_age'],
'decoration' => $_POST['decoration'],
'covered_area' => $_POST['acreage'],
'volume_rate' => $_POST['volume_rate'],
'greening_rate' => $_POST['greening_rate'],
'households' => $_POST['households'],
'parking_spaces' => $_POST['parking_spaces'],
'property_management' => $_POST['property_management'],
'overview' => $_POST['overview'],
'city_id' => $_POST['baseCity'],
'district_id' => $_POST['baseAreaId'],
'plate_id' => $_POST["basePlateId"],
"room_id" => $_POST["baseRoom"],
"property_money" => $_POST["property_money"],
'creattime' => date("Y-m-d H:i:s"),
'user_id' => get_current_user_id()
);
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['name'] . '" and address="' . $_POST['address'] . '"', OBJECT);
if (!$res) {
$houseRes = $wpdb->insert('tospur_house', $insert_tospur_house_array);
if (!$houseRes) {
return 500;
}
$houseid = $wpdb->insert_id;
}
//主力房源的图片与房子信息关联插入数据库
foreach($uploadedfile["name"] as $key=> $value) {
$uploadParam = array(
"name" => $uploadedfile["name"][$key],
"type" => $uploadedfile["type"][$key],
"tmp_name" => $uploadedfile["tmp_name"][$key],
"error" => $uploadedfile["error"][$key],
"size" => $uploadedfile["size"][$key]
);
//因为file提交过来有一个空的数组,所以这里判断在filename不为空的情况下,再做后续操作
if ($uploadParam["name"] != "") {
//上传图片
if (!function_exists('wp_handle_upload')) {
require_once(ABSPATH . 'wp-admin/includes/file.php');
}
$overrides = array('test_form' => false);
$movefile = wp_handle_upload($uploadParam, $overrides);
$str = preg_replace('#^https?://#', '', $movefile["url"]);
$length = strpos($str, "/",strpos($str, "/")+1);
$url = substr($str,$length);
if ($movefile && !isset($movefile['error'])) {
//上传成功后将图片信息存入tospur_image表
$insert_image_array = array(
'name' => $uploadParam["name"],
'path' => $url,
'creattime' => date("Y-m-d H:i:s"),
'alt' => "",
'image_type' =>$data[$key]["type"]
);
//插入图片表
$imgRes = $wpdb->insert('tospur_image', $insert_image_array);
if (!$imgRes) {
return 501;
}
//获取插入图片的id
$imgid = $wpdb->insert_id;
//房源类型、面积与图片关联表
if($data[$key]["type"] == "0"){
$houseTypeArea = array(
'house_id' => $houseid,
"buildproperty_id" => $data["$key"]["buildProperty"],
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
);
$houseTypeAreaRes = $wpdb->insert('a_district_area', $houseTypeArea);
if (!$houseTypeAreaRes) {
return 502;
}
}
//将房源id与图片id储存到关联表中
$house_img_array = array(
'house_id' => $houseid,
'image_id' => $imgid,
);
$houseImgRes = $wpdb->insert('a_house_image', $house_img_array);
if (!$houseImgRes) {
return 503;
}
} else {
return $movefile['error'];
}
}
}
}
}
\ No newline at end of file
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://v3.bootcss.com/customize/?id=77eb5b80e2738ea76db2)
* Config saved to config.json and https://gist.github.com/77eb5b80e2738ea76db2
*/
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
mark {
background: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333333;
}
input,
button,
select,
textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
a {
color: #337ab7;
text-decoration: none;
}
a:hover,
a:focus {
color: #23527c;
text-decoration: underline;
}
a:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
figure {
margin: 0;
}
img {
vertical-align: middle;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.img-rounded {
border-radius: 6px;
}
.img-thumbnail {
padding: 4px;
line-height: 1.42857143;
background-color: #ffffff;
border: 1px solid #dddddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
display: inline-block;
max-width: 100%;
height: auto;
}
.img-circle {
border-radius: 50%;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eeeeee;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
[role="button"] {
cursor: pointer;
}
.modal-open {
overflow: hidden;
}
.modal {
display: none;
overflow: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.modal.fade .modal-dialog {
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
-o-transform: translate(0, -25%);
transform: translate(0, -25%);
-webkit-transition: -webkit-transform 0.3s ease-out;
-o-transition: -o-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal-dialog {
position: relative;
width: auto;
margin: 10px;
}
.modal-content {
position: relative;
background-color: #ffffff;
border: 1px solid #999999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
-webkit-background-clip: padding-box;
background-clip: padding-box;
outline: 0;
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000000;
}
.modal-backdrop.fade {
opacity: 0;
filter: alpha(opacity=0);
}
.modal-backdrop.in {
opacity: 0.5;
filter: alpha(opacity=50);
}
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
min-height: 16.42857143px;
}
.modal-header .close {
margin-top: -2px;
}
.modal-title {
margin: 0;
line-height: 1.42857143;
}
.modal-body {
position: relative;
padding: 15px;
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 1px solid #e5e5e5;
}
.modal-footer .btn + .btn {
margin-left: 5px;
margin-bottom: 0;
}
.modal-footer .btn-group .btn + .btn {
margin-left: -1px;
}
.modal-footer .btn-block + .btn-block {
margin-left: 0;
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
.modal-sm {
width: 300px;
}
}
@media (min-width: 992px) {
.modal-lg {
width: 900px;
}
}
.clearfix:before,
.clearfix:after,
.modal-footer:before,
.modal-footer:after {
content: " ";
display: table;
}
.clearfix:after,
.modal-footer:after {
clear: both;
}
.center-block {
display: block;
margin-left: auto;
margin-right: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
}
.affix {
position: fixed;
}
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://v3.bootcss.com/customize/?id=77eb5b80e2738ea76db2)
* Config saved to config.json and https://gist.github.com/77eb5b80e2738ea76db2
*//*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:hover,a:focus{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role="button"]{cursor:pointer}.modal-open{overflow:hidden}.modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transform:translate(0, -25%);-ms-transform:translate(0, -25%);-o-transform:translate(0, -25%);transform:translate(0, -25%);-webkit-transition:-webkit-transform 0.3s ease-out;-o-transition:-o-transform 0.3s ease-out;transition:transform 0.3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0, 0);-ms-transform:translate(0, 0);-o-transform:translate(0, 0);transform:translate(0, 0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);-webkit-background-clip:padding-box;background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.42857143px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.clearfix:before,.clearfix:after,.modal-footer:before,.modal-footer:after{content:" ";display:table}.clearfix:after,.modal-footer:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right !important}.pull-left{float:left !important}.hide{display:none !important}.show{display:block !important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none !important}.affix{position:fixed}
\ No newline at end of file
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*!
* Generated using the Bootstrap Customizer (http://v3.bootcss.com/customize/?id=77eb5b80e2738ea76db2)
* Config saved to config.json and https://gist.github.com/77eb5b80e2738ea76db2
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(t){"use strict";var e=t.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(t){"use strict";function e(e,o){return this.each(function(){var s=t(this),n=s.data("bs.modal"),r=t.extend({},i.DEFAULTS,s.data(),"object"==typeof e&&e);n||s.data("bs.modal",n=new i(this,r)),"string"==typeof e?n[e](o):r.show&&n.show(o)})}var i=function(e,i){this.options=i,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};i.VERSION="3.3.5",i.TRANSITION_DURATION=300,i.BACKDROP_TRANSITION_DURATION=150,i.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},i.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},i.prototype.show=function(e){var o=this,s=t.Event("show.bs.modal",{relatedTarget:e});this.$element.trigger(s),this.isShown||s.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(e){t(e.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var s=t.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),s&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var n=t.Event("shown.bs.modal",{relatedTarget:e});s?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(n)}).emulateTransitionEnd(i.TRANSITION_DURATION):o.$element.trigger("focus").trigger(n)}))},i.prototype.hide=function(e){e&&e.preventDefault(),e=t.Event("hide.bs.modal"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(i.TRANSITION_DURATION):this.hideModal())},i.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},i.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},i.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},i.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},i.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},i.prototype.backdrop=function(e){var o=this,s=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=t.support.transition&&s;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+s).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy(function(t){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;n?this.$backdrop.one("bsTransitionEnd",e).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):e()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var r=function(){o.removeBackdrop(),e&&e()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",r).emulateTransitionEnd(i.BACKDROP_TRANSITION_DURATION):r()}else e&&e()},i.prototype.handleUpdate=function(){this.adjustDialog()},i.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},i.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},i.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},i.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",t+this.scrollbarWidth)},i.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},i.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var o=t.fn.modal;t.fn.modal=e,t.fn.modal.Constructor=i,t.fn.modal.noConflict=function(){return t.fn.modal=o,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(i){var o=t(this),s=o.attr("href"),n=t(o.attr("data-target")||s&&s.replace(/.*(?=#[^\s]+$)/,"")),r=n.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(s)&&s},n.data(),o.data());o.is("a")&&i.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){o.is(":visible")&&o.trigger("focus")})}),e.call(n,r,this)})}(jQuery);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
class Config {
//table name
const DIC_CITY_TABLE = 'dic_city';
const DIC_ROOM_TABLE = 'dic_room';
const DIC_BUILDPROPERTY_TABLE = 'dic_buildproperty';
const DIC_AREA_TABLE = 'dic_area';
const DIC_UNITPRICERANGE_TABLE = 'dic_unitpricerange';
const DIC_TOTALPRICE_TABLE = 'dic_totalprice';
const DIC_PHOTOTYPE_TABLE = "dic_phototype";
const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization';
const TOSPUR_CONSULTANT = 'tospur_consultant';
//sync url
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
const other_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetCommonPlate?radomPla=123456';
const organization_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetOrgnaziTion?radomOrg=123456';
}
\ No newline at end of file
<?php <?php
class SearchDao{ class SearchDao{
public function __construct() {
require_once(PLUGIN_DIR . '\TCSync.php');
}
public static function ajax_serachCity(){ public static function ajax_serachCity(){
wp_send_json(SearchDao::searchCity($_GET["cityId"],$_GET['districtId'])); wp_send_json(SearchDao::searchCity($_GET["cityId"],$_GET['districtId']));
} }
...@@ -13,16 +9,20 @@ class SearchDao{ ...@@ -13,16 +9,20 @@ class SearchDao{
$selectName = "cityId as id,cityName as value"; $selectName = "cityId as id,cityName as value";
$where = " where 1=1 "; $where = " where 1=1 ";
$groupBy = " group by cityId"; $groupBy = " group by cityId";
$params = array();
if($cityId != NULL && $districtId == NULL){ if($cityId != NULL && $districtId == NULL){
$selectName = "districtId as id,districtName as value"; $selectName = "districtId as id,districtName as value";
$where .= " and cityId =".$cityId; $where .= " and cityId = %d";
$params[] = $cityId;
$groupBy = " group by districtId"; $groupBy = " group by districtId";
}else if($cityId != NULL && $districtId != NULL){ }else if($cityId != NULL && $districtId != NULL){
$selectName = "plateId as id,plateName as value"; $selectName = "plateId as id,plateName as value";
$where .= " and cityId = ".$cityId." and districtId = ".$districtId; $where .= " and cityId = %d and districtId = %d";
$params[] = $cityId;
$params[] = $districtId;
$groupBy = ""; $groupBy = "";
} }
$result = $wpdb->get_results('select '.$selectName.' from '.TCSync::DIC_CITY_TABLE.$where.$groupBy); $result = $wpdb->get_results($wpdb->prepare('select '.$selectName.' from '.Config::DIC_CITY_TABLE.$where.$groupBy,$params));
return $result; return $result;
} }
...@@ -34,9 +34,9 @@ class SearchDao{ ...@@ -34,9 +34,9 @@ class SearchDao{
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
if(isset($_GET['cityId'])){ if(isset($_GET['cityId'])){
$where .= " and cityId = ".$cityId; $where .= " and cityId = %d";
} }
$result = $wpdb->get_results('select id,priceValue as value from '.TCSync::DIC_AREA_TABLE.$where); $result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from '.Config::DIC_AREA_TABLE.$where,$cityId));
return $result; return $result;
} }
...@@ -46,7 +46,7 @@ class SearchDao{ ...@@ -46,7 +46,7 @@ class SearchDao{
public static function searchBuildProperty(){ public static function searchBuildProperty(){
global $wpdb; global $wpdb;
$result = $wpdb->get_results('select value as id,literal as value from '.TCSync::DIC_BUILDPROPERTY_TABLE); $result = $wpdb->get_results('select value as id,literal as value from '.Config::DIC_BUILDPROPERTY_TABLE);
return $result; return $result;
} }
...@@ -56,7 +56,7 @@ class SearchDao{ ...@@ -56,7 +56,7 @@ class SearchDao{
public static function searchRoom(){ public static function searchRoom(){
global $wpdb; global $wpdb;
$result = $wpdb->get_results('select value as id,literal as value from '.TCSync::DIC_ROOM_TABLE); $result = $wpdb->get_results('select value as id,literal as value from '.Config::DIC_ROOM_TABLE);
return $result; return $result;
} }
...@@ -68,9 +68,9 @@ class SearchDao{ ...@@ -68,9 +68,9 @@ class SearchDao{
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
if(isset($_GET['cityId'])){ if(isset($_GET['cityId'])){
$where .= " and cityId = ".$cityId; $where .= " and cityId = %d";
} }
$result = $wpdb->get_results('select id,priceValue as value from '.TCSync::DIC_UNITPRICERANGE_TABLE.$where); $result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from '.Config::DIC_UNITPRICERANGE_TABLE.$where,$cityId));
return $result; return $result;
} }
...@@ -84,7 +84,7 @@ class SearchDao{ ...@@ -84,7 +84,7 @@ class SearchDao{
if(isset($_GET['cityId'])){ if(isset($_GET['cityId'])){
$where .= " and cityId = ".$cityId; $where .= " and cityId = ".$cityId;
} }
$result = $wpdb->get_results('select id,priceValue as value from '.TCSync::DIC_TOTALPRICE_TABLE.$where); $result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from '.Config::DIC_TOTALPRICE_TABLE.$where,$cityId));
return $result; return $result;
} }
...@@ -98,13 +98,13 @@ class SearchDao{ ...@@ -98,13 +98,13 @@ class SearchDao{
if($parentId != NULL){ if($parentId != NULL){
$where .= " and ParentId =".$parentId; $where .= " and ParentId =".$parentId;
} }
$result = $wpdb->get_results('select Id as id,Name as name from '.TCSync::TOSPUR_ORGANIZATION_TABLE.$where); $result = $wpdb->get_results($wpdb->prepare('select Id as id,Name as name from '.Config::TOSPUR_ORGANIZATION_TABLE.$where,$parentId));
return $result; return $result;
} }
public static function getCityNameWithId($cityId){ public static function getCityNameWithId($cityId){
global $wpdb; global $wpdb;
$result = $wpdb->get_var("select cityName from ".TCSync::DIC_CITY_TABLE." where cityId = ".$cityId); $result = $wpdb->get_var($wpdb->prepare("select cityName from ".Config::DIC_CITY_TABLE." where cityId = %d",$cityId));
if($result){ if($result){
return $result; return $result;
}else{ }else{
...@@ -112,7 +112,68 @@ class SearchDao{ ...@@ -112,7 +112,68 @@ class SearchDao{
} }
} }
public static function getWorkUser(){ public static function ajax_searchHouse(){
wp_send_json(SearchDao::searchHouse($_GET["cityId"],$_GET["districtId"],$_GET["plateId"],$_GET["buildPropertyId"],$_GET["roomId"],$_GET["acreage"],$_GET["totalPrice"],$_GET["searchText"]));
}
public static function searchHouse($cityId = 0,$districtId = 0,$plateId = 0,$buildPropertyId = 0,$roomId = 0,$acreage = 0,$totalPrice = 0,$searchText = NULL){
global $wpdb;
$params = array();
$sql = "select * from tospur_house th
left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id
left join dic_city dc on th.plate_id = dc.plateId
left join (select * from a_house_image group by house_id) hi on th.id = hi.house_id
left join (select id,name as iname,path,creattime as itime,alt,image_type from tospur_image) i on hi.image_id = i.id where 1=1";
if($cityId!=0 ){
$params[] = $cityId;
$sql = $sql." and cityId=%d";
}
if($districtId != 0 ){
$params[] = $districtId;
$sql = $sql." and districtId=%d";
}
if($plateId != 0){
$params[] = $plateId;
$sql = $sql." and plateId=%d";
}
if( $buildPropertyId != 0){
$params[] = $buildPropertyId;
$sql = $sql." and buildproperty_id=%d";
}
if($roomId!=0){
$params[] = $roomId;
$sql = $sql." and room_id=%d";
}
if($acreage!=0){
$areaArray = explode("-",$acreage);
$params[] = $areaArray[0];
$params[] = $areaArray[1];
$sql = $sql." and covered_area between %d and %d";
}
if($totalPrice!=0){
$priceArray = explode("-",$totalPrice);
$params[] = $priceArray[0];
$params[] = $priceArray[1];
$sql = $sql." and total_price between %d and %d";
}
if($searchText!=0){
$params[] = "%".$searchText."%";
$sql = $sql." and name like %s";
}
$sql = $sql." group by bph_id order by th.creattime DESC";
print_r($wpdb->prepare($sql,$params));
$result = $wpdb->get_results($wpdb->prepare($sql,$params));
return $result;
}
public static function ajax_searchPhotoType(){
wp_send_json(SearchDao::searchPhotoType());
}
public static function searchPhotoType(){
global $wpdb;
$result = $wpdb->get_results('select id,photo_name as value from '.Config::DIC_PHOTOTYPE_TABLE);
return $result;
} }
} }
\ No newline at end of file
<?php
class TCSync {
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
public static function user_sync(){
$response = wp_remote_post( TCSync::user_url );
$res = array(
'code' => 200,
'msg' => "success"
);
//判断请求是否成功
if( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ){
$res['code'] = 500;
$res['msg'] = "get user info error";
}else{
set_time_limit(0) ;
//获取请求内容
$result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true);
foreach($result['data'] as $item){
if(username_exists($item['WorkNum'])){
$user = get_user_by( "login", $item['WorkNum'] );
$userdata = array(
'ID' => $user->data->ID,
'display_name' => $item['Name']
);
$user_id = wp_update_user( $userdata ) ;
}else{
$userdata = array(
'user_login' => $item['WorkNum'],
'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected.
'role' => 'editor',
'wp_user_level' => 7,
'display_name' => $item['Name']
);
$user_id = wp_insert_user( $userdata ) ;
}
if(is_numeric($user_id) && !is_null($item['ImageUrl'])){
update_user_meta( $user_id, "tc_image", $item['ImageUrl'] );
}
}
}
return $res;
}
}
\ No newline at end of file
<?php <?php
require_once(PLUGIN_DIR . 'Config.php');
class TCSync { class TCSync {
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
const other_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetCommonPlate?radomPla=123456';
const organization_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetOrgnaziTion?radomOrg=123456';
const DIC_CITY_TABLE = 'dic_city';
const DIC_ROOM_TABLE = 'dic_room';
const DIC_BUILDPROPERTY_TABLE = 'dic_buildproperty';
const DIC_AREA_TABLE = 'dic_area';
const DIC_UNITPRICERANGE_TABLE = 'dic_unitpricerange';
const DIC_TOTALPRICE_TABLE = 'dic_totalprice';
const TOSPUR_ORGANIZATION_TABLE = 'tospur_organization';
public static function user_sync(){ public static function user_sync(){
$response = wp_remote_post( TCSync::user_url ); global $wpdb;
$response = wp_remote_post( Config::user_url );
$res = array( $res = array(
'code' => 200, 'code' => 200,
'msg' => "success" 'msg' => "success"
...@@ -46,9 +36,14 @@ class TCSync { ...@@ -46,9 +36,14 @@ class TCSync {
$user_id = wp_insert_user( $userdata ) ; $user_id = wp_insert_user( $userdata ) ;
} }
if(is_numeric($user_id)){ if(is_numeric($user_id)){
if(!is_null($item['ImageUrl'])) $info = array(
update_user_meta( $user_id, "tc_image", $item['ImageUrl'] ); 'id' => $user_id,
update_user_meta( $user_id, "tc_cityId", $item['CityId'] ); 'cityId' => $item['CityId'],
'imageUrl' => $item['ImageUrl'],
'mobile' => $item['Mobile'],
'name' => $item['Name']
);
$wpdb->query(TCSync::create_insert_update_sql(Config::TOSPUR_CONSULTANT,$info,array('id')));
} }
} }
} }
...@@ -57,7 +52,7 @@ class TCSync { ...@@ -57,7 +52,7 @@ class TCSync {
public static function other_sync(){ public static function other_sync(){
global $wpdb; global $wpdb;
$response = wp_remote_post( TCSync::other_url ); $response = wp_remote_post( Config::other_url );
$res = array( $res = array(
'code' => 200, 'code' => 200,
'msg' => "success" 'msg' => "success"
...@@ -73,33 +68,33 @@ class TCSync { ...@@ -73,33 +68,33 @@ class TCSync {
$result = json_decode($result,true); $result = json_decode($result,true);
//print_r($result['data']['CityList']); //print_r($result['data']['CityList']);
foreach($result['data']['CityList'] as $item){ foreach($result['data']['CityList'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_CITY_TABLE,$item,array('plateId'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_CITY_TABLE,$item,array('plateId')));
//print_r(TCSync::create_insert_update_sql(TCSync::CITY_TABLE,$item,array('plateId')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::CITY_TABLE,$item,array('plateId')));print_r("<br />");
} }
foreach($result['data']['RoomStyle'] as $item){ foreach($result['data']['RoomStyle'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_ROOM_TABLE,$item,array('id'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_ROOM_TABLE,$item,array('id')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_ROOM_TABLE,$item,array('id')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_ROOM_TABLE,$item,array('id')));print_r("<br />");
} }
foreach($result['data']['BulidProperty'] as $item){ foreach($result['data']['BulidProperty'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_BUILDPROPERTY_TABLE,$item,array('id'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_BUILDPROPERTY_TABLE,$item,array('id')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_BUILDPROPERTY_TABLE,$item,array('id')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_BUILDPROPERTY_TABLE,$item,array('id')));print_r("<br />");
} }
foreach($result['data']['AreaRange'] as $item){ foreach($result['data']['AreaRange'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_AREA_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_AREA_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />");
} }
foreach($result['data']['TotalPrice'] as $item){ foreach($result['data']['TotalPrice'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_TOTALPRICE_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_TOTALPRICE_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />");
} }
foreach($result['data']['UnitPriceRange'] as $item){ foreach($result['data']['UnitPriceRange'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::DIC_UNITPRICERANGE_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min'))); $wpdb->query(TCSync::create_insert_update_sql(Config::DIC_UNITPRICERANGE_TABLE,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />");
} }
} }
...@@ -107,7 +102,7 @@ class TCSync { ...@@ -107,7 +102,7 @@ class TCSync {
public static function organization_sync(){ public static function organization_sync(){
global $wpdb; global $wpdb;
$response = wp_remote_post( TCSync::organization_url ); $response = wp_remote_post( Config::organization_url );
$res = array( $res = array(
'code' => 200, 'code' => 200,
'msg' => "success" 'msg' => "success"
...@@ -121,8 +116,8 @@ class TCSync { ...@@ -121,8 +116,8 @@ class TCSync {
$result = wp_remote_retrieve_body( $response ); $result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true); $result = json_decode($result,true);
foreach($result['data'] as $item){ foreach($result['data'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(TCSync::TOSPUR_ORGANIZATION_TABLE,$item,array('Id'))); $wpdb->query(TCSync::create_insert_update_sql(Config::TOSPUR_ORGANIZATION_TABLE,$item,array('Id')));
//print_r(TCSync::create_insert_update_sql(TCSync::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />"); //print_r(TCSync::create_insert_update_sql(Config::DIC_AREA,$item,array('id'),array('maxValue'=>'max','minValue'=>'min')));print_r("<br />");
} }
} }
} }
......
...@@ -17,8 +17,58 @@ function tospur_init() ...@@ -17,8 +17,58 @@ function tospur_init()
require_once('view_house.php'); require_once('view_house.php');
require_once(PLUGIN_DIR . 'Tools\TCSync.php'); require_once(PLUGIN_DIR . 'Tools\TCSync.php');
require_once(PLUGIN_DIR . 'Dao\SearchDao.php'); require_once(PLUGIN_DIR . 'Dao\SearchDao.php');
add_action('admin_menu', 'create_menu'); require_once(PLUGIN_DIR . 'Admin\House.php');
add_action('admin_menu', 'reset_menu');
$type = $_POST["type"];
if($type==1){
wp_redirect("?page=newHouse&updated=true");
}
tospur_register_script_style();
tospur_ajax_set(); tospur_ajax_set();
tospur_theme_format();
}
function tospur_theme_format(){
//移除
add_filter('admin_footer_text', tospur_remove_admin_footer_text, 1000);
add_filter('update_footer', tospur_remove_admin_footer_upgrade, 1000);
add_action('login_enqueue_scripts', 'tospur_login_logo');
//admin bar
add_action('wp_before_admin_bar_render', 'tospur_remove_admin_bar');
function tospur_remove_admin_footer_text($footer_text =''){
return '';
}
function tospur_remove_admin_footer_upgrade($footer_text =''){
return '';
}
function tospur_remove_admin_bar(){
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
$wp_admin_bar->remove_menu('updates');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('edit-profile');
$wp_admin_bar->remove_menu('view-site');
$wp_admin_bar->remove_menu('user-info');
}
function tospur_login_logo()
{ ?>
<style type="text/css">
.login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/fnl.jpg);
padding-bottom: 30px;
}
</style>
<?php }
}
function tospur_register_script_style(){
wp_register_script('jquery-ui',plugins_url('Admin/views', __FILE__)."/js/jquery-ui.js");
wp_register_script('bootstrapjs',plugins_url('Admin/views', __FILE__)."/js/bootstrap.min.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");
} }
function tospur_ajax_set() function tospur_ajax_set()
...@@ -37,6 +87,8 @@ function tospur_ajax_set() ...@@ -37,6 +87,8 @@ function tospur_ajax_set()
add_action('wp_ajax_nopriv_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice'); add_action('wp_ajax_nopriv_searchTotalPrice', 'SearchDao::ajax_searchTotalPrice');
add_action('wp_ajax_searchOrganization', 'SearchDao::ajax_searchOrganization'); add_action('wp_ajax_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization'); add_action('wp_ajax_nopriv_searchOrganization', 'SearchDao::ajax_searchOrganization');
add_action( 'wp_ajax_searchHouse', 'SearchDao::ajax_searchHouse' );
add_action( 'wp_ajax_nopriv_searchHouse', 'SearchDao::ajax_searchHouse');
//后台处理 置业顾问评分 //后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score'); add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
...@@ -59,7 +111,6 @@ function valid_consultant_score() ...@@ -59,7 +111,6 @@ function valid_consultant_score()
wp_send_json($array); wp_send_json($array);
} }
} }
function update_consultant() function update_consultant()
{ {
$house_id = $_POST['id']; $house_id = $_POST['id'];
...@@ -76,13 +127,46 @@ function update_consultant() ...@@ -76,13 +127,46 @@ function update_consultant()
} }
} }
function create_menu() function reset_menu()
{ {
add_menu_page("talbe_test", "table_test", "manage_options", "1", "create_table"); add_menu_page("talbe_test", "table_test", "manage_options", "1", "create_table");
add_menu_page( 'newHouse_title', '新房信息', 'manage_options', 'newHouse', 'House::init_view', 'dashicons-admin-tools', 6 );
//移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 );
global $menu;
$restricted = array(
__('Dashboard'),
__('Posts'),
__('latestnews'),
__('Media'),
__('Links'),
__('Pages'),
__('Appearance'),
__('Tools'),
__('Users'),
__('Settings'),
__('Comments'),
__('Plugins'),
);
end($menu);
while (prev($menu)) {
$value = explode(' ', $menu[key($menu)][0]);
if (strpos($value[0], '<') === FALSE) {
if (in_array($value[0] != NULL ? $value[0] : "", $restricted)) {
unset($menu[key($menu)]);
}
} else {
$value2 = explode('<', $value[0]);
if (in_array($value2[0] != NULL ? $value2[0] : "", $restricted)) {
unset($menu[key($menu)]);
}
}
}
} }
function create_table() function create_table()
{ {
TCSync::user_sync(); //TCSync::user_sync();
//TCSync::organization_sync(); TCSync::organization_sync();
TCSync::other_sync();
} }
...@@ -118,20 +118,33 @@ ...@@ -118,20 +118,33 @@
//do somthing //do somthing
$(".btn-group").removeClass("open"); $(".btn-group").removeClass("open");
console.log(JSON.stringify(searchData)); console.log(JSON.stringify(searchData));
getHouse();
} }
} }
}); });
var searchData = {
cityId:{{cityId}},
districtId:0,
plateId:0,
totalPrice:'',
buildPropertyId:0,
roomId:0,
acreage:'',
searchText:''
};
}); });
var searchData = {
action:"searchHouse",
cityId:{{cityId}},
districtId:0,
plateId:0,
totalPrice:'',
buildPropertyId:0,
roomId:0,
acreage:'',
searchText:''
};
function getHouse(){
$.ajax({
type: "GET",
url: "/tospur/wp-admin/admin-ajax.php",
data: searchData,
success:function(json){
alert(JSON.stringify(json));
}
});
}
</script> </script>
</head> </head>
<body> <body>
......
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