/**
  * 模版列表页
  * @author 郑钟良<*****@*****.**>
  */
 public function tpls()
 {
     $aCleanCookie = I('get.cleanCookie', 0, 'intval');
     if ($aCleanCookie) {
         cookie('TO_LOOK_THEME', null, array('prefix' => 'OSV2'));
     }
     // 根据应用目录取全部APP信息
     $dir = OS_THEME_PATH;
     $tplList = null;
     if (is_dir($dir)) {
         if ($dh = opendir($dir)) {
             while (($file = readdir($dh)) !== false) {
                 //去掉"“.”、“..”以及带“.xxx”后缀的文件
                 if ($file != "." && $file != ".." && !strpos($file, ".")) {
                     if (is_file(OS_THEME_PATH . $file . '/info.php')) {
                         $tpl = (require_once OS_THEME_PATH . $file . '/info.php');
                         $tpl['path'] = OS_THEME_PATH . $file;
                         $tpl['file_name'] = $file;
                         $tplList[] = $tpl;
                     }
                 }
             }
             closedir($dh);
         }
     }
     $now_theme = modC('NOW_THEME', 'default', 'Theme');
     $this->assign('now_theme', $now_theme);
     $this->assign('tplList', $tplList);
     $this->display();
 }
 public function nicknameLength($nickname)
 {
     if (mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') || mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
         $this->error = L('_NICKNAME_LENGTH_MUST_BE_IN_') . modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') . '-' . modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG') . L('_POSITION_WITH_EXCLAMATION_');
     }
     return true;
 }
Esempio n. 3
0
 public function nicknameLength($nickname)
 {
     if (mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') || mb_strlen($nickname, 'utf-8') < modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
         $this->error = '昵称长度必须在' . modC('NICKNAME_MIN_LENGTH', 2, 'USERCONFIG') . '-' . modC('NICKNAME_MAX_LENGTH', 32, 'USERCONFIG') . '位之间!';
     }
     return true;
 }
 private function assignQuestion()
 {
     $num = modC('QUESTION_SHOW_COUNT', 4, 'Question');
     $type = modC('QUESTION_SHOW_TYPE', 0, 'Question');
     $field = modC('QUESTION_SHOW_ORDER_FIELD', 'answer_num', 'Question');
     $order = modC('QUESTION_SHOW_ORDER_TYPE', 'desc', 'Question');
     $cache = modC('QUESTION_SHOW_CACHE_TIME', 600, 'Question');
     $list = S('question_home_data');
     if (!$list) {
         if ($type) {
             $map['is_recommend'] = 1;
         }
         $map['status'] = 1;
         $list = $this->_getList($map, $num, $field . ' ' . $order);
         if (!$list) {
             $list = 1;
         }
         S('question_home_data', $list, $cache);
     }
     unset($v);
     if ($list == 1) {
         $list = null;
     }
     $this->assign('question_lists', $list);
 }
Esempio n. 5
0
function get_withdraw_type($field)
{
    $fields_config = modC('WITHDRAW_FIELD', "", 'recharge');
    $fields = json_decode($fields_config, true);
    $res = array_search_key($fields, 'FIELD', $field);
    return $res;
}
 public function getForumList($map_type = array('status' => 1))
 {
     $tag = 'forum_list_' . serialize($map_type);
     $forum_list = S($tag);
     $cache_time = modC('CACHE_TIME', 300, 'Forum');
     if (empty($forum_list)) {
         //读取板块列表
         $forum_list = D('Forum/Forum')->where($map_type)->order('sort asc')->select();
         $forumPostModel = D('ForumPost');
         $forumPostReplyModel = D('ForumPostReply');
         $forumLzlReplyModel = D('ForumLzlReply');
         foreach ($forum_list as &$f) {
             $map['status'] = 1;
             $map['forum_id'] = $f['id'];
             $f['background'] = $f['background'] ? getThumbImageById($f['background'], 800, 'auto') : C('TMPL_PARSE_STRING.__IMG__') . '/default_bg.jpg';
             $f['logo'] = $f['logo'] ? getThumbImageById($f['logo'], 128, 128) : C('TMPL_PARSE_STRING.__IMG__') . '/default_logo.png';
             $f['topic_count'] = $forumPostModel->where($map)->count();
             $post_id = $forumPostModel->where(array('forum_id' => $f['id']))->field('id')->select();
             $p_id = getSubByKey($post_id, 'id');
             $map['post_id'] = array('in', implode(',', $p_id));
             $f['total_count'] = $f['topic_count'] + $forumPostReplyModel->where($map)->count();
             // + $forumLzlReplyModel->where($map)->count();
         }
         unset($f);
         S($tag, $forum_list, $cache_time);
     }
     return $forum_list;
 }
