Commit 102311c9 by felix

每日一更

parent 974ac51a
......@@ -12,7 +12,7 @@ class Contract {
$context['siteUrl'] = get_site_url();
$context['adminUrl'] = admin_url();
$context['city'] = SearchDao::searchCity();
$context['managers'] = get_users( 'role=editor' );
$context['managers'] = get_users( 'role=jl' );
$context['status'] = SearchDao::searchStatusType(4);
$context['buildProperty'] = SearchDao::searchBuildProperty();
$context['room'] = SearchDao::searchRoom();
......@@ -48,6 +48,18 @@ class Contract {
Timber::render("contract.html",$context);
}
private static function formatCommissionParams($params,$contractId,$type){
$commissionParams = array(
"accounts" => $params["accounts"],
"type" => $_REQUEST["businessType"],
"contractId" => $contractId,
"consultantId" => $params["consultantId"],
"ioType" => $type,
"mtime" => $params["mtime"]
);
return $commissionParams;
}
private static function doSqlAction(){
$params = array(
'signedDate' =>$_REQUEST['signedDate'],
......@@ -77,10 +89,15 @@ class Contract {
return $result;
}
$status = 0;
if($params['status'] == 4) {
if($params['status'] == 4) {//作废
$status = 0;
}else if($params['status'] == 3){
}else if($params['status'] == 3){//成交
$status = 2;
$result = CustomerDao::updateCustomerStatue($_REQUEST['customerNumber'],1);
if(!is_numeric($result)){
return $result;
}
}
$result = HouseDao::updateStatus($status,$_REQUEST['id']);
if(!is_numeric($result)){
......@@ -121,28 +138,14 @@ class Contract {
return $result;
}
}
$buyCommission = $_REQUEST['buy'];
$buyCommissionParams = array(
"accounts" => $buyCommission["accounts"],
"type" => $_REQUEST["businessType"],
"contractId" => $contractId,
"consultantId" => $buyCommission["consultantId"],
"ioType" => 0
);
$buyCommissionParams = Contract::formatCommissionParams($_REQUEST['buy'],$contractId,0);
$result = CommissionDao::insert_touspur_commission($buyCommissionParams);
if(!is_numeric($result)){
return $result;
}
$commissionType['buy'] = $result;
$sellCommission = $_REQUEST['sell'];
$sellCommissionParams = array(
"accounts" => $sellCommission["accounts"],
"type" => $_REQUEST["businessType"],
"contractId" => $contractId,
"consultantId" => $sellCommission["consultantId"],
"ioType" => 1
);
$sellCommissionParams = Contract::formatCommissionParams($_REQUEST['sell'],$contractId,1);
$result = CommissionDao::insert_touspur_commission($sellCommissionParams);
if(!is_numeric($result)){
return $result;
......
......@@ -93,9 +93,9 @@ class Contract_List extends WP_List_Table{
left join tospur_status ts on ts.status_type = 4 and t.status = ts.status_id
where 1=1 ";
//置业顾问显示自己的合同
if(current_user_can("author")){
if(current_user_can("zygw")){
$sql .= " and t.consultantId = ".get_current_user_id();
}elseif(current_user_can("editor")){//经理显示提交给自己的合同,和自己的合同
}else if(current_user_can("htApproval")){//经理显示提交给自己的合同,和自己的合同
$sql .= " and (t.consultantId = ".get_current_user_id()." or t.managerId = ".get_current_user_id().")";
}
$sql .= " order by t.signedDate desc";
......
......@@ -35,11 +35,38 @@ class House extends Tospur_House{
'room_id' => $_POST['baseRoom'],
"location" => $_POST["location"],
"property_money" => $_POST["property_money"],
'community_name' => $_POST["community_name"],
'status' => $_POST["status"]
'community_name' => $_POST["community_name"]
);
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
//首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = House::data_update($_POST['houseId'],$insert_tospur_house_array);
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
......@@ -50,10 +77,12 @@ class House extends Tospur_House{
echo "新房房源修改成功";
}
}else{
$insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = House::data_insert($insert_tospur_house_array);
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r($result);;
print_r($result);
echo "新增房源失败";
}else{
$wpdb->query("COMMIT");
......@@ -69,7 +98,7 @@ class House extends Tospur_House{
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["status"] = searchDao::searchStatusType(1);
}
$context['role'] = House::getCurrentRole();
$context['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
......@@ -133,7 +162,6 @@ class House extends Tospur_House{
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($houseId, $_REQUEST);
return $result;
}
......
<?php
class Tospur_House{
public static function canApproval(){
return current_user_can("houseApproval");
}
public static function getCurrentRole(){
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) )
......
......@@ -125,12 +125,12 @@ class commissionList extends WP_List_Table
$achieving_rate = 0;
if ($value->target_amount) {
$target_amount = $value->target_amount;
$achieving_rate = round((($value->paid) / $target_amount / 10000), 2);
$achieving_rate = round((($value->paid) / $target_amount) * 100, 2);
}
$data[$key] = array(
'organization_name' => $value->organization_name,
'consultant_name' => $value->consultant_name,
'target_amount' => $target_amount,
'target_amount' => round($target_amount / 10000, 2),
'achieving_rate' => $achieving_rate . '%',
'business' => round($value->business / 10000, 2),
'lease' => round($value->lease / 10000, 2),
......
......@@ -173,13 +173,6 @@ class consultantScoreList extends WP_List_Table
}
}
function add_consultant_score_menu()
{
add_menu_page('置业顾问评分', '置业顾问评分', 'moderate_comments', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
}
function consultant_score_page()
{
$consultantScoreList = new consultantScoreList();
......
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class customerTrackingList extends WP_List_Table
{
function __construct()
{
}
function column_default($item, $column_name)
{
switch ($column_name) {
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['status_name'] = '跟进类型';
$columns['consultant_name'] = '置业顾问';
$columns['time'] = '时间';
$columns['description'] = '跟进说明';
$columns['origin'] = '客/房源';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$sql = "SELECT tct.*,ts.status_name,tc.name as consultant_name FROM tospur_customer_tracking tct" .
" left join (SELECT * FROM tospur_status where status_type = 3) as ts on tct.status_type = ts.status_id" .
" left join tospur_consultant tc on tct.consultant_id = tc.id where 1 = 1";
if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
}
if (isset($_REQUEST['search_consultant_name'])) {
$sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tct.time >= '" . $_REQUEST['search_min_time'] . "'";
}
if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tct.time <= '" . $_REQUEST['search_max_time'] . "'";
}
$sql = $sql . " order by tct.time desc";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'status_id' => $value->status_id,
'status_name' => $value->status_name,
'consultant_name' => $value->consultant_name,
'time' => $value->time,
'description' => $value->description,
'origin' => ($value->origin == 1) ? '房源' : (($value->origin == 2) ? '客源' : '')
);
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function function_customerTrackingList()
{
$context = array();
$context['status'] = SearchDao::searchStatusType(3);
$context['status_type'] = isset($_REQUEST['status_type']) ? $_REQUEST['status_type'] : -1;
$context['search_consultant_name'] = $_REQUEST['search_consultant_name'];
$context['search_min_time'] = $_REQUEST['search_min_time'];
$context['search_max_time'] = $_REQUEST['search_max_time'];
Timber::render("customerTrackingList.html", $context);
}
function addCustomerTrackingTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', $_SERVER['REQUEST_URI'] );
$customerTrackingList = new customerTrackingList();
$customerTrackingList->prepare_items();
$customerTrackingList->display();
}
?>
<?php
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class customerTrackingList extends WP_List_Table
{
function __construct()
{
}
function column_default($item, $column_name)
{
switch ($column_name) {
default:
return $item[$column_name];
}
}
function get_columns()
{
$columns['status_name'] = '跟进类型';
$columns['consultant_name'] = '置业顾问';
$columns['time'] = '时间';
$columns['description'] = '跟进说明';
$columns['origin'] = '客/房源';
return $columns;
}
function prepare_items()
{
global $wpdb;
$per_page = 10;
$columns = $this->get_columns();
$hidden = array();
$this->_column_headers = array($columns, $hidden);
$sql = "SELECT tct.*,ts.status_name,tc.name as consultant_name,tc.subsidiaryId FROM tospur_customer_tracking tct" .
" left join (SELECT * FROM tospur_status where status_type = 3) as ts on tct.status_type = ts.status_id" .
" left join tospur_consultant tc on tct.consultant_id = tc.id" .
" left join tospur_organization torg on tc.subsidiaryId = torg.id" .
" where 1 = 1";
if (current_user_can('zygw')) {
$sql = $sql . " and tc.id = " . get_current_user_id();
}
if (isset($_REQUEST['organization']) && $_REQUEST['organization'] != -1) {
$sql = $sql . " and tc.subsidiaryId = " . $_REQUEST['organization'];
}
if (isset($_REQUEST['status_type']) && $_REQUEST['status_type'] != -1) {
$sql = $sql . " and tct.status_type = " . $_REQUEST['status_type'];
}
if (isset($_REQUEST['search_consultant_name']) && $_REQUEST['search_consultant_name'] != null) {
$sql = $sql . " and tc.name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
if (isset($_REQUEST['search_min_time']) && $_REQUEST['search_min_time'] != null) {
$sql = $sql . " and tct.time >= '" . $_REQUEST['search_min_time'] . "'";
}
if (isset($_REQUEST['search_max_time']) && $_REQUEST['search_max_time'] != null) {
$sql = $sql . " and tct.time <= '" . $_REQUEST['search_max_time'] . "'";
}
$sql = $sql . " order by tct.time desc";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'status_id' => $value->status_id,
'status_name' => $value->status_name,
'consultant_name' => $value->consultant_name,
'time' => $value->time,
'description' => $value->description,
'origin' => ($value->origin == 1) ? '房源' : (($value->origin == 2) ? '客源' : '')
);
}
$current_page = $this->get_pagenum();
$total_items = count($data);
$total_pages = ceil($total_items / $per_page);
if ($_REQUEST['paged'] > $total_pages) {
$current_page = $total_pages;
}
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function function_customerTrackingList()
{
$context = array();
$context['status'] = SearchDao::searchStatusType(3);
$context['req'] = $_REQUEST;
Timber::render("customerTrackingList.html", $context);
}
function addCustomerTrackingTable()
{
$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', $_SERVER['REQUEST_URI']);
$customerTrackingList = new customerTrackingList();
$customerTrackingList->prepare_items();
$customerTrackingList->display();
}
?>
......@@ -4,17 +4,19 @@ class introduction
{
public static function ajax_submit_introduction()
{
$time = $_POST['time'];
$introduction = $_POST['introduction'];
$user_id = $_POST['user_id'];
wp_send_json(introduction::submit_introduction($introduction, $user_id));
wp_send_json(introduction::submit_introduction($time, $introduction, $user_id));
}
public static function submit_introduction($introduction, $user_id)
public static function submit_introduction($time, $introduction, $user_id)
{
global $wpdb;
$result = $wpdb->update(
Config::TOSPUR_CONSULTANT,
array(
'time' => $time,
'introduction' => $introduction
),
array('id' => $user_id)
......@@ -22,12 +24,12 @@ class introduction
return $result;
}
public static function search_introduction()
public static function search_time_and_introduction()
{
global $wpdb;
$user_id = introduction::get_user_id();
$sql = "select introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id;
$result = $wpdb->get_var($sql);
$sql = "select time,introduction from " . Config::TOSPUR_CONSULTANT . " where id = " . $user_id;
$result = $wpdb->get_row($sql);
return $result;
}
......@@ -35,7 +37,9 @@ class introduction
{
$context = array();
$context['url'] = home_url();
$context['introduction'] = introduction::search_introduction();
$result = introduction::search_time_and_introduction();
$context['time'] = $result->time;
$context['introduction'] = $result->introduction;
$user_id = introduction::get_user_id();
$context['user_id'] = $user_id;
Timber::render('introduction.html', $context);
......
......@@ -12,25 +12,31 @@ class newHouseList extends WP_List_Table
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(NULLIF(approval != -2, false)) as needCheckNum,
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
COUNT(NULLIF(approval = 2, false)) as notSaleNum
from ".Config::TOSPUR_HOUSE_TABLE." where house_type = 0";
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
"onSaleNum" => $value->onSaleNum
"onSaleNum" => $value->onSaleNum,
"notSaleNum" => $value->notSaleNum
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval=" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
"onSaleNum" => '<a href="'.$current_url.'&approval=-1">交易中<span class="count">('.$approvalParam["onSaleNum"].')</span></a>'
"onSaleNum" => '<a href="'.$current_url.'&approval=-1">交易中<span class="count">('.$approvalParam["onSaleNum"].')</span></a>',
"notSaleNum" => '<a href="'.$current_url.'&approval=-1">下架<span class="count">('.$approvalParam["notSaleNum"].')</span></a>'
);
} function __construct()
{
......@@ -130,7 +136,7 @@ class newHouseList extends WP_List_Table
function get_bulk_actions()
{
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
......@@ -140,6 +146,7 @@ class newHouseList extends WP_List_Table
'unCheck'=>'未审核',
'check' =>'审核',
'onSale'=>'交易中',
'notSale' =>'下架'
);
}
return $actions;
......@@ -205,9 +212,9 @@ class newHouseList extends WP_List_Table
if ($action) {
$string = null;
$status = null;
$id = $_REQUEST['newhouselist'];
switch ($action) {
case 'unCheck':
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,0);
......@@ -218,7 +225,6 @@ class newHouseList extends WP_List_Table
}
break;
case 'check':
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,1);
......@@ -229,7 +235,6 @@ class newHouseList extends WP_List_Table
}
break;
case 'onSale':
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,-1);
......@@ -239,6 +244,16 @@ class newHouseList extends WP_List_Table
$status = $res;
}
break;
case 'notSale':
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,2);
if(!$res){
exit;
}
$status = $res;
}
break;
}
global $wpdb;
$result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string,$status));
......@@ -258,7 +273,7 @@ class newHouseList extends WP_List_Table
$this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action();
......@@ -322,7 +337,7 @@ class newHouseList extends WP_List_Table
$sql = $sql . " and name like %s";
}
if(isset($_REQUEST["approval"])){
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
......
......@@ -50,14 +50,41 @@ class RentHouse extends Tospur_House{
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"],
"rent"=>$_POST["rent"],
"status" => $_POST["status"],
"property_money"=>$_POST["property_money"]
"property_money"=>$_POST["property_money"],
"parking_spaces"=>$_POST["parking_spaces"]
);
if($type==3){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
//首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = RentHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
print_r($result);;
......@@ -68,6 +95,8 @@ class RentHouse extends Tospur_House{
}
}else {
$insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = RentHouse::rentHouseData_insert($insert_tospur_house_array);
if (is_numeric($result)) {
$wpdb->query("ROLLBACK");
......@@ -87,7 +116,7 @@ class RentHouse extends Tospur_House{
$context["mark"] = SearchDao::searchHouseTag($_GET['id']);
$context["status"] = searchDao::searchStatusType(2);
}
$context['role'] = RentHouse::getCurrentRole();
$context['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
......@@ -170,11 +199,12 @@ class RentHouse extends Tospur_House{
}
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
$result = InsertDao::addRecConsultant($houseId,$data);
$result = InsertDao::addRecConsultant($houseId,$data['recConsultant']);
if(!is_numeric($result)){
return $result;
}
InsertDao::addHouseTag($houseId, $data['houseTag']);
CustomerTrackingDao::insert($_POST['houseId'], $_REQUEST);
return $result;
}
}
......
......@@ -10,7 +10,8 @@ class rentHouseList extends WP_List_Table
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(NULLIF(approval != -2, false)) as needCheckNum,
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
......@@ -22,6 +23,7 @@ class rentHouseList extends WP_List_Table
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
......@@ -33,6 +35,7 @@ class rentHouseList extends WP_List_Table
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
......@@ -129,7 +132,7 @@ class rentHouseList extends WP_List_Table
function get_bulk_actions()
{
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
......@@ -206,7 +209,9 @@ class rentHouseList extends WP_List_Table
function process_bulk_action()
{
$action = $this->current_action();
global $wpdb; if ($action) {
global $wpdb;
$id = $_REQUEST['renthouselist'];
if ($action) {
$string = null;
$status = null;
if($action == 'allot'){
......@@ -214,7 +219,6 @@ class rentHouseList extends WP_List_Table
}else{
switch ($action) {
case 'unCheck':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,0);
......@@ -225,7 +229,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'check':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,1);
......@@ -236,7 +239,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'selfSale':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,2);
......@@ -247,7 +249,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'otherSale':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,3);
......@@ -258,7 +259,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'invalid':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,4);
......@@ -269,7 +269,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'reactivation':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string);
......@@ -284,7 +283,6 @@ class rentHouseList extends WP_List_Table
}
break;
case 'onSale':
$id = $_REQUEST['renthouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,-1);
......@@ -313,7 +311,7 @@ class rentHouseList extends WP_List_Table
$this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action();
......@@ -375,7 +373,7 @@ class rentHouseList extends WP_List_Table
$sql = $sql . " and name like %s";
}
if(isset($_REQUEST["approval"])){
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
......
......@@ -48,14 +48,42 @@ class SecHandHouse extends Tospur_House{
"garage"=>$_POST["garage"],
"entrustDay"=>$_POST["entrustDay"],
"deadLine"=>$_POST["deadLine"],
"status" => $_POST["status"],
"property_money"=>$_POST["property_money"],
"mortgage" =>$_POST["mortgage"]
"mortgage" =>$_POST["mortgage"],
"parking_spaces"=>$_POST["parking_spaces"]
);
if($type==2){
$wpdb->query("START TRANSACTION");
if(isset($_POST['houseId'])){
//首先判断是经理修改还是职业顾问做不同的操作,接着判断置业顾问是否修改了状态
if($_POST["userType"] == 0){
//经理
//通过
if($_POST["status"] != -2){
$insert_tospur_house_array["status"] =$_POST["status"];
$insert_tospur_house_array["approval"] = -2;
}else{
//退回
$insert_tospur_house_array["approval"] = $_POST["status"];
}
}else{
//置业顾问
$currentStatus = SearchDao::getDetailInfo($_POST["userType"]);
//修改了状态
if($currentStatus["result"]->status != $_POST["status"]){
$insert_tospur_house_array["approval"] = $_POST["status"];
}else {
//没有修改状态
//没有申请审批
if($currentStatus["result"]->approval == -2){
$insert_tospur_house_array["approval"] = $currentStatus["result"]->status;
}else{
//申请了审批,没有修改状态,approval保持原来的
$insert_tospur_house_array["approval"] = $currentStatus["result"]->approval;
}
}
}
$result = SecHandHouse::data_update($_POST['houseId'],$insert_tospur_house_array);
if(!is_numeric($result)){
$wpdb->query("ROLLBACK");
......@@ -67,6 +95,8 @@ class SecHandHouse extends Tospur_House{
}
}else {
$insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1;
$result = SecHandHouse::secHouseData_insert($insert_tospur_house_array);
if (!is_numeric($result)) {
$wpdb->query("ROLLBACK");
......@@ -84,7 +114,7 @@ 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['role'] = SecHandHouse::getCurrentRole();
$context['canApproval'] = House::canApproval();
$context["city"] = SearchDao::searchCity();
$context["buildProperty"] = SearchDao::searchBuildProperty();
$context["room"] = SearchDao::searchRoom();
......
......@@ -9,7 +9,8 @@ class secHandHouseList extends WP_List_Table
global $wpdb;
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( array( 'paged','type'), $current_url );
$sql = "select COUNT(NULLIF(approval != -2, false)) as needCheckNum,
$sql = "select COUNT(*) as allNum,
COUNT(NULLIF(approval != -2, false)) as needCheckNum,
COUNT(NULLIF(approval = 0, false)) as unCheckNum,
COUNT(NULLIF(approval = 1, false)) as checkNum,
COUNT(NULLIF(approval = -1, false)) as onSaleNum,
......@@ -21,6 +22,7 @@ class secHandHouseList extends WP_List_Table
$result = $wpdb->get_results($sql);
foreach($result as $value){
$approvalParam = array(
"allNum" =>$value->allNum,
"needCheckNum" => $value->needCheckNum,
"unCheckNum" => $value->unCheckNum,
"checkNum" => $value->checkNum,
......@@ -32,6 +34,7 @@ class secHandHouseList extends WP_List_Table
);
}
return array(
"allNum" => '<a href="'.$current_url.'&approval" class="current">全部<span class="count">('.$approvalParam["allNum"].')</span></a>',
"needCheckNum" => '<a href="'.$current_url.'&approval=-2" class="current">需审批<span class="count">('.$approvalParam["needCheckNum"].')</span></a>',
"unCheckNum" => '<a href="'.$current_url.'&approval=0">未审核<span class="count">('.$approvalParam["unCheckNum"].')</span></a>',
"checkNum" => '<a href="'.$current_url.'&approval=1">审核<span class="count">('.$approvalParam["checkNum"].')</span></a>',
......@@ -128,7 +131,7 @@ class secHandHouseList extends WP_List_Table
function get_bulk_actions()
{
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$actions = array(
"agree" =>"通过",
"goBack" =>"退回"
......@@ -204,6 +207,8 @@ class secHandHouseList extends WP_List_Table
{
$action = $this->current_action();
if ($action) {
global $wpdb;
$id = $_REQUEST['sechandhouselist'];
$string = null;
$status = null;
if($action == 'allot'){
......@@ -211,7 +216,6 @@ class secHandHouseList extends WP_List_Table
}else{
switch ($action) {
case 'unCheck':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,0);
......@@ -222,7 +226,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'check':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,1);
......@@ -233,7 +236,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'selfSale':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,2);
......@@ -244,7 +246,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'otherSale':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,3);
......@@ -255,7 +256,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'invalid':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,4);
......@@ -266,7 +266,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'reactivation':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$sql = "select status from tospur_house where id in".$string;
......@@ -282,7 +281,6 @@ class secHandHouseList extends WP_List_Table
}
break;
case 'onSale':
$id = $_REQUEST['sechandhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$res = $this->getCurrentStatus($string,-1);
......@@ -310,7 +308,7 @@ class secHandHouseList extends WP_List_Table
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
if( current_user_can('moderate_comments') ) {
if( current_user_can('houseApproval') ) {
$this->manage_bulk_action();
}else{
$this->process_bulk_action();
......@@ -373,7 +371,7 @@ class secHandHouseList extends WP_List_Table
$sql = $sql . " and name like %s";
}
if(isset($_REQUEST["approval"])){
if(isset($_REQUEST["approval"]) && $_REQUEST["approval"]!=""){
if($_REQUEST["approval"] == -2){
$params[] = $_REQUEST["approval"];
$sql = $sql . " and approval != %d";
......
......@@ -21,7 +21,7 @@ class tospurSaleList extends WP_List_Table
{
switch ($column_name) {
case 'community_name':
return '<a href="' . admin_url('admin.php?page=' . $_GET['page'] . '&id=' . $item['id']) . '">' . $item[$column_name] . '</a>';
return '<a href="' . admin_url('admin.php?page=' . $_GET['page'] . '&id=' . $item['id'] . '&cityId=' . $item['cityId']) . '">' . $item[$column_name] . '</a>';
case 'consultant':
$consultant = $item[$column_name] ? $item[$column_name] : '未分配';
return $consultant;
......@@ -113,10 +113,13 @@ class tospurSaleList extends WP_List_Table
} else if ($house_type == 'tospur_sale_rent') {
$house_type = 2;
}
$sql = "SELECT ts.*,dc.cityName,u.display_name FROM tospur_sale ts" .
$sql = "SELECT ts.*,dc.cityName,tc.name as consultant_name FROM tospur_sale ts" .
" left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" .
" left join wp_users u on u.ID = ts.consultant_id" .
" left join tospur_consultant tc on tc.id = ts.consultant_id" .
" where ts.house_type = " . $house_type;
if (!current_user_can('fdfw_allot')) {
$sql .= " and tc.id = " . get_current_user_id();
}
$cityId = (int)$_GET['cityId'];
if ($cityId > 0) {
$sql .= " and ts.cityId = " . $cityId;
......@@ -131,6 +134,7 @@ class tospurSaleList extends WP_List_Table
$unit = ($value->house_type == 1) ? '万元' : '元/月';
$data[$key] = array(
'id' => $value->id,
'cityId' => $value->cityId,
'cityName' => $value->cityName,
'community_name' => $value->community_name,
'apartment' => $value->bedroom . '室' . $value->hall . '厅' . $value->kitchen . '厨' . $value->bathroom . '卫',
......@@ -141,7 +145,7 @@ class tospurSaleList extends WP_List_Table
'description' => $value->description,
'phone' => $value->phone,
'submission_date' => $value->submission_date,
'consultant' => $value->display_name,
'consultant' => $value->consultant_name,
'handle' => $value->handle,
'handle_date' => $value->handle_date
);
......@@ -173,15 +177,6 @@ class tospurSaleList extends WP_List_Table
}
}
function add_tospur_sale_menu()
{
add_menu_page('房东服务', '房东服务', 'activate_plugins', 'tospur_sale_secondhand', 'tospur_sale_page', 'dashicons-menu', 28);
add_submenu_page('tospur_sale_secondhand', '出售', '出售', 'activate_plugins', 'tospur_sale_secondhand', 'tospur_sale_page');
add_submenu_page('tospur_sale_secondhand', '出租', '出租', 'activate_plugins', 'tospur_sale_rent', 'tospur_sale_page');
}
add_action('admin_menu', 'add_tospur_sale_menu');
function tospur_sale_page()
{
if ($_GET['id']) {
......
......@@ -8,22 +8,53 @@ if ($page == 'tospur_sale_secondhand') {
} else if ($page == 'tospur_sale_rent') {
$house_type = 2;
}
$detail_sql = "SELECT ts.*,dc.cityName,u.display_name FROM tospur_sale ts" .
$role_flag = current_user_can('fdfw_allot');
global $wpdb;
if (isset($_POST['submit']) && $role_flag) {
$consultant_id = $_POST['data']['recConsultant'][0];
if (isset($consultant_id) && $consultant_id != null) {
$wpdb->update('tospur_sale',
array('consultant_id' => $consultant_id),
array('id' => $house_id)
);
} else {
echo '<script>alert("请选择置业顾问")</script>';
}
} else if (isset($_POST['handle']) && !$role_flag) {
$wpdb->update('tospur_sale',
array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s'),
),
array('id' => $house_id)
);
}
$detail_sql = "SELECT ts.*,dc.cityName,tc.id as consultant_id,tc.imageUrl,tc.name as consultant_name FROM tospur_sale ts" .
" left join (SELECT cityId,cityName FROM dic_city group by cityId) dc on ts.cityId = dc.cityId" .
" left join wp_users u on u.ID = ts.consultant_id" .
" left join tospur_consultant tc on tc.id = ts.consultant_id" .
" where ts.house_type = " . $house_type . " and ts.id = " . $house_id;
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u '
. 'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
$result = $wpdb->get_row($detail_sql);
global $wpdb;
$context['detail_result'] = $wpdb->get_row($detail_sql);
$context['consultant_result'] = $wpdb->get_results($consultant_sql);
if ($result->consultant_id && $role_flag) {
$context['consultant'][0] = array(
'id' => $result->consultant_id,
'imageUrl' => $result->imageUrl,
'name' => $result->consultant_name
);
}
$context['detail_result'] = $result;
$context['url'] = home_url();
$context['id'] = $house_id;
$context['cityId'] = $_GET['cityId'];
$context['house_type'] = $house_type;
$context['city'] = SearchDao::searchCity();
$context['role_flag'] = $role_flag;
if (!$role_flag) {
$context['handle'] = (integer)$result->handle;
}
Timber::render('sale_detail.html', $context);
......
......@@ -127,13 +127,6 @@ class viewHouseList extends WP_List_Table
}
}
function add_view_house_menu()
{
add_menu_page('预约列表', '预约列表', 'moderate_comments', 'view_house', 'view_house_page', 'dashicons-menu', 27);
}
add_action('admin_menu', 'add_view_house_menu');
function view_house_page()
{
if ($_GET['id']) {
......
......@@ -227,6 +227,13 @@
<br/>
<div class="row">
<div class="col-md-8">
<label for="buy[mtime]">应收时间:</label>
<input name="buy[mtime]" type="text" class="form-control" {% if commission[0] %}value = "{{commission[0].mtime}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<button type="button" class="button action" id="paid_buy">
添加实收佣金
</button>
......@@ -317,6 +324,13 @@
<br/>
<div class="row">
<div class="col-md-8">
<label for="sell[mtime]">应收时间:</label>
<input name="sell[mtime]" type="text" class="form-control" {% if commission[1] %}value = "{{commission[1].mtime}}" readonly {% endif %}>
</div>
</div>
<br/>
<div class="row">
<div class="col-md-8">
<button type="button" class="button action" id="paid_sell">
添加实收佣金
</button>
......
<h2>诚信宣言</h2>
<label for="introduction">
<textarea id="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ introduction }}</textarea>
</label>
<style>
p {
font-size: 15px;
margin: 20px 0;
}
</style>
<h2>我的设置</h2>
<p>
<label for="time">入职时间:</label>
<input type="date" id="time" value="{{ time }}">
</p>
<p>
<label for="introduction" style="vertical-align: top;">诚信宣言:</label>
<textarea id="introduction" placeholder="请输入诚信宣言" rows="10" cols="50" style="resize: none;">{{ introduction }}</textarea>
</p>
<p>
<input type="hidden" id="user_id" value="{{ user_id }}">
<input type="submit" id="submit" class="button">
</p>
<script>
(function ($) {
var oldIntroduction = '{{ introduction }}';
$(document).ready(function () {
$('#submit').click(function () {
var introduction = $('#introduction').val();
var time = $('#time').val();
var user_id = $('#user_id').val();
if (introduction.trim() != '' && oldIntroduction != introduction) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=submit_introduction&introduction=' + introduction + '&user_id=' + user_id,
success: function (data) {
if (data) {
alert('提交成功');
}
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=submit_introduction&time=' + time + '&introduction=' + introduction + '&user_id=' + user_id,
success: function (data) {
if (data) {
alert('提交成功');
}
});
}else{
alert('请修改诚信宣言');
}
}
});
});
});
})(jQuery);
......
......@@ -5,92 +5,96 @@
<br />
{% include 'selectOrganization.html' %}
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity" class="form-control">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="listDistrict" name="listDistrict" class="form-control">
<option value="-1">区域</option>
{% if district %}
{% for item in district %}
<option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
<div style="margin-bottom: 10px;">
<input type="hidden" name="page" value="{{page}}"/>
<select id="listCity" name="listCity" class="form-control">
<option value="-1"> 城市</option>
{% for item in city %}
<option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="listDistrict" name="listDistrict" class="form-control">
<option value="-1">区域</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" class="form-control">
<option value="-1">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice" class="form-control">
<option value ="">租金</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% elseif house_type == 0 %}
<select id="averagePrice" name="averagePrice" class="form-control">
<option value ="">单价</option>
<!--<option {{ item.value == average_price ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>-->
</select>
{% else%}
<select id="totalPrice" name="totalPrice" class="form-control">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% endif %}
</select>
<select id="listPlate" name="listPlate" class="form-control">
<option value="-1">板块</option>
{% if plate %}
{% for item in plate %}
<option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
{% if house_type == 0%}
<select id="room" name="room" class="form-control">
<option value="-1">类型</option>
{% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
{% endif %}
</select>
{% if house_type == 2%}
<select id="rentalPrice" name="rentalPrice" class="form-control">
<option value ="">租金</option>
{% if dicRentalPrice %}
{% for item in dicRentalPrice %}
<option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% elseif house_type == 0 %}
<select id="averagePrice" name="averagePrice" class="form-control">
<option value ="">单价</option>
<!--<option {{ item.value == average_price ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>-->
</select>
{% else%}
<select id="totalPrice" name="totalPrice" class="form-control">
<option value ="">价格</option>
{% if dicTotalPrice %}
{% for item in dicTotalPrice %}
<option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
{% endfor %}
{% endif %}
</select>
{% endif %}
{% if house_type == 0%}
<select id="room" name="room" class="form-control">
<option value="-1">类型</option>
{% for item in room %}
<option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
{% endif %}
<select id="buildProperty" name="buildProperty" class="form-control">
<option value="-1"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage" class="form-control">
<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" class="form-control">
<option value="-1">状态</option>
{% for item in status%}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<input type="text" placeholder="请出入楼盘名" name="searchText" class="form-control">
<br />
<label for="beginDate" >开始日期:</label>
<input type="date" name="beginDate" class="form-control" {% if req %}value="{{req.beginDate}}"{% endif %}>
<label for="endDate">结束日期:</label>
<input type="date" name="endDate" class="form-control" {% if req %}value="{{req.endDate}}"{% endif %}>
<label for="stuff">员工:</label>
<input type="text" name="stuff" class="form-control" {% if req %}value="{{req.stuff}}"{% endif %}>
<input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索">
<select id="buildProperty" name="buildProperty" class="form-control">
<option value="-1"> 房型</option>
{% for item in buildProperty %}
<option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
<select id="acreage" name="acreage" class="form-control">
<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" class="form-control">
<option value="-1">状态</option>
{% for item in status%}
<option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
{% endfor %}
</select>
</div>
<div id="organization" style="margin-bottom: 10px;">
<label for="endDate">楼盘名:</label>
<input type="text" name="searchText" class="form-control">
<label for="beginDate" >开始日期:</label>
<input type="date" name="beginDate" class="form-control" {% if req %}value="{{req.beginDate}}"{% endif %}>
<label for="endDate">结束日期:</label>
<input type="date" name="endDate" class="form-control" {% if req %}value="{{req.endDate}}"{% endif %}>
<label for="stuff">员工:</label>
<input type="text" name="stuff" class="form-control" {% if req %}value="{{req.stuff}}"{% endif %}>
<input type="hidden" name="hasSearch" value="1"/>
<input type="hidden" id="house_type" value="{{house_type}}"/>
<input type="submit" id="submit" class="button action" value="搜索">
</div>
</form>
<form method="post">
<!-- Now we can render the completed list table -->
......
......@@ -62,16 +62,25 @@
</div>
<div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status" class="form-control">
{% if houseId %}
{% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
{% else %}
<select name="status" class="form-control">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
</select>
{% else %}
<input type="hidden" name="status" value="0">
<input type="hidden" name="userType" value="{{houseId}}">
{% endif %}
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
<input type="submit" id="submit" class="button action" style="float:left">
</div>
</div>
......@@ -128,6 +137,7 @@
community_name:'请输入小区名称',
address:'请输入地址',
average_price:'请输入均价',
description:'请输入跟进说明'
},
errorContainer: "#messageBox1",
......@@ -137,8 +147,12 @@
alert("请选择房源相册");
return false;
}
if($("#houseImg > p").length == 0){
alert("请选择推荐房源");
if($("#consultantImg > p").length == 0){
alert("请选择置业顾问");
return false;
}
if($("#photosTbody > tr").length == 0){
alert("请选择房源相册");
return false;
}
form.submit();
......
......@@ -50,15 +50,26 @@
{% endif %}
</div>
<div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
</select>
<div class="row" style="position: fixed;">
{% if houseId %}
{% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
{% else %}
<select name="status" class="form-control">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
</select>
<input type="hidden" name="userType" value="{{houseId}}">
{% endif %}
{% endif %}
<input type="submit" id="submit" class="button action" style="float:left">
</div>
</div>
</div>
......
<style>
.sale_detail ul {
margin-top: 30px;
}
.sale_detail ul li {
margin: 20px 0;
}
.sale_detail ul li span:nth-of-type(1) {
font-weight: bold;
font-size: 14px;
display: inline-block;
width: 100px;
}
.sale_detail ul li span:nth-of-type(2) {
font-size: 14px;
display: inline-block;
width: 400px;
}
</style>
<script>
(function ($) {
$(document).ready(function () {
$('#handle').click(function () {
var consultant_id = $('#consultant').find('option:selected').val();
alert(consultant_id);
});
});
})(jQuery);
</script>
{% if house_type == 1 %}
{% set unit = '万元' %}
{% set price = '售价' %}
{% elseif house_type == 2 %}
{% set unit = '元/月' %}
{% set price = '租金' %}
{% endif %}
<div class="sale_detail">
<h2>房东服务详细</h2>
<ul>
<li>
<span>城市:</span>
<span>{{ detail_result.cityName }}</span>
</li>
<li>
<span>小区名称:</span>
<span>{{ detail_result.community_name }}</span>
</li>
<li>
<span>户型:</span>
<span>{{ detail_result.bedroom }}室{{ detail_result.hall }}厅{{ detail_result.kitchen }}厨{{ detail_result.bathroom }}卫</span>
</li>
<li>
<span>面积:</span>
<span>{{ detail_result.covered_area }}m²</span>
</li>
<li>
<span>楼层:</span>
<span>第{{ detail_result.floor }}层(共{{ detail_result.total_floor }}层)</span>
</li>
<li>
<span>期望{{ price }}:</span>
<span>{{ detail_result.price }}{{ unit }}</span>
</li>
<li>
<span>房源描述:</span>
<span>{{ detail_result.description }}</span>
</li>
<li>
<span>置业顾问:</span>
<span>
<select id="consultant">
{% for consultant in consultant_result %}
<option value="{{ consultant.id }}"{% if(house_result.consultant_id == consultant.id) %} selected="selected"{% endif %}>{{ consultant.display_name }}</option>
{% endfor %}
</select>
<label for="consultant"></label>
</span>
</li>
</ul>
</div>
<button id="handle">提交处理</button>
\ No newline at end of file
<style>
.sale_detail ul {
margin-top: 30px;
}
.sale_detail ul li {
margin: 20px 0;
}
.sale_detail ul li span:nth-of-type(1) {
font-weight: bold;
font-size: 14px;
display: inline-block;
width: 100px;
}
.sale_detail ul li span:nth-of-type(2) {
font-size: 14px;
display: inline-block;
width: 400px;
}
</style>
<script>
(function ($) {
$(document).ready(function () {
$('#handle').click(function () {
var consultant_id = $('#consultant').find('option:selected').val();
alert(consultant_id);
});
});
})(jQuery);
</script>
{% if house_type == 1 %}
{% set unit = '万元' %}
{% set price = '售价' %}
{% elseif house_type == 2 %}
{% set unit = '元/月' %}
{% set price = '租金' %}
{% endif %}
<form method="post">
<div class="sale_detail">
<h2>房东服务详细</h2>
<ul>
<li>
<span>城市:</span>
<span>{{ detail_result.cityName }}</span>
</li>
<li>
<span>小区名称:</span>
<span>{{ detail_result.community_name }}</span>
</li>
<li>
<span>户型:</span>
<span>{{ detail_result.bedroom }}室{{ detail_result.hall }}厅{{ detail_result.kitchen }}厨{{ detail_result.bathroom }}卫</span>
</li>
<li>
<span>面积:</span>
<span>{{ detail_result.covered_area }}m²</span>
</li>
<li>
<span>楼层:</span>
<span>第{{ detail_result.floor }}层(共{{ detail_result.total_floor }}层)</span>
</li>
<li>
<span>期望{{ price }}:</span>
<span>{{ detail_result.price }}{{ unit }}</span>
</li>
<li>
<span>房源描述:</span>
<span>{{ detail_result.description }}</span>
</li>
</ul>
{% if role_flag %}
{% include 'addConsultant.html' %}
<input type="hidden" name="submit" value="1">
<input type="hidden" id="baseCity" value="{{ cityId }}">
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
{% else %}
<input type="hidden" name="handle" value="1">
{% endif %}
{% if handle == 0 %}
<input type="submit" id="submit" class="button action" value="提交处理">
{% endif %}
</div>
</form>
\ No newline at end of file
......@@ -55,15 +55,25 @@
</div>
<div class="col-xs-2">
<div class="row" style="position: fixed;top:200px;">
{% if (role == 'administrator'or role =='eidtor') %}
<select id="status" name="status" class="form-control">
{% if houseId %}
{% if canApproval %}
{% if result.approval != -2 %}
<select name="status" class="form-control">
<option value="{{result.approval}}">通过</option>
<option value="-2">退回</option>
</select>
<input type="hidden" name="userType" value="0">
{% endif %}
{% else %}
<select name="status" class="form-control">
{% for item in status %}
<option {{ item.id == result.status?"selected":"" }} value={{item.id}}>{{item.value}}</option>
{% endfor %}
</select>
{% else %}
<input type="hidden" name="status" value="0"> {% endif %}
<input type="submit" id="submit" class="button action" style="position: fixed;top:155px">
<input type="hidden" name="userType" value="{{houseId}}">
{% endif %}
{% endif %}
<input type="submit" id="submit" class="button action" style="float:left">
</div>
</div>
</div>
......
{% set organization = function('SearchDao::searchOrganization')|json_encode() %}
<div id="organization" style="margin-bottom: 10px;">
<span>门店</span>
<label>部门:</label>
<label for="depth_1" class="hidden"></label>
<select data-depth="1" id="depth_1">
<option value="-1">请选择</option>
......
......@@ -46,6 +46,18 @@ class CustomerDao
$result = $wpdb->get_results($wpdb->prepare($sql, $search,$search));
wp_send_json($result);
}
public static function updateCustomerStatue($id,$status){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CUSTOMER_TABLE,array(
'status' => $status,
),array(
'id' => $id
));
if($wpdb->last_error)
return $wpdb->last_error;
return $result;
}
}
?>
\ No newline at end of file
......@@ -3,16 +3,15 @@
class InsertDao{
public static function insert_tospur_house($params){
global $wpdb;
$houseRes = $wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
$wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
$houseId = $wpdb->insert_id;
if(!InsertDao::setHouseNumber($houseId,$params['house_type'],$params['city_id'])){
return "房源代码生成失败";
}
if($houseRes){
return $houseId;
}else{
return $wpdb->last_error;
}
return $houseId;
}
public static function setHouseNumber($houseId,$houseType,$cityId){
......@@ -41,52 +40,47 @@ class InsertDao{
public static function insert_tospur_image($params){
global $wpdb;
$imgRes = $wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params);
$imgId = $wpdb->insert_id;
if($imgRes){
return $imgId;
}else{
$wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
$imgId = $wpdb->insert_id;
return $imgId;
}
public static function insert_a_district_area($params){
global $wpdb;
$districtAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params);
if($districtAreaRes){
return $districtAreaRes;
}else{
$wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
return $wpdb->insert_id;
}
public static function insert_a_house_image($params){
global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params);
if($houseImageRes){
return $houseImageRes;
}else{
$wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
return $wpdb->insert_id;
}
public static function insert_a_house_recommend($params){
global $wpdb;
$houseImageRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
if($houseImageRes){
return $houseImageRes;
}else{
$wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
return $wpdb->insert_id;
}
public static function insert_a_house_user($params){
global $wpdb;
$houseUserRes = $wpdb->insert(Config::A_HOUSE_USER_TABLE, $params);
if($houseUserRes){
return $houseUserRes;
}else{
$wpdb->insert(Config::A_HOUSE_USER_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
return $wpdb->insert_id;
}
public static function addMainImage($houseId,$data){
......@@ -94,6 +88,7 @@ class InsertDao{
//图片信息
$uploadedfile = $_FILES['files'];
$frontCover = $_POST["frontCover"];
$result = 1;
//主力房源的图片与房子信息关联插入数据库
if(isset($uploadedfile["name"])){
foreach($uploadedfile["name"] as $key=> $value) {
......@@ -128,9 +123,9 @@ class InsertDao{
$imagePath = get_home_path().$url;
Image::makeImage($uploadFileName,$imagePath);
//插入图片表
$imgRes = $wpdb->insert('tospur_image', $insert_image_array);
if (!$imgRes) {
return 501;
$wpdb->insert('tospur_image', $insert_image_array);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
//获取插入图片的id
......@@ -147,10 +142,8 @@ class InsertDao{
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
);
$houseTypeAreaRes = $wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if ($houseTypeAreaRes) {
return $houseTypeAreaRes;
}else{
$wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
}
......@@ -159,9 +152,9 @@ class InsertDao{
'house_id' => $houseId,
'image_id' => $imgid,
);
$houseImgRes = $wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if ($houseImgRes) {
return $houseImgRes;
$wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
} else {
return $movefile['error'];
......@@ -170,6 +163,10 @@ class InsertDao{
}
}
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,array("frontCover_id"=>$frontCover),array("id"=>$houseId));
if ($wpdb->last_error) {
return $wpdb->last_error;
}
return $result;
}
public static function addRecommend($houseId,$data){
......@@ -181,14 +178,13 @@ class InsertDao{
"house_id" => $houseId,
"recommend_id" =>$value
);
$a_house_recommendRes = $wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
}
if($a_house_recommendRes){
return $a_house_recommendRes;
}else{
return $wpdb->last_error;
$wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
if( $wpdb->last_error){
return $wpdb->last_error;
}
}
}
return 1;
}
public static function addRecConsultant($houseId, $consultant){
......@@ -201,14 +197,13 @@ class InsertDao{
"house_id" => $houseId,
"user_type" => 1
);
$a_house_userRes = $wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
}
if($a_house_userRes){
return $a_house_userRes;
}else{
return $wpdb->last_error;
$wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
if( $wpdb->last_error){
return $wpdb->last_error;
}
}
}
return 1;
}
public static function addHouseFeature($houseId,$houseFeature){
......@@ -219,15 +214,13 @@ class InsertDao{
"house_id" => $houseId,
"tag_id" =>$val
);
$a_house_featureRes = $wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
}
if($a_house_featureRes){
return $a_house_featureRes;
}else{
return $wpdb->last_error;
$wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
if( $wpdb->last_error){
return $wpdb->last_error;
}
}
}
return 1;
}
......@@ -240,6 +233,9 @@ class InsertDao{
" left JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id) as a" .
" where house_id = %d and a.type = 0);", $house_id)
);
if( $wpdb->last_error){
return $wpdb->last_error;
}
if ($houseTag) {
foreach ($houseTag as $val) {
$a_house_tag = array(
......@@ -247,8 +243,12 @@ class InsertDao{
"tag_id" => $val
);
$wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
if( $wpdb->last_error){
return $wpdb->last_error;
}
}
}
return 1;
}
public static function arrayToString($array)
......
......@@ -305,7 +305,7 @@ class SearchDao
}
if($consultantName != NULL){
$params[] = '%'.$consultantName.'%';
$sql = $sql." and name like %s";
$sql = $sql." and tc.name like %s";
}
$result = $wpdb->get_results($wpdb->prepare($sql,$params));
return $result;
......
<?php
require_once(PLUGIN_DIR . 'Config.php');
class TospurDao
......
......@@ -3,4 +3,29 @@
require_once(PLUGIN_DIR . 'Config.php');
class Core {
function get_week($year) {
$year_start = $year . "-01-01";
$year_end = $year . "-12-31";
$startday = strtotime($year_start);
if (intval(date('N', $startday)) != '1') {
$startday = strtotime("next monday", strtotime($year_start)); //获取年第一周的日期
}
$year_mondy = date("Y-m-d", $startday); //获取年第一周的日期
$endday = strtotime($year_end);
if (intval(date('W', $endday)) == '7') {
$endday = strtotime("last sunday", strtotime($year_end));
}
$num = intval(date('W', $endday));
for ($i = 1; $i <= $num; $i++) {
$j = $i -1;
$start_date = date("Y-m-d", strtotime("$year_mondy $j week "));
$end_day = date("Y-m-d", strtotime("$start_date +6 day"));
$week_array[$i] = array ( $start_date, $end_day );
}
return $week_array;
}
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ class TCSync {
$user = get_user_by( "login", $item['WorkNum'] );
$userdata = array(
'ID' => $user->data->ID,
'role' => 'author',
'role' => 'zygw',
'display_name' => $item['Name']
);
$user_id = wp_update_user( $userdata ) ;
......@@ -30,7 +30,7 @@ class TCSync {
$userdata = array(
'user_login' => $item['WorkNum'],
'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected.
'role' => 'author',
'role' => 'zygw',
'display_name' => $item['Name']
);
$user_id = wp_insert_user( $userdata ) ;
......@@ -70,6 +70,7 @@ class TCSync {
$result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true);
//print_r($result['data']['CityList']);
$wpdb->query("delete from ".Config::DIC_CITY_TABLE." where cityId > -1;");
foreach($result['data']['CityList'] as $item){
$wpdb->query(TCSync::create_insert_update_sql(Config::DIC_CITY_TABLE,$item,array('plateId')));
//print_r(TCSync::create_insert_update_sql(Config::CITY_TABLE,$item,array('plateId')));print_r("<br />");
......
......@@ -11,7 +11,7 @@ define('PLUGIN_DIR', dirname(__FILE__) . '/');
add_action('init', 'tospur_init');
function tospur_init()
{
{my_plugin_activate();
require_once(PLUGIN_DIR . 'Config.php');
require_once(PLUGIN_DIR . 'Tools/TCSync.php');
require_once(PLUGIN_DIR . 'Tools/Image.php');
......@@ -184,26 +184,141 @@ function update_consultant()
}
}
function my_plugin_activate() {
remove_role("zygw");
remove_role("qzzy");
remove_role("xzzl");
remove_role("jl");
$cRole = array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"mySet" => true,
"fdfw_allot" => true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
);
add_role("zygw","置业顾问",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"ht"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"mySet" => true,
"yyList"=>true
));
add_role("qzzy","权证专员",array(
"ht"=>true,
"htEdit"=>true
));
add_role("xzzl","行政助理",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"fdfw_allot"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
));
add_role("jl","经理",array(
"xf"=>true,
"xfList"=>true,
"esf"=>true,
"esfList"=>true,
"zf"=>true,
"zfList"=>true,
"kh"=>true,
"khList"=>true,
"fygj"=>true,
"sygl"=>true,
"zygwpf"=>true,
"zygwyj"=>true,
"syjdb"=>true,
"addTag"=>true,
"addFeature"=>true,
"dataSync"=>true,
"houseApproval"=>true,
"ht"=>true,
"htEdit"=>true,
"htApproval"=>true,
"fdfw_allot"=>true,
"fdfw_cs" => true,
"fdfw_cz" => true,
"yyList"=>true
));
}
register_activation_hook( __FILE__, 'my_plugin_activate' );
function reset_menu()
{
add_menu_page('新房列表','新房列表', 'edit_published_posts', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'edit_published_posts', 'newHouse', 'House::init_view');
add_menu_page('二手房列表','二手房列表', 'edit_published_posts', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'edit_published_posts', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_menu_page('租房列表','租房列表', 'edit_published_posts', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'edit_published_posts', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("诚信宣言", "诚信宣言", "author", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('合同列表','合同列表', 'edit_published_posts', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10);
add_submenu_page('contractList', '添加合同', '添加合同', 'edit_published_posts', 'contract', 'Contract::init_view');
add_menu_page('客户列表','客户列表', 'edit_published_posts', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'edit_published_posts', 'customer', 'customer::customer_html');
add_menu_page('签约—房客跟进', '签约—房客跟进', 'edit_published_posts', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('收佣管理','收佣管理', 'edit_published_posts', 'commissionManage', 'commissionManage::commissionManage_html', 'dashicons-menu', 13);
add_menu_page('置业顾问评分', '置业顾问评分', 'moderate_comments', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 14);
add_submenu_page('consultant_score', '置业顾问业绩', '置业顾问业绩', 'edit_published_posts', 'quotaList', 'QuotaYearList::showHtml');
add_menu_page('收佣进度表', '收佣进度表', 'moderate_comments', 'commissionList', 'function_commissionList', 'dashicons-menu', 15); add_menu_page('添加标签', '添加标签', 'edit_published_posts', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('添加特色', '添加特色', 'edit_published_posts', 'add_feature', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page("同步数据", "同步数据", "manage_options", "sync", "TCSyncView::display", 'dashicons-menu');
add_menu_page('新房列表','新房列表', 'xfList', 'newHouseList', 'function_newHouseList', 'dashicons-menu', 6);
add_submenu_page('newHouseList', '添加新房', '添加新房', 'xf', 'newHouse', 'House::init_view');
add_menu_page('二手房列表','二手房列表', 'esfList', 'secHandHouseList', 'function_secHandHouseList', 'dashicons-menu', 7);
add_submenu_page('secHandHouseList', '添加二手房', '添加二手房', 'esf', 'secHandHouse', 'SecHandHouse::secHandHouse_html');
add_menu_page('租房列表','租房列表', 'zfList', 'rentHouseList', 'function_rentHouseList', 'dashicons-menu', 8);
add_submenu_page('rentHouseList', '添加租房', '添加租房', 'zf', 'rentHouse', 'RentHouse::rentHouse_html');
add_menu_page("我的设置", "我的设置", "mySet", "introduction", "introduction::introduction_html", 'dashicons-menu', 9);
add_menu_page('合同列表','合同列表', 'ht', 'contractList', 'Contract_List::showTableView', 'dashicons-menu', 10);
add_submenu_page('contractList', '添加合同', '添加合同', 'htEdit', 'contract', 'Contract::init_view');
add_menu_page('客户列表','客户列表', 'khList', 'customerList', 'function_customerList', 'dashicons-menu', 11);
add_submenu_page('customerList', '新增客户', '新增客户', 'kh', 'customer', 'customer::customer_html');
add_menu_page('房客跟进', '房客跟进', 'fygj', 'customerTrackingList', 'function_customerTrackingList', 'dashicons-menu', 12);
add_menu_page('置业顾问评分', '置业顾问评分', 'zygwpf', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 14);
add_submenu_page('consultant_score', '置业顾问业绩', '置业顾问业绩', 'zygwyj', 'quotaList', 'QuotaYearList::showHtml');
add_menu_page('收佣进度表', '收佣进度表', 'syjdb', 'commissionList', 'function_commissionList', 'dashicons-menu', 15);
add_menu_page('房东服务', '房东服务', 'fdfw_cs', 'tospur_sale_secondhand', 'tospur_sale_page', 'dashicons-menu', 16);
add_submenu_page('tospur_sale_secondhand', '出售', '出售', 'fdfw_cs', 'tospur_sale_secondhand', 'tospur_sale_page');
add_submenu_page('tospur_sale_secondhand', '出租', '出租', 'fdfw_cz', 'tospur_sale_rent', 'tospur_sale_page');
add_menu_page('预约列表', '预约列表', 'yyList', 'view_house', 'view_house_page', 'dashicons-menu', 17);
add_menu_page('添加标签', '添加标签', 'addTag', 'add_tag', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page('添加特色', '添加特色', 'addFeature', 'add_feature', 'feature::add_feature_html', 'dashicons-menu');
add_menu_page("同步数据", "同步数据", "dataSync", "sync", "TCSyncView::display", 'dashicons-menu');
//移除更新信息
remove_action( 'admin_notices', 'update_nag', 3 );
global $menu;
......
......@@ -242,11 +242,14 @@ function new_login_redirect($redirect_to, $request, $user)
{
if ($user->ID > 0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor') {
return admin_url('admin.php?page=newHouseList');
if ($role == 'administrator' || $role == 'editor' || $role == 'author' || $role == 'zygw' || $role == 'xzzl' || $role == 'jl') {
$url = admin_url('admin.php?page=newHouseList');
} else if($role == 'qzzy'){
$url = admin_url('admin.php?page=contractList');
} else {
return site_url();
$url = site_url();
}
return $url;
} else {
return $redirect_to;
}
......@@ -270,8 +273,10 @@ function user_redirect($user)
$url = null;
if ($user->ID > 0) {
$role = $user->roles[0];
if ($role == 'administrator' || $role == 'editor' || $role == 'author') {
if ($role == 'administrator' || $role == 'editor' || $role == 'author' || $role == 'zygw' || $role == 'xzzl' || $role == 'jl') {
$url = admin_url('admin.php?page=newHouseList');
} else if($role == 'qzzy'){
$url = admin_url('admin.php?page=contractList');
} else {
$url = site_url();
}
......
......@@ -136,7 +136,7 @@ function ajax_get_house(url, loading, ajax_data, context) {
div.find('[data-attr=community]').text(value.community_name);
div.find('[data-attr=apartment]').text(value.bp_literal);
div.find('[data-attr=covered_area]').text(value.covered_area + '平米');
div.find('[data-attr=price]').html('<em>' + (value.total_price / 10000) + '万</em>');
div.find('[data-attr=price]').html('<em>' + (value.total_price / 10000).toFixed(0) + '万</em>');
} else if (houseType == 2) {
div.find('[data-attr=community]').text(value.community_name);
div.find('[data-attr=apartment]').text(value.bp_literal);
......
......@@ -13,7 +13,7 @@ if ($current_user_id != 0) {
case 'subscriber':
$result = TospurDao::search_view_house_by_user_id($current_user_id);
break;
case 'editor':
case 'zygw':
$result = TospurDao::search_view_house_by_consultant_id($current_user_id);
break;
}
......
......@@ -12,13 +12,11 @@ if ($current_user_id == 0) {
$role = $current_user->roles[0];
$user_role = '';
switch ($role) {
case 'administrator':
case 'subscriber':
$user_role = '用户';
wp_redirect(get_site_url()."?page=myHouse");
break;
case 'editor':
case 'zygw':
$user_role = '置业顾问';
wp_redirect(get_site_url()."?page=list");
break;
......
......@@ -274,7 +274,9 @@
$("#urbanArea_scroller").children(":not(:first)").remove();
if($(this).attr("data-id") != undefined){
$.each(plate[$(this).attr("data-id")],function(i,item){
$("#urbanArea_scroller").append('<a data-id="'+item.id+'">'+item.value+'</a>');
if(item.value){
$("#urbanArea_scroller").append('<a data-id="'+item.id+'">'+item.value+'</a>');
}
});
}
urbanAreaScroll.refresh();
......
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