Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     $this->_masterPdoName = "user_activity_master";
     $this->_slavePdoName = "user_activity_slave";
     self::$pdo = APF_DB_Factory::get_instance()->get_pdo($this->_masterPdoName);
 }
 public function handle_request()
 {
     $BrokerServiceObj = new Bll_Service_Broker();
     $num = rand(1, 9);
     $params = array(array('brokerId' => '1357262', 'email' => '*****@*****.**', 'mobile' => '1348569758' . $num, 'trueName' => '谭晓轶', 'gender' => 1));
     //传入的参数
     echo PHP_EOL . '入参:' . PHP_EOL;
     print_r($params);
     $sq = $BrokerServiceObj->setBasicInfo($params, 100);
     //调用的接口
     $reply = $BrokerServiceObj->aps_wait_for_replies(array($sq));
     echo '出参:' . PHP_EOL;
     print_r($reply[$sq]);
     //数据库验证
     $PDO = APF_DB_Factory::get_instance()->get_pdo('anjuke_slave');
     $sql = 'select UserMobile, TrueName,UserSex,UserId from ajk_brokerextend where brokerId = ?';
     $stmt = $PDO->prepare($sql);
     $stmt->execute(array($params[0]['brokerId']));
     $results = $stmt->fetch();
     $sql1 = 'select UserEmail, UserId from ajk_members where UserId = ?';
     $stmt1 = $PDO->prepare($sql1);
     $stmt1->execute(array($results['UserId']));
     $resu = $stmt1->fetch();
     $dbtest = $results['UserMobile'] == $params[0]['mobile'] && $resu['UserEmail'] == $params[0]['email'] && $results['TrueName'] == $params[0]['trueName'] && intval($results['UserSex']) == $params[0]['gender'] ? true : false;
     //var_dump($results);
     //var_dump($resu); //UserEmail 不对
     //断言返回参数有18个
     $this->phpUnitMsg('reply', $reply[$sq]);
     $this->phpUnitMsg('dbtest', $dbtest);
 }
 static function addPpcRecommmend($proId = 0, $brokerId = 0, $createtime = 0, $order = 0, $dplan_id = 0, $type = 0, $jplan_id = 0)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("ppc_master");
     $sql = "insert into ppc_firein_hole(`pro_id`,`broker_id`,`createtime`,`order`,`dplan_id`,`type`,`jplan_id`) values(?,?,?,?,?,?,?)";
     $stmt = $pdo->prepare($sql);
     return $stmt->execute(array($proId, $brokerId, $createtime, $order, $dplan_id, $type, $jplan_id));
 }
Beispiel #4
0
 /** 根据db获取pdo
  * @param $db
  * @return mixed
  */
 private static function _getPdo($db = "cms_slave")
 {
     if (empty(self::$_pdo[$db])) {
         self::$_pdo[$db] = APF_DB_Factory::get_instance()->get_pdo($db);
     }
     return self::$_pdo[$db];
 }
Beispiel #5
0
 /**
  * @return APF_DB_Factory
  */
 public static function &get_instance()
 {
     if (!self::$instance) {
         self::$instance = new APF_DB_Factory();
     }
     return self::$instance;
 }
Beispiel #6
0
 /**
  * 经纪人切换为套餐经纪人
  * @param int $uid
  */
 public static function comboBrokerChange($brokerid)
 {
     $sql = "update ajk_brokerextend set PayType=9999 where BrokerId=?";
     $pdo = APF_DB_Factory::get_instance()->get_pdo('master');
     $stmt = $pdo->prepare($sql);
     $result = $stmt->execute(array($brokerid));
     return $result;
 }
 public static function get_yesterday_lucky_draw_award_log($broker_id, $start_time, $end_time)
 {
     $sqlSelectWinner = sprintf('SELECT `user_name`,`broker_id`, `prize_id`, `phone`, `type`, `title` FROM `%s` WHERE `broker_id`=%d AND `type`=1 AND `add_time`>=%d AND `add_time`<%d ;', self::$__table, $broker_id, $start_time, $end_time);
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_slave");
     $stmt = $pdo->prepare($sqlSelectWinner);
     $stmt->execute();
     return $stmt->fetchAll(PDO::FETCH_ASSOC);
 }