Esempio n. 7
0
 /**
  * 获取微店交易积分类型
  * @return mixed
  * @author 郑钟良<*****@*****.**>
  */
 public function getCurrency_info()
 {
     $score_id = modC('CURRENCY_TYPE', 4, 'Store');
     $scoreModel = D('Ucenter/Score');
     $currency = $scoreModel->getType($score_id);
     return $currency;
 }
Esempio n. 8
0
 public function getAdvList($name, $path)
 {
     $list = S('adv_list_' . $name . $path);
     if ($list === false) {
         $now_theme = modC('NOW_THEME', 'default', 'Theme');
         $advPos = D('Common/AdvPos')->getInfo($name, $path);
         //找到当前调用的广告位
         if ($advPos['theme'] != 'all' && !in_array($now_theme, explode(',', $advPos['theme']))) {
             return null;
         }
         $advMap['pos_id'] = $advPos['id'];
         $advMap['status'] = 1;
         $advMap['start_time'] = array('lt', time());
         $advMap['end_time'] = array('gt', time());
         $data = $this->where($advMap)->order('sort asc')->select();
         foreach ($data as &$v) {
             $d = json_decode($v['data'], true);
             if (!empty($d)) {
                 $v = array_merge($d, $v);
             }
         }
         unset($v);
         S('adv_list_' . $name . $path, $list);
     }
     return $data;
 }
Esempio n. 9
0
 /**
  * 验证用户名长度
  * @param $username
  * @return bool
  * @author 郑钟良<*****@*****.**>
  */
 protected function checkUsernameLength($username)
 {
     $length = mb_strlen($username, 'utf-8');
     // 当前数据长度
     if ($length < modC('USERNAME_MIN_LENGTH', 2, 'USERCONFIG') || $length > modC('USERNAME_MAX_LENGTH', 32, 'USERCONFIG')) {
         return false;
     }
     return true;
 }
Esempio n. 10
0
 function _initialize()
 {
     $this->paperModel = D('Paper/Paper');
     $this->paperCategoryModel = D('Paper/PaperCategory');
     $catTitle = modC('PAPER_CATEGORY_TITLE', '网站介绍', 'Paper');
     $sub_menu['left'][] = array('tab' => 'home', 'title' => $catTitle, 'href' => U('index'));
     $this->assign('sub_menu', $sub_menu);
     $this->assign('current', 'home');
 }
Esempio n. 11
0
 private function getAmount($order)
 {
     $finally = $order['total_cny'] + $order['adj_cny'];
     $score_id = modC('CURRENCY_TYPE', 4, 'Store');
     $fields_config = modC('RE_FIELD', "", 'recharge');
     $fields = json_decode($fields_config, true);
     $type = array_search_key($fields, 'FIELD', $score_id);
     !$type && ($type['UNIT'] = 1);
     return number_format($finally / $type['UNIT'], 2, ".", "");
 }
