/** * 获取经纪人的定价计划信息 * * @param int $brokerId * @param int $cityId * @param array $propIds * @param int $brokerCheckState * @return array */ public static function getBrokerFixPlanList($brokerId, $cityId, &$propIds, $brokerCheckState = 1) { $rtn = array(); $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId); if (empty($fixSpreadPlanList)) { return $rtn; } if (!is_array($propIds)) { $propIds = array(); } $balance = static::getAccountBalance($brokerId); $date = date('Ymd'); foreach ($fixSpreadPlanList as $fixSpreadPlan) { $fixPlanId = $fixSpreadPlan['id']; // $dayCost = Bll_Ppc_ServiceAPI::planTodayNewCost($fixPlanId); // $fixSpreadPlan['dayCost'] = $dayCost['allAmount'] ? $dayCost['allAmount'] : 0; $dayCost = Bll_Ppc_ServiceAPI::brokerDailyFixCost($brokerId, $fixPlanId, $date, $date); $fixSpreadPlan['dayCost'] = max(0, $dayCost) / 100; // $fixSpreadPlan['clickTotal'] = $dayCost['allClick']; $planDailyClickNum = Bll_Ppc_ServiceAPI::getFixPlanDailyClickNum($brokerId, $fixPlanId, $date, $date); $fixSpreadPlan['clickTotal'] = 0; if (!empty($planDailyClickNum)) { foreach ($planDailyClickNum as $planDailyClick) { $fixSpreadPlan['clickTotal'] += intval($planDailyClick['clickNum']); } } // $fixSpreadPlan['allAgioAmount'] = $dayCost['allAgioAmount']; $fixSpreadPlan['balance'] = $balance; if ($brokerCheckState != 1) { $fixSpreadPlan['flag'] = 6; } elseif ($balance <= 0) { $fixSpreadPlan['flag'] = 2; } elseif ($fixSpreadPlan['viewtime'] <= time()) { $fixSpreadPlan['flag'] = 1; } elseif ($fixSpreadPlan['viewtime'] == 1893427200) { //账户没钱停止的标记(2030年),显示以结束 $fixSpreadPlan['flag'] = $balance > 0 ? 3 : 2; } elseif ($fixSpreadPlan['viewtime'] == 1861891200) { //手动停止标记(2029年) $fixSpreadPlan['flag'] = 3; } elseif ($fixSpreadPlan['ceiling'] <= $fixSpreadPlan['dayCost'] * 100) { //限额小于等于花费,限额不足 $fixSpreadPlan['flag'] = 4; } else { $fixSpreadPlan['flag'] = 5; } $planInfo = array('planInfo' => $fixSpreadPlan, 'houseList' => array()); $propFixedPlanRelationList = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $fixPlanId); foreach ($propFixedPlanRelationList as $propFixedPlanRelation) { $propIds[] = $propFixedPlanRelation['propId']; $planInfo['houseList'][] = $propFixedPlanRelation['propId']; } $rtn[] = $planInfo; } return $rtn; }