Commit fc27c8f7 by felix

每日一更

parent f93022d6
......@@ -126,8 +126,8 @@ class Contract {
$delete_photo_ids = implode(",",$delete_photo_ids);
if($delete_photo_ids){
$path = ContractDao::searchImgPath($delete_photo_ids);
$wpdb->query("delete from ".Config::A_CONTRACT_IMAGE_TABLE." where contract_id = {$_REQUEST["id"]} and image_id in ({$delete_photo_ids});");
$wpdb->query("delete from ".Config::TOSPUR_IMAGE_TABLE." where id in ({$delete_photo_ids});");
DBManager::query("delete from ".Config::A_CONTRACT_IMAGE_TABLE." where contract_id = {$_REQUEST["id"]} and image_id in ({$delete_photo_ids});");
DBManager::query("delete from ".Config::TOSPUR_IMAGE_TABLE." where id in ({$delete_photo_ids});");
foreach($path as $value){
$url = substr_replace(__DIR__,$value->path,strpos(__DIR__,"wp",0)-1);
unlink($url);
......
......@@ -116,7 +116,7 @@ class Contract_List extends WP_List_Table{
$sql .= " and (t.consultantId = ".get_current_user_id()." or t.managerId = ".get_current_user_id().")";
}
$sql .= " order by t.signedDate desc";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......
......@@ -88,11 +88,11 @@ class House extends Tospur_House{
public static function data_update($houseId,$insert_tospur_house_array){
global $wpdb;
$data = $_POST["data"];
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
$result = DBManager::update(Config::TOSPUR_HOUSE_TABLE,$insert_tospur_house_array,array("id" => $houseId));
$exist_ids = array();
if(isset($_POST['exists'])){
foreach($_POST['exists'] as $id => $item){
$wpdb->update(Config::A_DISTRICT_AREA_TABLE,array(
DBManager::update(Config::A_DISTRICT_AREA_TABLE,array(
"buildproperty_id" => $item['buildProperty'],
"house_area" => $item['housearea']
),array("image_id" => $id));
......@@ -105,14 +105,14 @@ class House extends Tospur_House{
$delete_ids[] = $id;
}
$delete_ids = implode(",",$delete_ids);
$wpdb->query("delete from ".Config::A_DISTRICT_AREA_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
DBManager::query("delete from ".Config::A_DISTRICT_AREA_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
DBManager::query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_ids});");
InsertDao::addMainImage($houseId,$data);
$exists_photo_ids = array();
if(isset($_POST['exists_photo'])){
foreach($_POST['exists_photo'] as $id => $item){
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
DBManager::update(Config::TOSPUR_IMAGE_TABLE,array(
"image_type" => $item['type'],
),array("id" => $id));
$exists_photo_ids[] = $id;
......@@ -124,9 +124,9 @@ class House extends Tospur_House{
$delete_photo_ids[] = $id;
}
$delete_photo_ids = implode(",",$delete_photo_ids);
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
DBManager::query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
DBManager::delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
......@@ -149,7 +149,7 @@ class House extends Tospur_House{
//获取新房信息,存入tospur_house表
$params['creattime'] = date("Y-m-d H:i:s");
$params['house_type'] = 0;
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT);
$res = DBManager::get_results('SELECT * FROM tospur_house WHERE name="' . $_POST['housename'] . '" and address="' . $_POST['address'] . '" and house_type=0', OBJECT);
if (!$res) {
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
......
......@@ -31,7 +31,7 @@ class QuotaMonthList extends WP_List_Table{
$sql = "select COUNT(*) as totle,COUNT(NULLIF(quota is not null, false)) as isset,COUNT(NULLIF(quota is null, false)) as unset from ".Config::TOSPUR_CONSULTANT." tc
left join ".Config::TOSPUR_QUOTA_TABLE." tq on tq.consultantId = tc.id and tq.year = %d and tq.month = %d
where subsidiaryId = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
$result =DBManager::get_row($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
return array(
"all" => '<a href="'.$current_url.'"'.(isset($_REQUEST["type"])?"":'class="current"').'>全部<span class="count">('.$result->totle.')</span></a>',
......@@ -62,7 +62,7 @@ class QuotaMonthList extends WP_List_Table{
}
$sql .=" null";
}
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
$result = DBManager::get_results($wpdb->prepare($sql,$_REQUEST["year"],$_REQUEST["month"],$_REQUEST["oid"]));
foreach($result as $key => $value){
$data[$key] = array(
'id' => $value->id,
......
......@@ -37,8 +37,8 @@ class QuotaYearList extends WP_List_Table
if(isset($_REQUEST["year"]) && isset($_REQUEST["organization"])){
$sql = "select *, month,sum(quota) as quota from ".Config::TOSPUR_QUOTA_TABLE." where consultantId in(select id from ".Config::TOSPUR_CONSULTANT."
where subsidiaryId = %d) and year = %d group by year,month;";
$result = $wpdb->get_results($wpdb->prepare($sql,$_REQUEST["organization"],$_REQUEST["year"]));
$name = $wpdb->get_var($wpdb->prepare("select Name from tospur_organization where id = %d;",$_REQUEST["organization"]));
$result = DBManager::get_results($wpdb->prepare($sql,$_REQUEST["organization"],$_REQUEST["year"]));
$name = DBManager::get_var($wpdb->prepare("select Name from tospur_organization where id = %d;",$_REQUEST["organization"]));
$j = 0;
for($i = 1;$i<=12;$i++){
$item = $result[$j];
......
......@@ -11,7 +11,7 @@ class Statistics {
where house_type >0 and creattime >= '".$today."' and
creattime<DATE_SUB('".$today."', INTERVAL -1 DAY)
group by user_id,house_type;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -41,7 +41,7 @@ class Statistics {
where time >= '".$today."'
and time<DATE_SUB('".$today."', INTERVAL -1 DAY)
group by consultant_id;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -82,7 +82,7 @@ class Statistics {
where tct.time >= '".$today."'
and tct.time < DATE_SUB('".$today."', INTERVAL -1 DAY)
group by consultant_id;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -109,7 +109,7 @@ class Statistics {
and dealTime >= '".$today."'
and dealTime < DATE_SUB('".$today."', INTERVAL -1 DAY))
group by consultantId;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
//print_r($wpdb->last_query);
if(!$wpdb->last_error){
foreach($result as $item){
......@@ -133,7 +133,7 @@ class Statistics {
}
$sql = "select consultantId,quota from tospur_quota where year = ".$year." and month = ".$month.";";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -157,7 +157,7 @@ class Statistics {
tospur_commission where mtime >= '".$today."'
and mtime < DATE_SUB('".$today."', INTERVAL -1 DAY)
group by consultantId;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -182,7 +182,7 @@ class Statistics {
where time >= '".$today."'
and time < DATE_SUB('".$today."', INTERVAL -1 DAY)
group by tc.consultantId;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -205,7 +205,7 @@ class Statistics {
$sql = "select sum(if(house_type = 1,1,0)) sell,sum(if(house_type = 2,1,0)) lease,ahu.user_id as consultantId from a_house_user ahu
left join tospur_house th on th.id = ahu.house_id
where th.house_type > 0 and user_type = 1 group by ahu.user_id;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -228,7 +228,7 @@ class Statistics {
}
$sql = "select consultant_id as consultantId,sum(secondHand_house) as stockSellC,sum(rent_house) as stockLeaseC from tospur_customer where status = 0 group by consultant_id;";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
if(!$wpdb->last_error){
foreach($result as $item){
if(!$consultant[$item->consultantId]){
......@@ -263,11 +263,11 @@ class Statistics {
public static function updateBusiness($params,$where){
global $wpdb;
$result = $wpdb->update(Config::STATISTICS_BUSINESS,$params,$where);
$result = DBManager::update(Config::STATISTICS_BUSINESS,$params,$where);
if($result === 0){
$result = $wpdb->get_row($wpdb->prepare("select * from ".Config::STATISTICS_BUSINESS." where consultantId=%d and date = %s",$where["consultantId"],$where["date"]));
$result = DBManager::get_row($wpdb->prepare("select * from ".Config::STATISTICS_BUSINESS." where consultantId=%d and date = %s",$where["consultantId"],$where["date"]));
if(!$result)
$wpdb->insert(Config::STATISTICS_BUSINESS,array_merge($params,$where));
DBManager::insert(Config::STATISTICS_BUSINESS,array_merge($params,$where));
}
}
}
\ No newline at end of file
......@@ -59,9 +59,9 @@ class Tospur_House{
$string = null;
$user_id = get_current_user_id();
if($user_id){
$res = $wpdb->get_row("select subsidiaryId from ".Config::TOSPUR_CONSULTANT." where id = ".$user_id);
$res = DBManager::get_row("select subsidiaryId from ".Config::TOSPUR_CONSULTANT." where id = ".$user_id);
if($res){
$results = $wpdb->get_results("select id from ".Config::TOSPUR_CONSULTANT." where subsidiaryId = ".$res->subsidiaryId);
$results = DBManager::get_results("select id from ".Config::TOSPUR_CONSULTANT." where subsidiaryId = ".$res->subsidiaryId);
$resArray =array();
foreach($results as $key=>$value) {
$resArray[$key] = $value->id;
......
......@@ -118,7 +118,7 @@ class commissionList extends WP_List_Table
$sql = $sql . " and tc.consultant_name like '%" . $_REQUEST['search_consultant_name'] . "%'";
}
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
$data = array();
foreach ($result as $key => $value) {
......
......@@ -76,7 +76,7 @@ class CommissionManage{
"consultanId" => $data["recConsultant"],
"type" => $_POST["businessType"]
);
$updateRes = $wpdb->update(Config::TOSPUR_COMMISSION,$updateParam,array("contractId" => $contractId));
$updateRes = DBManager::update(Config::TOSPUR_COMMISSION,$updateParam,array("contractId" => $contractId));
$commission = CommissionDao::search_tospur_commission($contractId);
if(is_numeric($updateRes)){
if(isset( $_POST["log"])) {
......
......@@ -5,7 +5,7 @@ class introduction
public static function submit_introduction($time, $introduction, $user_id)
{
global $wpdb;
$result = $wpdb->update(
$result = DBManager::update(
Config::TOSPUR_CONSULTANT,
array(
'time' => $time,
......@@ -21,7 +21,7 @@ class introduction
public static function updateQRcode($user_id,$url){
global $wpdb;
$result = $wpdb->update(
$result = DBManager::update(
Config::TOSPUR_CONSULTANT,
array(
'QRcodeImg' => $url,
......@@ -37,7 +37,7 @@ class introduction
public static function search_consultant_results($user_id){
global $wpdb;
$sql = "select time,introduction,QRcodeImg from " . Config::TOSPUR_CONSULTANT . " where id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$user_id));
$result = DBManager::get_row($wpdb->prepare($sql,$user_id));
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -86,7 +86,7 @@ class introduction
$time = $_POST['time'];
$introduction = $_POST['introduction'];
$user_id = $_POST['user_id'];
$result = $wpdb->update(
$result = DBManager::update(
Config::TOSPUR_CONSULTANT,
array(
'time' => $time,
......
......@@ -20,7 +20,7 @@ class newHouseList extends WP_List_Table
COUNT(NULLIF(status = -1, false)) as onSaleNum,
COUNT(NULLIF(status = 2, false)) as notSaleNum
from " . Config::TOSPUR_HOUSE_TABLE . " where house_type = 0";
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
foreach ($result as $value) {
$approvalParam = array(
"allNum" => $value->allNum,
......@@ -173,14 +173,14 @@ class newHouseList extends WP_List_Table
$id = $_REQUEST['newhouselist'];
if ($id) {
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$approvalRes = $wpdb->get_results('select approval from tospur_house where id in ' . $string);
$approvalRes = DBManager::get_results('select approval from tospur_house where id in ' . $string);
foreach ($approvalRes as $value) {
if ($value->approval == -2) {
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$result = DBManager::query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
}
break;
......@@ -194,7 +194,7 @@ class newHouseList extends WP_List_Table
}
if ($flag == 1) {
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
DBManager::query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
......@@ -203,7 +203,7 @@ class newHouseList extends WP_List_Table
{
global $wpdb;
$sql = "select status from tospur_house where id in" . $houseId;
$res = $wpdb->get_results($sql);
$res = DBManager::get_results($sql);
if ($changeStatus != null || $changeStatus == 0) {
foreach ($res as $value) {
if ($value->status == $changeStatus) {
......@@ -258,7 +258,7 @@ class newHouseList extends WP_List_Table
break;
}
}
$result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string, $status));
$result = DBManager::query($wpdb->prepare('update tospur_house SET status = 0 , approval=%d where id in ' . $string, $status));
}
}
......@@ -361,7 +361,7 @@ class newHouseList extends WP_List_Table
$sql = $sql . " order by " . $orderby . " " . $order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$result = DBManager::get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......
......@@ -29,7 +29,7 @@ class progressList extends WP_List_Table
} ?>>
<?php $this->display_rows_or_placeholder(); ?>
<?php
if ( $this->has_items() ) {
if ($this->has_items()) {
global $progress_sql;
$result = DBManager::get_row($progress_sql);
$achieving_rate = 0;
......@@ -38,22 +38,22 @@ class progressList extends WP_List_Table
}
echo '<tr>
<td>合计</td>
<td class="sum_newSell">' . $result->sum_newSell . '</td>
<td class="sum_newLease">' . $result->sum_newLease . '</td>
<td class="sum_newBuy">' . $result->sum_newBuy . '</td>
<td class="sum_newTenant">' . $result->sum_newTenant . '</td>
<td class="sum_business">' . $result->sum_business . '</td>
<td class="sum_lease">' . $result->sum_lease . '</td>
<td class="sum_dealBusiness">' . $result->sum_dealBusiness . '</td>
<td class="sum_dealLease">' . $result->sum_dealLease . '</td>
<td class="sum_quota">' . round($result->sum_quota / 10000, 2) . '</td>
<td class="newSell">' . $result->newSell . '</td>
<td class="newLease">' . $result->newLease . '</td>
<td class="newBuy">' . $result->newBuy . '</td>
<td class="newTenant">' . $result->newTenant . '</td>
<td class="business">' . $result->business . '</td>
<td class="lease">' . $result->lease . '</td>
<td class="dealBusiness">' . $result->dealBusiness . '</td>
<td class="dealLease">' . $result->dealLease . '</td>
<td class="quota">' . round($result->quota / 10000, 2) . '</td>
<td class="achieving_rate">' . round($achieving_rate, 2) . '%</td>
<td class="sum_accounts">' . round($result->sum_accounts / 10000, 2) . '</td>
<td class="sum_paid">' . round($result->sum_paid / 10000, 2) . '</td>
<td class="sum_stockSellH">' . $result->sum_stockSellH . '</td>
<td class="sum_stockLeaseH">' . $result->sum_stockLeaseH . '</td>
<td class="sum_stockSellC">' . $result->sum_stockSellC . '</td>
<td class="sum_stockLeaseC">' . $result->sum_stockLeaseC . '</td>
<td class="accounts">' . round($result->accounts / 10000, 2) . '</td>
<td class="paid">' . round($result->paid / 10000, 2) . '</td>
<td class="stockSellH">' . $result->stockSellH . '</td>
<td class="stockLeaseH">' . $result->stockLeaseH . '</td>
<td class="stockSellC">' . $result->stockSellC . '</td>
<td class="stockLeaseC">' . $result->stockLeaseC . '</td>
</tr>';
}
?>
......@@ -97,29 +97,29 @@ class progressList extends WP_List_Table
function get_columns()
{
$columns['organization'] = '部门';
$columns['sum_newSell'] = '出售';
$columns['sum_newLease'] = '出租';
$columns['newSell'] = '出售';
$columns['newLease'] = '出租';
$columns['sum_newBuy'] = '求购';
$columns['sum_newTenant'] = '求租';
$columns['newBuy'] = '求购';
$columns['newTenant'] = '求租';
$columns['sum_business'] = '买卖';
$columns['sum_lease'] = '租赁';
$columns['business'] = '买卖';
$columns['lease'] = '租赁';
$columns['sum_dealBusiness'] = '买卖';
$columns['sum_dealLease'] = '租赁';
$columns['dealBusiness'] = '买卖';
$columns['dealLease'] = '租赁';
$columns['sum_quota'] = '金额(万)';
$columns['quota'] = '金额(万)';
$columns['achieving_rate'] = '达成率%';
$columns['sum_accounts'] = '金额(万)';
$columns['sum_paid'] = '金额(万)';
$columns['accounts'] = '金额(万)';
$columns['paid'] = '金额(万)';
$columns['sum_stockSellH'] = '出售';
$columns['sum_stockLeaseH'] = '出租';
$columns['stockSellH'] = '出售';
$columns['stockLeaseH'] = '出租';
$columns['sum_stockSellC'] = '求购';
$columns['sum_stockLeaseC'] = '求租';
$columns['stockSellC'] = '求购';
$columns['stockLeaseC'] = '求租';
return $columns;
}
......@@ -133,12 +133,14 @@ class progressList extends WP_List_Table
$this->_column_headers = array($columns, $hidden);
$sql = "select p.id,p.consultantId,p.name as consultant_name,p.subsidiaryId,p.organization,p.date,
sum(p.newSell) as sum_newSell,sum(p.newLease) as sum_newLease,sum(p.newBuy) as sum_newBuy,sum(p.newTenant) as sum_newTenant,
sum(p.business) as sum_business,sum(p.lease) as sum_lease,sum(p.dealBusiness) as sum_dealBusiness,sum(p.dealLease) as sum_dealLease,
sum(p.quota) as sum_quota,sum(p.accounts) as sum_accounts,sum(p.paid) as sum_paid,(sum(p.paid)/sum(p.quota)) as achieving_rate,
sum(p.stockSellH) as sum_stockSellH,sum(p.stockLeaseH) as sum_stockLeaseH,sum(p.stockSellC) as sum_stockSellC,sum(p.stockLeaseC) as sum_stockLeaseC
from (SELECT tc.name,sb.*,tc.subsidiaryId,torg.Name as organization FROM statistics_business sb
$sql = "select q.*,sum(sb2.quota) as quota,(sum(q.paid)/sum(sb2.quota)) as achieving_rate,
sum(sb2.stockSellH) as stockSellH,sum(sb2.stockLeaseH) as stockLeaseH,
sum(sb2.stockSellC) as stockSellC,sum(sb2.stockLeaseC) as stockLeaseC
from (select p.id,p.name,p.subsidiaryId,p.organization,
sum(p.newSell) as newSell,sum(p.newLease) as newLease,sum(p.newBuy) as newBuy,sum(p.newTenant) as newTenant,
sum(p.business) as business,sum(p.lease) as lease,sum(p.dealBusiness) as dealBusiness,sum(p.dealLease) as dealLease,
sum(p.accounts) as accounts,sum(p.paid) as paid
from (select tc.name,tc.subsidiaryId,torg.Name as organization,sb.* from statistics_business sb
left join tospur_consultant tc on sb.consultantId = tc.id
left join tospur_organization torg on tc.subsidiaryId = torg.Id
where 1 = 1";
......@@ -165,9 +167,10 @@ sum(p.stockSellH) as sum_stockSellH,sum(p.stockLeaseH) as sum_stockLeaseH,sum(p.
$sql .= " and sb.date >= '" . $_REQUEST['year'] . "-1-1' and sb.date < DATE_SUB('" . $_REQUEST['year'] . "-1-1', INTERVAL -1 YEAR)";
}
$sql .= " order by sb.id desc) p";
$sql .= " order by sb.id desc) p group by p.consultantId) q
left join statistics_business sb2 on q.id = sb2.id";
$progress_sql = $sql;
$sql .= " group by p.subsidiaryId";
$sql .= " group by q.subsidiaryId";
$result = DBManager::get_results($sql);
$data = array();
foreach ($result as $key => $value) {
......@@ -177,22 +180,22 @@ sum(p.stockSellH) as sum_stockSellH,sum(p.stockLeaseH) as sum_stockLeaseH,sum(p.
}
$data[$key] = array(
'organization' => $value->organization,
'sum_newSell' => $value->sum_newSell,
'sum_newLease' => $value->sum_newLease,
'sum_newBuy' => $value->sum_newBuy,
'sum_newTenant' => $value->sum_newTenant,
'sum_business' => $value->sum_business,
'sum_lease' => $value->sum_lease,
'sum_dealBusiness' => $value->sum_dealBusiness,
'sum_dealLease' => $value->sum_dealLease,
'sum_quota' => round($value->sum_quota / 10000, 2),
'newSell' => $value->newSell,
'newLease' => $value->newLease,
'newBuy' => $value->newBuy,
'newTenant' => $value->newTenant,
'business' => $value->business,
'lease' => $value->lease,
'dealBusiness' => $value->dealBusiness,
'dealLease' => $value->dealLease,
'quota' => round($value->quota / 10000, 2),
'achieving_rate' => round($achieving_rate, 2) . '%',
'sum_accounts' => round($value->sum_accounts / 10000, 2),
'sum_paid' => round($value->sum_paid / 10000, 2),
'sum_stockSellH' => $value->sum_stockSellH,
'sum_stockLeaseH' => $value->sum_stockLeaseH,
'sum_stockSellC' => $value->sum_stockSellC,
'sum_stockLeaseC' => $value->sum_stockLeaseC
'accounts' => round($value->accounts / 10000, 2),
'paid' => round($value->paid / 10000, 2),
'stockSellH' => $value->stockSellH,
'stockLeaseH' => $value->stockLeaseH,
'stockSellC' => $value->stockSellC,
'stockLeaseC' => $value->stockLeaseC
);
}
......
......@@ -108,7 +108,7 @@ class RentHouse extends Tospur_House{
$data = $_POST["data"];
$params['creattime'] = date("Y-m-d H:i:s");
$params['house_type'] = 2;
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT);
$res = DBManager::get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=2', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
......@@ -152,12 +152,12 @@ class RentHouse extends Tospur_House{
public static function data_update($houseId,$params){
global $wpdb;
$data = $_POST["data"];
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = DBManager::update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
InsertDao::addMainImage($houseId,$data);
$exists_photo_ids = array();
if(isset($_POST['exists_photo'])){
foreach($_POST['exists_photo'] as $id => $item){
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
DBManager::update(Config::TOSPUR_IMAGE_TABLE,array(
"image_type" => $item['type'],
),array("id" => $id));
$exists_photo_ids[] = $id;
......@@ -169,9 +169,9 @@ class RentHouse extends Tospur_House{
$delete_photo_ids[] = $id;
}
$delete_photo_ids = implode(",",$delete_photo_ids);
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
DBManager::query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
DBManager::delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
......
......@@ -29,7 +29,7 @@ class rentHouseList extends WP_List_Table
$select = $select." left join(select user_id as aus_id,house_id from a_house_user) ahu on th.id = ahu.house_id";
$where = $where." and aus_id in ".$consultantArray;
}
$result = $wpdb->get_results($select.$where);
$result = DBManager::get_results($select.$where);
foreach ($result as $value) {
$approvalParam = array(
"allNum" => $value->allNum,
......@@ -172,14 +172,14 @@ class rentHouseList extends WP_List_Table
$flag = 0;
switch ($action) {
case"agree":
$approvalRes = $wpdb->get_results('select approval from tospur_house where id in ' . $string);
$approvalRes = DBManager::get_results('select approval from tospur_house where id in ' . $string);
foreach ($approvalRes as $value) {
if ($value->approval == -2) {
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$result = DBManager::query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
break;
case"goBack":
......@@ -190,7 +190,7 @@ class rentHouseList extends WP_List_Table
break;
}
if ($flag == 1) {
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
DBManager::query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
......@@ -199,7 +199,7 @@ class rentHouseList extends WP_List_Table
{
global $wpdb;
$sql = "select status from tospur_house where id in" . $houseId;
$res = $wpdb->get_results($sql);
$res = DBManager::get_results($sql);
foreach ($res as $value) {
if ($value->status == $changeStatus) {
print_r("您申请的状态含有与原状态相同的房源,请重新选择");
......@@ -283,7 +283,7 @@ class rentHouseList extends WP_List_Table
$status = $res;
break;
}
$result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string, $status));
$result = DBManager::query($wpdb->prepare('update tospur_house SET status = 0 ,approval=%d where id in ' . $string, $status));
}
}
......@@ -389,7 +389,7 @@ class rentHouseList extends WP_List_Table
$order = $_GET["order"];
$sql = $sql . " order by " . $orderby . " " . $order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$result = DBManager::get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......
......@@ -108,7 +108,7 @@ class SecHandHouse extends Tospur_House{
$params['creattime'] = date("Y-m-d H:i:s");
$params['house_type'] = 1;
//获取新房信息,存入tospur_house表
$res = $wpdb->get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
$res = DBManager::get_results('SELECT * FROM tospur_house WHERE address="' .$params['address'] . '" and owner_name="' .$params['owner_name'] . '" and owner_phone="'.$params['owner_phone'].'" and house_type=1', OBJECT);
if(!$res){
$houseId = InsertDao::insert_tospur_house($params);
if(is_numeric($houseId)){
......@@ -151,7 +151,7 @@ class SecHandHouse extends Tospur_House{
public static function data_update($houseId,$params){
global $wpdb;
$data = $_POST["data"];
$res = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$res = DBManager::update(Config::TOSPUR_HOUSE_TABLE,$params,array("id" => $houseId));
$result = 201;
InsertDao::addMainImage($houseId,$data);
......@@ -159,7 +159,7 @@ class SecHandHouse extends Tospur_House{
$exists_photo_ids = array();
if(isset($_POST['exists_photo'])){
foreach($_POST['exists_photo'] as $id => $item){
$wpdb->update(Config::TOSPUR_IMAGE_TABLE,array(
DBManager::update(Config::TOSPUR_IMAGE_TABLE,array(
"image_type" => $item['type'],
),array("id" => $id));
$exists_photo_ids[] = $id;
......@@ -171,9 +171,9 @@ class SecHandHouse extends Tospur_House{
$delete_photo_ids[] = $id;
}
$delete_photo_ids = implode(",",$delete_photo_ids);
$wpdb->query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
DBManager::query("delete from ".Config::A_HOUSE_IMAGE_TABLE." where house_id = {$houseId} and image_id in ({$delete_photo_ids});");
$wpdb->delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
DBManager::delete(Config::A_HOUSE_RECOMMEND_TABLE,array("house_id" => $houseId));
$result = InsertDao::addRecommend($houseId,$data);
if(!is_numeric($result)){
return $result;
......@@ -184,7 +184,7 @@ class SecHandHouse extends Tospur_House{
return $result;
}
$wpdb->query(
DBManager::query(
$wpdb->prepare(
"DELETE FROM a_house_tag
WHERE tag_id in(select tag_id from (select tag_id,tt.type from a_house_tag as aht
......
......@@ -28,7 +28,7 @@ class secHandHouseList extends WP_List_Table
$select = $select." left join(select user_id as aus_id,house_id from a_house_user) ahu on th.id = ahu.house_id";
$where = $where." and aus_id in ".$consultantArray;
}
$result = $wpdb->get_results($select.$where);
$result = DBManager::get_results($select.$where);
foreach ($result as $value) {
$approvalParam = array(
"allNum" => $value->allNum,
......@@ -171,14 +171,14 @@ class secHandHouseList extends WP_List_Table
$approval = null;
switch ($action) {
case"agree":
$approvalRes = $wpdb->get_results('select approval from tospur_house where id in ' . $string);
$approvalRes = DBManager::get_results('select approval from tospur_house where id in ' . $string);
foreach ($approvalRes as $value) {
if ($value->approval == -2) {
print_r("您审批的房源中含有未申请审批的房源,请重新选择");
exit;
}
}
$result = $wpdb->query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$result = DBManager::query('update tospur_house th SET th.status= th.approval where id in ' . $string);
$flag = 1;
break;
case"goBack":
......@@ -189,7 +189,7 @@ class secHandHouseList extends WP_List_Table
break;
}
if ($flag == 1) {
$wpdb->query('update tospur_house th SET th.approval= -2 where id in ' . $string);
DBManager::query('update tospur_house th SET th.approval= -2 where id in ' . $string);
}
}
}
......@@ -198,7 +198,7 @@ class secHandHouseList extends WP_List_Table
{
global $wpdb;
$sql = "select status from tospur_house where id in" . $houseId;
$res = $wpdb->get_results($sql);
$res = DBManager::get_results($sql);
foreach ($res as $value) {
if ($value->status == $changeStatus) {
print_r("您申请的状态含有与原状态相同的房源,请重新选择");
......@@ -231,7 +231,6 @@ class secHandHouseList extends WP_List_Table
$id = $_REQUEST['sechandhouselist'];
$string = '(' . implode(',', array_map('intval', $id)) . ')';
$status = null;
$flag = 0;
switch ($action) {
case 'unCheck':
$res = $this->getCurrentStatus($string, 0);
......@@ -283,8 +282,7 @@ class secHandHouseList extends WP_List_Table
$status = $res;
break;
}
if($flag == 0)
$result = $wpdb->query($wpdb->prepare('update tospur_house SET approval=%d where id in ' . $string, $status));
$result = DBManager::query($wpdb->prepare('update tospur_house SET status = 0 , approval=%d where id in ' . $string, $status));
}
}
......@@ -416,7 +414,7 @@ class secHandHouseList extends WP_List_Table
$order = $_GET["order"];
$sql = $sql . " order by " . $orderby . " " . $order;
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$result = DBManager::get_results($wpdb->prepare($sql, $params));
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
......
......@@ -2,7 +2,7 @@
class CommissionDao{
public static function insert_touspur_commission($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_COMMISSION,$params);
DBManager::insert(Config::TOSPUR_COMMISSION,$params);
if($wpdb->insert_id){
return $wpdb->insert_id;
}else{
......@@ -12,7 +12,7 @@ class CommissionDao{
public static function insert_commission_log($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_COMMISSION_LOG,$params);
DBManager::insert(Config::TOSPUR_COMMISSION_LOG,$params);
if($wpdb->insert_id){
return $wpdb->insert_id;
}else{
......@@ -26,16 +26,15 @@ class CommissionDao{
left join (SELECT tct.id,imageUrl,tct.name,ton.name as branchName from ".Config::TOSPUR_CONSULTANT." tct
left JOIN ".Config::TOSPUR_ORGANIZATION_TABLE." ton on ton.id = tct.subsidiaryId) tc
on tcom.consultantId = tc.id where tcom.contractId = %d order by ioType;";
$result = $wpdb->get_results($wpdb->prepare($sql,$contractId));
$result = DBManager::get_results($wpdb->prepare($sql,$contractId));
return $result;
}
public static function search_commission_log($commissionIds){
global $wpdb;
$sql = " SELECT tcl.id,time,paid,ioType from tospur_commission_log tcl
left join tospur_commission tc on tc.id = tcl.commissionId
where tcl.commissionId in (".$commissionIds.");";
$result = $wpdb->get_results($sql);
$result =DBManager::get_results($sql);
return $result;
}
......@@ -43,7 +42,7 @@ class CommissionDao{
global $wpdb;
$sql = "select id,accounts,type,mtime from ".Config::TOSPUR_COMMISSION."
where contractId = %d";
$result = $wpdb->get_results($wpdb->prepare($sql,$contractId));
$result = DBManager::get_results($wpdb->prepare($sql,$contractId));
return $result;
}
}
......@@ -3,16 +3,17 @@
class ContractDao {
public static function insert($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_CONTRACT,$params);
DBManager::insert(Config::TOSPUR_CONTRACT,$params);
if($wpdb->last_error){
return $wpdb->last_error;
}
return $wpdb->insert_id;
}
public static function setContractId($id,$contractId){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONTRACT,array(
$result = DBManager::update(Config::TOSPUR_CONTRACT,array(
"contractId" => $contractId
),array(
"id" => $id
......@@ -26,7 +27,7 @@ class ContractDao {
public static function update($id,$params){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_CONTRACT,$params,array(
$result =DBManager::update(Config::TOSPUR_CONTRACT,$params,array(
"id" => $id
));
if($wpdb->last_error)
......@@ -39,7 +40,7 @@ class ContractDao {
$sql = "select tc.*,th.address from ".Config::TOSPUR_CONTRACT." tc
left join ".Config::TOSPUR_HOUSE_TABLE." th on tc.houseId = th.id
where tc.id = %d;";
$result = $wpdb->get_row($wpdb->prepare($sql,$id));
$result =DBManager::get_row($wpdb->prepare($sql,$id));
if($result){
return $result;
}else{
......@@ -49,7 +50,7 @@ class ContractDao {
public static function insert_a_contract_image($params){
global $wpdb;
$wpdb->insert(Config::A_CONTRACT_IMAGE_TABLE,$params);
DBManager::insert(Config::A_CONTRACT_IMAGE_TABLE,$params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -110,7 +111,7 @@ class ContractDao {
$sql = "select ti.id,ti.path from a_contract_image aci
left join tospur_contract tc on tc.id = aci.contract_id
left join tospur_image ti on aci.image_id = ti.id where aci.contract_id = %d;";
$result = $wpdb->get_results($wpdb->prepare($sql,$id));
$result =DBManager::get_results($wpdb->prepare($sql,$id));
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -120,7 +121,7 @@ class ContractDao {
public static function searchImgPath($id){
global $wpdb;
$sql = "select path from ".Config::TOSPUR_IMAGE_TABLE." where id in ({$id})";
$results = $wpdb->get_results($sql);
$results =DBManager::get_results($sql);
if($wpdb->last_error){
return $wpdb->last_error;
}
......
......@@ -28,7 +28,7 @@ class CustomerTrackingDao
'description' => $request['description'],
'origin' => $origin
);
$result = $wpdb->insert(Config::TOSPUR_CUSTOMER_TRACKING_TABLE, $array);
$result = DBManager::insert(Config::TOSPUR_CUSTOMER_TRACKING_TABLE, $array);
if ($result) {
return $wpdb->insert_id;
} else {
......@@ -41,20 +41,18 @@ class CustomerTrackingDao
public static function search($house_id, $origin)
{
global $wpdb;
$sql = 'SELECT tct.*,ts.status_name,tc.name FROM ' . Config::TOSPUR_CUSTOMER_TRACKING_TABLE . ' tct' .
' left join (SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3) as ts on tct.status_type = ts.status_id' .
' left join ' . Config::TOSPUR_CONSULTANT . ' tc on tct.consultant_id = tc.id' .
' where tct.house_id = ' . $house_id . ' and tct.origin = ' . $origin;
$result = $wpdb->get_results($sql);
$result = DBManager::get_results($sql);
return $result;
}
public static function search_status()
{
global $wpdb;
$sql = 'SELECT * FROM ' . Config::TOSPUR_STATUS_TABLE . ' where status_type = 3';
return $wpdb->get_results($sql);
return DBManager::get_results($sql);
}
}
......
......@@ -3,7 +3,7 @@
class HouseDao {
public static function updateStatus($status,$houseId){
global $wpdb;
$result = $wpdb->update(Config::TOSPUR_HOUSE_TABLE,array(
$result = DBManager::update(Config::TOSPUR_HOUSE_TABLE,array(
'status' => $status
),array(
'id' => $houseId
......@@ -15,7 +15,7 @@ class HouseDao {
public static function checkHouseStatus($houseId){
global $wpdb;
$result = $wpdb->get_row(Config::TOSPUR_HOUSE_TABLE,array(
$result = DBManager::get_row(Config::TOSPUR_HOUSE_TABLE,array(
'id' => $houseId
));
if($wpdb->last_error)
......
......@@ -3,7 +3,7 @@
class InsertDao{
public static function insert_tospur_house($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_HOUSE_TABLE, $params);
DBManager::insert(Config::TOSPUR_HOUSE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -15,7 +15,6 @@ class InsertDao{
}
public static function setHouseNumber($houseId,$houseType,$cityId){
global $wpdb;
switch($houseType){
case 0:
$prefix = "xf";
......@@ -28,7 +27,7 @@ class InsertDao{
break;
}
$house_number = $prefix.str_pad($cityId,4,'0',STR_PAD_LEFT).str_pad($houseId,8,'0',STR_PAD_LEFT);
return $wpdb->update(Config::TOSPUR_HOUSE_TABLE,
return DBManager::update(Config::TOSPUR_HOUSE_TABLE,
array(
'house_number' => $house_number
),
......@@ -40,7 +39,7 @@ class InsertDao{
public static function insert_tospur_image($params){
global $wpdb;
$wpdb->insert(Config::TOSPUR_IMAGE_TABLE, $params);
DBManager::insert(Config::TOSPUR_IMAGE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -49,7 +48,7 @@ class InsertDao{
}
public static function insert_a_district_area($params){
global $wpdb;
$wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $params);
DBManager::insert(Config::A_DISTRICT_AREA_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -58,7 +57,7 @@ class InsertDao{
public static function insert_a_house_image($params){
global $wpdb;
$wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $params);
DBManager::insert(Config::A_HOUSE_IMAGE_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -67,7 +66,7 @@ class InsertDao{
public static function insert_a_house_recommend($params){
global $wpdb;
$wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
DBManager::insert(Config::A_HOUSE_RECOMMEND_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -76,7 +75,7 @@ class InsertDao{
public static function insert_a_house_user($params){
global $wpdb;
$wpdb->insert(Config::A_HOUSE_USER_TABLE, $params);
DBManager::insert(Config::A_HOUSE_USER_TABLE, $params);
if($wpdb->last_error){
return $wpdb->last_error;
}
......@@ -123,7 +122,7 @@ class InsertDao{
$imagePath = get_home_path().$url;
Image::makeImage($uploadFileName,$imagePath);
//插入图片表
$wpdb->insert('tospur_image', $insert_image_array);
DBManager::insert('tospur_image', $insert_image_array);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
......@@ -142,7 +141,7 @@ class InsertDao{
"house_area" => $data["$key"]["housearea"],
"image_id" => $imgid
);
$wpdb->insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
DBManager::insert(Config::A_DISTRICT_AREA_TABLE, $houseTypeArea);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
......@@ -152,7 +151,7 @@ class InsertDao{
'house_id' => $houseId,
'image_id' => $imgid,
);
$wpdb->insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
DBManager::insert(Config::A_HOUSE_IMAGE_TABLE, $house_img_array);
if ($wpdb->last_error) {
return $wpdb->last_error;
}
......@@ -162,7 +161,7 @@ class InsertDao{
}
}
}
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,array("frontCover_id"=>$frontCover),array("id"=>$houseId));
DBManager::update(Config::TOSPUR_HOUSE_TABLE,array("frontCover_id"=>$frontCover),array("id"=>$houseId));
if ($wpdb->last_error) {
return $wpdb->last_error;
}
......@@ -178,7 +177,7 @@ class InsertDao{
"house_id" => $houseId,
"recommend_id" =>$value
);
$wpdb->insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
DBManager::insert(Config::A_HOUSE_RECOMMEND_TABLE, $a_house_recommendArray);
if( $wpdb->last_error){
return $wpdb->last_error;
}
......@@ -190,7 +189,7 @@ class InsertDao{
public static function addRecConsultant($houseId, $consultant){
global $wpdb;
if($consultant){
$wpdb->delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
DBManager::delete(Config::A_HOUSE_USER_TABLE,array("house_id" => $houseId));
//插入推荐置业顾问user_id与新房id到关联表a_house_recommend
foreach($consultant as $val){
$a_house_userArray = array(
......@@ -198,13 +197,13 @@ class InsertDao{
"house_id" => $houseId,
"user_type" => 1
);
$wpdb->replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
DBManager::replace(Config::A_HOUSE_USER_TABLE,$a_house_userArray);
if( $wpdb->last_error){
return $wpdb->last_error;
}
}
$res = $wpdb->get_row("select subsidiaryId from ".Config::TOSPUR_CONSULTANT." where id =".$consultant[0]);
$wpdb->update(Config::TOSPUR_HOUSE_TABLE,array("organizationId"=>$res->subsidiaryId),array("id"=>$houseId));
$res =DBManager::get_row("select subsidiaryId from ".Config::TOSPUR_CONSULTANT." where id =".$consultant[0]);
DBManager::update(Config::TOSPUR_HOUSE_TABLE,array("organizationId"=>$res->subsidiaryId),array("id"=>$houseId));
if( $wpdb->last_error){
return $wpdb->last_error;
}
......@@ -220,7 +219,7 @@ class InsertDao{
"house_id" => $houseId,
"tag_id" =>$val
);
$wpdb->insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
DBManager::insert(Config::A_HOUSE_TAG_TABLE,$a_house_feature);
if( $wpdb->last_error){
return $wpdb->last_error;
}
......@@ -233,7 +232,7 @@ class InsertDao{
public static function addHouseTag($house_id, $houseTag)
{
global $wpdb;
$wpdb->query(
DBManager::query(
$wpdb->prepare("DELETE FROM " . Config::A_HOUSE_TAG_TABLE .
" WHERE tag_id in(select tag_id from (select tag_id,tt.type from " . Config::A_HOUSE_TAG_TABLE . " as aht" .
" left JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id) as a" .
......@@ -248,7 +247,7 @@ class InsertDao{
"house_id" => $house_id,
"tag_id" => $val
);
$wpdb->insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
DBManager::insert(Config::A_HOUSE_TAG_TABLE, $a_house_tag);
if( $wpdb->last_error){
return $wpdb->last_error;
}
......
......@@ -3,7 +3,7 @@
class QuotaDao {
public static function replace($year,$month,$consultantId,$quota){
global $wpdb;
$result = $wpdb->replace(Config::TOSPUR_QUOTA_TABLE,array(
$result = DBManager::replace(Config::TOSPUR_QUOTA_TABLE,array(
"year" => $year,
"month" => $month,
"consultantId" => $consultantId,
......
......@@ -29,7 +29,7 @@ class SearchDao
$params[] = $districtId;
$groupBy = "";
}
$result = $wpdb->get_results($wpdb->prepare('select ' . $selectName . ' from ' . Config::DIC_CITY_TABLE . $where . $groupBy, $params));
$result = DBManager::get_results($wpdb->prepare('select ' . $selectName . ' from ' . Config::DIC_CITY_TABLE . $where . $groupBy, $params));
return $result;
}
......@@ -45,7 +45,7 @@ class SearchDao
if (isset($_GET['cityId'])) {
$where .= " and cityId = %d";
}
$result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_AREA_TABLE . $where, $cityId));
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_AREA_TABLE . $where, $cityId));
return $result;
}
......@@ -57,7 +57,7 @@ class SearchDao
public static function searchBuildProperty()
{
global $wpdb;
$result = $wpdb->get_results('select value as id,literal as value from ' . Config::DIC_BUILDPROPERTY_TABLE);
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_BUILDPROPERTY_TABLE);
return $result;
}
......@@ -68,8 +68,7 @@ class SearchDao
public static function searchRoom()
{
global $wpdb;
$result = $wpdb->get_results('select value as id,literal as value from ' . Config::DIC_ROOM_TABLE);
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_ROOM_TABLE);
return $result;
}
......@@ -85,7 +84,7 @@ class SearchDao
if (isset($_GET['cityId'])) {
$where .= " and cityId = %d";
}
$result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_UNITPRICERANGE_TABLE . $where, $cityId));
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_UNITPRICERANGE_TABLE . $where, $cityId));
return $result;
}
......@@ -101,7 +100,7 @@ class SearchDao
if ($cityId) {
$where .= " and cityId = " . $cityId;
}
$result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_TOTALPRICE_TABLE . $where, $cityId));
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_TOTALPRICE_TABLE . $where, $cityId));
return $result;
}
......@@ -117,7 +116,7 @@ class SearchDao
if ($cityId) {
$where .= " and cityId = " . $cityId;
}
$result = $wpdb->get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_RENTALPRICE_TABLE . $where, $cityId));
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_RENTALPRICE_TABLE . $where, $cityId));
return $result;
}
......@@ -133,14 +132,14 @@ class SearchDao
if ($parentId != NULL) {
$where .= " and ParentId = %d";
}
$result = $wpdb->get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
$result = DBManager::get_results($wpdb->prepare('select * from ' . Config::TOSPUR_ORGANIZATION_TABLE . $where, $parentId));
return $result;
}
public static function getCityNameWithId($cityId)
{
global $wpdb;
$result = $wpdb->get_var($wpdb->prepare("select cityName from " . Config::DIC_CITY_TABLE . " where cityId = %d", $cityId));
$result = DBManager::get_var($wpdb->prepare("select cityName from " . Config::DIC_CITY_TABLE . " where cityId = %d", $cityId));
if ($result) {
return $result;
} else {
......@@ -273,7 +272,7 @@ class SearchDao
$params[] = $array['index'];
$sql = $sql . " limit %d,10";
}
$result = $wpdb->get_results($wpdb->prepare($sql, $params));
$result = DBManager::get_results($wpdb->prepare($sql, $params));
return $result;
}
......@@ -285,7 +284,7 @@ class SearchDao
public static function searchPhotoType()
{
global $wpdb;
$result = $wpdb->get_results('select id,photo_name as value from ' . Config::DIC_PHOTOTYPE_TABLE);
$result = DBManager::get_results('select id,photo_name as value from ' . Config::DIC_PHOTOTYPE_TABLE);
return $result;
}
......@@ -307,7 +306,7 @@ class SearchDao
$params[] = '%'.$consultantName.'%';
$sql = $sql." and tc.name like %s";
}
$result = $wpdb->get_results($wpdb->prepare($sql,$params));
$result = DBManager::get_results($wpdb->prepare($sql,$params));
return $result;
}
......@@ -335,15 +334,14 @@ class SearchDao
global $wpdb;
$featureSql ="select tag_id,name from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$hid));
$feature = DBManager::get_results($wpdb->prepare($featureSql,$hid));
return $feature;
}
public static function searchFeature()
{
global $wpdb;
$sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;';
return $wpdb->get_results($sql);
return DBManager::get_results($sql);
}
public static function ajax_searchTagOrFeature()
......@@ -353,9 +351,8 @@ class SearchDao
public static function searchTagOrFeature($type)
{
global $wpdb;
$sql = 'select id,name as value from ' . Config::TOSPUR_TAG_TABLE . ' where type = ' . $type;
return $wpdb->get_results($sql);
return DBManager::get_results($sql);
}
public static function getDetailInfo($hid,$type = NULL){
......@@ -364,7 +361,7 @@ class SearchDao
left JOIN ".Config::DIC_ROOM_TABLE." dr on th.room_id = dr.id
left JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on th.buildproperty_id = db.value
where th.id = %d";
$result = $wpdb->get_row($wpdb->prepare($sql,$hid));
$result = DBManager::get_row($wpdb->prepare($sql,$hid));
$context = array();
$context['result'] = $result;
$houseType = $result->house_type;
......@@ -376,7 +373,7 @@ class SearchDao
LEFT JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on db.value = ada.buildproperty_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id
where ada.house_id = %d";
$mainImage = $wpdb->get_results($wpdb->prepare($mainImagesSql,$hid));
$mainImage = DBManager::get_results($wpdb->prepare($mainImagesSql,$hid));
foreach($mainImage as $key => $value){
$path = $value->path;
......@@ -400,7 +397,7 @@ class SearchDao
where th.id in(select recommend_id from ".Config::A_HOUSE_RECOMMEND_TABLE." where house_id = %d);";
}
$recommends = $wpdb->get_results($wpdb->prepare($recommendSql,$hid));
$recommends = DBManager::get_results($wpdb->prepare($recommendSql,$hid));
foreach($recommends as $key => $value){
$value->path = Image::getImage($value->path,'small');
}
......@@ -411,7 +408,7 @@ class SearchDao
from ".Config::TOSPUR_CONSULTANT_SCORE_TABLE."
where valid=1 group by consultant_id) s on c.id = s.consultant_id
where id in(select user_id from ".Config::A_HOUSE_USER_TABLE." where user_type = 1 and house_id = %d) limit {$consultantLimit};";
$consultant = $wpdb->get_results($wpdb->prepare($consultantSql,$hid));
$consultant = DBManager::get_results($wpdb->prepare($consultantSql,$hid));
$context['consultant'] = $consultant;
if($type == 'edit'){
......@@ -424,7 +421,7 @@ class SearchDao
WHERE ahi.house_id = %d order by image_type;';
}
$images = $wpdb->get_results($wpdb->prepare($imagesSql,$hid,$hid));
$images = DBManager::get_results($wpdb->prepare($imagesSql,$hid,$hid));
foreach($images as $key => $value){
$path = $value->path;
$value->path = Image::getImage($path,'big');
......@@ -440,7 +437,7 @@ class SearchDao
$sql = "select tt.name from ".Config::A_HOUSE_TAG_TABLE." aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on aht.tag_id = tt.id
where aht.house_id = %d and type = 0;";
$results = $wpdb->get_results($wpdb->prepare($sql,$houseId));
$results = DBManager::get_results($wpdb->prepare($sql,$houseId));
$tags = array();
foreach($results as $item){
$tags[] =$item->name;
......@@ -451,7 +448,7 @@ class SearchDao
public static function searchStatusType($statusType){
global $wpdb;
$sql="select status_id as id,status_name as value from ".Config::TOSPUR_STATUS_TABLE." where status_type = %d";
$results = $wpdb->get_results($wpdb->prepare($sql,$statusType));
$results = DBManager::get_results($wpdb->prepare($sql,$statusType));
return $results;
}
......@@ -463,7 +460,7 @@ class SearchDao
$params[] = $type;
$featureSql ="select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and tt.type = %d";
$feature = $wpdb->get_results($wpdb->prepare($featureSql,$params));
$feature = DBManager::get_results($wpdb->prepare($featureSql,$params));
return $feature;
}
......
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