Esempio n. 12
0
function seo_replace_variables($string, $vars)
{
    //如果输入的文字是空的,那就直接返回空的字符串好了。
    if (!$string) {
        return '';
    }
    //调用ThinkPHP中的解析引擎解析变量
    $view = new Think\View();
    $view->assign('website_name', modC('WEB_SITE_NAME'));
    $view->assign($vars);
    $result = $view->fetch('', $string);
    //返回替换变量后的结果
    return $result;
}
Esempio n. 13
0
 public function AdvsList($param)
 {
     $now_theme = modC('NOW_THEME', 'default', 'Theme');
     if (isset($param)) {
         //TODO 插入广告位标识符判断
         $advPos = M('Addons://Advertising/Advertising')->getInfo($param);
         //找到当前调用的广告位
         if ($advPos['theme'] != 'all' && !in_array($now_theme, explode(',', $advPos['theme']))) {
             return null;
         }
         $advMap['position'] = $advPos['id'];
     }
     $advMap['status'] = 1;
     if ($advPos['type'] == 2) {
         $advs = $this->where($advMap)->order('level asc,id asc')->select();
         foreach ($advs as $key => $val) {
             if (intval($val['create_time']) != 0) {
                 if ($val['create_time'] > time()) {
                     unset($advs[$key]);
                     continue;
                 }
             }
             if (intval($val['end_time']) != 0) {
                 if ($val['end_time'] < time()) {
                     unset($advs[$key]);
                     continue;
                 }
             }
             $data[$key] = $val;
             $cover = D('picture')->find($val['advspic']);
             $data[$key]['path'] = $cover['path'];
         }
     } else {
         $data = $this->where($advMap)->order('level asc,id asc')->find();
         if (intval($data['create_time']) != 0) {
             if ($data['create_time'] > time()) {
                 return null;
             }
         }
         if (intval($data['end_time']) != 0) {
             if ($data['end_time'] < time()) {
                 return null;
             }
         }
     }
     $result['data'] = $data;
     $result['pos'] = $advPos;
     return $result;
 }
function parse_weibo_content($content)
{
    $content = shorten_white_space($content);
    if (modC('WEIBO_BR', 0, 'Weibo')) {
        $content = str_replace('/br', '<br/>', $content);
        $content = str_replace('/nb', '&nbsp', $content);
    } else {
        $content = str_replace('/br', '', $content);
        $content = str_replace('/nb', '', $content);
    }
    $content = parse_url_link($content);
    $content = parse_expression($content);
    $content = parseWeiboContent($content);
    return $content;
}
Esempio n. 15
0
 private function filterWeibo($aType, $param)
 {
     if ($aType == 'concerned') {
         $followList = D('Follow')->getFollowList();
         $param['where']['uid'] = array('in', $followList);
     }
     if ($aType == 'hot') {
         $hot_left = modC('HOT_LEFT', 3);
         $time_left = get_some_day($hot_left);
         $param['where']['create_time'] = array('gt', $time_left);
         $param['order'] = 'comment_count desc';
         $this->assign('tab', 'hot');
     }
     return $param;
 }
 private function assignForumPost()
 {
     $list = S('FORUM_POST_SHOW_DATA');
     if (empty($list)) {
         $order_key = modC('FORUM_POST_ORDER', 'last_reply_time', 'Forum');
         $order_type = modC('FORUM_POST_TYPE', 'desc', 'Forum');
         $limit = modC('FORUM_POST_SHOW_NUM', 5, 'Forum');
         $cache_time = modC('FORUM_POST_CACHE_TIME', 600, 'Forum');
         $map['status'] = 1;
         $list = M('ForumPost')->where($map)->order($order_key . ' ' . $order_type)->limit($limit)->select();
         $list = $this->assignForumInfo($list);
         S('FORUM_POST_SHOW_DATA', $list, $cache_time);
     }
     $this->assign('forum_post_list', $list);
 }
Esempio n. 17
0
 public function getTitleConfig()
 {
     $title = modC('LEVEL', '', 'USERCONFIG');
     if ($title == '') {
         return array(0 => 'Lv1 实习', 50 => 'Lv2 试用', 100 => 'Lv3 转正', 200 => 'Lv 4 助理', 400 => 'Lv 5 经理', 800 => 'Lv 6 董事', 1600 => 'Lv 7 董事长');
     } else {
         $title = str_replace("\r", '', $title);
         $title = explode("\n", $title);
         foreach ($title as $v) {
             $temp = explode(':', $v);
             $result[$temp[0]] = $temp[1];
         }
         return $result;
     }
 }
