Esempio n. 1
0
 /**
  * 会员信息
  *
  * @param	intval	uid
  * @return	array
  */
 public function get_member($uid)
 {
     if (!$uid) {
         return NULL;
     }
     // 查询会员信息
     $data = $this->db->from($this->db->dbprefix('member') . ' AS m')->join($this->db->dbprefix('member_data') . ' AS a', 'a.uid=m.uid', 'left')->where('m.uid', $uid)->limit(1)->get()->row_array();
     if (!$data) {
         return NULL;
     }
     $group = $this->ci->get_cache('member', 'group');
     $data['uid'] = $uid;
     $data['tableid'] = (int) substr((string) $uid, -1, 1);
     $data['groupname'] = $group[$data['groupid']]['name'];
     $data['levelname'] = $group[$data['groupid']]['level'][$data['levelid']]['name'];
     $data['levelstars'] = $group[$data['groupid']]['level'][$data['levelid']]['stars'];
     $data['allowspace'] = $group[$data['groupid']]['allowspace'];
     // 快捷登陆用户信息提取
     $oauth = $this->db->where('uid', $uid)->order_by('expire_at desc')->get('member_oauth')->result_array();
     if ($oauth) {
         foreach ($oauth as $t) {
             if (!$data['username']) {
                 $data['username'] = $t['nickname'];
             }
             $data['oauth'][$t['oauth']] = $t;
         }
     }
     // 会员组过期判断
     if (!$data['groupid'] || $data['overdue'] && $group[$data['groupid']]['price'] && $data['overdue'] < SYS_TIME) {
         if ($group[$data['groupid']]['unit'] == 1 && $data['score'] - abs(intval($group[$data['groupid']]['price'])) > 0) {
             // 虚拟币自动扣费
             $this->update_score(1, $uid, -abs(intval($group[$data['groupid']]['price'])), '', "lang,m-128");
             $time = $this->upgrade($uid, $data['groupid'], $group[$data['groupid']]['limit'], $data['overdue']);
             $time = $time > 2000000000 ? lang('m-265') : dr_date($time);
             // 邮件提醒
             $this->ci->sendmail_queue($this->member['email'], lang('m-263'), dr_lang('m-264', $data['name'] ? $data['name'] : $data['username'], $group[$data['groupid']]['name'], $time));
             $this->add_notice($uid, 1, lang('m-263'));
         } else {
             // 转为过期的后的会员组
             $data['groupid'] = $data['group']['overdue'] ? $data['group']['overdue'] : 3;
             $this->db->where('uid', $uid)->update('member', array('levelid' => 0, 'overdue' => 0, 'groupid' => $data['groupid']));
             $data['groupname'] = $group[$data['groupid']]['name'];
             $data['allowspace'] = $group[$data['groupid']]['allowspace'];
             $this->add_notice($uid, 1, lang('m-081'));
         }
     }
     // 会员组等级升级
     if ($group[$data['groupid']]['level']) {
         $level = array_reverse($group[$data['groupid']]['level']);
         // 倒序判断
         foreach ($level as $t) {
             if ($data['experience'] >= $t['experience']) {
                 if ($data['levelid'] != $t['id']) {
                     $data['levelid'] = $t['id'];
                     $data['levelname'] = $group[$data['groupid']]['level'][$data['levelid']]['name'];
                     $data['levelstars'] = $group[$data['groupid']]['level'][$data['levelid']]['stars'];
                     $this->db->where('uid', $uid)->update('member', array('levelid' => $t['id']));
                     /* 挂钩点:会员组等级升级 */
                     $this->add_notice($uid, 1, lang('m-082'));
                 }
                 break;
             }
         }
     }
     $data['mark'] = $data['groupid'] < 3 ? $data['groupid'] : $data['groupid'] . '_' . $data['levelid'];
     return $data;
 }
                            <li id="dr_cgbox_<?php 
            echo $t['id'];
            ?>
">
                                <a href="javascript:;" class="dr_cgbox_delete" did="<?php 
            echo $t['id'];
            ?>
" title="<?php 
            echo lang('del');
            ?>
"><img align="absmiddle" src="<?php 
            echo SITE_URL;
            ?>
dayrui/statics/images/b_drop.png"></a>
                                <span><?php 
            echo dr_date($t['inputtime']);
            ?>
