Example #1
0
 /**
  * 创建安居客支付中心账户ID
  * @params $userid
  * @return   $accountid or false
  */
 public function create_jpaccountid($UserId)
 {
     $ajk_broker_id = DAO_Broker::get_brokerid_by_userid($UserId);
     $jp_broker_id = DAO_Broker::get_jpbrokerid_by_ajkbrokerid($ajk_broker_id);
     if (!$jp_broker_id) {
         return 0;
     }
     $uri_PayCenterAPI = new Uri_PayCenterAPI();
     $propSpread = APF::get_instance()->get_config("propSpread_jp", "app");
     $account = $uri_PayCenterAPI->createAccount($propSpread['paycenter_id'], $propSpread['paycenter_key'], $jp_broker_id);
     if ($account && $account['account'] && $jp_broker_id) {
         $accountData = array("MEMBER_ID" => $jp_broker_id, "ACCOUNT" => intval($account['account']), "CREATE_TIME" => date("Y-m-d H:i:s"));
         if (!DAO_Payment_Account::addJPAccountDao($accountData)) {
             //写入失败,unikey冲突.将原数据查询出来返回去
             $getAccountInfo = DAO_Payment_Account::getJPAccountMapping($jp_broker_id, false);
             if ($getAccountInfo && $getAccountInfo['Account']) {
                 $account['account'] = $getAccountInfo['Account'];
             }
         }
         return intval($account['account']);
     } else {
         return false;
     }
 }
 function get30DaysScore($brokerid)
 {
     $key = 'get_30days_score_brokerid_' . $brokerid;
     APF::get_instance()->benchmark_begin(__CLASS__ . $key);
     $memcache = APF_Cache_Factory::get_instance()->get_memcache();
     $value = $memcache->get($key);
     if (!$value) {
         $value = parent::get30DaysScore($brokerid);
         $memcache->add($key, $value, 0, 21600);
         //6小时
     }
     APF::get_instance()->benchmark_end(__CLASS__ . $key);
     return $value;
 }