public function handle_request()
 {
     $sqlSelectErrorQueue = 'SELECT * from q_new_bid_deal_06 WHERE `actionId`=2 AND `siteType`=2 AND `status`=2 AND `id` >7330;';
     $errorQueueList = Model_Choice_ActionQueue::data_access(date('m'))->native_sql($sqlSelectErrorQueue, array());
     foreach ($errorQueueList as $errorQueue) {
         $this->log("开始修复: ID={$errorQueue['id']}\tBrokerId={$errorQueue['brokerId']}\tPlanId={$errorQueue['planId']}");
         $ajkBrokerExtend = Model_Broker_AjkBrokerExtend::getDataByBrokerId($errorQueue['brokerId']);
         /** TODO 添加获取二手房经纪人信息为空日志 */
         if (empty($ajkBrokerExtend)) {
             $this->log(sprintf('获取经纪人(%d)的UserId失败(%d)。', $errorQueue['brokerId'], $errorQueue['id']));
             continue;
         }
         $planExtend = Dao_Broker_HzPlan::get_bid_sn($errorQueue['planId']);
         /** TODO 添加获取SN 失败日志 */
         if (empty($planExtend)) {
             $this->log(sprintf('获取计划(%d)的SN失败(%d)。', $errorQueue['planId'], $errorQueue['id']));
             continue;
         }
         $planInfo = Dao_Broker_HzPlan::get_plan($errorQueue['planId']);
         /** TODO 添加获取计划信息失败日志*/
         if (empty($planInfo)) {
             $this->log(sprintf('获取计划(%d)的信息失败(%d)。', $errorQueue['planId'], $errorQueue['id']));
             continue;
         }
         //精选结算
         $amount = $planInfo['total_consume'];
         $note = urlencode(sprintf('精选推广(%d)扣费失败修复', $errorQueue['planId']));
         $this->log("传递的参数:UserId={$ajkBrokerExtend['userId']}\tamount={$amount}\tplanId={$errorQueue['planId']}\tSN={$planExtend['sn']}");
         $charge_sn = Bll_PayAccount::cancel_frozen($ajkBrokerExtend['userId'], $amount, $errorQueue['planId'], Const_PaymentApp::HZ_CHOICE, $planExtend['sn'], $note, true);
         if ($charge_sn['data']['status'] === 'ok') {
             $this->log('修复成功。');
         } else {
             $this->log('修复失败。');
         }
         $this->log(print_r($charge_sn, true));
     }
     return 'success';
 }
Beispiel #2
0
 /**
  * 竞价计划删除操作
  */
 public static function delete_bid($broker_id, $plan_id, $proid)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     if (empty($broker_id) || empty($plan_id) || empty($proid)) {
         $flag_array['msg'] = Const_HzErrorInfo::PARAMS;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_check_planning($proid, $plan_id, Const_HzPlan::BID_TYPE);
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         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 || $plan_info['plan_type'] != Const_HzPlan::BID_TYPE) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     // 如果精选  由job读取上下架日志处理
     if ($plan_info['bidVersion'] == 2) {
         $flag_array['status'] = 1;
         return $flag_array;
     }
     if ($plan_info['status'] == 1) {
         //正在推广的竞价,先停止再删除
         $outBidResult = self::prop_out_bid($broker_id, $proid, true);
         if ($outBidResult['status'] == 1) {
             Dao_Broker_HzPlan::update_history_bids($plan_id);
             $flag_array = $outBidResult;
             return $flag_array;
         } else {
             $flag_array['msg'] = $outBidResult['msg'];
             return $flag_array;
         }
     } else {
         Dao_Broker_HzPlan::update_history_bids($plan_id);
         $flag_array['status'] = 1;
         return $flag_array;
     }
 }
Beispiel #3
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;
 }
Beispiel #4
0
 /**
  * 拼接参数,供上下文使用
  * @param $params
  * @return array
  */
 private static function joinParams(&$params)
 {
     // 获取basic
     // bug42309 需取master
     if (!($basic = Dao_Broker_HzPlan::get_plan($params['planId'], true))) {
         return Bll_HzPropBll::build_return(0, array("获取好租计划失败"));
     }
     $params['userId'] = $basic['user_id'];
     $params['blockId'] = $basic['blockId'];
     $params['priceId'] = $basic['priceId'];
     $params['status'] = $basic['status'];
     $params['flag'] = $basic['flag'];
     $params['bidVersion'] = $basic['bidVersion'];
     //精选标记 1-竞价,2-精选
     $params['planId'] = $basic['id'];
     //计划id
     $params['totalConsume'] = $basic['total_consume'];
     //竞价、精选花费
     $params['is_valid'] = $params['isValid'] = $basic['status'];
     // 由于经纪人操作太快, 可能关系里的plan_id已经被更新成新的了
     // 所以队列表里加了proId
     // 此处兼容proId=0的情况
     if (!isset($params['proId']) || $params['proId'] == 0) {
         // 获取planning
         $planning = Dao_Broker_HzPlan::get_planning($params['planId'], 2, '', true);
         if (count($planning) < 1) {
             return Bll_HzPropBll::build_return(0, array("获取好租关系失败"));
         }
         $params['proId'] = $planning[0]['proid'];
     }
     // 获取城市id
     $userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($params['userId']);
     $params['cityId'] = isset($userInfo['cityId']) ? $userInfo['cityId'] : 0;
     return Bll_HzPropBll::build_return(1, array("success"));
 }
Beispiel #5
0
 /**
  * 记录房源updown 日志
  */
 public static function add_updown_log($proid, $plan_id, $action, $option)
 {
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     $sql = "insert into prop_updown_log(`proid`,`brokerid`,`action`,`plan_id`,`offline_reason`,`plan_type`) value (?,?,?,?,?,?);";
     $reason = $action == 1 ? 0 : $option;
     $stmt = APF_DB_Factory::get_instance()->get_pdo('rent_logs_master')->prepare($sql);
     return $stmt->execute(array($proid, $plan_info['user_id'], $action, $plan_id, $reason, $plan_info['plan_type']));
 }