Commit 0a88b5b2 authored by wangzhengwen's avatar wangzhengwen

rank

parents 5d065245 1e5d4402
......@@ -32,8 +32,10 @@ class Setting extends AdminBase
*/
public function index(string $do = '')
{
$groups = vconfig('sys_group',[]); reset($groups);
if($do=='json'){
$group = $this->request->get('group',key($groups));
$where[] = ['state','=',1];
$where[] = ['addon','=',''];
......
<?php
namespace app\admin\controller\users;
use app\admin\controller\AdminBase;
use app\model\UserExpLog as UserExpLogModel;
use think\App;
class UserExpLog extends AdminBase
{
protected $userexplog;
public function __construct(App $app)
{
parent::__construct($app);
$this->userexplog = new UserExpLogModel();
}
//列表
public function index(string $do = '')
{
$limit = 10;
if ($do == 'json') {
$post = input();
$post['limit'] = isset($post['limit']) ? $post['limit'] : $limit;
$hasmap = [];
if (isset($post['kw']) && !empty($post['kw'])) {
$hasmap[] = ['username|mobile', 'like', '%' . $post['kw'] . '%'];
}
$list = $this->userexplog->hasWhere('getuserdata', $hasmap)->with(['getuserdata', 'getruledata'])->paginate($post['limit']);
return $this->returnMsg($list);
}
$this->assign('limit', $limit);
$this->assign('get', input());
return $this->fetch('', '', false);
}
public function del()
{
$post = input();
$ids = is_array($post['id']) ? implode(',', $post['id']) : $post['id'];
if ($this->userexplog->where("id IN(" . $ids . ")")->update(['is_del' => 1])) {
return $this->returnMsg("删除成功", 1);
} else {
return $this->returnMsg("删除失败");
}
}
}
\ No newline at end of file
<?php
/**
* ===========================================================================
* Veitool 快捷开发框架系统
* Author: Niaho 26843818@qq.com
* Copyright (c)2019-2025 www.veitool.com All rights reserved.
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace app\admin\controller\users;
use app\admin\controller\AdminBase;
use app\admin\validate\UserExpRuleValidate;
use think\App;
use think\facade\Db;
use app\model\UserExpRule as UserExpRuleModel;
/**
* 后台主控制器
*/
class UserExpRule extends AdminBase
{
protected $userexprule;
public function __construct(App $app)
{
parent::__construct($app);
$this->userexprule = new UserExpRuleModel();
}
// 列表
public function index(string $do = '')
{
$limit = 10;
if ($do == 'json') {
$list = $this->userexprule->order('id asc')->select();
return $this->returnMsg($list);
}
$this->assign('limit', $limit);
return $this->fetch('', '', false);
}
//快速编辑
public function editup()
{
$post = input();
$result = $this->userexprule->update([$post['af'] => $post['av']], [['id', '=', $post['id']]]);
if ($result) {
return $this->returnMsg('修改成功', 1);
} else {
return $this->returnMsg('修改失败');
}
}
public function del()
{
$post = input();
// $ids = is_array($post['id']) ? implode(',', $post['id']) : $post['id'];
if ($this->userexprule->destroy($post['id'])) {
return $this->returnMsg("删除成功", 1);
} else {
return $this->returnMsg("删除失败");
}
}
}
\ No newline at end of file
<?php
namespace app\admin\validate;
use think\Validate;
use app\model;
use app\api\validate\BaseValidate;
class UserExpRuleValidate extends BaseValidate
{
protected $rule = [
'event' => 'require',
'action' => 'require',
'exp' => 'require|number'
];
protected $message = [
'event.require' => '事件不能为空',
'action.require' => '接口地址不能为空',
'exp.require' => '经验值不能为空'
];
}
\ No newline at end of file
<div class="layui-fluid">
<style>
.files_itemwuserexplog{width:50px;height:50px;cursor:pointer; padding: 1px; background:#fff;display:-webkit-box;-moz-box-align:center;-webkit-box-align:center;-moz-box-pack:center;-webkit-box-pack:center;}
.files_itemwuserexplog img{width:48px;height:48px;}
</style>
<div class="layui-card">
<div class="layui-card-header">
<form class="layui-form render">
<input type="hidden" name="groupid" id="userexplog-groupid" value=""/>
<div class="layui-form-item">
<div class="layui-inline" style="width:250px;"><input type="text" name="kw" placeholder="用户名,用户手机号" autocomplete="off" class="layui-input" lay-affix="clear"/></div>
<div class="layui-inline">
<div class="layui-btn-group">
<button class="layui-btn" lay-submit lay-filter="search-userexplog"><i class="layui-icon layui-icon-search"></i> 搜索</button>
<a class="layui-btn" lay-submit lay-filter="search-userexplog-all" onclick="$('#userexplog-groupid').val('')"><i class="layui-icon layui-icon-light"></i>全部</a>
</div>
</div>
</div>
</form>
</div>
<div class="layui-card-body">
<div class="layui-card-box">
<table lay-filter="userexplog" id="userexplog"></table>
</div>
</div>
</div>
</div>
<!--JS部分-->
<script>
layui.use(['vinfo', 'buildItems'], function(){
var map_root = layui.cache.maps;
var app_root = map_root + 'users.user_exp_log/';
var layer = layui.layer,table=layui.table,form=layui.form,admin=layui.admin;
var dropdown = layui.dropdown;
/*初始渲染*/
/*==============左树结构END==============*/
/*渲染数据*/
table.render({
elem: '#userexplog',
page: true,
limit:{$limit},
url: app_root+"index?&do=json",
css:".layui-table-cell{ height:auto;}",
cols: [[
{type:'checkbox',fixed:'left'},
{field:'id',width:50,unresize:true,align:'center',title:'ID',sort:!0},
{field:'userexplogname',align:'center',width:160,title:'用户名',templet:'<div>{{d.getuserdata.username}}</div>'},
{field:'mobile',align:'center',width:160,title:'用户手机号',templet:'<div>{{d.getuserdata.mobile}}</div>'},
{field:'event',align:'center',width:160,title:'事件名',templet:'<div>{{d.getruledata.event}}</div>'},
{field:'exp',align:'center',title:'获得积分'},
{field:'create_time',width:150,align:'center',title:'时间'},
]],
done: function(){ admin.vShow($('[lay-table-id="userexplog"]'));
}
});
// 状态 - 开关操作
form.on('switch(userexplog-chang)', function(obj){
var json = JSON.parse(decodeURIComponent($(this).data('json')));
var av = obj.elem.checked ? 1 : 0;
admin.req(app_root+"editup",{id:json.id,av:av,af:obj.elem.name},function(res){
layer.tips(res.msg,obj.othis,{time:1000});
if(res.code === 0) obj.elem.checked = parseInt(obj.value);
},'post',{headersToken:true});
});
/*快编监听*/
table.on('edit(userexplog)',function(obj){
admin.req(app_root+"editup",{id:obj.data.id,av:obj.value,af:obj.field},function(res){
layer.msg(res.msg,{shade:[0.4,'#000'],time:500});
},'post',{headersToken:true});
});/**/
/*工具条监听*/
table.on('tool(userexplog)', function(obj){
var data = obj.data;
var id = data.id;
if(obj.event === 'detail'){
userexplogOpen(id);
}else if(obj.event === 'del'){
del(id);
}else if(obj.event === 'userexplog-event-image'){
var src = $(this).attr('src'), alt = $(this).attr('alt');
layer.photos({photos:{data:[{alt:alt,src:src}],start:'0'},anim:5,shade:[0.4,'#000']});
}else if(obj.event === 'more'){
}
});/**/
/*删除*/
function del(ids){
layer.confirm('确定要删除所选记录吗?', function(){
admin.req(app_root+"del",{id:ids},function(res){
layer.msg(res.msg,{shade:[0.4,'#000'],time:1500},function(){
if(res.code==1) table.reloadData('userexplog');
});
},'post',{headersToken:true});
});
}/**/
/*弹出窗*/
function userexplogOpen(id='',type=''){
layer.open({
type: 2,
area: ['900px', '900px'],
title: '资料详情',
btn: ['确定', '关闭'],
fixed: false, //不固定
content: '/admin/users.userexplog/detail?id='+id+'&type='+type,
yes: function(index, layero){
layer.close(index);
},
});
}/**/
function shajax(id,shstatus,errordesc=''){
$.ajax({
method: "post",
url: layui.cache.maps+'/users.userexplog/shenheuserexplog',
data: {id:id,shstatus:shstatus,errordesc:errordesc},
dataType: "json",
success: function (res){
if(res.code===1) {
layer.msg(res.msg,{icon:1,shade:[0.4,'#000'],time:1500},function (){
layer.closeAll();
table.reloadData('userexplog');
});
}else{
layer.msg(res.msg,{icon:2,shade:[0.4,'#000'],time:1500},function (){
});
}
}
});
}
});
</script>
\ No newline at end of file
<div class="layui-fluid">
<style>
.files_itemadv{width:30px;height:30px;line-height:30px;cursor:pointer;padding:1px;background:#fff;display:-webkit-box;-moz-box-align:center;-webkit-box-align:center;-moz-box-pack:center;-webkit-box-pack:center;}
.files_itemadv img{max-width:28px;max-height:28px;border:0}
</style>
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-card-box">
<table lay-filter="userexprule" id="userexprule"></table>
</div>
</div>
</div>
</div>
<!--JS部分-->
<script>
layui.use(['vinfo', 'buildItems'], function(){
var map_root = layui.cache.maps;
var app_root = map_root + 'users.user_exp_rule/';
var layer = layui.layer,table=layui.table,form=layui.form,admin=layui.admin;
var dropdown = layui.dropdown;
/*初始渲染*/
/*==============左树结构END==============*/
/*渲染数据*/
var kc = $('input[name=kc]').val();
table.render({
elem: '#userexprule',
url: app_root+"index?&do=json",
where:{kc:kc},
cols: [[
{field:'id',width:50,unresize:true,align:'center',title:'ID',sort:!0},
{field:'event',align:'center',width:160,title:'事件名称',edit:'text',editTrigger:'dblclick'},
{field:'action',align:'center',title:'控制器/方法 格式如:user/login'},
{field:'exp',align:'center',width:160,title:'可获经验值',edit:'text',editTrigger:'dblclick'},
{field:'daily_limit',align:'center',width:160,title:'每日上限',edit:'text',editTrigger:'dblclick'},
{field:'interval_limit',align:'center',width:160,title:'间隔时间(秒)',edit:'text',editTrigger:'dblclick'},
{field:'is_open',align:'center',width:100,title:'是否启用',templet:function(d){return '<input type="checkbox" name="is_open" lay-skin="switch" lay-text="开启|关闭" lay-filter="userexprule-chang" value="'+d.is_open+'" data-json="'+encodeURIComponent(JSON.stringify(d))+'"'+(d.is_open==1 ? ' checked' : '')+'>';},unresize:true,},
// {fixed:'right',width:130,align:'center',toolbar:'<div><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a></div>',title:'操作'}
]],
done: function(){ admin.vShow($('[lay-table-id="userexprule"]'));
}
});
// 状态 - 开关操作
form.on('switch(userexprule-chang)', function(obj){
var json = JSON.parse(decodeURIComponent($(this).data('json')));
var av = obj.elem.checked ? 1 : 0;
admin.req(app_root+"editup",{id:json.id,av:av,af:obj.elem.name},function(res){
layer.tips(res.msg,obj.othis,{time:1000});
if(res.code === 0) obj.elem.checked = parseInt(obj.value);
},'post',{headersToken:true});
});
/*快编监听*/
table.on('edit(userexprule)',function(obj){
admin.req(app_root+"editup",{id:obj.data.id,av:obj.value,af:obj.field},function(res){
layer.msg(res.msg,{shade:[0.4,'#000'],time:500});
},'post',{headersToken:true});
});/**/
/*工具条监听*/
table.on('tool(userexprule)', function(obj){
var data = obj.data;
var id = data.id;
if(obj.event === 'detail'){
userexpruleOpen(id);
}else if(obj.event === 'del'){
del(id);
}else if(obj.event === 'userexprule-event-image'){
var src = $(this).attr('src'), alt = $(this).attr('alt');
layer.photos({photos:{data:[{alt:alt,src:src}],start:'0'},anim:5,shade:[0.4,'#000']});
}
});/**/
/*删除*/
function del(ids){
layer.confirm('确定要删除所选记录吗?', function(){
admin.req(app_root+"del",{id:ids},function(res){
layer.msg(res.msg,{shade:[0.4,'#000'],time:1500},function(){
if(res.code==1) table.reloadData('userexprule');
});
},'post',{headersToken:true});
});
}/**/
});
</script>
\ No newline at end of file
......@@ -18,10 +18,24 @@ class System extends BaseController
$list = AdvertCate::where(['id' => $position, 'is_show' => 1, 'is_del' => 0])
->with(['getAdvertList' => ['coverImg']])
->find();
return $this->returnMsg('操作成功', 1, $list);
}
//热搜榜
public function gethotlist()
{
$hotlist = explode("\n", vconfig('hot_keywork', []));
$newhotlist = [];
foreach ($hotlist as &$item) {
$arr = explode('|', $item);
$newhotlist[] = array(
'title' => $arr[0],
'tag' => isset($arr[1]) ? $arr[1] : '',
);
}
return $this->returnMsg('操作成功', 1, $newhotlist);
}
}
\ No newline at end of file
......@@ -63,7 +63,7 @@ class Project extends BaseController
}
}
$query->order('createtime desc');
$list = $query->paginate([
'page' => $page,
'list_rows' => $pageSize
......@@ -97,7 +97,7 @@ class Project extends BaseController
$userId = $request->userId;
$res = (new ProjectModel())->projectDetail($data['project_id'],$userId);
$res = (new ProjectModel())->projectDetail($data['project_id'], $userId);
if (!$res) {
return $this->returnMsg('项目不存在');
}
......@@ -240,7 +240,7 @@ class Project extends BaseController
//创建项目
public function createProject(Request $request)
{
$filed = ['title', 'cate_id', 'tag_ids', 'yusuan', 'zhouqi', 'description','put_end_time'];
$filed = ['title', 'cate_id', 'tag_ids', 'yusuan', 'zhouqi', 'description', 'put_end_time'];
// 参数验证
$vo = (new ProjectValidate())->goCheck($filed);
......@@ -304,29 +304,27 @@ class Project extends BaseController
//编辑项目
public function editProject(Request $request)
{
$filed = ['project_id', 'title', 'cate_id', 'tag_ids', 'yusuan', 'zhouqi', 'description','put_end_time'];
$filed = ['project_id', 'title', 'cate_id', 'tag_ids', 'yusuan', 'zhouqi', 'description', 'put_end_time', 'thumb'];
$filedpost = ['project_id', 'title', 'cate_id', 'tag_ids', 'yusuan', 'zhouqi', 'description', 'put_end_time', 'thumb','content','file_id_str'];
$vo = (new ProjectValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
}
$data = $request->param();
// $data = $request->param();
$data = $request->only($filedpost);
$id = $data['project_id'];
unset($data['project_id']);
$data['put_end_time'] = strtotime($data['put_end_time']);
$project = ProjectModel::where(['id' => $id, 'user_id' => $request->userId])->find();
if (!$project)
{
if (!$project) {
return $this->returnMsg('项目不存在');
}
if ($project->sh_status==2)
{
return $this->returnMsg('项目已审核不能编辑');
if ($project->sh_status == 2) {
// return $this->returnMsg('项目已审核不能编辑');
}
$res = ProjectModel::where(['id' => $id, 'user_id' => $request->userId])->update($data);
return $this->returnMsg('success', 1, $res);
......
......@@ -13,9 +13,9 @@ use app\api\validate\StudyInformationValidate;
class StudyInformation extends BaseController
{
// protected $middleware = [
// Auth::class,
// ];
protected $middleware = [
Auth::class,
];
//添加学习资料
public function addStudyInformation(Request $request)
......@@ -124,13 +124,14 @@ class StudyInformation extends BaseController
//学习资料详情
public function detailStudyInformation(Request $request)
{
$vo = (new StudyInformationValidate())->goCheck(['study_information_id']);
if ($vo !== true) {
return $vo;
}
$parm = $request->param();
$where = ['id' => $parm['study_information_id'], 'user_id' => $request->userId];
$info = StudyInformationModel::where($where)->with(['filepath', 'studycatedata'])->append(['status_text'])->find();
$info = StudyInformationModel::where($where)->with(['filepath', 'studycatedata'])->append(['status_text'])->find();
return $this->returnMsg('操作成功', 1, $info);
}
......
<?php
/**
* ===========================================================================
* Veitool 快捷开发框架系统
* Author: Niaho 26843818@qq.com
* Copyright (c)2019-2025 www.veitool.com All rights reserved.
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace app\model;
use app\model\project\User;
use think\facade\Db;
use think\Model;
/**
* 课程模型
*/
class UserExpLog extends Model
{
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
//用户信息
public function getuserdata()
{
return $this->belongsTo(User::class, 'user_id')
->field('username,mobile,id');
}
//规则学习
public function getruledata()
{
return $this->belongsTo(UserExpRule::class, 'rule_id')
->field('event,action,id');
}
}
\ No newline at end of file
<?php
/**
* ===========================================================================
* Veitool 快捷开发框架系统
* Author: Niaho 26843818@qq.com
* Copyright (c)2019-2025 www.veitool.com All rights reserved.
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace app\model;
use think\facade\Db;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 课程模型
*/
class UserExpRule extends Model
{
use SoftDelete;
protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = true;
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment