本文整理汇总了PHP中AWS_APP::cache方法的典型用法代码示例。如果您正苦于以下问题:PHP AWS_APP::cache方法的具体用法?PHP AWS_APP::cache怎么用?PHP AWS_APP::cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AWS_APP
的用法示例。
在下文中一共展示了AWS_APP::cache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_views
public function update_views($uid)
{
if (AWS_APP::cache()->get('update_views_people_' . md5(session_id()) . '_' . intval($uid))) {
return false;
}
AWS_APP::cache()->set('update_views_people_' . md5(session_id()) . '_' . intval($uid), time(), get_setting('cache_level_normal'));
return $this->query('UPDATE ' . $this->get_table('users') . ' SET views_count = views_count + 1 WHERE uid = ' . intval($uid));
}
示例2: get_font
public function get_font()
{
if (!($captcha_fonts = AWS_APP::cache()->get('captcha_fonts'))) {
$captcha_fonts = fetch_file_lists(AWS_PATH . 'core/fonts/');
AWS_APP::cache()->set('captcha_fonts', $captcha_fonts, get_setting('cache_level_normal'));
}
return array_random($captcha_fonts);
}
示例3: get_notifications_texts
public function get_notifications_texts()
{
$notifications = AWS_APP::cache()->get('admin_notifications');
if (!$notifications) {
$notifications = get_setting('admin_notifications');
}
if (!$notifications) {
return false;
}
if ($notifications['question_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/', 'text' => AWS_APP::lang()->_t('有 %s 个主题待审核', $notifications['question_approval']));
}
if ($notifications['unverified_modify_count']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-unverified_modify', 'text' => AWS_APP::lang()->_t('有 %s 个主题修改待审核', $notifications['unverified_modify_count']));
}
if ($notifications['answer_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-answer', 'text' => AWS_APP::lang()->_t('有 %s 个回复待审核', $notifications['answer_approval']));
}
if ($notifications['article_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-article', 'text' => AWS_APP::lang()->_t('有 %s 篇文章待审核', $notifications['article_approval']));
}
if ($notifications['article_comment_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-article_comment', 'text' => AWS_APP::lang()->_t('有 %s 个文章评论待审核', $notifications['article_comment_approval']));
}
if ($notifications['weibo_msg_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-weibo_msg', 'text' => AWS_APP::lang()->_t('有 %s 个微博消息待审核', $notifications['weibo_msg_approval']));
}
if ($notifications['received_email_approval']) {
$notifications_texts[] = array('url' => 'admin/approval/list/type-received_email', 'text' => AWS_APP::lang()->_t('有 %s 个邮件咨询待审核', $notifications['received_email_approval']));
}
if ($notifications['user_report']) {
$notifications_texts[] = array('url' => 'admin/question/report_list/', 'text' => AWS_APP::lang()->_t('有 %s 个用户举报待查看', $notifications['user_report']));
}
if (get_setting('register_valid_type') == 'approval' and $notifications['register_approval']) {
$notifications_texts[] = array('url' => 'admin/user/register_approval_list/', 'text' => AWS_APP::lang()->_t('有 %s 个新用户待审核', $notifications['register_approval']));
}
if ($notifications['verify_approval']) {
$notifications_texts[] = array('url' => 'admin/user/verify_approval_list/', 'text' => AWS_APP::lang()->_t('有 %s 个认证申请待审核', $notifications['verify_approval']));
}
if ($notifications['last_version']['build_day'] > G_VERSION_BUILD and $this->user_info['is_administortar']) {
$notifications_texts[] = array('url' => 'http://www.HeavenSpree.com/downloads/', 'text' => AWS_APP::lang()->_t('程序需要更新,最新版本为 %s', $notifications['last_version']['version']));
}
if (get_setting('weibo_msg_enabled') == 'Y' and $notifications['sina_users']) {
foreach ($notifications['sina_users'] as $sina_user) {
$notifications_texts[] = array('url' => 'admin/weibo/msg/', 'text' => AWS_APP::lang()->_t('用户 %s 的微博账号需要更新 Access Token,请重新授权', $sina_user['user_name']));
}
}
$receiving_email_global_config = get_setting('receiving_email_global_config');
if ($receiving_email_global_config['enabled'] == 'Y' and $notifications['receive_email_error']) {
foreach ($notifications['receive_email_error'] as $error_msg) {
$notifications_texts[] = array('url' => 'admin/edm/receiving/id-' . $error_msg['id'], 'text' => AWS_APP::lang()->_t('邮件导入失败,错误为 %s,请重新配置', $error_msg['msg']));
}
}
return $notifications_texts;
}
示例4: save_mobile_app_secret
public function save_mobile_app_secret($mobile_app_secret)
{
if ($this->fetch_row('system_setting', "varname = 'mobile_app_secret'")) {
$this->update('system_setting', array('value' => serialize($mobile_app_secret)), "`varname` = 'mobile_app_secret'");
$this->update('system_setting', array('value' => serialize(time())), "`varname` = 'mobile_app_secret_update_time'");
} else {
$this->insert('system_setting', array('value' => serialize($mobile_app_secret), 'varname' => 'mobile_app_secret'));
$this->insert('system_setting', array('value' => serialize(time()), 'varname' => 'mobile_app_secret_update_time'));
}
AWS_APP::cache()->delete('mobile_app_secret');
}
示例5: minute
public function minute()
{
@unlink(TEMP_PATH . 'plugins_table.php');
@unlink(TEMP_PATH . 'plugins_model.php');
if ($this->model('reputation')->calculate(AWS_APP::cache()->get('reputation_calculate_start'), 100)) {
AWS_APP::cache()->set('reputation_calculate_start', intval(AWS_APP::cache()->get('reputation_calculate_start')) + 100, 604800);
} else {
AWS_APP::cache()->set('reputation_calculate_start', 0, 604800);
}
$this->model('email')->send_mail_queue(120);
$this->model('online')->delete_expire_users();
}
示例6: minute
public function minute()
{
@unlink(TEMP_PATH . 'plugins_table.php');
@unlink(TEMP_PATH . 'plugins_model.php');
if ($this->model('reputation')->calculate(AWS_APP::cache()->get('reputation_calculate_start'), 100)) {
AWS_APP::cache()->set('reputation_calculate_start', intval(AWS_APP::cache()->get('reputation_calculate_start')) + 100, 604800);
} else {
AWS_APP::cache()->set('reputation_calculate_start', 0, 604800);
}
if (!get_setting('wecenter_access_token')) {
$this->model('weixin')->get_weixin_app_id_setting_var();
}
$this->model('email')->send_mail_queue(120);
$this->model('online')->delete_expire_users();
}
示例7: bind_account
function bind_account($sina_profile, $redirect, $uid, $sina_token, $is_ajax = false)
{
if ($openid_info = $this->get_users_sina_by_uid($uid)) {
if ($openid_info['id'] != $sina_profile['id']) {
if ($is_ajax) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('此微博已经与本站的另外一个账号绑定')));
} else {
H::redirect_msg(AWS_APP::lang()->_t('此微博已经与本站的另外一个账号绑定'), '/account/logout/');
}
}
}
$user_sina = $this->get_users_sina_by_id($sina_profile['id']);
if (empty($user_sina)) {
$this->users_sina_add($sina_profile['id'], $uid, $sina_profile['screen_name'], $sina_profile['location'], $sina_profile['description'], $sina_profile['profile_url'], $sina_profile['profile_image_url'], $sina_profile['gender']);
} else {
if ($user_sina['uid'] != $uid) {
if ($is_ajax) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('此账号已经与另外一个微博绑定')));
} else {
H::redirect_msg(AWS_APP::lang()->_t('此账号已经与另外一个微博绑定'), $redirect);
}
}
}
$this->refresh_access_token($sina_profile['id'], $sina_token);
$tmp_service_account = AWS_APP::cache()->get('tmp_service_account');
if ($tmp_service_account[$uid]) {
$this->model('weibo')->update_service_account($uid, 'add');
unset($tmp_service_account[$uid]);
AWS_APP::cache()->set('tmp_service_account', $tmp_service_account, 86400);
}
$admin_notifications = get_setting('admin_notifications');
if ($admin_notifications['sina_users'][$uid]) {
unset($admin_notifications['sina_users'][$uid]);
}
$this->model('setting')->set_vars(array('admin_notifications' => $admin_notifications));
if ($redirect) {
HTTP::redirect($redirect);
} else {
if ($is_ajax) {
H::ajax_json_output(AWS_APP::RSM(array('url' => '/'), 1, null));
} else {
H::redirect_msg(AWS_APP::lang()->_t('绑定成功'));
}
}
}
示例8: msg_action
public function msg_action()
{
$this->crumb(AWS_APP::lang()->_t('消息接收'), 'admin/weibo/msg/');
$services_info = $this->model('weibo')->get_services_info();
if (!empty($services_info)) {
foreach ($services_info as $service_info) {
$service_uids[] = $service_info['uid'];
}
$service_users_info = $this->model('account')->get_user_info_by_uids($service_uids);
TPL::assign('service_users_info', $service_users_info);
}
$tmp_service_users_info = AWS_APP::cache()->get('tmp_service_account');
if (!empty($tmp_service_users_info)) {
TPL::assign('tmp_service_users_info', $tmp_service_users_info);
}
TPL::assign('published_user', get_setting('weibo_msg_published_user'));
TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(806));
TPL::output('admin/weibo/msg');
}
示例9: minute
public function minute()
{
@unlink(TEMP_PATH . 'plugins_table.php');
@unlink(TEMP_PATH . 'plugins_model.php');
if ($this->model('reputation')->calculate(AWS_APP::cache()->get('reputation_calculate_start'), 100)) {
AWS_APP::cache()->set('reputation_calculate_start', intval(AWS_APP::cache()->get('reputation_calculate_start')) + 100, 604800);
} else {
AWS_APP::cache()->set('reputation_calculate_start', 0, 604800);
}
$this->model('online')->delete_expire_users();
if (check_extension_package('project')) {
$expire_orders = $this->fetch_all('product_order', 'add_time < ' . (time() - 600) . ' AND payment_time = 0 AND cancel_time = 0 AND refund_time = 0');
if ($expire_orders) {
foreach ($expire_orders as $order_info) {
$this->model('project')->cancel_project_order_by_id($order_info['id']);
}
}
}
$this->model('email')->send_mail_queue(120);
}
示例10: fetch_answers_list_by_topic_ids
public function fetch_answers_list_by_topic_ids($topic_ids, $page, $limit)
{
if (!is_array($topic_ids)) {
return false;
}
array_walk_recursive($topic_ids, 'intval_string');
$result_cache_key = 'reader_list_by_topic_ids_' . md5(implode('_', $topic_ids) . $page . $limit);
if (!($result = AWS_APP::cache()->get($result_cache_key))) {
$topic_relation_where[] = '`topic_id` IN(' . implode(',', $topic_ids) . ')';
$topic_relation_where[] = "`type` = 'question'";
if ($topic_relation_query = $this->query_all("SELECT item_id FROM " . get_table('topic_relation') . " WHERE " . implode(' AND ', $topic_relation_where))) {
foreach ($topic_relation_query as $key => $val) {
$question_ids[$val['item_id']] = $val['item_id'];
}
}
if (!$question_ids) {
return false;
}
$result = $this->fetch_all('answer', 'question_id IN (' . implode(',', $question_ids) . ') AND add_time > ' . (time() - 86400 * intval(get_setting('reader_questions_last_days'))) . ' AND agree_count >= ' . intval(get_setting('reader_questions_agree_count')), 'add_time DESC', calc_page_limit($page, $limit));
AWS_APP::cache()->set($result_cache_key, $result, get_setting('cache_level_low'));
}
return $result;
}
示例11: get_groups
public function get_groups()
{
$groups = AWS_APP::cache()->get('weixin_groups');
if (!$groups) {
$result = $this->model('openid_weixin_weixin')->access_request(get_setting('weixin_app_id'), get_setting('weixin_app_secret'), 'groups/get', 'GET');
if (!$result) {
return AWS_APP::lang()->_t('远程服务器忙');
}
if ($result['errcode']) {
return $result['errmsg'];
}
foreach ($result['groups'] as $group) {
$groups[$group['id']] = $group;
}
AWS_APP::cache()->set('weixin_groups', $groups, get_setting('cache_level_normal'));
}
return $groups;
}
示例12: publish_question_action
public function publish_question_action()
{
if (!$this->user_info['permission']['publish_question']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你没有权限发布问题')));
}
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作')));
}
if (!$_POST['question_content']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请输入问题标题')));
}
if (get_setting('category_enable') == 'N') {
$_POST['category_id'] = 1;
}
if (!$_POST['category_id']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择问题分类')));
}
if (cjk_strlen($_POST['question_content']) < 5) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('问题标题字数不得少于 5 个字')));
}
if (get_setting('question_title_limit') > 0 and cjk_strlen($_POST['question_content']) > get_setting('question_title_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('问题标题字数不得大于 %s 字节', get_setting('question_title_limit'))));
}
if (!$this->user_info['permission']['publish_url'] and FORMAT::outside_url_exists($_POST['question_detail'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('你所在的用户组不允许发布站外链接')));
}
if (human_valid('question_valid_hour') and !AWS_APP::captcha()->is_validate($_POST['seccode_verify'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请填写正确的验证码')));
}
if ($_POST['topics']) {
foreach ($_POST['topics'] as $key => $topic_title) {
$topic_title = trim($topic_title);
if (!$topic_title) {
unset($_POST['topics'][$key]);
} else {
$_POST['topics'][$key] = $topic_title;
}
}
if (get_setting('question_topics_limit') and sizeof($_POST['topics']) > get_setting('question_topics_limit')) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('单个问题话题数量最多为 %s 个, 请调整话题数量', get_setting('question_topics_limit'))));
}
}
if (!$_POST['topics'] and get_setting('new_question_force_add_topic') == 'Y') {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请为问题添加话题')));
}
if (!$this->model('publish')->insert_attach_is_self_upload($_POST['question_detail'], $_POST['attach_ids'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('只允许插入当前页面上传的附件')));
}
if ($_POST['weixin_media_id']) {
$_POST['weixin_media_id'] = base64_decode($_POST['weixin_media_id']);
$weixin_pic_url = AWS_APP::cache()->get('weixin_pic_url_' . md5($_POST['weixin_media_id']));
if (!$weixin_pic_url) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('图片已过期或 media_id 无效')));
}
$file = $this->model('openid_weixin_weixin')->get_file($_POST['weixin_media_id']);
if (!$file) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('远程服务器忙')));
}
if (is_array($file) and $file['errmsg']) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('获取图片失败,错误为: %s', $file['errmsg'])));
}
AWS_APP::upload()->initialize(array('allowed_types' => get_setting('allowed_upload_types'), 'upload_path' => get_setting('upload_dir') . '/questions/' . gmdate('Ymd'), 'is_image' => TRUE, 'max_size' => get_setting('upload_size_limit')));
AWS_APP::upload()->do_upload($_POST['weixin_media_id'] . '.jpg', $file);
$upload_error = AWS_APP::upload()->get_error();
if ($upload_error) {
switch ($upload_error) {
default:
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,错误为 %s' . $upload_error)));
break;
case 'upload_invalid_filetype':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,本站不允许上传 jpeg 格式的图片')));
break;
case 'upload_invalid_filesize':
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('图片尺寸过大, 最大允许尺寸为 %s KB', get_setting('upload_size_limit'))));
break;
}
}
$upload_data = AWS_APP::upload()->data();
if (!$upload_data) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存图片失败,请与管理员联系')));
}
foreach (AWS_APP::config()->get('image')->attachment_thumbnail as $key => $val) {
$thumb_file[$key] = $upload_data['file_path'] . $val['w'] . 'x' . $val['h'] . '_' . basename($upload_data['full_path']);
AWS_APP::image()->initialize(array('quality' => 90, 'source_image' => $upload_data['full_path'], 'new_image' => $thumb_file[$key], 'width' => $val['w'], 'height' => $val['h']))->resize();
}
$this->model('publish')->add_attach('question', $upload_data['orig_name'], $_POST['attach_access_key'], time(), basename($upload_data['full_path']), true);
}
// !注: 来路检测后面不能再放报错提示
if (!valid_post_hash($_POST['post_hash'])) {
H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('页面停留时间过长,或内容已提交,请刷新页面')));
}
$this->model('draft')->delete_draft(1, 'question', $this->user_id);
if ($this->publish_approval_valid()) {
$this->model('publish')->publish_approval('question', array('question_content' => $_POST['question_content'], 'question_detail' => $_POST['question_detail'], 'category_id' => $_POST['category_id'], 'topics' => $_POST['topics'], 'anonymous' => $_POST['anonymous'], 'attach_access_key' => $_POST['attach_access_key'], 'ask_user_id' => $_POST['ask_user_id'], 'permission_create_topic' => $this->user_info['permission']['create_topic']), $this->user_id, $_POST['attach_access_key']);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/publish/wait_approval/')), 1, null));
} else {
$question_id = $this->model('publish')->publish_question($_POST['question_content'], $_POST['question_detail'], $_POST['category_id'], $this->user_id, $_POST['topics'], $_POST['anonymous'], $_POST['attach_access_key'], $_POST['ask_user_id'], $this->user_info['permission']['create_topic']);
if ($_POST['_is_mobile']) {
if ($weixin_user = $this->model('openid_weixin_weixin')->get_user_info_by_uid($this->user_id)) {
if ($weixin_user['location_update'] > time() - 7200) {
//.........这里部分代码省略.........
示例13: get_user_actions
public function get_user_actions($uid, $limit = 10, $actions = false, $this_uid = 0)
{
$cache_key = 'user_actions_' . md5($uid . $limit . $actions . $this_uid);
if ($user_actions = AWS_APP::cache()->get($cache_key)) {
return $user_actions;
}
$associate_action = ACTION_LOG::ADD_QUESTION;
if (strstr($actions, ',')) {
$associate_action = explode(',', $actions);
array_walk_recursive($associate_action, 'intval_string');
$associate_action = implode(',', $associate_action);
} else {
if ($actions) {
$associate_action = intval($actions);
}
}
if (!$uid) {
$where[] = "(associate_type = " . ACTION_LOG::CATEGORY_QUESTION . " AND associate_action IN(" . $this->quote($associate_action) . "))";
} else {
$where[] = "(associate_type = " . ACTION_LOG::CATEGORY_QUESTION . " AND uid = " . intval($uid) . " AND associate_action IN(" . $this->quote($associate_action) . "))";
}
if ($this_uid == $uid) {
$show_anonymous = true;
}
$action_list = ACTION_LOG::get_action_by_where(implode($where, ' OR '), $limit, $show_anonymous);
// 重组信息
foreach ($action_list as $key => $val) {
$uids[] = $val['uid'];
switch ($val['associate_type']) {
case ACTION_LOG::CATEGORY_QUESTION:
if (in_array($val['associate_action'], array(ACTION_LOG::ADD_ARTICLE, ACTION_LOG::ADD_COMMENT_ARTICLE))) {
$article_ids[] = $val['associate_id'];
} else {
$question_ids[] = $val['associate_id'];
}
if (in_array($val['associate_action'], array(ACTION_LOG::ADD_TOPIC, ACTION_LOG::MOD_TOPIC, ACTION_LOG::MOD_TOPIC_DESCRI, ACTION_LOG::MOD_TOPIC_PIC, ACTION_LOG::DELETE_TOPIC, ACTION_LOG::ADD_TOPIC_FOCUS)) and $val['associate_attached']) {
$associate_topic_ids[] = $val['associate_attached'];
}
break;
}
}
if ($uids) {
$action_list_users = $this->model('account')->get_user_info_by_uids($uids, true);
}
if ($question_ids) {
$action_questions_info = $this->model('question')->get_question_info_by_ids($question_ids);
}
if ($associate_topic_ids) {
$associate_topics = $this->model('topic')->get_topics_by_ids($associate_topic_ids);
}
if ($article_ids) {
$action_articles_info = $this->model('article')->get_article_info_by_ids($article_ids);
}
foreach ($action_list as $key => $val) {
$action_list[$key]['user_info'] = $action_list_users[$val['uid']];
switch ($val['associate_type']) {
case ACTION_LOG::CATEGORY_QUESTION:
switch ($val['associate_action']) {
case ACTION_LOG::ADD_ARTICLE:
case ACTION_LOG::ADD_COMMENT_ARTICLE:
$article_info = $action_articles_info[$val['associate_id']];
$action_list[$key]['title'] = $article_info['title'];
$action_list[$key]['link'] = get_js_url('/article/' . $article_info['id']);
$action_list[$key]['article_info'] = $article_info;
$action_list[$key]['last_action_str'] = ACTION_LOG::format_action_data($val['associate_action'], $val['uid'], $action_list_users[$val['uid']]['user_name']);
break;
default:
$question_info = $action_questions_info[$val['associate_id']];
$action_list[$key]['title'] = $question_info['question_content'];
$action_list[$key]['link'] = get_js_url('/question/' . $question_info['question_id']);
if (in_array($val['associate_action'], array(ACTION_LOG::ADD_TOPIC, ACTION_LOG::MOD_TOPIC, ACTION_LOG::MOD_TOPIC_DESCRI, ACTION_LOG::MOD_TOPIC_PIC, ACTION_LOG::DELETE_TOPIC, ACTION_LOG::ADD_TOPIC_FOCUS)) and $val['associate_attached']) {
$topic_info = $associate_topics[$val['associate_attached']];
} else {
unset($topic_info);
}
if (in_array($val['associate_action'], array(ACTION_LOG::ADD_QUESTION)) and $question_info['has_attach']) {
$question_info['attachs'] = $question_attachs[$question_info['question_id']];
}
if ($val['uid']) {
$action_list[$key]['last_action_str'] = ACTION_LOG::format_action_data($val['associate_action'], $val['uid'], $action_list_users[$val['uid']]['user_name'], $question_info, $topic_info);
}
if (in_array($val['associate_action'], array(ACTION_LOG::ANSWER_QUESTION)) and $question_info['answer_count']) {
if ($answer_list = $this->model('answer')->get_answer_by_id($val['associate_attached'])) {
$action_list[$key]['answer_info'] = $answer_list;
}
}
$action_list[$key]['question_info'] = $question_info;
break;
}
break;
}
}
AWS_APP::cache()->set($cache_key, $action_list, get_setting('cache_level_normal'));
return $action_list;
}
示例14: get_answer_users_by_question_id
public function get_answer_users_by_question_id($question_id, $limit = 5, $published_uid = null)
{
if ($result = AWS_APP::cache()->get('answer_users_by_question_id_' . md5($question_id . $limit . $published_uid))) {
return $result;
}
if (!$published_uid) {
if (!($question_info = $this->get_question_info_by_id($question_id))) {
return false;
}
$published_uid = $question_info['published_uid'];
}
if ($answer_users = $this->query_all("SELECT DISTINCT uid FROM " . get_table('answer') . " WHERE question_id = " . intval($question_id) . " AND uid <> " . intval($published_uid) . " AND anonymous = 0 ORDER BY agree_count DESC LIMIT " . intval($limit))) {
foreach ($answer_users as $key => $val) {
$answer_uids[] = $val['uid'];
}
$result = $this->model('account')->get_user_info_by_uids($answer_uids);
AWS_APP::cache()->set('answer_users_by_question_id_' . md5($question_id . $limit . $published_uid), $result, get_setting('cache_level_normal'));
}
return $result;
}
示例15: send_valid_email_crond
public function send_valid_email_crond()
{
$now = time();
$lock_time = AWS_APP::cache()->get('send_valid_email_locker');
if ($lock_time and $now - $lock_time <= 300) {
return false;
}
$where[] = 'valid_email <> 1';
$where[] = 'reg_time < ' . ($now - 604800);
$last_sent_id = get_setting('last_sent_valid_email_id');
if ($last_sent_id) {
$where[] = 'uid > ' . intval($last_sent_id);
}
$invalid_email_users = $this->fetch_all('users', implode(' AND ', $where), null, 200);
if (!$invalid_email_users) {
return false;
}
AWS_APP::cache()->set('send_valid_email_locker', $now, 300);
foreach ($invalid_email_users as $invalid_email_user) {
if ($invalid_email_user['email']) {
$this->new_valid_email($invalid_email_user['uid'], $invalid_email_user['email'], 'slave');
}
$this->model('setting')->set_vars(array('last_sent_valid_email_id' => $invalid_email_user['uid']));
}
AWS_APP::cache()->delete('send_valid_email_locker');
return true;
}