Esempio n. 18
0
 /**
  * sendVerify 发送验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function sendVerify()
 {
     $aAccount = $cUsername = I('post.account', '', 'op_t');
     $aType = I('post.type', '', 'op_t');
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     $aAction = I('post.action', 'config', 'op_t');
     if (!check_reg_type($aType)) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error($str . '选项已关闭!');
     }
     if (empty($aAccount)) {
         $this->error('帐号不能为空');
     }
     check_username($cUsername, $cEmail, $cMobile);
     $time = time();
     if ($aType == 'mobile') {
         $resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
         if ($time <= session('verify_time') + $resend_time) {
             $this->error('请' . ($resend_time - ($time - session('verify_time'))) . '秒后再发');
         }
     }
     if ($aType == 'email' && empty($cEmail)) {
         $this->error('请验证邮箱格式是否正确');
     }
     if ($aType == 'mobile' && empty($cMobile)) {
         $this->error('请验证手机格式是否正确');
     }
     $checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
     if ($checkIsExist) {
         $str = $aType == 'mobile' ? '手机' : '邮箱';
         $this->error('该' . $str . '已被其他用户使用!');
     }
     $verify = D('Verify')->addVerify($aAccount, $aType);
     if (!$verify) {
         $this->error('发送失败!');
     }
     $res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
     if ($res === true) {
         if ($aType == 'mobile') {
             session('verify_time', $time);
         }
         $this->success('发送成功,请查收');
     } else {
         $this->error($res);
     }
 }
 /**
  * sendVerify 发送验证码
  * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
  */
 public function sendVerify()
 {
     $aAccount = $cUsername = I('post.account', '', 'op_t');
     $aType = I('post.type', '', 'op_t');
     $aType = $aType == 'mobile' ? 'mobile' : 'email';
     $aAction = I('post.action', 'config', 'op_t');
     if (!check_reg_type($aType)) {
         $str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
         $this->error($str . L('_ERROR_OPTIONS_CLOSED_') . L('_EXCLAMATION_'));
     }
     if (empty($aAccount)) {
         $this->error(L('_ERROR_ACCOUNT_CANNOT_EMPTY_'));
     }
     check_username($cUsername, $cEmail, $cMobile);
     $time = time();
     if ($aType == 'mobile') {
         $resend_time = modC('SMS_RESEND', '60', 'USERCONFIG');
         if ($time <= session('verify_time') + $resend_time) {
             $this->error(L('_ERROR_WAIT_1_') . ($resend_time - ($time - session('verify_time'))) . L('_ERROR_WAIT_2_'));
         }
     }
     if ($aType == 'email' && empty($cEmail)) {
         $this->error(L('_ERROR__EMAIL_'));
     }
     if ($aType == 'mobile' && empty($cMobile)) {
         $this->error(L('_ERROR_PHONE_'));
     }
     $checkIsExist = UCenterMember()->where(array($aType => $aAccount))->find();
     if ($checkIsExist) {
         $str = $aType == 'mobile' ? L('_PHONE_') : L('_EMAIL_');
         $this->error(L('_ERROR_USED_1_') . $str . L('_ERROR_USED_2_') . L('_EXCLAMATION_'));
     }
     $verify = D('Verify')->addVerify($aAccount, $aType);
     if (!$verify) {
         $this->error(L('_ERROR_FAIL_SEND_') . L('_EXCLAMATION_'));
     }
     $res = A(ucfirst($aAction))->doSendVerify($aAccount, $verify, $aType);
     if ($res === true) {
         if ($aType == 'mobile') {
             session('verify_time', $time);
         }
         $this->success(L('_ERROR_SUCCESS_SEND_'));
     } else {
         $this->error($res);
     }
 }
 /**
  * 模版列表页
  * @author 郑钟良<*****@*****.**>
  */
 public function tpls()
 {
     $aCleanCookie = I('get.cleanCookie', 0, 'intval');
     if ($aCleanCookie) {
         cookie('TO_LOOK_THEME', null, array('prefix' => 'OSV2'));
     }
     // 根据应用目录取全部APP信息
     $dir = OS_THEME_PATH;
     /*刷新模块列表时清空缓存*/
     $aRefresh = I('get.refresh', 0, 'intval');
     if ($aRefresh == 1) {
     } else {
         if ($aRefresh == 2) {
             S('admin_themes', null);
         }
     }
     $tpls = S('admin_themes');
     if ($tpls === false) {
         $tpls = null;
         if (is_dir($dir)) {
             if ($dh = opendir($dir)) {
                 while (($file = readdir($dh)) !== false) {
                     //去掉"“.”、“..”以及带“.xxx”后缀的文件
                     if ($file != "." && $file != ".." && !strpos($file, ".")) {
                         if (is_file(OS_THEME_PATH . $file . '/info.php')) {
                             $tpl = (require_once OS_THEME_PATH . $file . '/info.php');
                             $tpl['path'] = OS_THEME_PATH . $file;
                             $tpl['file_name'] = $file;
                             $tpl['token'] = file_get_contents(OS_THEME_PATH . $file . '/token.ini');
                             $tpls[] = $tpl;
                         }
                     }
                 }
                 closedir($dh);
             }
         }
         $tpls = M('Admin/Cloud')->getVersionInfoList($tpls);
         S('admin_themes', $tpls);
     }
     /*刷新模块列表时清空缓存 end*/
     $now_theme = modC('NOW_THEME', 'default', 'Theme');
     $this->assign('now_theme', $now_theme);
     $this->assign('tplList', $tpls);
     $this->display();
 }
 public function index()
 {
     if (is_login()) {
     }
     hook('homeIndex');
     $default_url = C('DEFUALT_HOME_URL');
     //获得配置,如果为空则显示聚合,否则跳转
     if ($default_url != '' && strtolower($default_url) != 'home/index/index') {
         redirect(get_nav_url($default_url));
     }
     $show_blocks = get_kanban_config('BLOCK', 'enable', array(), 'Home');
     $this->assign('showBlocks', $show_blocks);
     $enter = modC('ENTER_URL', '', 'Home');
     $this->assign('enter', get_nav_url($enter));
     $sub_menu['left'] = array(array('tab' => 'home', 'title' => L('_SQUARE_'), 'href' => U('index')));
     $this->assign('sub_menu', $sub_menu);
     $this->assign('current', 'home');
     $this->display();
 }
