内核更新,多余文件清理

This commit is contained in:
2016-07-01 18:04:46 +08:00
parent a595f3a13e
commit 0398e5bd80
31 changed files with 426 additions and 551 deletions

View File

@@ -1,124 +0,0 @@
{extend name="public/base"/}
{block name="style"}
<!-- datepicker statr -->
<link href="__PUBLIC__/plugs/datepicker/css/foundation-datepicker.min.css" rel="stylesheet" type="text/css">
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.js"></script>
<script src="__PUBLIC__/plugs/datepicker/js/foundation-datepicker.zh-CN.js"></script>
<!-- datepicker end -->
{/block}
{block name="body"}
<div class="main-box clearfix">
<header class="main-box-header clearfix">
<div class="pull-left">
<h2>{$meta_title}</h2>
</div>
<div class="pull-right">
<a class="btn btn-primary" href="{:url('admin/content/add?model_id='.$model_id)}">新 增</a>
<button class="btn btn-danger ajax-post confirm" url="{:url('admin/content/del?model_id='.$model_id)}" target-form="ids">删 除</button>
</div>
</header>
<div class="main-box-body clearfix">
<div class="row">
<form method="get">
<div class="col-sm-12 col-md-4 pt-5">
<div class="input-group">
<div class="input-group-addon">书名:</div>
<input type="text" class="form-control" name="book_name" value="{$book_name|default=''}" placeholder="书名">
</div>
</div>
<div class="col-sm-12 col-md-4 pt-5">
<div class="input-group">
<div class="input-group-addon">发布时间:</div>
<div class="col-sm-5">
<input type="text" class="form-control create_time" name="create_time[]" id="create_time" placeholder="开始时间" value="{$create_time[0]|default=''}" readonly>
</div>
<div class="col-sm-5">
<input type="text" class="form-control create_time" name="create_time[]" id="create_time" placeholder="结束时间" value="{$create_time[1]|default=''}" readonly>
</div>
</div>
</div>
<div class="col-sm-12 col-md-4 pt-5">
<div class="input-group">
<div class="input-group-addon">标准类型:</div>
<select class="form-control" name="stand_class"></select>
</div>
</div>
<div class="col-sm-12 col-md-4 pt-5">
<div class="input-group">
<div class="input-group-addon">编号:</div>
<input type="text" class="form-control" name="book_no" value="{$book_no|default=''}" placeholder="编号">
</div>
</div>
<div class="col-sm-12 col-md-4 pt-5">
<button class="btn btn-primary" type="submit">搜索</button>
</div>
</form>
</div>
<div class="table-responsive clearfix">
<div class="table-responsive clearfix">
<table class="table table-hover">
<thead>
<tr>
<th width="30"><input class="checkbox check-all" type="checkbox"></th>
{volist name="grid['grids']" id="item"}
<th>{$item['title']}</th>
{/volist}
<th>操作</th>
</tr>
</thead>
<tbody>
{if condition="empty($list)"}
{php}
$cow = count($grid['grids'])+2;
{/php}
<tr>
<td colspan="{$cow}" align="center">暂无数据!</td>
</tr>
{else/}
{volist name="list" id="item"}
<tr>
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
{volist name="grid['grids']" id="vo"}
{if isset($vo['format'])}
<td>{$item[$vo['field'][0]]|$vo['format']}</td>
{else/}
<td>{$item[$vo['field'][0]]}</td>
{/if}
{/volist}
<td>
{if isset($item['status'])}
{if $item['status']}
<a href="{:url('admin/content/status',array('id'=>$item['id'],'model_id'=>$model_id,'status'=>'0'))}" class="ajax-get">取消审核</a>
{else/}
<a href="{:url('admin/content/status',array('id'=>$item['id'],'model_id'=>$model_id,'status'=>'1'))}" class="ajax-get">审核</a>
{/if}
{/if}
<a href="{:url('admin/content/edit',array('id'=>$item['id'],'model_id'=>$model_id))}" >编辑</a>
<a href="{:url('admin/content/del',array('id'=>$item['id'],'model_id'=>$model_id))}" class="ajax-get confirm">删除</a>
</td>
</tr>
{/volist}
{/if}
</tbody>
</table>
</div>
{$page}
</div>
</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
$(function(){
$('.create_time').fdatepicker({
format: 'yyyy-mm-dd',
pickTime: true
});
$('.height_btn').click(function(){
$('.height').show();
});
})
</script>
{/block}

