Esempio n. 1
0
 /**
  * 更新竞价扩展信息
  *
  * @param int $planId
  * @param array $data
  * @return int
  */
 public static function updatePlanExtend($planId, $data)
 {
     unset($data['plan_id']);
     try {
         $oExtend = Model_Plan_HzPlanExtend::data_access()->filter('plan_id', $planId)->force_master();
         foreach ($data as $key => $value) {
             $oExtend->set_field($key, $value);
         }
         return $oExtend->update();
     } catch (Exception $e) {
         return 0;
     }
 }
Esempio n. 2
0
 /**
  * 添加竞价计划
  * 往 `promotion_planning_basic` 里 添加一条记录,往 `promotion_planning_extend` 添加一条记录
  * 房源计划关系表`promotion_prop_planning`里一个房源只能有2个记录,一个定价,一个竞价,所以先判断房源在
  * 该表里是否已经有竞价计划记录了,有则更新,没有就添加。
  *
  * @param int $brokerId
  * @param int $propId
  * @param float $price
  * @param float $amount
  * @param int $blockId
  * @param int $cityId
  * @param int $sn
  * @param int $ajk_broker_id
  * @return array|int|mixed
  */
 public static function insertBidPlan($brokerId, $propId, $price, $amount, $blockId, $cityId, $sn, $ajk_broker_id = 0)
 {
     $prop = Model_House_HzProp::get_prop_info_by_prop_id($propId);
     $priceInterval = Model_House_HzPriceChoice::get_price($cityId, $prop['contentBasic']['pricenum']);
     $planBasicData = array('plan_title' => '精选', 'blockId' => $blockId, 'priceId' => $priceInterval['id'], 'plan_type' => Const_HzPlan::BID_TYPE, 'user_id' => $brokerId, 'amount' => $amount, 'status' => Const_HzPlan::WAITING, 'created' => time(), 'stop_date' => strtotime('+14 days'), 'order_update' => time(), 'cityId' => $cityId, 'bid_version' => Const_HzPlan::BID_VERSION_CHOICE, 'ajkBrokerId' => $ajk_broker_id);
     $planId = Model_Plan_HzPlanBasic::addPlan($planBasicData);
     if ($planId == 0) {
         return 0;
     }
     Bll_Log_EffectPlanLog::addPlanLog(Const_HzPlan::BID_TYPE, $planId, $propId, Const_HaoPanLog::PROPSTARTBID, $brokerId, 0, Const_HzPlan::WAITING, Bll_Log_EffectPlanLog::OPERATION_CHOICE);
     $extendData = array('plan_id' => $planId, 'start_date' => time(), 'created' => time(), 'end_date' => strtotime('+14 days'), 'sn' => $sn);
     Model_Plan_HzPlanExtend::addPlanExtend($extendData);
     $propPlanInfo = Model_Plan_HzPlanning::getPropBidPlan($propId);
     if (!empty($propPlanInfo)) {
         $propPlan = array('plan_id' => $planId, 'unit_price' => $price, 'is_valid' => Const_HzPlan::WAITING, 'current_day' => date("Ymd"), 'ajkBrokerId' => $ajk_broker_id, 'last_update' => date("Y-m-d H:i:s"));
         Model_Plan_HzPlanning::updatePropPlan($propPlanInfo['id'], $propPlan);
     } else {
         $propPlan = array('proid' => $propId, 'plan_id' => $planId, 'plan_type' => 2, 'unit_price' => $price, 'is_valid' => Const_HzPlan::WAITING, 'created' => time(), 'city_id' => $cityId, 'current_day' => date("Ymd"), 'user_id' => $brokerId, 'ajkBrokerId' => $ajk_broker_id);
         Model_Plan_HzPlanning::addPropPlan($propPlan);
     }
     return $planId;
 }