Beispiel #1
0
 /**
  * 房源取消竞价
  * $newFrozen 是否使用新的扣费程序
  */
 public static function prop_out_bid($broker_id, $proid, $newFrozen = false)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     if ($newFrozen) {
         $proinfo = Dao_Broker_HzProp::get_prop($proid, true);
     } else {
         $proinfo = Dao_Broker_HzProp::get_prop($proid);
     }
     if (empty($proinfo)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPNULL;
         return $flag_array;
     }
     // 13为精选的排队中状态
     $planning = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::BID_TYPE, '1,13');
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     $plan_info = Dao_Broker_HzPlan::get_plan($planning[0]['plan_id']);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     if ($plan_info['status'] != 1 && !$newFrozen) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANSTOP;
         return $flag_array;
     }
     $basic_info = $proinfo[$proid]['content_basic'];
     if ($basic_info['userid'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPERROR;
         return $flag_array;
     }
     $sn = Dao_Broker_HzPlan::get_bid_sn($plan_info['id']);
     $sn = $sn['sn'];
     if (empty($sn)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPERROR;
         return $flag_array;
     }
     $amount = $plan_info['total_consume'];
     $note = urlencode('推广房源' . $proid);
     $user_id = Bll_HzBroker::get_userid_by_hzbrokerid($broker_id);
     $unfreezeOrderData = array('userId' => $user_id, 'proId' => $proid, 'serialNumber' => $sn, 'planId' => $plan_info['id'], 'amount' => $amount);
     $unfreezeOrder = Bll_Ppc_BidUnfreeze::createHzOrder($unfreezeOrderData);
     $charge_sn = Bll_PayAccount::cancel_frozen($user_id, $amount, $proid, $plan_info['bidVersion'] == 1 ? Const_PaymentApp::HZ_BID : Const_PaymentApp::HZ_CHOICE, $sn, $note, $newFrozen);
     if (!$charge_sn) {
         $unfreezeOrder->fail();
         $flag_array['msg'] = Const_HzErrorInfo::CHARGEFAIL;
         // 此处不需要block,由job保证此处解冻正确
         //return $flag_array;
     } else {
         $unfreezeOrder->complete();
     }
     $new_status = Const_HzStatus::MANUALLY;
     $fix_planning = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::SPREAD_TYPE, 1);
     if (!empty($fix_planning)) {
         $new_status = Const_HzStatus::ONLINE;
     } else {
         if ($newFrozen) {
             $new_status = Const_HzStatus::OUTLINE;
         }
     }
     $prop_log_option = Const_HzLog::MENUSTOPSPREADPROP;
     $plan_log_option = Const_HzLog::MENUSTOPSPREADPLAN;
     //停止竞价 房源状态更新为9
     if (Dao_Broker_HzProp::change_prop_status($proid, $new_status)) {
         //更新房源状态
         if (Dao_Broker_HzPlan::update_planning($planning[0]['id'], Const_HzPlan::MENUOVER)) {
             //更新关联关系
             if (Dao_Broker_HzPlan::update_plan_status($plan_info['id'], Const_HzPlan::MENUOVER)) {
                 //更新计划状态
                 Dao_Broker_HzPlan::add_prop_log($proid, $prop_log_option, $basic_info['userid'], $plan_info['id'], $basic_info['status'], $new_status);
                 //记房源日志
                 Dao_Broker_HzPlan::add_plan_log($plan_info['id'], $proid, $plan_log_option, 2, $basic_info['userid'], 0, Const_HzPlan::SPREAD, Const_HzPlan::MENUOVER);
                 //记录计划日志
                 if ($basic_info['status'] == Const_HzStatus::ONLINE && $new_status != Const_HzStatus::ONLINE) {
                     Dao_Broker_HzProp::into_prop_lucene($proid, $basic_info['cityid'], 2);
                     //下线房源
                     Dao_Broker_HzProp::add_updown_log($proid, $plan_info['id'], Const_HzStatus::GOOFFLINE, $prop_log_option);
                 } else {
                     Dao_Broker_HzProp::into_prop_lucene($proid, $basic_info['cityid'], 1);
                     //竞价下,定价还在线。则更新上
                 }
                 $flag_array['status'] = 1;
                 return $flag_array;
             }
         }
     }
     $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
     return $flag_array;
 }
Beispiel #2
0
 /**
  * 删除经纪人定价组
  * @param $broker_id
  * @param $plan_id
  * @return array
  */
 public static function delete_broker_plan($broker_id, $plan_id)
 {
     //删除价组 条件判断
     $flag_array = array('status' => 0, 'msg' => '');
     if (empty($broker_id) || empty($plan_id)) {
         $flag_array['msg'] = Const_HzErrorInfo::PARAMS;
         return $flag_array;
     }
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     // 已删除
     if ($plan_info['status'] == Const_HzPlan::MANUALLY_PAUSE) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     $plannings = Dao_Broker_HzPlan::get_planning($plan_id);
     $proids = array();
     foreach ($plannings as $planning) {
         $proids[] = $planning['proid'];
     }
     $prop_option = Const_HzLog::DELPLANPROP;
     $status = Const_HzStatus::OUTLINE;
     // 房源更新状态
     $plan_status = Const_HzPlan::MANUALLY_PAUSE;
     // 计划状态
     $plan_option = Const_HzLog::DELPLAN;
     $proids_str = implode(',', $proids);
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     foreach ($plannings as $planning) {
         $basic_info = $proinfo[$planning['proid']]['content_basic'];
         //更新房源计划信息
         if (Dao_Broker_HzProp::change_prop_status($planning['proid'], $status)) {
             //更新房源状态
             if (Dao_Broker_HzPlan::update_planning($planning['id'], $plan_status)) {
                 //更新关联关系
                 Dao_Broker_HzPlan::add_prop_log($planning['proid'], $prop_option, $basic_info['userid'], $plan_id, $basic_info['status'], $status);
                 //记房源日志
                 // TODO 停止竞价
                 // TODO 下solr
                 //记录房源下线日志
                 if ($status != Const_HzStatus::ONLINE && $basic_info['status'] == Const_HzStatus::ONLINE) {
                     Dao_Broker_HzProp::ezft_assistant_log($planning['proid'], $basic_info['userid'], Const_HzPlan::SPREAD_TYPE, $basic_info['spread_type']);
                 }
                 //房源上下线日志
                 Dao_Broker_HzProp::add_updown_log($planning['proid'], $plan_id, Const_HzStatus::GOONLINE, $prop_option);
             }
         }
     }
     //更新计划
     Dao_Broker_HzPlan::update_plan_status($plan_id, $plan_status);
     //计划日志
     Dao_Broker_HzPlan::add_plan_log($plan_id, $proids_str, $plan_option, 1, $broker_id, 0, $plan_info['status'], $plan_status);
     $flag_array['status'] = 1;
     return $flag_array;
 }