View File

@@ -20,6 +20,9 @@
<th>
<span>Email</span>
</th>
<th>
<span>手机号码</span>
</th>
<th>
<span>创建时间</span>
</th>
@@ -40,6 +43,9 @@
<td>
<span >{$item['email']}</span>
</td>
<td>
<span >{$item['mobile']}</span>
</td>
<td>{$item['reg_time']|date='Y-m-d',###}</td>
<td class="text-center">
{if condition="$item['status']"}

View File

@@ -3,7 +3,7 @@ namespace app\common\behavior;
class InitHook {
public function run(&$content){
public function run(&$request){
//初始化某些配置信息
if (cache('db_config_data')) {

View File

@@ -16,8 +16,10 @@ class Fornt extends Base{
//判读是否为关闭网站
if (\think\Config::get('web_site_close')) {
return $this->fetch('common@default/public/close');exit();
header("Content-type:text/html;charset=utf-8");
echo $this->fetch('common@default/public/close');exit();
}
//设置SEO
$this->setSeo();

View File

@@ -0,0 +1,20 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\common\model;
/**
* 用户模型
*/
class MemberExtend extends Base{
protected $type = array(
'uid' => 'integer',
);
}

View File

@@ -12,19 +12,14 @@ namespace app\common\model;
/**
* 用户模型
*/
class User extends \think\model\Merge{
class User extends Base{
protected $name = "Member";
protected static $relationModel = array('MemberExtend');
protected $createTime = 'reg_time';
protected $updateTime = 'last_login_time';
protected $fk = 'user_id';
protected $mapFields = array(
'uid' => 'Member.uid',
'user_id' => 'MemberExtend.uid',
);
protected $type = array(
'id' => 'integer',
'uid' => 'integer',
);
protected $insert = array('salt', 'password', 'status', 'reg_time');
protected $update = array();
@@ -54,11 +49,21 @@ class User extends \think\model\Merge{
array('name'=>'nickname','title'=>'昵称','type'=>'text','help'=>''),
array('name'=>'sex','title'=>'性别','type'=>'select','option'=>array('0'=>'保密','1'=>'男','2'=>'女'),'help'=>''),
array('name'=>'email','title'=>'邮箱','type'=>'text','help'=>'用户邮箱,用于找回密码等安全操作'),
array('name'=>'mobile','title'=>'联系电话','type'=>'text','help'=>''),
array('name'=>'qq','title'=>'QQ','type'=>'text','help'=>''),
array('name'=>'score','title'=>'用户积分','type'=>'text','help'=>''),
array('name'=>'signature','title'=>'用户签名','type'=>'textarea','help'=>''),
);
public $userextend = array(
array('name'=>'company','title'=>'单位名称','type'=>'text','help'=>''),
array('name'=>'company_addr','title'=>'单位地址','type'=>'text','help'=>''),
array('name'=>'company_contact','title'=>'单位联系人','type'=>'text','help'=>''),
array('name'=>'company_zip','title'=>'单位邮编','type'=>'text','help'=>''),
array('name'=>'company_depart','title'=>'所属部门','type'=>'text','help'=>''),
array('name'=>'company_post','title'=>'所属职务','type'=>'text','help'=>''),
array('name'=>'company_type','title'=>'单位类型','type'=>'select', 'option'=>'', 'help'=>''),
);
protected function setStatusAttr($value){
return 1;
}
@@ -72,6 +77,11 @@ class User extends \think\model\Merge{
*/
public function login($username = '', $password = '', $type = 1){
$map = array();
if (\think\Validate::is($username,'email')) {
$type = 2;
}elseif (preg_match("/^1[34578]{1}\d{9}$/",$username)) {
$type = 3;
}
switch ($type) {
case 1:
$map['username'] = $username;
@@ -111,11 +121,6 @@ class User extends \think\model\Merge{
* @param integer $user 用户信息数组
*/
function register($username, $password, $repassword, $email, $isautologin = true){
if ($password !== $repassword) {
$this->error = "密码和确认密码不相同";
return false;
}
$data['username'] = $username;
$data['salt'] = rand_string(6);
$data['password'] = $password;
@@ -123,6 +128,7 @@ class User extends \think\model\Merge{
$result = $this->validate(true)->save($data);
if ($result) {
$this->data['uid'] = $result;
$this->extend()->save($data);
if ($isautologin) {
$this->autoLogin($this->data);
}
@@ -147,8 +153,8 @@ class User extends \think\model\Merge{
'last_login_time' => time(),
'last_login_ip' => get_client_ip(1),
);
$this->db()->where(array('uid'=>$user['uid']))->update($data);
$user = $this->db()->where(array('uid'=>$user['uid']))->find();
$this->where(array('uid'=>$user['uid']))->update($data);
$user = $this->where(array('uid'=>$user['uid']))->find();
/* 记录登录SESSION和COOKIES */
$auth = array(
@@ -167,7 +173,7 @@ class User extends \think\model\Merge{
}
public function getInfo($uid){
$data = $this->db()->where(array('uid'=>$uid))->find();
$data = $this->where(array('uid'=>$uid))->find();
if ($data) {
return $data->toArray();
}else{
@@ -178,7 +184,12 @@ class User extends \think\model\Merge{
public function change(){
$data = input('post.');
if ($data['uid']) {
return $this->save($data, array('uid'=>$data['uid']));
$result = $this->validate('member.edit')->save($data, array('uid'=>$data['uid']));
if ($result) {
$result = $this->extend->save($data, array('uid'=>$data['uid']));
}else{
return false;
}
}else{
$this->error = "非法操作!";
return false;
@@ -211,6 +222,10 @@ class User extends \think\model\Merge{
return $this->db()->where(array('uid'=>$uid))->update($data);
}
public function extend(){
return $this->hasOne('MemberExtend', 'uid');
}
protected function checkPassword($username,$password){
if (!$username || !$password) {
return false;

View File

@@ -15,17 +15,21 @@ namespace app\common\validate;
class Member extends \think\Validate{
protected $rule = array(
'username' => 'require|unique:member|/^[a-zA-Z]\w{0,39}$/',
'email' => 'require|unique:member|email',
'username' => 'require|unique:member|/^[a-zA-Z]\w{0,39}$/',
'email' => 'require|unique:member|email',
'mobile' => 'unique:member',
'repassword'=>'require|confirm:password'
);
protected $message = array(
'username.require' => '用户名必须',
'username.unique' => '用户名已存在',
'email.require' => '邮箱必须',
'email.unique' => '邮箱已存在',
'mobile.unique' => '手机号已存在',
'repassword.require' => '确认密码和密码必须一致',
);
protected $scene = array(
//'add' => 'username,email',
'edit' => 'email,mobile',
);
}

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SentCMS网站管理系统 - PowerBy TenSent</title>
<style>
body{font-family: "微软雅黑","Microsoft Yahei";}
.close{border: 5px solid #efefef; padding: 30px; width: 300px; margin: 100px auto; text-align: center;}
</style>
</head>
<body>
<div class="close">
本站已关闭!
</div>
</body>
</html>

View File

@@ -92,9 +92,14 @@ return array(
),
'log' => array(
// 日志记录方式,支持 file socket trace sae
// 日志记录方式,支持 file sae
'type' => 'file',
// 日志保存目录
'path' => LOG_PATH,
)
),
// 页面Trace信息
// 'trace' =>array(
// //支持Html,Console 设为false则不显示
// 'type' => false,
// )
);

View File

@@ -15,7 +15,7 @@ return array(
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'nmg_www',
'database' => 'sentcms_www',
// 数据库用户名
'username' => 'root',
// 数据库密码

View File

@@ -1,70 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\index\controller;
use app\common\controller\Fornt;
class Book extends Fornt{
public function _initialize(){
parent::_initialize();
$this->book = model('Book');
}
public function index(){
$map = $this->search();
$order = 'id desc';
$list = $this->book->where($map)->order($order)->paginate(10);
$data = array(
'list' => $list,
'page' => $list->render()
);
$this->assign($data);
return $this->fetch();
}
//图书详情
public function detail($id = 0){
$map['id'] = $id;
$info = $this->book->where($map)->find();
$data = array(
'info' => $info,
);
$this->assign($data);
return $this->fetch();
}
//图书搜索条件组织
protected function search(){
$map = array();
$data = $this->request->post();
$data['is_show_height'] = 0;
if (isset($data['book_name']) && $data['book_name']) {
$map['book_name'] = array("LIKE", "%" . $data['book_name'] . "%");
}
if (isset($data['book_no']) && $data['book_no']) {
$map['book_no'] = array("LIKE", "%" . $data['book_no'] . "%");
$data['is_show_height'] = 1;
}
if (isset($data['stand_class']) && $data['stand_class']) {
$map['stand_class'] = $data['stand_class'];
$data['is_show_height'] = 1;
}
if (isset($data['create_time'][0]) && isset($data['create_time'][1]) && $data['create_time'][0] && $data['create_time'][1]) {
$map['create_time'] = array('BETWEEN',$data['create_time']);
$data['is_show_height'] = 1;
}
$this->assign($data);
return $map;
}
}

View File

@@ -1,53 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace app\index\controller;
use app\common\controller\Fornt;
class Cart extends Fornt{
public function _initialize(){
$this->cart = new \com\Cart();
}
//购物车
public function index(){
$list = $this->cart->all();
$data = array(
'list' => $list,
);
$this->assign($data);
return $this->fetch();
}
//加入购物车
public function add($id, $num){
if ($num > 0) {
$this->cart->addItem($id, $num);
}
$info['code'] = 1;
$info['num'] = $this->cart->getCount();
return $info;
}
//加入购物车
public function del($id){
$this->cart->delItem($id);
$info['code'] = 1;
$info['data'] = array('num'=>$this->cart->getCount());
return $info;
}
//购物车统计
public function count(){
$data = array('info'=>$this->cart->getCount());
echo json_encode($data);
}
}

View File

@@ -51,20 +51,27 @@ class Order extends User{
if (!$order_id) {
$price_count = '0.00';
$list = $this->cart->all();
foreach ($list as $key => $value) {
$price_count += $value['price_count'];
if ($list) {
foreach ($list as $key => $value) {
$price_count += $value['price_count'];
}
$data = array(
'list' => $list,
'price_count' => $price_count
);
//生成订单
$map['id'] = $this->order->createOrder($data);
}
$data = array(
'list' => $list,
'price_count' => $price_count
);
//生成订单
$map['id'] = $this->order->createOrder($data);
}else{
$map['id'] = $order_id;
}
if (!isset($map['id'])) {
return $this->error('非法操作!');
}
$order = $this->order->where($map)->find();
$data = array(

View File

@@ -24,8 +24,13 @@ class Profile extends User{
}
}else{
$group['基础资料'] = $user->useredit;
$group['扩展信息'] = $user->userextend;
$info = $user->getInfo(session('user_auth.uid'));
$info = $user->where(array('uid'=>session('user_auth.uid')))->find();
if ($info->extend) {
$info = array_merge($info->toArray(), $info->extend->toArray());
}
$data = array(
'fieldGroup' => $group,
'info' => $info

View File

@@ -79,7 +79,7 @@ time { color: #777;}
.nc-login-form dl { background-color: #FFF; width: 398px; height: 52px; margin-top: -1px; border: solid 1px #E6E6E6; position: relative; z-index: 1; overflow: hidden;}
.nc-login-form dl.focus { border-color: #7ABD54; z-index: 3;}
.nc-login-form dl.error { border-color: #F87622 !important; z-index: 2;}
.nc-login-form dl dt { font-size: 14px; line-height: 20px; color: #666; width: 72px; padding: 16px 0 16px 20px; float: left;}
.nc-login-form dl dt { font-size: 14px; line-height: 20px; color: #333333; width: 72px; padding: 16px 0 16px 20px; float: left;}
.nc-login-form dl dd { height: 28px; float: left; padding: 12px 0;}
.nc-login-form dl dd .text { font-family: "microsoft yahei"; font-size: 14px; line-height: 28px; width: 290px; height: 28px; padding: 0; border: none 0;}

View File

@@ -39,7 +39,7 @@
<dl>
<dt>&nbsp;&nbsp;&nbsp;号:</dt>
<dd>
<input type="text" class="text" autocomplete="off" name="username" placeholder="用户名/邮箱" id="username" >
<input type="text" class="text" autocomplete="off" name="username" placeholder="用户名/邮箱/手机号码" id="username" >
</dd>
</dl>
<dl>