Commit 5d92fe11 by shz

每日一更

parent b3fa582f
...@@ -175,7 +175,7 @@ class consultantScoreList extends WP_List_Table ...@@ -175,7 +175,7 @@ class consultantScoreList extends WP_List_Table
function add_consultant_score_menu() function add_consultant_score_menu()
{ {
add_menu_page('置业顾问评分', '置业顾问评分', 'activate_plugins', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26); add_menu_page('置业顾问评分', '置业顾问评分', 'moderate_comments', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
} }
add_action('admin_menu', 'add_consultant_score_menu'); add_action('admin_menu', 'add_consultant_score_menu');
......
...@@ -51,6 +51,7 @@ class customer extends Tospur_House ...@@ -51,6 +51,7 @@ class customer extends Tospur_House
'bathroom' => $_POST['bathroom'], 'bathroom' => $_POST['bathroom'],
'origin_remark' => $_POST['origin_remark'], 'origin_remark' => $_POST['origin_remark'],
'consultant_id' => $_POST['consultant_id'], 'consultant_id' => $_POST['consultant_id'],
//(1)
'status' => $_POST['status'] 'status' => $_POST['status']
); );
if ($_POST) { if ($_POST) {
...@@ -68,7 +69,7 @@ class customer extends Tospur_House ...@@ -68,7 +69,7 @@ class customer extends Tospur_House
echo "修改客源失败"; echo "修改客源失败";
} }
} else { } else {
$id = InsertDao::insert_customer($insert_tospur_house_array); $id = CustomerDao::insert_customer($insert_tospur_house_array);
if ($id) { if ($id) {
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
echo "新增客源成功"; echo "新增客源成功";
...@@ -80,11 +81,16 @@ class customer extends Tospur_House ...@@ -80,11 +81,16 @@ class customer extends Tospur_House
exit; exit;
} else if (isset($_GET['edit'])) { } else if (isset($_GET['edit'])) {
$context['houseId'] = $_GET['id']; $context['houseId'] = $_GET['id'];
$context = array_merge($context, SearchDao::searchCustomer($_GET['id'])); $context = array_merge($context, CustomerDao::searchCustomer($_GET['id']));
$context["district"] = SearchDao::searchCity($context['result']->city_id); $context["district"] = SearchDao::searchCity($context['result']->city_id);
$context["plate"] = SearchDao::searchCity($context['result']->city_id, $context['result']->district_id); $context["plate"] = SearchDao::searchCity($context['result']->city_id, $context['result']->district_id);
} }
$context['role'] = customer::getCurrentRole();
$current_user = wp_get_current_user();
$context['role'] = $current_user->roles[0];
if ($context['role'] == 'author') {
$context['consultant_id'] = $current_user->ID;
}
$context['city'] = SearchDao::searchCity(); $context['city'] = SearchDao::searchCity();
$context['buildProperty'] = SearchDao::searchBuildProperty(); $context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom(); $context['room'] = SearchDao::searchRoom();
...@@ -95,10 +101,5 @@ class customer extends Tospur_House ...@@ -95,10 +101,5 @@ class customer extends Tospur_House
} }
Timber::render('customer.html', $context); Timber::render('customer.html', $context);
} }
public static function data_update($houseId, $params)
{
}
} }
...@@ -8,89 +8,103 @@ class customerList extends WP_List_Table ...@@ -8,89 +8,103 @@ class customerList extends WP_List_Table
{ {
function __construct() function __construct()
{ {
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'customerList', //singular name of the listed records
'plural' => 'customerLists', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
} }
function column_default($item, $column_name) function column_default($item, $column_name)
{ {
switch ($column_name) { switch ($column_name) {
case'id':
case 'name': case 'name':
case 'address': return '<a href="' . admin_url('admin.php?page=customer&edit=true&id=' . $item['id']) . '">' . $item[$column_name] . '</a>';
case 'average_price':
case 'developer':
case 'check_in_time':
case 'room_id':
case 'property_age':
case 'decoration':
case 'covered_area':
case 'status':
case 'volume_rate':
case 'greening_rate':
case 'households':
case 'parking_spaces':
case 'property_management':
case 'property_money':
default: default:
return '<a href="' . admin_url() . 'admin.php?page=newHouse&edit=true&id=' . $item['id'] . '">' . $item[$column_name] . '</a>'; return $item[$column_name];
}
} }
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
/*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
);
} }
function get_columns() function get_columns()
{ {
if (current_user_can('administrator')) {
$columns = array(
'cb' => '<input type="checkbox" />'
);
}
$columns['name'] = '姓名'; $columns['name'] = '姓名';
$columns['demand_type'] = '需求类型'; $columns['demand_type'] = '需求类型';
$columns['customer_remark'] = '客户备注'; $columns['customer_remark'] = '客户备注';
$columns['consultant'] = '置业顾问'; $columns['consultant_name'] = '置业顾问';
$columns['check_in_time'] = '状态'; $columns['status_name'] = '状态';
return $columns; return $columns;
} }
function get_sortable_columns()
{
$sortable_columns = array();
return $sortable_columns;
}
function prepare_items() function prepare_items()
{ {
global $wpdb; global $wpdb;
$per_page = 10; $per_page = 10;
$columns = $this->get_columns(); $columns = $this->get_columns();
$hidden = array(); $hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable); $this->_column_headers = array($columns, $hidden);
$sql = "select * from tospur_customer tc"; $sql = "SELECT tcs.*,tc.name as consultant_name,ts.status_name FROM tospur_customer tcs" .
" left join (SELECT * FROM tospur_status where status_type = 5) as ts on tcs.status = ts.status_id" .
" left join tospur_consultant tc on tcs.consultant_id = tc.id where 1 = 1";
if (isset($_POST['status']) && $_POST['status'] != -1) {
$sql = $sql . " and tcs.status = " . $_POST['status'];
}
if (isset($_POST['customer_type']) && $_POST['customer_type'] != -1) {
$sql = $sql . " and tcs.customer_type = " . $_POST['customer_type'];
}
if (isset($_POST['demand_type']) && $_POST['demand_type'] != -1) {
$demand_type = null;
switch ($_POST['demand_type']) {
case 0:
$demand_type = 'tcs.new_house';
break;
case 1:
$demand_type = 'tcs.secondHand_house';
break;
case 2:
$demand_type = 'tcs.rent_house';
break;
}
if ($demand_type) {
$sql = $sql . " and " . $demand_type . " = 1";
}
}
if (isset($_POST['search_name'])) {
$sql = $sql . " and tcs.name like '%" . $_POST['search_name'] . "%'";
}
if (isset($_POST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_POST['search_consultant_name'] . "%'";
}
if (isset($_POST['search_phone'])) {
$sql = $sql . " and tcs.phone like '%" . $_POST['search_phone'] . "%'";
}
if (isset($_POST['search_min_time'])) {
$sql = $sql . " and tcs.time >= '" . $_POST['search_min_time'] . "'";
}
if (isset($_POST['search_max_time'])) {
$sql = $sql . " and tcs.time <= '" . $_POST['search_max_time'] . "'";
}
$result = $wpdb->get_results($sql); $result = $wpdb->get_results($sql);
$data = array(); $data = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$demand_type_array = array(
($value->new_house == 1) ? '新房' : null,
($value->secondHand_house == 1) ? '二手房' : null,
($value->rent_house == 1) ? '租房' : null
);
$demand_type_array = array_filter($demand_type_array, function ($var) {
return !is_null($var);
});
$data[$key] = array(
'id' => $value->id,
'name' => $value->name,
'demand_type' => implode("、", $demand_type_array),
'customer_remark' => $value->customer_remark,
'consultant_name' => $value->consultant_name,
'status_name' => $value->status_name
);
} }
$current_page = $this->get_pagenum(); $current_page = $this->get_pagenum();
if (isset($_POST['paged'])) {
$current_page = $_POST['paged'];
}
$total_items = count($data); $total_items = count($data);
...@@ -109,6 +123,18 @@ class customerList extends WP_List_Table ...@@ -109,6 +123,18 @@ class customerList extends WP_List_Table
function function_customerList() function function_customerList()
{ {
$context = array(); $context = array();
$context['status'] = SearchDao::searchStatusType(5);
$context['customer_type'] = SearchDao::searchStatusType(6);
$context['status_id'] = $_POST['status'];
$context['demand_type'] = isset($_POST['demand_type']) ? $_POST['demand_type'] : -1;
$context['customer_type_id'] = isset($_POST['customer_type']) ? $_POST['customer_type'] : -1;
$context['search_name'] = $_POST['search_name'];
$context['search_consultant_name'] = $_POST['search_consultant_name'];
$context['search_phone'] = $_POST['search_phone'];
$context['search_min_time'] = $_POST['search_min_time'];
$context['search_max_time'] = $_POST['search_max_time'];
Timber::render("customerList.html", $context); Timber::render("customerList.html", $context);
} }
......
...@@ -129,7 +129,7 @@ class viewHouseList extends WP_List_Table ...@@ -129,7 +129,7 @@ class viewHouseList extends WP_List_Table
function add_view_house_menu() function add_view_house_menu()
{ {
add_menu_page('预约列表', '预约列表', 'activate_plugins', 'view_house', 'view_house_page', 'dashicons-menu', 27); add_menu_page('预约列表', '预约列表', 'moderate_comments', 'view_house', 'view_house_page', 'dashicons-menu', 27);
} }
add_action('admin_menu', 'add_view_house_menu'); add_action('admin_menu', 'add_view_house_menu');
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
<input type="submit" id="submit" class="button action" style="position: fixed;"> <input type="submit" id="submit" class="button action" style="position: fixed;">
{% if role == 'administrator' %} {% if role == 'administrator' or role == 'editor' %}
<div class="row" style="position: fixed;top:50px;"> <div class="row" style="position: fixed;top:50px;">
<select id="status" name="status"> <select id="status" name="status">
{% for item in status %} {% for item in status %}
...@@ -80,9 +80,6 @@ ...@@ -80,9 +80,6 @@
<script> <script>
(function($){ (function($){
$(document).ready(function(){ $(document).ready(function(){
$("#check_in_time").datepicker({
dateFormat: "yy-mm-dd"
});
//基本信息的联动AJAX //基本信息的联动AJAX
$("#baseCity").change(function(){ $("#baseCity").change(function(){
var cityId = $("#baseCity").val(); var cityId = $("#baseCity").val();
...@@ -174,22 +171,10 @@ ...@@ -174,22 +171,10 @@
}); });
//删除置业顾问 //删除置业顾问
$("#consultantImg").on("click",".imgCancel,.consultantCancel,.picDelet,.featureCancel",function(){ $("#consultantImg").on("click",".consultantCancel",function(){
$(this).parents("p").remove(); $(this).parents("p").remove();
}); });
$("#consultantImg").on("click",".existsCancel",function(){
$(this).parent().remove();
});
$("input[id='keyCheck']").change(function(){
textDisable("keyCheck","key");
});
$("input[id='garageCheck']").change(function(){
textDisable("garageCheck","garage");
});
$('#customerForm').validate({ $('#customerForm').validate({
onkeyup: false, onkeyup: false,
onfocusout: false, onfocusout: false,
...@@ -221,7 +206,8 @@ ...@@ -221,7 +206,8 @@
errorLabelContainer: "#notice", errorLabelContainer: "#notice",
errorElement: 'div', errorElement: 'div',
submitHandler: function (form) { submitHandler: function (form) {
if ($("#consultantImg > p").length == 0) { var consultantImg = $('#consultantImg');
if (consultantImg.length == 1 && consultantImg.find('p').length == 0) {
alert("请选择置业顾问"); alert("请选择置业顾问");
} else { } else {
form.submit(); form.submit();
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<label for="check_in_time">入住时间:</label> <label for="check_in_time">入住时间:</label>
<input type="text" name="check_in_time" id="check_in_time" value="{{ result.check_in_time }}" class="form-control"> <input type="date" name="check_in_time" id="check_in_time" value="{{ result.check_in_time }}" class="form-control">
</div> </div>
</div> </div>
<br> <br>
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label for="propertyRight">产权:</label> <label for="propertyRight">产权:</label>
<select name="propertyRight" id="propertyRight" class="form-control"> <select name="propertyRight" id="propertyRight" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="个人产权">个人产权</option> <option value="个人产权">个人产权</option>
<option value="单位产权">单位产权</option> <option value="单位产权">单位产权</option>
<option value="售后产权">售后产权</option> <option value="售后产权">售后产权</option>
...@@ -96,7 +97,7 @@ ...@@ -96,7 +97,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label for="decoration">装修:</label> <label for="decoration">装修:</label>
<select name="decoration" id="decoration" class="form-control"> <select name="decoration" id="decoration" class="form-control">
<option value="不限">不限</option> <option value="不限" selected="selected">不限</option>
<option value="毛坯">毛坯</option> <option value="毛坯">毛坯</option>
<option value="简单装修">简单装修</option> <option value="简单装修">简单装修</option>
<option value="中等装修">中等装修</option> <option value="中等装修">中等装修</option>
...@@ -110,7 +111,7 @@ ...@@ -110,7 +111,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label for="age">年代:</label> <label for="age">年代:</label>
<select name="age" id="age" class="form-control"> <select name="age" id="age" class="form-control">
<option value="不限">不限</option> <option value="不限" selected="selected">不限</option>
{% for item in age %} {% for item in age %}
<option value="{{ item }}">{{ item }}</option> <option value="{{ item }}">{{ item }}</option>
{% endfor %} {% endfor %}
...@@ -119,6 +120,7 @@ ...@@ -119,6 +120,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label for="faceto">朝向:</label> <label for="faceto">朝向:</label>
<select name="faceto" id="faceto" class="form-control"> <select name="faceto" id="faceto" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="其他">其他</option> <option value="其他">其他</option>
<option value="东"></option> <option value="东"></option>
<option value="南"></option> <option value="南"></option>
...@@ -139,6 +141,7 @@ ...@@ -139,6 +141,7 @@
<div class="col-md-6"> <div class="col-md-6">
<label>户型:</label> <label>户型:</label>
<select name="bedroom" id="bedroom" class="form-control"> <select name="bedroom" id="bedroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
...@@ -151,6 +154,7 @@ ...@@ -151,6 +154,7 @@
</select> </select>
<label for="bedroom"></label> <label for="bedroom"></label>
<select name="hall" id="hall" class="form-control"> <select name="hall" id="hall" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
...@@ -159,6 +163,7 @@ ...@@ -159,6 +163,7 @@
</select> </select>
<label for="hall"></label> <label for="hall"></label>
<select name="bathroom" id="bathroom" class="form-control"> <select name="bathroom" id="bathroom" class="form-control">
<option value="不限" selected="selected">不限</option>
<option value="0">0</option> <option value="0">0</option>
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
...@@ -176,6 +181,7 @@ ...@@ -176,6 +181,7 @@
</div> </div>
</div> </div>
<br> <br>
{% if role == 'administrator' or role == 'editor' %}
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<tr> <tr>
...@@ -199,3 +205,6 @@ ...@@ -199,3 +205,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
{% elseif role == 'author' %}
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
{% endif %}
\ No newline at end of file
<div class="wrap"> <div class="wrap">
<h2>客户列表</h2> <h2>客户列表</h2>
<form id="scores-filter" method="post"> <form id="" method="post">
<input type="hidden" name="page" value="{{page}}"/> <div>
<select id="listCity" name="listCity"> <label for="status" class="hidden"></label>
<option value="0"> 城市</option> <select name="status" id="status">
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="listDistrict" name="listDistrict">
<option value="0">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="listPlate" name="listPlate">
<option value="0">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="totalPrice" name="totalPrice">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select id="room" name="room">
<option value="0">类型</option>
{% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="buildProperty" name="buildProperty">
<option value="0"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage">
<option value ="">面积</option>
{% if acreage %}
{% for item in dicArea %}
<option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
<select name="status" name="status">
<option value="-1">状态</option> <option value="-1">状态</option>
{% for item in status%} {% for item in status %}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option> <option {{ item.id == status_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="text" placeholder="请出入楼盘名" name="searchText"> <label for="customer_type" class="hidden"></label>
<input type="hidden" name="hasSearch" value="1"/> <select name="customer_type" id="customer_type">
<option value="-1">客户类型</option>
{% for item in customer_type %}
<option {{ item.id == customer_type_id ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<label for="demand_type" class="hidden"></label>
<select name="demand_type" id="demand_type">
<option value="-1">需求类型</option>
<option value="0">新房</option>
<option value="1">二手房</option>
<option value="2">租房</option>
</select>
<input type="text" placeholder="请输入姓名" name="search_name" value="{{ search_name }}">
<input type="text" placeholder="请输入置业顾问" name="search_consultant_name" value="{{ search_consultant_name }}">
<input type="text" placeholder="请输入电话" name="search_phone" value="{{ search_phone }}">
</div>
<div style="margin-top: 10px;">
<span>日期</span>
<label for="search_min_time" class="hidden"></label>
<input type="date" name="search_min_time" id="search_min_time" value="{{ search_min_time }}">
<label for="search_max_time" class="hidden"></label>
<input type="date" name="search_max_time" id="search_max_time" value="{{ search_max_time }}">
<input type="submit" id="submit" class="button action" value="搜索"> <input type="submit" id="submit" class="button action" value="搜索">
<!-- Now we can render the completed list table --> </div>
{{function("addCustomerTable")}} {{ function("addCustomerTable") }}
<input type="hidden" name="paged" value="1">
</form> </form>
</div> </div>
<script> <script>
(function ($) { (function ($) {
$(document).ready(function(){ $(document).ready(function(){
$('#demand_type').val('{{ demand_type }}');
}); });
})(jQuery); })(jQuery);
</script> </script>
\ No newline at end of file
<?php
class CustomerDao
{
public static function insert_customer($params){
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_CUSTOMER_TABLE, $params);
$insert_id = $wpdb->insert_id;
if($result){
return $insert_id;
}else{
return 0;
}
}
public static function searchCustomer($id)
{
global $wpdb;
$sql = "SELECT tcs.* FROM tospur_customer tcs where tcs.id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql, $id));
$context = array();
if($result){
$context['result'] = $result;
$consultant_sql = "SELECT * FROM tospur_consultant where id = %d";
$consultant = $wpdb->get_results($wpdb->prepare($consultant_sql, $result->consultant_id));
$context['consultant'] = $consultant;
}
return $context;
}
}
?>
\ No newline at end of file
...@@ -15,18 +15,6 @@ class InsertDao{ ...@@ -15,18 +15,6 @@ class InsertDao{
} }
} }
public static function insert_customer($params){
global $wpdb;
$result = $wpdb->insert(Config::TOSPUR_CUSTOMER_TABLE, $params);
print_r($wpdb->last_query);
$insert_id = $wpdb->insert_id;
if($result){
return $insert_id;
}else{
return 0;
}
}
public static function setHouseNumber($houseId,$houseType,$cityId){ public static function setHouseNumber($houseId,$houseType,$cityId){
global $wpdb; global $wpdb;
switch($houseType){ switch($houseType){
......
...@@ -418,21 +418,6 @@ class SearchDao ...@@ -418,21 +418,6 @@ class SearchDao
return $context; return $context;
} }
public static function searchCustomer($id)
{
global $wpdb;
$sql = "SELECT tcs.* FROM tospur_customer tcs where tcs.id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql, $id));
$context = array();
if($result){
$context['result'] = $result;
$consultant_sql = "SELECT * FROM tospur_consultant where id = %d";
$consultant = $wpdb->get_results($wpdb->prepare($consultant_sql, $result->consultant_id));
$context['consultant'] = $consultant;
}
return $context;
}
public static function searchHouseTag($houseId){ public static function searchHouseTag($houseId){
global $wpdb; global $wpdb;
$sql = "select tt.name from a_house_tag aht $sql = "select tt.name from a_house_tag aht
......
...@@ -18,6 +18,7 @@ function tospur_init() ...@@ -18,6 +18,7 @@ function tospur_init()
require_once(PLUGIN_DIR . 'Dao/SearchDao.php'); require_once(PLUGIN_DIR . 'Dao/SearchDao.php');
require_once(PLUGIN_DIR . 'Dao/TospurDao.php'); require_once(PLUGIN_DIR . 'Dao/TospurDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php'); require_once(PLUGIN_DIR . 'Dao/CustomerTrackingDao.php');
require_once(PLUGIN_DIR . 'Dao/CustomerDao.php');
require_once(PLUGIN_DIR . 'Admin/House.php'); require_once(PLUGIN_DIR . 'Admin/House.php');
require_once(PLUGIN_DIR . 'Admin/newHouseList.php'); require_once(PLUGIN_DIR . 'Admin/newHouseList.php');
require_once(PLUGIN_DIR . 'Admin/secHandHouse.php'); require_once(PLUGIN_DIR . 'Admin/secHandHouse.php');
...@@ -162,17 +163,17 @@ function update_consultant() ...@@ -162,17 +163,17 @@ function update_consultant()
function reset_menu() function reset_menu()
{ {
add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync"); add_menu_page("sync", "同步数据", "manage_options", "1", "do_sync");
add_menu_page('nesHouseList','新房列表', 'moderate_comments', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6); add_menu_page('nesHouseList','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'moderate_comments', 'newHouse', 'House::init_view'); add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view');
add_menu_page('secHandHouseList','二手房列表', 'moderate_comments', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7); add_menu_page('secHandHouseList','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'moderate_comments', 'secHandHouse', 'SecHandHouse::secHandHouse_html'); add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'edit_published_posts', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'moderate_comments', 'add_feature', 'feature::add_feature_html'); add_submenu_page('secHandHouseList', '添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html');
add_menu_page('rentHouseList','租房列表', 'moderate_comments', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8); add_menu_page('rentHouseList','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'moderate_comments', 'rentHouse', 'RentHouse::rentHouse_html'); add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("introduction", "诚信宣言", "editor", "introduction", "introduction::introduction_html", 'dashicons-menu', 9); add_menu_page("introduction", "诚信宣言", "editor", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('contract','合同管理', 'moderate_comments', 'contract', 'Contract::init_view', 'dashicons-menu', 10); add_menu_page('contract','合同管理', 'edit_published_posts', 'contract', 'Contract::init_view', 'dashicons-menu', 10);
add_menu_page('客户列表','客户列表', 'moderate_comments', 'customerList', 'function_customerList', 'dashicons-menu', 11); add_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'moderate_comments', 'customer', 'customer::customer_html'); add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
//移除更新信息 //移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 ); remove_action( 'admin_notices', 'update_nag', 3 );
global $menu; global $menu;
......
...@@ -264,7 +264,7 @@ function user_redirect($user) ...@@ -264,7 +264,7 @@ function user_redirect($user)
$url = null; $url = null;
if ($user->ID > 0) { if ($user->ID > 0) {
$role = $user->roles[0]; $role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') { if ($role == 'administrator' || $role == 'editor' || $role == 'author') {
$url = admin_url('admin.php?page=newHouseList'); $url = admin_url('admin.php?page=newHouseList');
} else { } else {
$url = site_url(); $url = site_url();
......
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