コード例 #1
0
ファイル: HzBidPlan.php プロジェクト: emilymwang8/ajk-broker
 public static function change_bid_budget($plan_id, $new_amount)
 {
     $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;
     }
     if ((int) ($plan_info['amount'] * 100) > (int) ($new_amount * 100)) {
         $flag_array['msg'] = Const_HzErrorInfo::BIDAMOUNTLOW;
         return $flag_array;
     } elseif ((int) ($plan_info['amount'] * 100) == (int) ($new_amount * 100)) {
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_planning($plan_id, Const_HzPlan::BID_TYPE, 1);
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     $broker_id = $planning[0]['user_id'];
     $proid = $planning[0]['proid'];
     $sn = Dao_Broker_HzPlan::get_bid_sn($plan_id);
     $user_id = Bll_HzBroker::get_userid_by_hzbrokerid($broker_id);
     $note = urlencode('推广房源' . $proid);
     $cha_amount = $new_amount - $plan_info['amount'];
     // 冻结只能冻结差值
     $freezeResult = Bll_PayAccount::freeze($user_id, $cha_amount, $proid, "ZF", $sn['sn'], $note);
     //冻结流水号
     if ($freezeResult['status'] === "error") {
         if ($freezeResult['errcode'] == 398445) {
             $flag_array['msg'] = Const_HzErrorInfo::BIDAMOUNTTOP;
         } else {
             $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
         }
         return $flag_array;
     }
     $new_sn = $freezeResult['sn'];
     Dao_Broker_HzPlan::update_bid_extend($plan_id, $new_sn);
     $log_option = Const_HzLog::BIDUPDATE;
     if (Dao_Broker_HzPlan::change_plan_amount($plan_id, $new_amount)) {
         //更新预算,预算直接改输入值
         Dao_Broker_HzPlan::add_plan_log($plan_id, $planning[0]['proid'], $log_option, 2, $planning[0]['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;
 }
コード例 #2
0
ファイル: HzFixPlan.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 修改单个定价组限额
  */
 public static function change_fix_budget($broker_id, $plan_id, $amount)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($broker_id);
     $city_top = Bll_HzFixPlan::get_citytop($broker_info['cityid']);
     if (!empty($city_top)) {
         $flag_array['msg'] = Const_HzErrorInfo::CHARGECITYTOP;
         return $flag_array;
     }
     $today_cost = self::get_plan_clickinfo($broker_id, $plan_id);
     if ($amount <= $today_cost['total_cost']) {
         $flag_array['msg'] = Const_HzErrorInfo::AMOUNTLOW;
         return $flag_array;
     }
     $re = Dao_Broker_HzPlan::change_plan_amount($plan_id, $amount);
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if ($re) {
         //记计划日志
         Dao_Broker_HzPlan::add_plan_log($plan_id, '', Const_HzLog::CHANGEPRICE, 1, $plan_info['user_id'], 0, $plan_info['status'], $plan_info['status']);
         //刷爆的计划在修改限额后要重推
         if ($plan_info['status'] == Const_HzPlan::AUTOOVER) {
             self::option_fix_plan($broker_id, $plan_id, 'repeat', 2);
         }
         $flag_array['status'] = 1;
         return $flag_array;
     }
     return $flag_array;
 }