Esempio n. 22
0
 private function assignData($reply_id)
 {
     $reply = D('Group/GroupPostReply')->getReply($reply_id);
     $lzlModel = D('GroupLzlReply');
     $map = array('status' => 1, 'to_f_reply_id' => $reply_id);
     $r = modC('GROUP_LZL_SHOW_COUNT', 5, 'GROUP');
     $order = modC('GROUP_LZL_REPLY_ORDER', 1, 'GROUP') == 1 ? 'create_time asc' : 'create_time desc';
     $lzl_list = $lzlModel->getList(array('where' => $map, 'order' => $order, 'page' => 1, 'count' => $r));
     $lzl_total_count = $lzlModel->where($map)->count();
     $data['to_f_reply_id'] = $reply_id;
     $pageCount = ceil($lzl_total_count / $r);
     $html = getPageHtml('group_lzl_page', $pageCount, $data, 1);
     $this->assign('post', D('Group/GroupPost')->getPost($reply['post_id']));
     $this->assign('html', $html);
     $this->assign('lzl_total_count', $lzl_total_count);
     $this->assign('r', $r);
     $this->assign('lzl_list', $lzl_list);
     $this->assign('reply', $reply);
 }
 public function assignUser($pos = '1', $field = 'score1')
 {
     $num = modC('USER_SHOW_COUNT' . $pos, 5, 'People');
     $field = modC('USER_SHOW_ORDER_FIELD' . $pos, $field, 'People');
     $order = modC('USER_SHOW_ORDER_TYPE' . $pos, 'desc', 'People');
     $cache = modC('USER_SHOW_CACHE_TIME' . $pos, 600, 'People');
     $data = S('people_home_data' . $pos);
     if (empty($data)) {
         $map = array('status' => 1);
         $content = M('Member')->field('uid')->where($map)->order($field . ' ' . $order)->limit($num)->select();
         foreach ($content as &$v) {
             $v['user'] = query_user(array('uid', 'nickname', 'space_url', 'space_link', 'avatar64', 'rank_html'), $v['uid']);
         }
         $data = $content;
         S('people_home_data' . $pos, $data, $cache);
     }
     unset($v);
     $this->assign('people' . $pos, $data);
 }
 public function getCommentList($weibo_id, $page = 1, $show_more = 0)
 {
     $order = modC('COMMENT_ORDER', 0, 'WEIBO') == 1 ? 'create_time asc' : 'create_time desc';
     $comment = $this->where(array('weibo_id' => $weibo_id, 'status' => 1))->order($order)->page($page, 10)->field('id')->select();
     /*        if($page == 1){
                 $t = array_chunk($comment,5);
                 if($show_more ){
                     $comment = $t[1];
                 }else{
                     $comment = $t[0];
                 }
             }*/
     $ids = getSubByKey($comment, 'id');
     $list = array();
     foreach ($ids as $v) {
         $list[$v] = $this->getComment($v);
     }
     return $list;
 }
