Exemplo n.º 1
0
 /**
  * 房源价格修改,定价rebulid
  * @param $Id
  * @param $ProId
  * @param $CityId
  * @param $ProPrice
  */
 public function rebulidStaticPro($relationId, $CityId, $ProPrice)
 {
     //重新计算房源出价
     $PriceInterval = $this->getPriceInterval($CityId, $ProPrice - 0.01, 0, 0);
     if (empty($PriceInterval)) {
         return "未知价格区间";
     }
     //更新计划明细
     $param = array('ID' => $relationId, 'PRICE' => $PriceInterval['price'] * 100);
     DAO_Plan_StaticPricePlan::updateStaticPriceRelationById($param, $CityId);
     return true;
 }
 /**
  * 查询当前计划的状态
  * @param $pro_id
  * @param $remark
  * @param $type
  * @param $site_type
  * @return mixed
  */
 public function getPlanStatusRemark($pro_id, $city_id, $remark, $type, $site_type)
 {
     //不需要查询当前计划状态的动作,直接返回原备注
     if (!in_array($type, array())) {
         return $remark;
     }
     switch ($site_type) {
         case 1:
             //二手房
             //根据房源id获取计划id
             $ProSpreadRelation = DAO_Plan_StaticPriceRelation::getProSpreadRelationByProId($pro_id, $city_id);
             if (empty($ProSpreadRelation)) {
                 return $remark;
             }
             //根据计划id获取计划状态
             $plan_info = DAO_Plan_StaticPricePlan::getStaticPricePlanById($ProSpreadRelation['PlanId']);
             if (empty($plan_info)) {
                 return $remark;
             }
             if ($plan_info) {
             }
             break;
         case 2:
             //租房
             //根据房源id获取计划id
             //根据计划id获取计划状态
             break;
         case 3:
             //金铺
             //根据房源id获取计划id
             //根据计划id获取计划状态
             break;
         default:
             break;
     }
     return $remark;
 }
Exemplo n.º 3
0
 /**
  * 303竞价结算
  * 1. 查询经纪人所有有效计划,
  *      没有计划return
  *
  * 2. 基于推广计划,查询计划下有效房源(循环计划查询)
  *
  *      判断计划状态
  *          推广中,contine
  *          第二天推广,continue
  *          手动停止,continue
  *          账户限额不足,计划置为推广中,记录计划推广日志
  *      查询计划下房源关系,
  *          如果为空,contine
  *          不为空,判断计划状态
  *                  如果账户余额不足,记录房源推广日志
  */
 public static function broker_frozen_money($params)
 {
     if (empty($params['broker_id'])) {
         return Bll_JpPropBll::build_return(1, array("经纪人ID为空"));
     }
     $returnLog = array();
     //获取账户余额
     try {
         $userId = Bll_Broker_MainBusiness::getDataByEsfId($params['broker_id'])->memberId;
         $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     } catch (Exception $e) {
         array_push($returnLog, "获取账户余额不足失败");
         return Bll_JpPropBll::build_return(0, $returnLog);
     }
     if ($balance['data']['balance'] <= 0) {
         array_push($returnLog, "当前账户余额不足");
         return Bll_JpPropBll::build_return(1, $returnLog);
     }
     array_push($returnLog, "当前账户余额:" . $balance['data']['balance']);
     //获取经纪人正在推广的计划
     $StaticPricePlanList = DAO_Plan_StaticPricePlan::getStaticPricePlanListByBrokerId($params['broker_id']);
     foreach ($StaticPricePlanList as $list) {
         if ($list['Status'] != 1) {
             //无效的计划
             array_push($returnLog, "无效的计划:" . $list['Id'] . ";");
             continue;
         }
         if ($list['ViewTime'] != 1893427200) {
             //非账户没钱停止的计划
             array_push($returnLog, "计划Id:" . $list['Id'] . "展示时间:" . date("Y-m-d H:i:s", $list['ViewTime']) . ";");
             continue;
         }
         $tmpStr = "计划Id:" . $list['Id'] . "展示时间:" . date("Y-m-d H:i:s", $list['ViewTime']) . ";";
         //获取计划下面的房源
         $StaticPriceRelation = DAO_Plan_StaticPriceRelation::getProSpreadRelation($list['Id'], $list['CityId']);
         //更新计划的状态
         if (BLL_Fixedspread_StaticPlanUpDownSwicher::isOnline()) {
             DAO_Plan_StaticPricePlan::updateStaticPricePlanById(array('Id' => $list['Id'], 'ViewTime' => time()));
         }
         //记录计划日志
         $params['plan_id'] = $list['Id'];
         $data = self::build_plan_log($params, 8, "账户有钱计划推广,动作id:" . $params['id'], $params['broker_id']);
         if (!Model_House_UpDown_PlanLog::create($data, date('m'))->save()) {
             array_push($returnLog, "账户有钱计划推广日志写入失败");
             return Bll_JpPropBll::build_return(0, $returnLog);
         }
         //记录房源日志
         foreach ($StaticPriceRelation as $Relation) {
             $params['pro_id'] = $Relation['ProId'];
             $data = Bll_EsfPropBll::build_prop_log($params, 5, "房源推广,动作id:" . $params['id'], $params['broker_id']);
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 array_push($returnLog, "房源" . $Relation['ProId'] . "房源推广日志写入失败");
                 return Bll_JpPropBll::build_return(0, $returnLog);
             }
             $tmpStr .= $Relation['ProId'] . ",";
         }
         array_push($returnLog, $tmpStr);
     }
     if (empty($returnLog)) {
         array_push($returnLog, "经纪人没有计划");
     }
     return Bll_JpPropBll::build_return(1, $returnLog);
 }