Exemplo n.º 1
0
 public static function change_bid_offer($plan_id, $new_offer)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_planning($plan_id, Const_HzPlan::BID_TYPE, 1);
     $planning = $planning[0];
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     if ($planning['unit_price'] == $new_offer) {
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $bid_min_offer = self::get_bid_minoffer($planning['proid']);
     if ($new_offer < $bid_min_offer) {
         $flag_array['msg'] = Const_HzErrorInfo::BIDOFFERFAIL;
         return $flag_array;
     }
     if ($new_offer > $plan_info['amount']) {
         $flag_array['msg'] = Const_HzErrorInfo::BIDOFFERTOP;
         return $flag_array;
     }
     $log_option = Const_HzLog::BIDUPDATE;
     if (Dao_Broker_HzPlan::update_planning_offer($planning['id'], $new_offer)) {
         //更新出价
         Dao_Broker_HzPlan::add_plan_log($plan_id, $planning['proid'], $log_option, 2, $planning['user_id'], 0, $plan_info['status'], $plan_info['status']);
         //记录日志
         Dao_Broker_HzProp::into_prop_lucene($planning['proid'], $planning['city_id'], 1);
         //更新房源
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
     return $flag_array;
 }