作者 郭鑫

透视卡修改

@@ -29,7 +29,7 @@ class CommonController extends HomeBaseController @@ -29,7 +29,7 @@ class CommonController extends HomeBaseController
29 $url = explode('/',$_SERVER['PATH_INFO']); 29 $url = explode('/',$_SERVER['PATH_INFO']);
30 $count_url = count($url); 30 $count_url = count($url);
31 $fun = $url[$count_url-1]; 31 $fun = $url[$count_url-1];
32 - if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' || $url[1] == 'Index' || $url[1] == 'Thirdsend' || $url[1] == 'Notify' || $url[1] == 'Alipay' || $url[1] == 'Alipaywap' || $url[1] == 'NotifyCommon' ){ 32 + if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' || $url[1] == 'Index' || $url[1] == 'Thirdsend' ){
33 $connect = 1; 33 $connect = 1;
34 }else{ 34 }else{
35 $connect = 2; 35 $connect = 2;
@@ -57,8 +57,9 @@ class NotifyCommonController extends HomeBaseController @@ -57,8 +57,9 @@ class NotifyCommonController extends HomeBaseController
57 } 57 }
58 } 58 }
59 if($orderInfo['type'] == 3) { 59 if($orderInfo['type'] == 3) {
60 - $Intermediary = controller('Intermediary','controller');  
61 - $agencyOffer = $Intermediary->agencyOffer($orderInfo['user_id'],$orderInfo['need_id']); 60 +// $Intermediary = controller('Intermediary','controller');
  61 +// $agencyOffer = $Intermediary->agencyOffer($orderInfo['user_id'],
  62 + $agencyOffer = $this->agencyOffer($orderInfo['user_id'],$orderInfo['need_id']);
62 if(empty($agencyOffer) || empty($agencyOffer['money'])) { 63 if(empty($agencyOffer) || empty($agencyOffer['money'])) {
63 return 0; 64 return 0;
64 } else { 65 } else {
@@ -141,4 +142,47 @@ class NotifyCommonController extends HomeBaseController @@ -141,4 +142,47 @@ class NotifyCommonController extends HomeBaseController
141 } 142 }
142 } 143 }
143 144
  145 +
  146 +// 查询中介报价
  147 +// $need_id 需求id
  148 + public function agencyOffer($user_id,$need_id){
  149 + $where_agency['status'] = 2;
  150 + $where_agency['create_time'] = array('lt',time());
  151 + $where_agency['need_id'] = $need_id;
  152 + $agency_list = Db::name('Agency')
  153 + ->where($where_agency)
  154 + ->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge,refuse_complaint_time")
  155 + ->select()->toArray();
  156 + $final_list = array();
  157 + $add_arr = array();
  158 + if($agency_list){
  159 + foreach ($agency_list as $agencyk=>$agencyv){
  160 + $final_list[$agencyk]['need_id'] = $need_id;
  161 + $final_list[$agencyk]['agency_id'] = $agencyv['id'];
  162 + $final_list[$agencyk]['user_id'] = $user_id;
  163 + $money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
  164 + $money_arr[] = $money;
  165 + $fianlMoney = substr($money, 0,-4);
  166 + $final_list[$agencyk]['true_money'] = $money;
  167 + $final_list[$agencyk]['money'] = $fianlMoney;
  168 + }
  169 + sort($money_arr);
  170 + foreach ($final_list as $finalk=>$finalv){
  171 + if($finalv['true_money'] == $money_arr[0]){
  172 + $add_arr['need_id'] = $finalv['need_id'];
  173 + $add_arr['agency_id'] = $finalv['agency_id'];
  174 + $add_arr['user_id'] = $finalv['user_id'];
  175 + $add_arr['money'] = $finalv['money'];
  176 + $add_arr['create_time'] = time();
  177 + $add_arr['update_time'] = time();
  178 + }
  179 + }
  180 + $save = Db::name('See')->insertGetId($add_arr);
  181 + $return['id'] = $save;
  182 + $return['money'] = $add_arr['money'];
  183 + $return['time'] = time();
  184 + return $return;
  185 + }
  186 + }
  187 +
144 } 188 }