Esempio n. 25
0
function parse_at_users($content, $disabel_hight = false)
{
    $content = $content . ' ';
    //找出被AT的用户
    $at_usernames = get_at_usernames($content);
    //将@用户替换成链接
    foreach ($at_usernames as $e) {
        $user = D('Member')->where(array('nickname' => $e))->find();
        if ($user) {
            $query_user = query_user(array('space_url', 'avatar32'), $user['uid']);
            if (modC('HIGH_LIGHT_AT', 1, 'Weibo') && !$disabel_hight) {
                $content = str_replace("@{$e}", " <a class='user-at hl ' ucard=\"{$user['uid']}\" href=\"{$query_user['space_url']}\"><img src=\"{$query_user['avatar32']}\">@{$e} </a> ", $content);
            } else {
                $content = str_replace("@{$e}", " <a ucard=\"{$user['uid']}\" href=\"{$query_user['space_url']}\">@{$e} </a> ", $content);
            }
        }
    }
    //返回替换的文本
    return $content;
}
 private function assignGroupPost()
 {
     $list = S('GROUP_POST_SHOW_DATA');
     if (empty($list)) {
         $order_key = modC('FORUM_POST_ORDER', 'last_reply_time', 'Forum');
         $order_type = modC('FORUM_POST_TYPE', 'desc', 'Forum');
         $limit = modC('FORUM_POST_SHOW_NUM', 5, 'Forum');
         $cache_time = modC('FORUM_POST_CACHE_TIME', 600, 'Forum');
         $groupModel = new GroupModel();
         $group_ids = $groupModel->where(array('status' => 1))->field('id')->select();
         $group_ids = getSubByKey($group_ids, 'id');
         $list = M('GroupPost')->where(array('status' => 1, 'group_id' => array('in', $group_ids)))->order($order_key . ' ' . $order_type)->limit($limit)->select();
         foreach ($list as &$val) {
             $val['group'] = $groupModel->getGroup($val['group_id']);
         }
         unset($val);
         S('GROUP_POST_SHOW_DATA', $list, $cache_time);
     }
     $this->assign('group_post_list', $list);
 }
