diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 38d3653..37c736b 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -42,21 +42,23 @@ class Set extends AdminController View::assign(['sysInfo'=>$sysInfo,'syscy'=>$syscy]); return View::fetch('set/system/website'); } + + //综合设置 + public function server() + { + return $this->email(); + } - /** - * 显示创建资源表单页. - * - * @return \think\Response + /**邮箱设置 + * parem $id */ public function email() { - //$mailserver = Db::name('mail_server')->find(1); $mailserver = MailServer::find(1); //邮箱配置 if(Request::isAjax()){ $data = Request::param(); $res = $mailserver->save($data); - //dump($data); if($res){ return json(['code'=>0,'msg'=>'更新成功']); } else { @@ -65,7 +67,7 @@ class Set extends AdminController } View::assign('mailserver',$mailserver); - return View::fetch('set/system/email'); + return View::fetch('set/system/server'); } /** diff --git a/app/admin/controller/Sign.php b/app/admin/controller/Sign.php new file mode 100644 index 0000000..116b35a --- /dev/null +++ b/app/admin/controller/Sign.php @@ -0,0 +1,47 @@ +find(); + //$day = Db::name('user_signrule')->where('days',$data['days'])->find(); + if($day){ + $res = ['code'=>-1,'msg'=>'不能重复设置']; + } else { + $result = UserSignrule::create($data); + if($result){ + $res = ['code'=>0,'msg'=>'设置积分成功']; + } else { + $res = ['code'=>-1,'msg'=>'保存失败']; + } + } + return json($res); + } + + public function signRule() + { + $keys = UserSignrule::select(); + $count = $keys->count(); + $res = []; + if($count){ + $res = ['code'=>0,'msg'=>'','count'=>$count]; + foreach($keys as $k=>$v){ + $res['data'][] = ['id'=>$v['id'],'days'=>$v['days'],'score'=>$v['score'],'ctime'=>$v['create_time']]; + } + } else { + $res = ['code'=>-1,'msg'=>'还没有任何积分设置!']; + } + return json($res); + } + +} \ No newline at end of file diff --git a/app/admin/controller/Vip.php b/app/admin/controller/Vip.php new file mode 100644 index 0000000..2ac9924 --- /dev/null +++ b/app/admin/controller/Vip.php @@ -0,0 +1,46 @@ +find(); + if($vip){ + $res = ['code'=>-1,'msg'=>'vip等级不能重复设置']; + } else { + $result = UserViprule::create($data); + if($result){ + $res = ['code'=>0,'msg'=>'设置vip等级成功']; + } else { + $res = ['code'=>-1,'msg'=>'vip保存失败']; + } + } + return json($res); + } + + public function vipRule() + { + $keys = UserViprule::select(); + $count = $keys->count(); + $res = []; + if($count){ + $res = ['code'=>0,'msg'=>'','count'=>$count]; + foreach($keys as $k=>$v){ + $res['data'][] = ['id'=>$v['id'],'score'=>$v['score'],'vip'=>$v['vip'],'ctime'=>$v['create_time']]; + } + } else { + $res = ['code'=>-1,'msg'=>'还没有任何vip等级设置!']; + } + return json($res); + } + +} \ No newline at end of file diff --git a/app/api/controller/Message.php b/app/api/controller/Message.php index 08e39ac..9d1462d 100644 --- a/app/api/controller/Message.php +++ b/app/api/controller/Message.php @@ -28,7 +28,7 @@ class Message ->alias('t') ->join('message m','t.message_id = m.id' ) ->join('user u','t.send_id = u.id') - ->field('t.id as id,name,title,link,receve_id,t.create_time as create_time') + ->field('t.id as id,name,title,link,receve_id,t.create_time as create_time,is_read') ->where('t.receve_id',$uid) ->where('t.delete_time',0) ->select(); diff --git a/app/common/model/UserSignrule.php b/app/common/model/UserSignrule.php new file mode 100644 index 0000000..497ac26 --- /dev/null +++ b/app/common/model/UserSignrule.php @@ -0,0 +1,24 @@ +belongsTo('User','user_id','id'); + } + +} \ No newline at end of file diff --git a/app/common/model/UserViprule.php b/app/common/model/UserViprule.php new file mode 100644 index 0000000..57a4fef --- /dev/null +++ b/app/common/model/UserViprule.php @@ -0,0 +1,24 @@ +belongsTo('User','user_id','id'); + } + +} \ No newline at end of file diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 9a66140..74562f2 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -11,10 +11,9 @@ use app\common\model\User; use app\common\model\Comment; use app\common\model\Collection; use app\common\model\Article as ArticleModel; -use app\facade\Message; use think\exception\ValidateException; use think\facade\Config; - +use taoler\com\Message; class Article extends BaseController { diff --git a/app/index/controller/Message.php b/app/index/controller/Message.php index ff82fed..fadf935 100644 --- a/app/index/controller/Message.php +++ b/app/index/controller/Message.php @@ -5,7 +5,7 @@ use app\common\controller\BaseController; use think\facade\Session; use think\facade\Request; use think\facade\Db; -use app\facade\Message as MessageApi; +use taoler\com\Message as MessageApi; class Message extends BaseController { @@ -33,7 +33,7 @@ class Message extends BaseController if($count){ $res = ['status'=>0,'msg'=>'','count'=>$count]; foreach ($msg as $k => $v){ - $data = ['id'=>$v['id'],'name'=>$v['name'],'content'=>$v['title'],'time'=>date("Y-m-d H:i",$v['create_time']),'link'=>$v['link']]; + $data = ['id'=>$v['id'],'name'=>$v['name'],'content'=>$v['title'],'time'=>date("Y-m-d H:i",$v['create_time']),'link'=>$v['link'],'read'=>$v['is_read'] ? '已读':'未读']; $res['rows'][] = $data; } } else { diff --git a/app/index/controller/Sign.php b/app/index/controller/Sign.php index 496b14a..6155dc4 100644 --- a/app/index/controller/Sign.php +++ b/app/index/controller/Sign.php @@ -45,14 +45,15 @@ class Sign extends BaseController public function sign() { if (!Session::has('user_id') || !Session::has('user_name')) { - return json(array('code' => 0, 'msg' => '亲,登陆后才能签到哦','url' => 'index/login/index')); + return json(array('code' => 0, 'msg' => '亲,登陆后才能签到哦','url' => url('Login/index'))); } else { $uid = session('user_id'); $todayData = $this->todayData()->getData(); //var_dump($todayData); if ($todayData['is_sign'] == 1) { //数组中是返回的是一个对象,不能直接用[]来显示,正确的输出方法是:$pic[0]->title问题解决! - exit('{"code":-1,"msg":"你今天已经签过到了"}'); + //exit('{"code":-1,"msg":"你今天已经签过到了"}'); + return json(['code'=>-1,'msg'=>'你今天已签过到!']); } else { $data = $this->getInsertData($uid); diff --git a/app/index/controller/User.php b/app/index/controller/User.php index 311b591..3525a69 100644 --- a/app/index/controller/User.php +++ b/app/index/controller/User.php @@ -13,7 +13,7 @@ use app\common\model\Article; use app\common\model\Collection; use app\common\model\User as userModel; use think\facade\Config; -use app\facade\Message; +use taoler\com\Message; class User extends BaseController { diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index 0c292ff..29c9869 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -112,7 +112,7 @@ INSERT INTO `tao_auth_rule` VALUES ('7', 'admin/Admin/index', '管理员', '1', INSERT INTO `tao_auth_rule` VALUES ('8', 'admin/AuthGroup/list', '角色管理', '1', '1', '1', '1', '', '1', '11', '', '0', '1578901282', '0'); INSERT INTO `tao_auth_rule` VALUES ('9', 'admin/AuthRule/index', '权限管理', '1', '1', '1', '1', '', '1', '16', '', '0', '1578981541', '0'); INSERT INTO `tao_auth_rule` VALUES ('10', 'admin/set/website', '网站设置', '1', '1', '2', '1', '', '1', '1', '', '0', '0', '0'); -INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/set/email', '邮件服务', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0'); +INSERT INTO `tao_auth_rule` VALUES ('11', 'admin/set/server', '综合服务', '1', '1', '2', '1', '', '1', '3', '', '0', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('12', 'admin/Admin/info', '基本资料', '1', '1', '3', '1', '', '1', '50', '', '0', '1578980034', '0'); INSERT INTO `tao_auth_rule` VALUES ('13', 'admin/Admin/repass', '修改密码', '1', '1', '3', '1', '', '1', '51', '', '0', '1578980034', '0'); INSERT INTO `tao_auth_rule` VALUES ('15', 'admin/Forum/list', '帖子管理', '1', '1', '5', '1', '', '1', '1', '', '0', '1578902605', '0'); @@ -370,13 +370,26 @@ CREATE TABLE `tao_user_signrule` ( `id` int(2) unsigned NOT NULL AUTO_INCREMENT, `days` int(5) unsigned NOT NULL DEFAULT '0' COMMENT '连续天数', `score` int(3) unsigned NOT NULL DEFAULT '0' COMMENT '积分', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '升级时间', + `delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间', PRIMARY KEY (`id`) -) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='用户签到积分规则'; +) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='用户签到积分规则'; -INSERT INTO `tao_user_signrule` VALUES ('1', '1', '2'); -INSERT INTO `tao_user_signrule` VALUES ('2', '3', '3'); -INSERT INTO `tao_user_signrule` VALUES ('3', '5', '5'); +INSERT INTO `tao_user_signrule` VALUES ('1', '1', '2', '0', '0', '0'); +INSERT INTO `tao_user_signrule` VALUES ('2', '3', '3', '0', '0', '0'); +INSERT INTO `tao_user_signrule` VALUES ('3', '5', '5', '0', '0', '0'); +DROP TABLE IF EXISTS `tao_user_viprule`; +CREATE TABLE `tao_user_viprule` ( + `id` int(2) NOT NULL AUTO_INCREMENT COMMENT '用户等级ID', + `score` varchar(255) NOT NULL DEFAULT '0' COMMENT '积分区间', + `vip` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'vip等级', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '升级时间', + `delete_time` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `tao_user_zan`; CREATE TABLE `tao_user_zan` ( diff --git a/extend/taoler/com/Message.php b/extend/taoler/com/Message.php new file mode 100644 index 0000000..54d1b6d --- /dev/null +++ b/extend/taoler/com/Message.php @@ -0,0 +1,37 @@ +id; + $result = MessageTo::create(['send_id'=>$sendId,'receve_id'=>$receveId,'message_id'=>$msgId]); + if($result){ + return true; + } + } + + //receve msg + public static function receveMsg($uid) + { + $msg = Db::name('message_to') + ->alias('t') + ->join('message m','t.message_id = m.id' ) + ->join('user u','t.send_id = u.id') + ->field('t.id as id,name,title,link,receve_id,t.create_time as create_time,is_read') + ->where('t.receve_id',$uid) + ->where(['t.delete_time'=>0]) + ->order(['t.create_time'=>'desc']) + ->select(); + return $msg; + } + +} \ No newline at end of file diff --git a/public/static/res/mods/user.js b/public/static/res/mods/user.js index e6a2776..b63abfe 100644 --- a/public/static/res/mods/user.js +++ b/public/static/res/mods/user.js @@ -308,7 +308,7 @@ layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){