当前位置: 首页>>代码示例>>PHP>>正文


PHP base_kvstore类代码示例

本文整理汇总了PHP中base_kvstore的典型用法代码示例。如果您正苦于以下问题:PHP base_kvstore类的具体用法?PHP base_kvstore怎么用?PHP base_kvstore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了base_kvstore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create_key

 public function create_key($key)
 {
     if (isset($key[201])) {
         return parent::create_key($key);
     }
     return sprintf("%s/%s/%s", base_kvstore::kvprefix(), $this->prefix, $key);
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:7,代码来源:ecae.php

示例2: clear_by_app

 public function clear_by_app($app_id)
 {
     if (!$app_id) {
         return false;
     }
     base_kvstore::instance('imgbundle')->delete('imgbundle_' . $app_id);
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:7,代码来源:imgbundle.php

示例3: login_hankshake

 function login_hankshake()
 {
     if (base_kvstore::instance('ecos')->fetch('net.login_handshake', $value)) {
         echo $value;
     }
     base_kvstore::instance('ecos')->store('net.login_handshake', md5(microtime()));
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:7,代码来源:check.php

示例4: check_certid

 function check_certid()
 {
     $params['certi_app'] = 'open.login';
     $this->Certi = base_certificate::get('certificate_id');
     $this->Token = base_certificate::get('token');
     $params['certificate_id'] = $this->Certi;
     $params['format'] = 'json';
     /** 增加反查参数result和反查基础地址url **/
     $code = md5(microtime());
     base_kvstore::instance('ecos')->store('net.login_handshake', $code);
     $params['result'] = $code;
     $obj_apps = app::get('base')->model('apps');
     $tmp = $obj_apps->getList('*', array('app_id' => 'base'));
     $app_xml = $tmp[0];
     $params['version'] = $app_xml['local_ver'];
     $params['url'] = kernel::base_url(1);
     /** end **/
     $token = $this->Token;
     $str = '';
     ksort($params);
     foreach ($params as $key => $value) {
         $str .= $value;
     }
     $params['certi_ac'] = md5($str . $token);
     $http = kernel::single('base_httpclient');
     $http->set_timeout(20);
     $result = $http->post(config::get('link.license_center'), $params);
     $api_result = stripslashes($result);
     $api_arr = json_decode($api_result, true);
     return $api_arr;
 }
开发者ID:453111208,项目名称:bbc,代码行数:31,代码来源:certcheck.php

示例5: display

 function display($tmpl_file, $app_id = null)
 {
     array_unshift($this->_files, $tmpl_file);
     $this->_vars = $this->pagedata;
     if ($p = strpos($tmpl_file, ':')) {
         $object = kernel::service('tpl_source.' . substr($tmpl_file, 0, $p));
         if ($object) {
             $tmpl_file_path = substr($tmpl_file, $p + 1);
             $last_modified = $object->last_modified($tmpl_file_path);
         }
     } else {
         $tmpl_file = realpath(APP_DIR . '/' . ($app_id ? $app_id : $this->app->app_id) . '/view/' . $tmpl_file);
         $last_modified = filemtime($tmpl_file);
     }
     if (!$last_modified) {
         //无文件
     }
     $compile_id = $this->compile_id($tmpl_file);
     if ($this->force_compile || base_kvstore::instance('cache/template')->fetch($compile_id, $compile_code, $last_modified) === false) {
         if ($object) {
             $compile_code = $this->_compiler()->compile($object->get_file_contents($tmpl_file_path));
         } else {
             $compile_code = $this->_compiler()->compile_file($tmpl_file);
         }
         if ($compile_code !== false) {
             base_kvstore::instance('cache/template')->store($compile_id, $compile_code);
         }
     }
     eval('?>' . $compile_code);
     array_shift($this->_files);
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:render.php

示例6: counter

 /**
  * 不破坏缓存情况下的商品统计
  */
 public function counter($args = array())
 {
     $args = array_merge((array) $args, $this->req_params);
     $mdl_goods = app::get('b2c')->model('goods');
     $gid = $args['goods_id'];
     if (!$gid) {
         return false;
     }
     $db = vmc::database();
     $kv = base_kvstore::instance('b2c_counter');
     foreach ($args as $key => $value) {
         $value = intval($value);
         $update_sql = false;
         if ($value < 1) {
             $value = 1;
         }
         switch ($key) {
             case 'view_count':
                 $this->history($gid);
                 //UV型统计 24小时同一IP记录一次
                 $c_key = 'view_count_uv_' . $gid . '_' . base_request::get_remote_addr();
                 cacheobject::get($c_key, $time);
                 $kv->fetch('view_w_count_time', $vw_last_update);
                 if (!$time || strtotime('+1 day', $time) < time()) {
                     //获得周标记
                     if ($vw_last_update > strtotime('-1 week')) {
                         $update_sql = "UPDATE vmc_b2c_goods SET view_count=view_count+{$value},view_w_count=view_w_count+{$value} WHERE goods_id={$gid}";
                     } else {
                         $update_sql = "UPDATE vmc_b2c_goods SET view_count=view_count+{$value},view_w_count={$value} WHERE goods_id={$gid}";
                         $kv->store('view_w_count_time', time());
                     }
                     cacheobject::set($c_key, time(), 86400 + time());
                 }
                 break;
             case 'buy_count':
                 //验证
                 if (md5($gid . 'buy_count' . $value * 1024) != $args['buy_count_sign']) {
                     break;
                 }
                 //获得周标记
                 $kv->fetch('buy_w_count_time', $bw_last_update);
                 if ($bw_last_update > strtotime('-1 week')) {
                     $update_sql = "UPDATE vmc_b2c_goods SET buy_count=buy_count+{$value},buy_w_count=buy_w_count+{$value} WHERE goods_id={$gid}";
                 } else {
                     $update_sql = "UPDATE vmc_b2c_goods SET buy_count=buy_count+{$value},buy_w_count={$value} WHERE goods_id={$gid}";
                     $kv->store('buy_w_count_time', time());
                 }
                 break;
             case 'comment_count':
                 if (md5($gid . 'comment_count' . $value * 1024) == $args['comment_count_sign']) {
                     $update_sql = "UPDATE vmc_b2c_goods SET comment_count=comment_count+{$value} WHERE goods_id={$gid}";
                 }
                 break;
         }
         if ($update_sql) {
             logger::info($update_sql);
             $db->exec($update_sql, true);
         }
     }
 }
开发者ID:noikiy,项目名称:snk,代码行数:63,代码来源:goods.php

示例7: display_admin_widget

 public function display_admin_widget($tpl, $fetch = false, $widgets_app)
 {
     $this->_vars = $this->pagedata;
     $tmpl_file = realpath($tpl);
     $cur_theme = kernel::single('wap_theme_base')->get_default();
     if ($tmpl_file || ECAE_MODE) {
         $last_modified = filemtime($tmpl_file);
         $compile_id = $this->compile_id($cur_theme . $tpl);
         if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
             $file_content = kernel::single('wap_theme_file')->get_widgets_content($cur_theme, $tpl, $widgets_app);
             $compile_code = $this->_compiler()->compile($file_content);
             if ($compile_code !== false) {
                 base_kvstore::instance('cache/theme_admin_widget')->store($compile_id, $compile_code);
             }
         }
         ob_start();
         eval('?>' . $compile_code);
         $content = ob_get_contents();
         ob_end_clean();
         $this->pre_display($content);
     } else {
         $obj = kernel::single('base_render');
         $content = "<p class='notice' style='margin:0.3em'>{$tpl}<strong><{t app='wap'}>模板不存在,请重新编辑<{/t}></strong></p>";
     }
     if ($fetch === true) {
         return $content;
     } else {
         echo $content;
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:30,代码来源:render.php

示例8: getJsApiTicket

 /**
  * 获得jsapi_ticket  应该全局存储与更新
  * @return string
  */
 private function getJsApiTicket($bind_id)
 {
     if (base_kvstore::instance('weixin')->fetch('basic_jsapi_ticket_' . $bind_id, $jsapi_ticket) !== false) {
         logger::info('kv获取jsapi_ticket' . $jsapi_ticket);
         return $jsapi_ticket;
     } else {
         $accessToken = kernel::single('weixin_wechat')->get_basic_accesstoken($bind_id);
         // 如果是企业号用以下 URL 获取 ticket
         // $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
         $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$accessToken}";
         $httpclient = kernel::single('base_httpclient');
         $response = $httpclient->set_timeout(6)->get($url);
         $result = json_decode($response, true);
         $jsapi_ticket = $result['ticket'];
         if ($jsapi_ticket) {
             if (!base_kvstore::instance('weixin')->store('basic_jsapi_ticket_' . $bind_id, $jsapi_ticket, $result['expires_in'])) {
                 // 微信jsapi_ticket的有效期,单位为秒
                 logger::info("KVSTORE写入公众账号绑定id为: {$bind_id} 的jsapi_ticket错误");
             }
             logger::info('远程获取jsapi_ticket' . $jsapi_ticket);
             return $jsapi_ticket;
         } else {
             //todo : 错误提示
         }
     }
 }
开发者ID:noikiy,项目名称:Ecstore-to-odoo,代码行数:30,代码来源:jssdk.php

示例9: __construct

 public function __construct(&$app)
 {
     $api_info = base_rpc_service::$api_info;
     if ($api_info['from_node_id'] && $api_info['from_api_v']) {
         $obj_b2c_shop =& app::get('b2c')->model('shop');
         $shop_info = $obj_b2c_shop->getList('node_type', array('node_id' => $api_info['from_node_id'], 'status' => 'bind'));
         if (!($node_type = $shop_info[0]['node_type'])) {
             kernel::log('no data in b2c_shop! from_node_id: ' . $api_info['from_node_id']);
             trigger_error('server reject!', E_USER_ERROR);
         }
         base_kvstore::instance('b2c_apiv')->fetch('apiv.mapper', $apiv_mapper);
         if (!$apiv_mapper) {
             kernel::log('no apiv_mapper!');
             trigger_error('server reject!', E_USER_ERROR);
         }
         $local_apiv = $apiv_mapper[$node_type . '_' . $api_info['from_api_v']];
         if (!$local_apiv) {
             kernel::log('no data in apiv_mapper! node_type: ' . $node_type . ', node_apiv: ' . $api_info['from_api_v']);
             trigger_error('server reject!', E_USER_ERROR);
         }
     } else {
         $local_apiv = '2.0';
     }
     $this->apiv = $local_apiv;
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:25,代码来源:response.php

示例10: display_admin_widget

 public function display_admin_widget($tpl, $fetch = false, $widgets_app)
 {
     $this->_vars = $this->pagedata;
     $tmpl_file = realpath($tpl);
     $cur_theme = kernel::single('site_theme_base')->get_default();
     if ($tmpl_file || ECAE_MODE) {
         $last_modified = filemtime($tmpl_file);
         $compile_id = $this->compile_id($cur_theme . $tpl);
         if ($this->force_compile || !cachemgr::get($compile_id . $last_modified, $compile_code)) {
             $file_content = kernel::single('site_theme_tmpl_file')->get_widgets_content($cur_theme, $tpl, $widgets_app);
             $compile_code = $this->_compiler()->compile($file_content);
             if ($compile_code !== false) {
                 base_kvstore::instance('cache/theme_admin_widget')->store($compile_id, $compile_code);
             }
         }
         ob_start();
         eval('?>' . $compile_code);
         $content = ob_get_contents();
         ob_end_clean();
         $this->pre_display($content);
     } else {
         $obj = kernel::single('base_render');
         $obj->pagedata['tpl'] = $tpl;
         $content = $obj->fetch('admin/theme/widgets_tpl_lost.html', 'site');
         //todo: 无模板提示
     }
     if ($fetch === true) {
         return $content;
     } else {
         echo $content;
     }
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:32,代码来源:render.php

示例11: delete_vcode

 public function delete_vcode($account, $type, $vcodeData)
 {
     $vcode = $this->randomkeys(6);
     $vcodeData['vcode'] = $vcode;
     $key = $this->get_vcode_key($account, $type);
     base_kvstore::instance('vcode/account')->store($key, $vcodeData, $this->ttl);
     return $vcodeData;
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:8,代码来源:vcode.php

示例12: _set_session

 private function _set_session($value, $ttl)
 {
     if (!config::get('cache.enabled', true)) {
         return base_kvstore::instance('sessions')->store($this->_get_cache_key(), $value, $ttl);
     } else {
         return cacheobject::set($this->_get_cache_key(), $value, $ttl + time());
     }
 }
开发者ID:453111208,项目名称:bbc,代码行数:8,代码来源:session.php

示例13: destory

 public function destory()
 {
     if (!$this->_session_started) {
         return false;
     }
     $this->_session_started = false;
     return base_kvstore::instance('sessions')->store($this->_sess_id, array(), 1);
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:8,代码来源:session.php

示例14: _set_session

 private function _set_session($value, $ttl)
 {
     if (WITHOUT_CACHE === true) {
         return base_kvstore::instance('sessions')->store($this->_get_cache_key(), $value, $ttl);
     } else {
         return cacheobject::set($this->_get_cache_key(), $value, $ttl + time());
     }
 }
开发者ID:syjzwjj,项目名称:quyeba,代码行数:8,代码来源:session.php

示例15: refresh_genurl_map

 public function refresh_genurl_map()
 {
     $maps = app::get('wap')->model('route_statics')->getList('static, url', array('enable' => 'true'));
     foreach ($maps as $map) {
         $data[$map['url']] = $map['static'];
     }
     base_kvstore::instance($this->_kvprefix)->store('genurl_map', $data);
     app::get('wap')->setConf('statics.genurl_map_modify', microtime());
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:9,代码来源:static.php


注:本文中的base_kvstore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。