Esempio n. 27
0
 public function addVerify($account, $type, $uid = 0)
 {
     $uid = $uid ? $uid : is_login();
     if ($type == 'mobile' || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $type == 'email') {
         $verify = create_rand(6, 'num');
     } else {
         $verify = create_rand(32);
     }
     $this->where(array('account' => $account, 'type' => $type))->delete();
     $data['verify'] = $verify;
     $data['account'] = $account;
     $data['type'] = $type;
     $data['uid'] = $uid;
     $data = $this->create($data);
     $res = $this->add($data);
     if (!$res) {
         return false;
     }
     return $verify;
 }
 public function assignIssue()
 {
     $num = modC('ISSUE_SHOW_COUNT', 4, 'Issue');
     $field = modC('ISSUE_SHOW_ORDER_FIELD', 'view_count', 'Issue');
     $order = modC('ISSUE_SHOW_ORDER_TYPE', 'desc', 'Issue');
     $cache = modC('ISSUE_SHOW_CACHE_TIME', 600, 'Issue');
     $data = S('issue_home_data');
     if (empty($data)) {
         $map = array('status' => 1);
         $content = M('IssueContent')->where($map)->order($field . ' ' . $order)->limit($num)->select();
         foreach ($content as &$v) {
             $v['user'] = query_user(array('id', 'nickname', 'space_url', 'space_link', 'avatar128', 'rank_html'), $v['uid']);
             $v['issue'] = M('Issue')->field('id,title')->find($v['issue_id']);
         }
         $data = $content;
         S('issue_home_data', $data, $cache);
     }
     unset($v);
     $this->assign('IssueContents', $data);
 }
 public function checkin()
 {
     $this->requireLogin();
     $uid = is_login();
     $map['ctime'] = array('egt', strtotime(date('Ymd')));
     $map['uid'] = $uid;
     $ischeck = D('Check_info')->where($map)->find();
     //是否重复签到
     if (!$ischeck) {
         $map_last['ctime'] = array('lt', strtotime(date('Ymd')));
         $map_last['uid'] = $uid;
         $last = D('Check_info')->where($map_last)->order('ctime desc')->find();
         $data['ctime'] = $_SERVER['REQUEST_TIME'];
         $add_score = modC('User_CheckIN_Score', '0', 'user');
         //是否有签到记录
         if ($last) {
             //是否是连续签到
             if ($last['ctime'] >= strtotime(date('Ymd')) - 86400) {
                 $data['con_num'] = $last['con_num'] + 1;
             } else {
                 $data['con_num'] = 1;
             }
             $data['total_num'] = $last['total_num'] + 1;
             $data['total_score'] = $last['total_score'] + $add_score;
             $result = D('Check_info')->where(array('uid' => $uid))->save($data);
         } else {
             $data['uid'] = $uid;
             $data['con_num'] = 1;
             $data['total_num'] = 1;
             $data['total_score'] = $add_score;
             $result = D('Check_info')->add($data);
         }
         if ($result) {
             S('check_rank', null);
             //更新连续签到和累计签到的数据
             $this->apiSuccess('签到成功。', array('con_num' => $data['con_num'], 'total_num' => $data['total_num'], 'over_rate' => $this->getOverRate($data['total_num'])));
         }
     } else {
         $this->apiError('已签到。', 8000);
     }
 }
 private function assignNews()
 {
     $num = modC('NEWS_SHOW_COUNT', 4, 'News');
     $type = modC('NEWS_SHOW_TYPE', 0, 'News');
     $field = modC('NEWS_SHOW_ORDER_FIELD', 'view', 'News');
     $order = modC('NEWS_SHOW_ORDER_TYPE', 'desc', 'News');
     $cache = modC('NEWS_SHOW_CACHE_TIME', 600, 'News');
     $list = S('news_home_data');
     if (!$list) {
         if ($type) {
             /**
              * 获取推荐位数据列表
              * @param  number  $pos      推荐位 1-系统首页,2-推荐阅读,4-本类推荐
              * @param  number  $category 分类ID
              * @param  number  $limit    列表行数
              * @param  boolean $filed    查询字段
              * @param order 排序
              * @return array             数据列表
              */
             $list = M('News/News')->position(1, null, $num, true, $field . ' ' . $order);
         } else {
             $map = array('status' => 1, 'dead_line' => array('gt', time()));
             $list = M('News/News')->getList($map, $field . ' ' . $order, $num);
         }
         foreach ($list as &$v) {
             $v['user'] = query_user(array('space_url', 'nickname'), $v['uid']);
             $v['category_details'] = M('News/NewsCategory')->info($v['category']);
             //$category_details = //$v['category'] category id;
         }
         unset($v);
         if (!$list) {
             $list = 1;
         }
         S('news_home_data', $list, $cache);
     }
     unset($v);
     if ($list == 1) {
         $list = null;
     }
     $this->assign('news_lists', $list);
 }