</span>
                                <a href="javascript:;" class="dr_cgbox_select" did="<?php 
            echo $t['id'];
            ?>
"><?php 
            echo $t['title'];
            ?>
</a>
                            </li>
                            <?php 
        }
    }
    ?>
                        </ul>
Esempio n. 3
0
 /**
  * 字段输出
  */
 public function output($value)
 {
     return dr_date($value, NULL, 'red');
 }
        ?>
"><?php 
        $cache = $this->_cache_var('CATEGORY');
        eval('echo $cache' . $this->_get_var('$t[catid].name') . ';');
        unset($cache);
        ?>
</a></td>
			<td hide="1" align="center"><a href="javascript:;" onclick="dr_dialog_member('<?php 
        echo $t['uid'];
        ?>
')"><?php 
        echo dr_strcut($t['author'], 10);
        ?>
</a></td>
			<td align="left"><?php 
        echo dr_date($t['updatetime'], NULL, 'red');
        ?>
</td>
			<td align="left" class="dr_option">
            <div class="drmenu">
            <ul>
			<li><a class="ago" href="<?php 
        echo $t['url'];
        ?>
" target="_blank"><?php 
        echo lang('go');
        ?>
</a></li>
			<?php 
        if ($this->ci->is_auth(APP_DIR . '/admin/home/edit')) {
            ?>
Esempio n. 5
0
 /**
  * 会员组升级
  */
 public function upgrade()
 {
     $id = (int) $this->input->get('id');
     if ($id) {
         $group = $this->get_cache('member', 'group', $id);
         if (!$group) {
             $this->member_msg(lang('m-126'));
         }
         if (!$group['allowapply']) {
             $this->member_msg(lang('m-258'));
         }
         if ($id == $this->member['groupid']) {
             // 表示续费
             $time = $this->member['overdue'];
             $renew = TRUE;
             if ($time > 2000000000) {
                 $this->member_msg(lang('m-115'));
             }
         } else {
             $time = 0;
             $renew = FALSE;
         }
         if ($group['unit'] == 1) {
             // 虚拟币扣减
             $value = intval($group['price']);
             if ($this->member['score'] - $value < 0) {
                 $this->member_msg(dr_lang('m-259', $value, $this->member['score']));
             }
             $this->member_model->update_score(1, $this->uid, -$value, '', 'lang,m-260,' . $group['name']);
         } else {
             // 人民币扣减
             if ($this->member['money'] - $group['price'] < 0) {
                 $this->member_msg(dr_lang('m-267', $group['price'], $this->member['money']));
             }
             $this->load->model('pay_model');
             $this->pay_model->add($this->uid, -$group['price'], 'lang,m-260,' . $group['name']);
         }
         $time = $this->member_model->upgrade($this->uid, $id, $group['limit'], $time);
         $time = $time > 2000000000 ? lang('m-265') : dr_date($time);
         $subject = $renew ? lang('m-263') : lang('m-261');
         $message = dr_lang($renew ? 'm-264' : 'm-262', $this->member['name'] ? $this->member['name'] : $this->member['username'], $group['name'], $time);
         // 邮件提醒
         $this->sendmail_queue($this->member['email'], $subject, $message);
         $this->member_msg(dr_lang('m-266', $time), dr_url('account/permission'), 1, 3);
     } else {
         $data = array();
         $group = $this->get_cache('member', 'group');
         if ($group) {
             foreach ($group as $t) {
                 if ($t['allowapply']) {
                     $data[$t['id']] = $t;
                 }
             }
         }
         $this->template->assign(array('group' => $data));
         $this->template->display('account_upgrade.html');
     }
 }
$return = $this->list_tag("action=module module=news flag=4  field=title,url,updatetime order=updatetime num=5");
if ($return) {
    extract($return);
}
$count = count($return);
if (is_array($return)) {
    foreach ($return as $key => $t) {
        ?>
                <a href="<?php 
        echo $t['url'];
        ?>
" class="list-group-item"><span class="glyphicon glyphicon-chevron-right"></span><?php 
        echo $t['title'];
        ?>
<span class="badge"><?php 
        echo dr_date($t['_updatetime'], 'm-d');
        ?>
</span></a>
                <?php 
    }
}
?>
              </div>
            </div>
          </div>
        </div>
    <!-- 新闻中心 -->
    <?php 
if ($fn_include = $this->_include("footer.html")) {
    include $fn_include;
}