作者 郭鑫

透视卡修改

... ... @@ -29,7 +29,7 @@ class CommonController extends HomeBaseController
$url = explode('/',$_SERVER['PATH_INFO']);
$count_url = count($url);
$fun = $url[$count_url-1];
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' ){
if($fun == 'join' || $fun == 'login' || $fun == 'upload_one' || $fun == 'index' || $url[1] == 'Article' || $url[1] == 'Index' || $url[1] == 'Thirdsend' ){
$connect = 1;
}else{
$connect = 2;
... ...
... ... @@ -57,8 +57,9 @@ class NotifyCommonController extends HomeBaseController
}
}
if($orderInfo['type'] == 3) {
$Intermediary = controller('Intermediary','controller');
$agencyOffer = $Intermediary->agencyOffer($orderInfo['user_id'],$orderInfo['need_id']);
// $Intermediary = controller('Intermediary','controller');
// $agencyOffer = $Intermediary->agencyOffer($orderInfo['user_id'],
$agencyOffer = $this->agencyOffer($orderInfo['user_id'],$orderInfo['need_id']);
if(empty($agencyOffer) || empty($agencyOffer['money'])) {
return 0;
} else {
... ... @@ -141,4 +142,47 @@ class NotifyCommonController extends HomeBaseController
}
}
// 查询中介报价
// $need_id 需求id
public function agencyOffer($user_id,$need_id){
$where_agency['status'] = 2;
$where_agency['create_time'] = array('lt',time());
$where_agency['need_id'] = $need_id;
$agency_list = Db::name('Agency')
->where($where_agency)
->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge,refuse_complaint_time")
->select()->toArray();
$final_list = array();
$add_arr = array();
if($agency_list){
foreach ($agency_list as $agencyk=>$agencyv){
$final_list[$agencyk]['need_id'] = $need_id;
$final_list[$agencyk]['agency_id'] = $agencyv['id'];
$final_list[$agencyk]['user_id'] = $user_id;
$money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
$money_arr[] = $money;
$fianlMoney = substr($money, 0,-4);
$final_list[$agencyk]['true_money'] = $money;
$final_list[$agencyk]['money'] = $fianlMoney;
}
sort($money_arr);
foreach ($final_list as $finalk=>$finalv){
if($finalv['true_money'] == $money_arr[0]){
$add_arr['need_id'] = $finalv['need_id'];
$add_arr['agency_id'] = $finalv['agency_id'];
$add_arr['user_id'] = $finalv['user_id'];
$add_arr['money'] = $finalv['money'];
$add_arr['create_time'] = time();
$add_arr['update_time'] = time();
}
}
$save = Db::name('See')->insertGetId($add_arr);
$return['id'] = $save;
$return['money'] = $add_arr['money'];
$return['time'] = time();
return $return;
}
}
}
\ No newline at end of file
... ...