Beispiel #8
0
 public function __construct($cityid)
 {
     $this->ppcslave = APF_DB_Factory::get_instance()->get_pdo("ppc_slave");
     $this->propertyslave = APF_DB_Factory::get_instance()->get_pdo($this->getProDbType($cityid));
     //竞价点击相关
     $this->cityId = $cityid;
     $this->arcslave = APF_DB_Factory::get_instance()->get_pdo("ark_slave");
 }
Beispiel #9
0
 public function __construct()
 {
     if (empty($this->_table) || empty($this->_database)) {
         exit('没有设置表名和数据库!');
     }
     $this->_table = $this->_table;
     $this->_db = APF_DB_Factory::get_instance()->get_pdo($this->_database);
 }
 public function get_area_or_block_info($type_code, $city_id)
 {
     $sql = 'select typename, typeid from ajk_commtype where cityid = ? and typecode = ?';
     $stmt = APF_DB_Factory::get_instance()->get_pdo('anjuke_slave')->prepare($sql);
     $stmt->execute(array($city_id, $type_code));
     $res = $stmt->fetchAll();
     return $res;
 }
 /**
  *
  *
  * @param int $id
  * @return mixed
  */
 public static function get_activity_info_by_id($id)
 {
     $sqlSelectActivityInfo = sprintf('SELECT %s FROM `%s` WHERE `id`=%d;', self::$__fields, self::$__table, $id);
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_slave");
     $stmt = $pdo->prepare($sqlSelectActivityInfo);
     $stmt->execute();
     return $stmt->fetch(PDO::FETCH_ASSOC);
 }
Beispiel #12
0
 public function getVcr($winids)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo($this->_masterPdoName);
     $sql = "SELECT `broker_id`,`resource_url`, `resource_type` from " . $this->_tableName . " WHERE `broker_id` in (" . $winids . ") and resource_type=2";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     return $stmt->fetchAll();
 }
 public static function add_lucky_property($lucky_draw_id, $prize_id, $low, $high = 0)
 {
     $sqlInsert = sprintf('INSERT INTO `%s`(`lid`,`prize_id`, `low`,`high`, `add_time`) VALUES(%d, %d, %d, %d, %d)', self::$__table, $lucky_draw_id, $prize_id, $low, $high, time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsert);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
Beispiel #14
0
 public static function addBrokerData($data)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("user_master");
     $sql = "INSERT INTO broker_edition (brokerid,status) VALUES (?,?) ON DUPLICATE KEY UPDATE status=?";
     $stmt = $pdo->prepare($sql);
     $stmt->execute(array($data['brokerid'], $data['status'], $data['status']));
     return $pdo->lastInsertId();
 }
Beispiel #15
0
 public function get_keywords()
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("bbs_slave");
     $sql = "select `WORD` from ban_words";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     return $stmt->fetchAll();
 }
 public function getLockStatus($brokerId)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("user_master");
     $sql = "select * from agcy_phone_lock where broker_id=?";
     $stmt = $pdo->prepare($sql);
     $stmt->execute(array($brokerId));
     return $stmt->fetch();
 }
Beispiel #17
0
 /**
  * 根据经纪人id获取房源信息
  * @param unknown_type $brokerid
  * @param unknown_type $tradetype
  * @param unknown_type $operatestate
  */
 public static function getPropertyByBrokerId($brokerid, $cityid, $tradetype = 1, $operatestate = 1)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo(self::get_Property_db($cityid));
     $sql = "select ProId,CommId,ProName,OperateState,RoomNum,HallNum,ToiletNum,AreaNum,\n        ProPrice,PostDate,ModifyDate,Recommend,RecommendTime,UserDefined,viewSum,RefreshNum,CommName,ExpireWorker,\n        ExpireDate,IsHighQulity,LastEdit,IsVisible,TradeType,ShowDay,ShowDate,CityId,ProFloor,FloorNum,AreaCode from ajk_propertys force index (BrokerId) where BrokerId={$brokerid} and TradeType in ({$tradetype}) and SowooId=0 and OperateState in ({$operatestate}) and IsVisible=1 order by PostDate asc ";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $result = $stmt->fetchAll();
     return $result;
 }
 /**
  * 遍历中间表
  * @param unknown_type $where
  */
 public static function getProSpreadChangeListToJob($Id, $SplitTable)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("ppc_slave");
     $sql = "select Id,ProId,SpreadId,BrokerId,CityId,Type,AddDate,Remark,OperateId,`From` from Hp_ProSpread_Change_" . $SplitTable . " where Id>? order by id asc limit 1000";
     $stmt = $pdo->prepare($sql);
     $stmt->execute(array($Id));
     $result = $stmt->fetchAll();
     return $result;
 }
