コード例 #1
0
ファイル: TestMason.php プロジェクト: emilymwang8/ajk-broker
 private function choiceHouse($type = 1)
 {
     $params = array('planId' => 60732, 'brokerId' => 1168365, 'oldPrice' => 4500, 'newPrice' => 1000000);
     switch ($type) {
         case 1:
             var_dump(Bll_Plan_Bid_JpChoice::choicePromotion($params));
             break;
         case 2:
             var_dump(Bll_Plan_Bid_JpChoice::stopSpread($params));
             break;
         case 3:
             var_dump(Bll_Plan_Bid_JpChoice::expireSpread($params));
             break;
         case 4:
             var_dump(Bll_Plan_Bid_JpChoice::noMoneySpread($params));
             break;
         case 5:
             var_dump(Bll_Plan_Bid_JpChoice::removeFixSpread($params));
             break;
         case 6:
             var_dump(Bll_Plan_Bid_JpChoice::changePriceForHouse($params));
             break;
         case 7:
             $obj = new Bll_Plan_Bid_JpSettlement();
             var_dump($obj->insert_settlement('bid', array('spread_id' => 60690, 'log_status' => 7)));
             break;
     }
 }
コード例 #2
0
ファイル: Bidupdown.php プロジェクト: emilymwang8/ajk-broker
 /**
  *
  */
 public function handle_request()
 {
     //分表
     $date = date('Ymd');
     //获取游标
     $dateFlag = $this->getFlag();
     if (!empty($dateFlag)) {
         $date = $dateFlag['date'];
     }
     //竞价队列数据获取
     $split = date('m', strtotime($date));
     $year = date('Y', strtotime($date));
     $day = date('d', strtotime($date));
     $BidList = Model_Choice_ActionQueue::getBidQueenList($split);
     //判断当前队列是否处理完成
     if (empty($BidList)) {
         //判断是否切换表
         if ($split + 0 != date('m') + 0) {
             $split += 1;
             if ($split < 10) {
                 $date = $year . '0' . $split . $day;
             } elseif ($split <= 12) {
                 $date = $year . $split . $day;
             } else {
                 $date = $year + 1 . '0' . ($split - 12) . $day;
             }
             //记录表游标
             $this->setFlag(array('date' => $date));
         }
         //休息1秒钟
         $this->setShCommonSleepTime(1);
         $this->setLog(date('Y-m-d H:i:s') . ' 处理完成');
         exit;
     }
     //队列数据处理
     foreach ($BidList as $list) {
         try {
             $AjkChoice = new Bll_Plan_Bid_AjkChoice();
             $AjkBlockChoice = new Bll_Plan_Bid_AjkBlockChoice();
             $result = '';
             if ($list['siteType'] == 1) {
                 //查询计划信息
                 $propSpread = Model_Plan_AjkPropspread::getAjkPropspreadById($list['planId']);
             }
             switch ($list['actionId']) {
                 case 1:
                     //精选推广
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 1;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStartForJobByBroker($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStartForJobByBroker($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::choiceSpread($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::choicePromotion($list);
                     }
                     break;
                 case 2:
                     //手动停止
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 3;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStopForJobByBroker($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStopForJobByBroker($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::stopChoiceSpread($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::stopSpread($list);
                     }
                     break;
                 case 3:
                     //计划14天到期
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 6;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStopForJobBySystem($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStopForJobBySystem($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::timeIsUp($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::expireSpread($list);
                     }
                     break;
                 case 4:
                     //计划没钱
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 5;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStopForJobByNoMoney($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStopForJobByNoMoney($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::planNoMoney($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::noMoneySpread($list);
                     }
                     break;
                 case 5:
                     //房源移出定价计划,导致精选停止(房源日志发起)
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 2;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStopForJobBySystem($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStopForJobBySystem($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::removeFixPlanForChoice($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::removeFixSpread($list);
                     }
                     break;
                 case 6:
                     //房源价格变更(房源日志发起)
                     $priceaArr = json_decode($list['createRemark'], true);
                     $list = array_merge($list, $priceaArr);
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 4;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceChangePriceForJob($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceChangePriceForJob($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::changeProPrice($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::changePriceForHouse($list);
                     }
                     break;
                 case 7:
                     //房源移出定价计划,导致竞价停止(房源日志发起)20140717 caoyang 新增
                     if ($list['siteType'] == 1) {
                         /** 二手房走老队列 */
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::removeFixPlanForBid($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpBidManage::stopJpBidData($list);
                     }
                     break;
                 case Const_ChoiceType::CHOICE_REMOVE_FROM_COMBO:
                     //房源取消套餐推广,导致精选停止(房源日志发起)20140815 caoyang 新增
                     if ($list['siteType'] == 1) {
                         $list['bidStatus'] = 2;
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choiceStopForJobBySystem($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->blockChoiceStopForJobBySystem($list);
                         }
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::removeComboForChoice($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpChoice::removeFixSpread($list);
                     }
                     break;
                 case Const_ChoiceType::BID_REMOVE_FROM_COMBO:
                     //房源取消套餐推广,导致竞价停止(房源日志发起)20140815 caoyang 新增
                     if ($list['siteType'] == 1) {
                         /** 二手房走老队列 */
                     } elseif ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::removeFixPlanForBid($list);
                     } elseif ($list['siteType'] == 3) {
                         $result = Bll_Plan_Bid_JpBidManage::stopJpBidData($list);
                     }
                     break;
                     /** 精选房源板块变更 */
                 /** 精选房源板块变更 */
                 case Const_ChoiceType::CHOICE_HOUSE_AREA_CHANGE:
                     if ($list['siteType'] == 1) {
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->communityMerge($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->communityMerge($list);
                         }
                         break;
                     }
                     if ($list['siteType'] == 2) {
                         $result = Bll_Plan_Bid_HzChoice::houseAreaChange($list);
                         break;
                     } else {
                         if ($list['siteType'] == 3) {
                             $result = Bll_Plan_Bid_JpChoice::houseBlockChange($list);
                         }
                     }
                     break;
                     /** 精选房源价格段变更 */
                 /** 精选房源价格段变更 */
                 case Const_ChoiceType::CHOICE_PRICE_INTERVAL_CHANGE:
                     $result = array('status' => 2, 'msg' => '未知的动作类型');
                     if ($list['siteType'] == 1) {
                         if ($propSpread['model'] == 1) {
                             $result = $AjkChoice->choicePriceIntervalChange($list);
                         } elseif ($propSpread['model'] == 2) {
                             $result = $AjkBlockChoice->choicePriceIntervalChange($list);
                         }
                     }
                     break;
                     /** 精选上下架状态维护,该上没上,改下没下 */
                 /** 精选上下架状态维护,该上没上,改下没下 */
                 case Const_ChoiceType::NOTIFY_SOLR_UP_DOWN:
                     switch ($list['siteType']) {
                         case Const_Site::ANJUKE:
                             $result = $AjkChoice->notifySolrUpDown($list);
                             break;
                         case Const_Site::HAOZU:
                             $result = Bll_Plan_Bid_HzChoice::notifySolrUpDown($list);
                             break;
                         case Const_Site::JINPU:
                             $result = Bll_Plan_Bid_JpChoice::notifySolrUpDown($list);
                             break;
                     }
                     break;
                 default:
                     $result = array('status' => 2, 'msg' => '未知的动作类型');
                     break;
             }
             //解析返回值
             if ($list['siteType'] == 1) {
                 $status = $result ? 1 : 2;
                 if ($propSpread['model'] == 1) {
                     $updateRemark = $AjkChoice->getMsg();
                 } elseif ($propSpread['model'] == 2) {
                     $updateRemark = $AjkBlockChoice->getMsg();
                 }
             } elseif ($list['siteType'] == 2) {
                 $status = $result['status'] ? 1 : 2;
                 $updateRemark = is_array($result['msg']) ? implode(';', $result['msg']) : $result['msg'];
             } elseif ($list['siteType'] == 3) {
                 $status = $result['status'] ? 1 : 2;
                 $updateRemark = is_array($result['msg']) ? implode(';', $result['msg']) : $result['msg'];
             } else {
                 $status = 2;
                 $updateRemark = '未知的网站类型';
             }
         } catch (Exception $e) {
             $status = 2;
             $updateRemark = print_r($e, true);
         }
         //更新队列状态
         Model_Choice_ActionQueue::setBidQueenStatusById($split, $list['id'], $status, $updateRemark);
         //记录处理日志
         $this->setLog(date('Y-m-d H:i:s') . ' id:' . $list['id'] . '; 网站: ' . $list['siteType'] . '; split:' . $split . '; remark:' . $updateRemark);
         //记录表游标
         $this->setFlag(array('date' => $date));
     }
     //休息10毫秒
     $this->setShCommonSleepTime(0.01);
 }