Commit 3414a351 by felix

每日一更

parent 5cfde9dd
......@@ -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">
<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=feature_list';
break;
case 2001:
alert('不能重复添加特色');
break;
default:
break;
}
}
});
} else {
alert('请输入特色');
}
});
});
})(jQuery);
</script>
\ No newline at end of file
......@@ -2,7 +2,24 @@
<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 () {
......@@ -13,10 +30,15 @@
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_feature&name=' + name,
success: function (data) {
if (data) {
alert('添加成功');
} else {
alert('添加失败');
switch (data.code) {
case 2000:
window.location.href = admin_url + 'admin.php?page=add_feature';
break;
case 2001:
alert('不能重复添加特色');
break;
default:
break;
}
}
});
......
<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
......@@ -23,6 +23,7 @@ class Config {
const TOSPUR_TAG_TABLE = 'tospur_tag';
const TOSPUR_VIEW_HOUSE_TABLE = 'tospur_view_house';
const TOSPUR_VERIFY_TABLE = 'tospur_verify';
const TOSPUR_SALE_TABLE = 'tospur_sale';
const WP_USERS_TABLE = 'wp_users';
......
......@@ -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
<?php
require_once(PLUGIN_DIR . 'Config.php');
class TospurDao
{
//insert 预约看房
public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id)
{
$insert_view_house_array = array(
'house_id' => $house_id,
'user_id' => $user_id,
'date' => $date,
'time_index' => $index,
'time' => $time,
'consultant_id' => $consultant_id,
'handle' => 0
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_VIEW_HOUSE_TABLE, $insert_view_house_array);
return $result;
}
public static function update_view_house($id)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_VIEW_HOUSE_TABLE, array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s')
), array(
'id' => $id
));
return $result;
}
public static function update_view_house_consultant($house_id, $consultant_id)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_VIEW_HOUSE_TABLE, array(
'consultant_id' => $consultant_id
), array(
'id' => $house_id
));
return $result;
}
//search 预约看房 user_id
public static function search_view_house_by_user_id($user_id)
{
global $wpdb;
$sql = 'select v.house_id,v.date,v.time,v.consultant_id,v.handle,h.name from ' . Config::TOSPUR_VIEW_HOUSE_TABLE . ' v ' .
'left join ' . Config::TOSPUR_HOUSE_TABLE . ' h on v.house_id = h.id ' .
'where v.user_id = ' . $user_id . ' order by v.date desc';
return $wpdb->get_results($sql);
}
//search 预约看房 consultant_id
public static function search_view_house_by_consultant_id($consultant_id)
{
global $wpdb;
$sql = 'select v.id,v.house_id,v.date,v.time,v.user_id,v.handle,h.name from ' . Config::TOSPUR_VIEW_HOUSE_TABLE . ' v ' .
'left join ' . Config::TOSPUR_HOUSE_TABLE . ' h on v.house_id = h.id ' .
'where v.consultant_id = ' . $consultant_id . ' order by v.date desc';
return $wpdb->get_results($sql);
}
//insert 置业顾问评分
public static function insert_consultant_score($consultant_id, $user_id, $score, $valid = 1)
{
$insert_consultant_score_array = array(
'consultant_id' => $consultant_id,
'user_id' => $user_id,
'score' => $score,
'valid' => $valid
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_CONSULTANT_SCORE_TABLE, $insert_consultant_score_array);
return $result;
}
public static function search_score_type($user_id, $consultant_id)
{
global $wpdb;
$sql = 'select type from (SELECT user_id,consultant_id,handle_date,1 as type FROM ' . Config::TOSPUR_VIEW_HOUSE_TABLE .
' where handle = 1 and user_id = ' . $user_id . ' and consultant_id = ' . $consultant_id . ' UNION' .
' SELECT user_id,consultant_id,handle_date,2 as type FROM ' . Config::TOSPUR_SALE_TABLE .
' where handle = 1 and user_id = ' . $user_id . ' and consultant_id = ' . $consultant_id . ') as u' .
' order by handle_date desc limit 1';
return $wpdb->get_var($sql);
}
//search 置业顾问信息
public static function search_consultant_info($consultant_id)
{
global $wpdb;
$sql = 'select c.*,u.display_name,s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' .
'left join ' . Config::WP_USERS_TABLE . ' u on c.id = u.ID ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' group by consultant_id) s ' .
'on c.id = s.consultant_id where c.id = ' . $consultant_id;
return $wpdb->get_row($sql);
}
public static function update_consultant_score($score_id, $valid)
{
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONSULTANT_SCORE_TABLE, array(
'valid' => $valid
), array(
'id' => $score_id
));
return $result;
}
public static function search_tospur_verify($phone, $code)
{
global $wpdb;
$sql = 'select code from ' . Config::TOSPUR_VERIFY_TABLE . ' where phone = ' . $phone . ' and status = 0 ' .
'and create_time > NOW() - INTERVAL 30 MINUTE ' .
'order by create_time desc limit 1';
return $wpdb->get_var($sql);
}
public static function insert_tospur_verify($phone, $code)
{
$insert_tospur_verify_array = array(
'phone' => $phone,
'code' => $code,
'create_time' => current_time('Y-m-d H:i:s'),
'status' => 0
);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_VERIFY_TABLE, $insert_tospur_verify_array);
return $result;
}
public static function update_tospur_verify($phone)
{
global $wpdb;
$wpdb->update(Config::TOSPUR_VERIFY_TABLE, array(
'status' => 1
), array(
'phone' => $phone
));
}
public static function search_consultant_by_city($city_id, $index)
{
global $wpdb;
$consultant_sql = 'select c.*,u.display_name,s.average_score from ' . Config::TOSPUR_CONSULTANT . ' c ' .
'left join ' . Config::WP_USERS_TABLE . ' u on c.id = u.ID ' .
'left join (select consultant_id,sum(score)/count(score) as average_score from ' . Config::TOSPUR_CONSULTANT_SCORE_TABLE . ' where valid=1 group by consultant_id) s on c.id = s.consultant_id ' .
'where cityid = ' . $city_id . ' LIMIT ' . $index . ',20;';
return $wpdb->get_results($consultant_sql);
}
public static function insert_tospur_sale($post)
{
$post['submission_date'] = current_time('Y-m-d H:i:s');
unset($post['action']);
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_SALE_TABLE, $post);
return $result;
}
}
?>
\ No newline at end of file
......@@ -121,7 +121,7 @@ class consultantScoreList extends WP_List_Table
{
global $wpdb;
$per_page = 5;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
......
......@@ -16,6 +16,7 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Tools/TCSync.php');
require_once(PLUGIN_DIR . 'Tools/Image.php');
require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/TospurDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
......@@ -71,6 +72,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");
......@@ -111,7 +114,7 @@ function valid_consultant_score()
$score_id = $_POST['id'];
$valid = $_POST['valid'];
if (isset($score_id) && isset($valid)) {
$result = dao::update_consultant_score($score_id, $valid);
$result = TospurDao::update_consultant_score($score_id, $valid);
$array = array();
if ($result) {
$array['code'] = 2000;
......@@ -126,7 +129,7 @@ function update_consultant()
$house_id = $_POST['id'];
$consultant_id = $_POST['consultant_id'];
if (isset($consultant_id) && isset($house_id)) {
$result = dao::update_view_house_consultant($house_id, $consultant_id);
$result = TospurDao::update_view_house_consultant($house_id, $consultant_id);
$array = array();
if ($result) {
$array['code'] = 2000;
......@@ -144,7 +147,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');
......
......@@ -85,7 +85,7 @@ class viewHouseList extends WP_List_Table
{
global $wpdb;
$per_page = 5;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
//$sortable = $this->get_sortable_columns();
......
......@@ -7,7 +7,6 @@ $current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$current_user = wp_get_current_user();
$consultant_id = isset($_GET['consultant_id'])?$_GET['consultant_id']:$current_user->ID;
$context['consultant_id'] = $consultant_id;
$context['consultant'] = get_consultant_info($consultant_id);
......
......@@ -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;
}
......@@ -356,31 +356,41 @@ body {
a:hover {
text-decoration: none;
}
.main {
#wrapper {
position: absolute;
z-index: 1;
top: 40px;
bottom: 0;
left: 0;
width: 100%;
padding-bottom: 5%;
overflow: hidden;
}
#wrapper #scroller {
padding-bottom: 15px;
}
.main ul li {
#wrapper #scroller ul li {
margin: 0 15px;
padding: 13px 0;
height: 60px;
line-height: 60px;
border-bottom: 1px solid #b7b7b7;
color: #7d7d7d;
font-size: 18px;
overflow: hidden;
}
.main ul li label {
#wrapper #scroller ul li label {
margin-bottom: 0;
padding: 5px 0 0 4px;
padding: 0 0 0 4px;
}
.main ul li p {
#wrapper #scroller ul li p {
margin-bottom: 0;
padding: 0;
height: 100%;
}
.main ul li p .form-control {
#wrapper #scroller ul li p .form-control {
color: #7d7d7d;
font-size: 18px;
background-color: transparent;
border-color: transparent;
border: 0;
display: inline-block;
box-shadow: none;
-webkit-box-shadow: none;
......@@ -394,29 +404,34 @@ a:hover {
-webkit-border-bottom-right-radius: 0;
-webkit-appearance: none;
}
.main ul li p .form-control::-webkit-input-placeholder {
#wrapper #scroller ul li p .form-control::-webkit-input-placeholder {
color: #7d7d7d;
}
.main ul li p .form-control::-webkit-outer-spin-button,
.main ul li p .form-control::-webkit-inner-spin-button {
#wrapper #scroller ul li p .form-control::-webkit-outer-spin-button,
#wrapper #scroller ul li p .form-control::-webkit-inner-spin-button {
-webkit-appearance: none !important;
margin: 0;
}
.main ul li p .form-control.width-sm {
width: 45px;
#wrapper #scroller ul li p .form-control.width-sm {
width: 36px;
padding: 6px;
}
.main ul li p textarea.form-control {
#wrapper #scroller ul li p textarea.form-control {
resize: none;
background-color: #ffffff;
border-color: #e9e9e9;
border: 1px solid #e9e9e9;
}
.main ul li:last-child {
border-bottom: 0;
#wrapper #scroller ul li p em {
font-size: 9px;
position: relative;
top: -6px;
font-style: normal;
}
.main ul li:last-child label {
margin-bottom: 18px;
#wrapper #scroller ul li:last-child {
height: auto;
border-bottom: 0;
}
.main .btn {
#wrapper #scroller .btn {
width: 86%;
display: block;
color: #ffffff;
......@@ -435,9 +450,9 @@ a:hover {
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.main .btn:active {
#wrapper #scroller .btn:active {
background-color: #117bb9;
}
.main .btn:focus {
#wrapper #scroller .btn:focus {
outline: 0;
}
......@@ -14,10 +14,10 @@ if ($_POST) {
} else if (!$password) {
$context['error'] = '请输入新密码';
} else {
$search_code = dao::search_tospur_verify($phone, $code);
$search_code = TospurDao::search_tospur_verify($phone, $code);
if ($code == $search_code) {
wp_set_password($password, $user->data->ID);
dao::update_tospur_verify($phone);
TospurDao::update_tospur_verify($phone);
$context['error'] = '成功修改密码';
} else {
$context['error'] = '验证码错误';
......
<?php
require_once(dirname(__FILE__) . '/dao.php');
require_once('const.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/TospurDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Dao/SearchDao.php');
require_once(dirname(__FILE__) . '/../../plugins/tospur/Tools/Image.php');
......@@ -35,9 +36,6 @@ function page_template($template)
case 'consultant_list':
$page = $theme . '/consultant_list.php';
break;
case 'score':
$page = $theme . '/score.php';
break;
case 'comment':
$page = $theme . '/comment.php';
break;
......@@ -53,6 +51,12 @@ function page_template($template)
case 'loan_calculator':
$page = $theme . '/loan_calculator.php';
break;
case 'manager':
$page = $theme . '/manager.php';
break;
case 'sale':
$page = $theme . '/sale.php';
break;
}
return $page;
} else {
......@@ -85,7 +89,7 @@ function send_code()
$array['code'] = 2002;
} else {
$code = generate_code();
$insert_result = dao::insert_tospur_verify($phone, strtolower($code));
$insert_result = TospurDao::insert_tospur_verify($phone, strtolower($code));
$response = wp_remote_post('http://218.1.67.130:8988/api/NanTongWechat/MobileSendMessage' .
'?mobilePhone=' . $phone . '&VerificationCode=' . $code
);
......@@ -114,7 +118,7 @@ function view_house()
$date = $_POST['date'];
}
$time = (9 + $index) . ':00-' . (10 + $index) . ':00';
$result = dao::insert_view_house($_POST['house_id'], $_POST['user_id'], $date, $index, $time, $_POST['consultant_id']);
$result = TospurDao::insert_view_house($_POST['house_id'], $_POST['user_id'], $date, $index, $time, $_POST['consultant_id']);
$array = array();
if ($result) {
$array['code'] = 2000;
......@@ -131,7 +135,7 @@ function handle_view_house()
{
$id = $_POST['id'];
if (isset($id)) {
$result = dao::update_view_house($id);
$result = TospurDao::update_view_house($id);
$array = array();
if ($result) {
$array['code'] = 2000;
......@@ -147,12 +151,18 @@ add_action('wp_ajax_add_score', 'add_consultant_score');
function add_consultant_score()
{
if (isset($_POST['score'])) {
$result = dao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score']);
$type = TospurDao::search_score_type($_POST['user_id'], $_POST['consultant_id']);
$result = null;
if ($type) {
$result = TospurDao::insert_consultant_score($_POST['consultant_id'], $_POST['user_id'], $_POST['score']);
}
$array = array();
if ($result) {
if ($type && $result) {
$array['code'] = 2000;
} else {
} else if(!$type){
$array['code'] = 2001;
} else if(!$result){
$array['code'] = 2002;
}
wp_send_json($array);
}
......@@ -161,14 +171,14 @@ function add_consultant_score()
//置业顾问信息
function get_consultant_info($consultant_id)
{
return dao::search_consultant_info($consultant_id);
return TospurDao::search_consultant_info($consultant_id);
}
add_action('wp_ajax_get_consultant', 'get_consultant');
function get_consultant()
{
if (isset($_POST['city_id']) && isset($_POST['index'])) {
$result = dao::search_consultant_by_city($_POST['city_id'], $_POST['index']);
$result = TospurDao::search_consultant_by_city($_POST['city_id'], $_POST['index']);
$array = array();
if ($result) {
$array['code'] = 2000;
......@@ -224,7 +234,7 @@ function add_collect($house_id)
add_filter('login_redirect', 'new_login_redirect', 10, 3);
function new_login_redirect($redirect_to, $request, $user)
{
if ($user - ID > 0) {
if ($user->ID > 0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') {
return admin_url('admin.php?page=newHouseList');
......@@ -236,4 +246,44 @@ function new_login_redirect($redirect_to, $request, $user)
}
}
add_action('wp_logout', 'auto_redirect_after_logout');
function auto_redirect_after_logout()
{
header('Location: ' . home_url('/?page=manager'));
exit;
}
add_filter('login_url', 'my_login_page', 10, 2);
function my_login_page($login_url, $redirect)
{
return home_url('/?page=manager&redirect_to=' . $redirect);
}
function user_redirect($user)
{
$url = null;
if ($user->ID > 0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') {
$url = admin_url('admin.php?page=newHouseList');
} else {
$url = site_url();
}
header('Location:' . $url);
}
}
add_action('wp_ajax_submit_sale', 'submit_sale');
function submit_sale()
{
$array = array('code' => 2001);
if ($_POST) {
$result = TospurDao::insert_tospur_sale($_POST);
if ($result) {
$array['code'] = 2000;
}
}
wp_send_json($array);
}
?>
\ No newline at end of file
<?php
require_once(dirname(__FILE__) . '/dao.php');
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
......@@ -12,10 +11,10 @@ if ($current_user_id != 0) {
$result = null;
switch ($role) {
case 'subscriber':
$result = dao::search_view_house_by_user_id($current_user_id);
$result = TospurDao::search_view_house_by_user_id($current_user_id);
break;
case 'editor':
$result = dao::search_view_house_by_consultant_id($current_user_id);
$result = TospurDao::search_view_house_by_consultant_id($current_user_id);
break;
}
if ($result) {
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
if (is_user_logged_in()) {
$user = wp_get_current_user();
user_redirect($user);
} else {
if ($_POST) {
$phone = $_POST['phone'];
$password = $_POST['password'];
if (!$phone) {
$context['error'] = '请输入用户名';
} else if (!$password) {
$context['error'] = '请输入密码';
} else {
if (strlen($phone) != 11 && $phone != 'admin') {
$response = wp_remote_post('http://218.1.67.130:8988/api/NanTongWechat/LoginWechat' .
'?userName=' . $phone . '&password=' . $password
);
$body = json_decode($response['body']);
$data = $body->data;
if ($data) {
$password = $data->WorkNoAndId;
}
}
$creds['user_login'] = $phone;
$creds['user_password'] = $password;
$creds['remember'] = true;
$user = wp_signon($creds, false);
if (!is_wp_error($user)) {
user_redirect($user);
} else if ($user->get_error_code() == 'invalid_username') {
$context['error'] = '此帐号尚未注册';
} else if ($user->get_error_code() == 'incorrect_password') {
$context['error'] = '您输入的密码有误';
}
}
}
Timber::render('manager.html', $context);
}
?>
\ No newline at end of file
<?php
require_once('const.php');
$context = array();
$context['theme'] = get_template_directory_uri();
......
......@@ -15,11 +15,11 @@ if ($_POST) {
} else if (!$password) {
$context['error'] = '请输入密码';
} else {
$search_code = dao::search_tospur_verify($phone, $code);
$search_code = TospurDao::search_tospur_verify($phone, $code);
if ($code == $search_code) {
$result = wp_create_user($phone, $password);
if (is_integer($result)) {
dao::update_tospur_verify($phone);
TospurDao::update_tospur_verify($phone);
$creds['user_login'] = $phone;
$creds['user_password'] = $password;
$creds['remember'] = true;
......
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$context['consultant_id'] = $_GET['consultant_id'];
}
Timber::render('score.html', $context);
?>
\ No newline at end of file
......@@ -6,14 +6,6 @@ $context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$date = current_time('Y-m-d');
$datetime = new DateTime($cureent_time . '+1 day');
$date = $datetime->format('Y-m-d');
$context['data'] = array(
'jt' => $date,
'mt' => new DateTime($date . '+1 day'),
'ht' => $date
);
$context['user_id'] = $user_id;
$context['house_id'] = $_GET['house_id'];
$context['consultant_id'] = $_GET['consultant_id'];
......@@ -23,5 +15,4 @@ if ($user_id != 0) {
exit;
}
?>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title>信息反馈</title>
......
......@@ -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">
<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">
......@@ -184,10 +186,18 @@
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&user_id={{user_id}}&consultant_id={{consultant_id}}&score='+$("#score").val(),
success: function (data) {
if (data.code == 2000) {
switch (data.code){
case 2000:
alert('评分成功');
}else{
break;
case 2001:
alert('未和置业顾问接触过,不能评分');
break;
case 2002:
alert('您已经提交过评分了');
break;
default:
break;
}
},
complete:function(){
......
......@@ -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>
......
......@@ -62,6 +62,9 @@
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
});
</script>
</head>
......
......@@ -45,6 +45,9 @@
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
});
</script>
</head>
......
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title>登录</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/manager.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script>
$(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#loginForm').validate({
onkeyup: false,
onfocusout: false,
rules: {
phone: 'required',
password: 'required'
},
messages: {
phone: '请输入用户名',
password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
}
});
notice.bind('DOMNodeInserted',function(){
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal',function(){
notice.children().remove();
});
{% if(error) %}
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
});
</script>
</head>
<body>
<div class="container-fluid text-center">
<form id="loginForm" method="post">
<h2></h2>
<p class="has-feedback username">
<label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="账号">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<input type="submit" id="login_submit" value="登录" class="btn btn-lg btn-block">
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -62,6 +62,9 @@
notice.html('<span>{{ error }}</span>');
myModal.modal('show');
{% endif %}
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
});
</script>
</head>
......
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = 0;
$('#score').rating({
min: 0,
max: 5,
step: 0.5,
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
starCaptions: function (data) {
console.log(data);
score = data;
$(this).val(score);
}
});
var scoreForm = $('#scoreForm');
scoreForm.submit(function () {
if (score > 0) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&' + scoreForm.serialize(),
success: function (data) {
if (data.code == 2000) {
alert('评分成功');
}else{
alert('不能重复评分');
}
}
});
} else {
alert('请选择评分');
}
return false;
});
});
</script>
</head>
<body>
<form id="scoreForm" method="post">
<br>
<label for="score">评分</label>
<input type="hidden" id="score" name="score" value="0">
<input type="hidden" name="user_id" value="{{ user_id }}">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<br>
<p class="submit">
<input type="submit" id="score_submit" value="提交">
</p>
</form>
</body>
</html>
\ No newline at end of file
......@@ -59,6 +59,9 @@
}
return false;
});
document.addEventListener('touchmove', function(e){
e.preventDefault();
});
});
</script>
</head>
......
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