Beispiel #19
0
 public static function add_ppc_coin_type($act_type, $detail, $type_date)
 {
     $sqlInsertFmt = "INSERT INTO `%s`(`ActType`, `Detail`, `AddTime`, `TypeDate`) VALUES(%d, '%s', %d, %d);";
     $sqlInsert = sprintf($sqlInsertFmt, self::$__table, $act_type, $detail, time(), $type_date);
     $pdo = APF_DB_Factory::get_instance()->get_pdo("ppc_master");
     $stmt = $pdo->prepare($sqlInsert);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
 /**
  * 添加经纪人信息
  *
  * @param $aid
  * @param $user_id
  * @param $broker_id
  * @param $city_id
  * @param $user_name
  * @param $gender
  * @param $phone
  * @param $properties
  * @param $origin_properties
  * @param $grade_score
  * @param $grade_level
  * @return string
  */
 public static function add_broker($aid, $user_id, $broker_id, $city_id, $user_name, $gender, $phone, $properties, $origin_properties, $grade_score, $grade_level)
 {
     $sqlInsertFmt = "INSERT INTO `%s`(`aid`,`user_id`,`broker_id`,`city_id`,`user_name`,`gender`,`phone`,`propertys`,`origin_propertys`,`grade_score`,`grade_level`,`add_time`) values(%d,%d,%d,%d,'%s',%d,'%s',%d,%d,%d,%d,%d);";
     $sqlInsert = sprintf($sqlInsertFmt, self::$__table, $aid, $user_id, $broker_id, $city_id, $user_name, $gender, $phone, $properties, $origin_properties, $grade_score, $grade_level, time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsert);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
Beispiel #21
0
 public function getUserInfo($UserId)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo('anjuke_slave');
     $sql = "select UserName,UserEmail,RegDate,Points,Fuid,UserPwd from ajk_members where UserId='{$UserId}'";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $result = $stmt->fetch(PDO::FETCH_ASSOC);
     return $result;
 }
Beispiel #22
0
 public static function getShopSwitcherByBrokerId($brokerid)
 {
     $PDO = APF_DB_Factory::get_instance()->get_pdo('slave');
     $strSQL = 'select IsOpen from shop_list where BrokerId=? limit 1';
     $stmt = $PDO->prepare($strSQL);
     $stmt->execute(array($brokerid));
     $arrRtnDATA = $stmt->fetchAll();
     return $arrRtnDATA[0]['IsOpen'];
 }
 public static function add_lucky_area($lucky_draw_id, $prize_id, $city_id, $city_name)
 {
     $fileds = '`lid`, `prize_id`, `city_id`, `city_name`, `add_time`';
     $sqlInsertArea = sprintf("INSERT INTO `%s`(%s) VALUES(%d, %d, %d, '%s', %d )", self::$__table, $fileds, $lucky_draw_id, $prize_id, $city_id, $city_name, time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsertArea);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
Beispiel #24
0
 static function getNoPassReason($brokerid, $typeid)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("anjuke_slave");
     $sql = "select ExpDesc from ajk_broker_imgcheck where BrokerId=? and TypeId=? order by PostTime desc limit 1";
     $stmt = $pdo->prepare($sql);
     $stmt->execute(array($brokerid, $typeid));
     $result = $stmt->fetchColumn();
     return $result;
 }
 public static function add_config($aid, $periods_no, $times_limit, $title, $consume, $start_time, $end_time)
 {
     $fields = '`aid`, `periods_no`, `times_limit`, `title`, `consume`, `start_time`, `end_time`, `add_time`';
     $sqlInsertConfigFmt = "INSERT INTO `%s`(%s) VALUES(%d, %d, %d, '%s', %d, %d, %d, %d);";
     $sqlInsertConfig = sprintf($sqlInsertConfigFmt, self::$__table, $fields, $aid, $periods_no, $times_limit, $title, $consume, $start_time, $end_time, time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsertConfig);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
 public static function add_exchange_property($aid, $prize_id, $pic_url, $prize_title, $periods_no, $start_time, $end_time, $times_limit, $amount, $leavings, $consume)
 {
     $fields = '`aid`,`prize_id`,`pic_url`,`prize_title`,`periods_no`,`start_time`,`end_time`,`times_limit`,`amount`,`leavings`,`consume`,`add_time`';
     $sqlInsertFmt = "INSERT INTO `%s`(%s) VALUES(%d, %d, '%s', '%s', %d, %d, %d, %d, %d, %d, %d, %d);";
     $sqlInsert = sprintf($sqlInsertFmt, self::$__table, $fields, $aid, $prize_id, $pic_url, $prize_title, $periods_no, $start_time, $end_time, $times_limit, $amount, $leavings, $consume, time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsert);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
 /**
  * 根据计划id,SpreadId获取计划。
  * @param $SpreadId
  * return array 二位数组
  */
 static function getStaticPricePlanById($SpreadId)
 {
     $pdo = APF_DB_Factory::get_instance()->get_pdo("ppc_master");
     $sql = "select Id,BrokerId,CityId,Status,tradeType,ViewTime,Ceiling,PlanName,updated_datetime from static_price_plan where Id = :id";
     $stmt = $pdo->prepare($sql);
     $stmt->bindParam(":id", $SpreadId, PDO::PARAM_INT);
     $stmt->execute();
     $result = $stmt->fetch();
     return $result;
 }
 public static function add_lucky_draw_prize($prize_info)
 {
     $fields = '`lid`, `award_title`, `title`, `prize_id`, `pic_url`, `ammount`, `leavings`, `probability`, `mulriple`, `start_time`, `end_time`, `add_time`';
     $sqlInsertPrizeFmt = "INSERT INTO `%s`(%s) VALUES(%d, '%s', '%s', %d, '%s', %d, %d, '%s', %d, %d, %d, %d);";
     $sqlInsertPrize = sprintf($sqlInsertPrizeFmt, self::$__table, $fields, $prize_info['lid'], $prize_info['award_title'], $prize_info['title'], $prize_info['prize_id'], $prize_info['pic_url'], $prize_info['ammount'], $prize_info['leavings'], $prize_info['probability'], $prize_info['mulriple'], $prize_info['start_time'], $prize_info['end_time'], time());
     $pdo = APF_DB_Factory::get_instance()->get_pdo("cms_broker_master");
     $stmt = $pdo->prepare($sqlInsertPrize);
     $stmt->execute();
     return $pdo->lastInsertId();
 }
Beispiel #29
0
 public static function insertLog($broker, $status, $remark)
 {
     $brokerid = $broker['BrokerId'];
     $cityid = $broker['CityId'];
     $userid = $broker['UserId'];
     $master = APF_DB_Factory::get_instance()->get_pdo("ppc_master");
     $tablename = "log_static_broker_" . $brokerid % 10;
     $sql = "insert into {$tablename} (brokerId,userId,cityId,status,logtime,remark) values(\n         {$brokerid},{$userid},{$cityid},{$status}," . time() . ",'{$remark}'\n        )";
     $stmt = $master->prepare($sql);
     $stmt->execute();
 }
Beispiel #30
0
 public static function save($TypeId, $BrokerId, $AccountType, $Amount, $Remark, $CityId, $BrokerType, $BrokerAccountType)
 {
     $UpdateTime = $AddTime = time();
     $fields = '`TypeId`, `BrokerId`, `AccountType`, `Amount`, `Status`, `Remark`, `CityId`, `BrokerType`, `BrokerAccountType`, `UpdateTime`, `AddTime`';
     $sqlInsertFmt = "INSERT INTO `%s`(%s) VALUES(%d, %d, %d, %d, 0, '%s',%d,%d,%d,%d,%d);";
     $sqlInsert = sprintf($sqlInsertFmt, self::$__table, $fields, $TypeId, $BrokerId, $AccountType, $Amount, $Remark, $CityId, $BrokerType, $BrokerAccountType, $UpdateTime, $AddTime);
     $pdo = APF_DB_Factory::get_instance()->get_pdo("ppc_master");
     $stmt = $pdo->prepare($sqlInsert);
     $stmt->execute();
     return $pdo->lastInsertId();
 }