Commit 1da2424d authored by wangtao's avatar wangtao

学习资料

parent eb46e0a0
......@@ -46,9 +46,13 @@ class CourseCategory extends AdminBase
public function editup()
{
$post = input();
$this->coursecategory->update([$post['af'] => $post['av']], [['id', '=', $post['id']]]);
$result = $this->coursecategory->update([$post['af'] => $post['av']], [['id', '=', $post['id']]]);
if ($result) {
return $this->returnMsg('修改成功', 1);
} else {
return $this->returnMsg('修改成功');
}
}
//编辑新增分类
public function edit()
......
......@@ -99,8 +99,8 @@ class ProjectCategory extends AdminBase
public function del()
{
$post = input();
$ids = is_array($post['id']) ? implode(',', $post['id']) : $post['id'];
if ($this->projectcategory->destroy([$ids])) {
// $ids = is_array($post['id']) ? implode(',', $post['id']) : $post['id'];
if ($this->projectcategory->destroy($post['id'])) {
return $this->returnMsg("删除成功", 1);
} else {
return $this->returnMsg("删除失败");
......
<?php
/**
* ===========================================================================
* Veitool 快捷开发框架系统
* Author: Niaho 26843818@qq.com
* Copyright (c)2019-2025 www.veitool.com All rights reserved.
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace app\admin\controller\study;
use app\admin\controller\AdminBase;
use app\model\StudyCategory as StudyCategoryModel;
use think\App;
use think\facade\Db;
use think\facade\Validate;
use think\facade\Env;
/**
* 后台主控制器
*/
class StudyCategory extends AdminBase
{
protected $studycategory;
public function __construct(App $app)
{
parent::__construct($app);
$this->studycategory = new StudyCategoryModel();
}
//分类列表
public function index(string $do = '')
{
if ($do == 'json') {
$list = $this->studycategory->select()->append(['thumbpath'])->toArray();
return $this->returnMsg($list);
}
return $this->fetch('', '', false);
}
//快速编辑
public function editup()
{
$post = input();
$result = $this->studycategory->update([$post['af'] => $post['av']], [['id', '=', $post['id']]]);
if($result){
return $this->returnMsg('修改成功',1);
}else{
return $this->returnMsg('修改失败');
}
}
//编辑新增分类
public function edit()
{
$post = input();
if ($this->request->isPost()) {
$validate = Validate::rule([
'title' => 'require'
])->message([
'title.require' => '分类名称不能为空',
]);
if(!$validate->check($post)) {
return $this->returnMsg($validate->getError(), 0);
}
try {
if ($post['id'] > 0) {
$msg = '更新成功';
$this->studycategory->update($post, ['id' => $post['id']]);
} else {
unset($post['id']);
$post['createtime'] = time();
$msg = '添加成功';
$this->studycategory->save($post);
}
} catch (\Exception $e) {
return $this->returnMsg($e->getMessage(), 0);
}
return $this->returnMsg($msg, 1);
}
$data = Db::name('study_category')->where('id',$post['id'])->find();
$categorydata = $this->studycategory->catetree(isset($data['pid']) ? $data['pid'] : 0);
$this->assign('categorydata', $categorydata);
$this->assign('data', $data);
return $this->fetch('', '', false);
}
public function del()
{
$post = input();
// $ids = is_array($post['id']) ? implode(',', $post['id']) : $post['id'];
if ($this->studycategory->destroy($post['id'])) {
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\study;
use app\admin\controller\AdminBase;
use app\model\StudyInformation as StudyInformationModel;
use think\App;
use think\facade\Db;
use app\model\StudyCategory;
/**
* 后台主控制器
*/
class StudyInformation extends AdminBase
{
protected $studyinfomation;
public function __construct(App $app)
{
parent::__construct($app);
$this->studyinfomation = new StudyInformationModel();
}
// 列表
public function index(string $do = '')
{
$limit = 10;
if ($do == 'json') {
$post = input();
$post['limit'] = isset($post['limit']) ? $post['limit'] : $limit;
$map = [];
$hasmap = [];
if (isset($post['kw']) && !empty($post['kw'])) {
$map[] = ['title', 'like', '%' . $post['kw'] . '%'];
}
if (isset($post['cate_id']) && !empty($post['cate_id'])) {
$map[] = ['cate_id', '=', $post['cate_id']];
}
if (isset($post['status']) && $post['status'] > -1) {
$map[] = ['study_information.status', '=', $post['status']];
}
if (isset($post['user']) && !empty($post['user'])) {
$hasmap[] = ['username|mobile', 'like', '%' . $post['user'] . '%'];
}
$list = $this->studyinfomation->where($map)->hasWhere('getuserdata', $hasmap)->with(['studycatedata', 'getuserdata'])->append(['type_text', 'status_text'])->order('createtime desc')->paginate($post['limit']);
return $this->returnMsg($list);
}
$category = StudyCategory::field('*,pid as parentid')->order('sort desc')->select()->toArray();
$this->assign('category', json_encode($category));
$this->assign('limit', $limit);
return $this->fetch('', '', false);
}
//快速编辑
public function editup()
{
$post = input();
$result = $this->studyinfomation->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->studyinfomation->destroy($post['id'])) {
return $this->returnMsg("删除成功", 1);
} else {
return $this->returnMsg("删除失败");
}
}
//详情
public function detail()
{
$post = input();
$info = $this->studyinfomation->where('id', $post['id'])->with(['studycatedata', 'getuserdata'])->find()->append(['status_text','type_text']);
$this->assign('info', $info);
return $this->fetch('', '', false);
}
//推荐
public function tuijian()
{
$post = input();
if ($this->request->isAjax()) {
$data['is_hot'] = isset($post['is_hot']) ? $post['is_hot'] : 0;
$data['is_tj'] = isset($post['is_tj']) ? $post['is_tj'] : 0;
$this->studyinfomation->where('id', $post['id'])->update($data);
return $this->returnMsg("操作成功", 1);
}
$info = $this->studyinfomation->where('id', $post['id'])->find();
$this->assign('info', $info);
return $this->fetch('', '', false);
}
//审核
public function shenhestudyinfomation()
{
$post = input();
$errordesc = '';
$shstatus = 2; //通过
if ($post['shstatus'] == 2) {
if (empty($post['errordesc'])) {
return $this->returnMsg("请输入失败原因");
}
$errordesc = $post['errordesc'];
$shstatus = 1; //失败
}
$updatedata['status'] = $shstatus;
$updatedata['status_desc'] = $errordesc;
$result = $this->studyinfomation->where('id', $post['id'])->update($updatedata);
if ($result) {
return $this->returnMsg("操作成功", 1);
} else {
return $this->returnMsg("操作失败");
}
}
}
\ No newline at end of file
......@@ -30,7 +30,15 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推荐分类</label>
<div class="layui-input-block">
<input type="radio" name="is_tj" value="0" title="否" checked {eq name="$data.is_tj|default=''" value="0"}checked{/eq}>
<input type="radio" name="is_tj" value="1" title="是" {eq name="$data.is_tj|default=''" value="1"}checked{/eq}>
</div>
<div class="layui-form-mid"><i class="layui-icon"></i> 设计推荐分类可显示AI工坊页面</div>
</div>
<input type="hidden" name="id" value="{$data.id|default=0}">
</form>
......
......@@ -56,6 +56,7 @@
{field:'title',align:'left',title:'分类',edit:'text'},
{field:'thumb',width:50,align:'center',title:'缩略图',templet:'<div><div class="files_itemw1"><img src="{{d.thumbpath}}" lay-event="article-event-image" /></div></div>'},
{field:'sort',width:50,align:'center',title:'排序',edit:'text'},
{field:"is_tj",width:80,align:'center',title:"是否推荐",templet:function(d){return '<input type="checkbox" name="is_tj" lay-skin="switch" lay-text="是|否" lay-filter="is_tj-chang" value="'+d.is_tj+'" data-json="'+encodeURIComponent(JSON.stringify(d))+'"'+(d.is_tj==1 ? ' checked' : '')+'>';},unresize:true,},
{fixed:'right',width:130,align:'center',toolbar:'<div><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a></div>',title:'操作'}
]],
done: function(){ admin.vShow($('[lay-table-id="coursecategory"]')); }
......@@ -74,6 +75,16 @@
ob.attr('data',i).html(t);
});/**/
// 状态 - 开关操作
form.on('switch(is_tj-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});
});
/*快编监听*/
treeTable.on('edit(coursecategory)',function(obj){
......
......@@ -40,8 +40,8 @@
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item" id="new_dsh" style="display: none;"><a title="有新的待审核" href="#/index/main" style="color: #ff2638;" class="dshbounce">有新的待审核(10)</a></li>
<li class="layui-nav-item" lay-unselect><a v-event="clearCache" title="缓存" data-url="{$appMap}/index/clear"><i class="layui-icon layui-icon-clear"></i></a></li>
<li class="layui-nav-item" lay-unselect><a href="{PUBLIC__PATH}/" target="_blank" title="前台"><i class="layui-icon layui-icon-website"></i></a></li>
<li class="layui-nav-item" lay-unselect><a v-event="lockScreen" data-url="{PUBLIC__PATH}/static/admin/page/tpl/lock.html" title="锁屏"><i class="layui-icon layui-icon-password"></i></a></li>
<li class="layui-nav-item" lay-unselect><a href="https://www.kuajingxl.com" target="_blank" title="前台"><i class="layui-icon layui-icon-website"></i></a></li>
<!-- <li class="layui-nav-item" lay-unselect><a v-event="lockScreen" data-url="{PUBLIC__PATH}/static/admin/page/tpl/lock.html" title="锁屏"><i class="layui-icon layui-icon-password"></i></a></li>-->
<li class="layui-nav-item" lay-unselect><a v-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a></li>
<li class="layui-nav-item" lay-unselect>
<a><img src="" id="vFace" class="layui-nav-img" alt="Face"/><cite id="vUser"></cite></a>
......
......@@ -168,7 +168,7 @@
{field:'title',width:200,align:'center',title:'申请人',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'mobile',width:120,align:'center',title:'申请人手机号',templet:'<div>{{= d.getuserdata.mobile}}</div>'},
{field:'createtime',width:150,align:'center',title:'申请日期'},
{field:'sh_status',width:100,align:'center',title:'审核状态',templet:'#put-demo'},
{field:'sh_status',width:100,align:'center',title:'申请状态',templet:'#put-demo'},
{field:'status',width:100,align:'center',title:'作品状态',templet:'#putstatus-demo'},
{field:'user_desc',width:300,align:'center',title:'个人介绍'},
{fixed:'right',width:130,align:'center',toolbar:'<div><a class="layui-btn layui-btn-xs" lay-event="fileclcik">查看附件</a></div>',title:'操作'}
......
......@@ -165,9 +165,9 @@
cols: [[
{type:'checkbox',fixed:'left'},
{field:'id',width:50,unresize:true,align:'center',title:'ID',sort:!0},
{field:'sn',align:'center',title:'项目编号'},
{field:'username',align:'center',title:'发布者',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'title',align:'center',title:'项目名称'},
{field:'sn',align:'center',width:160,title:'项目编号'},
{field:'username',align:'center',width:130,title:'发布者',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'title',align:'center',width:240,title:'项目名称'},
{field:'cate_name',width:120,align:'center',title:'类别',templet:'<div>{{= d.projectcatedata.title}}</div>'},
{field:'yusuan',width:120,align:'center',title:'预算'},
{field:'zhouqi',width:120,align:'center',title:'周期/天'},
......
{extend name="base/header" /}
{block name="body"}
<div style="margin: 0px 20px 0px 0px">
<form class="layui-form " style="margin-top: 20px;" id="fjfrom">
<div class="layui-form-item">
<label class="layui-form-label"> 上级分类 </label>
<div class="layui-input-block">
<select name="pid">
<option value="">请选择分类</option>
{:$categorydata}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类名称</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入分类名称" autocomplete="off" class="layui-input" value="{$data.title|default=''}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">分类图片</label>
<div class="layui-input-block" id="thumbup">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">推荐分类</label>
<div class="layui-input-block">
<input type="radio" name="is_tj" value="0" title="否" checked {eq name="$data.is_tj|default=''" value="0"}checked{/eq}>
<input type="radio" name="is_tj" value="1" title="是" {eq name="$data.is_tj|default=''" value="1"}checked{/eq}>
</div>
<!-- <div class="layui-form-mid"><i class="layui-icon"></i> 设计推荐分类可显示在项目工坊页面</div>-->
</div>
<input type="hidden" name="id" value="{$data.id|default=0}">
</form>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use(['buildItems', 'form', 'laydate', 'util'], function () {
var form = layui.form;
/*解析顶部分组选项*/
var str = [{
"name": "thumb",
"title": "上传图片",
"value": "{$data.thumb|default=''|get_upload_file}",
"pathid": "{$data.thumb|default=''}",
"type": "imagewt"
}];
layui.buildItems.build({
fjbid:'fjfrom',
bid: 'thumbup',
url: '',
map: layui.cache.maps + 'system.upload/',
gid: 1,
data: str
});
layui.buildItems.init();
form.render();
});
var callbackdata = function () {
var data = $(".layui-form").serialize();
return data;
};
</script>
{/block}
\ No newline at end of file
<div class="layui-fluid">
<style>
.files_itemw1{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_itemw1 img{max-width:28px;max-height:28px;border:0}
</style>
<div class="layui-card">
<div class="layui-card-header">
<form class="layui-form render">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-btn-group">
<a class="layui-btn" id="studycategory-sz" data="1"><i class="layui-icon">&#xe624;</i>展开</a>
<a class="layui-btn" id="studycategory-add" ><i class="layui-icon layui-icon-add-circle"></i> 添加</a>
</div>
</div>
</div>
</form>
</div>
<div class="layui-card-body">
<div class="layui-card-body">
<table lay-filter="studycategory" id="studycategory"></table>
</div>
</div>
</div>
</div>
<!--JS部分-->
<script>
layui.use(['trTable','vinfo', 'buildItems'], function(){
var map_root = layui.cache.maps;
var app_root = map_root + 'study.study_category/';
var layer = layui.layer,table=layui.table,form=layui.form,admin=layui.admin,treeTable = layui.trTable;
/*渲染数据*/
var studycategorycateTb = treeTable.render({
elem: '#studycategory',
checkdd: false,
url: app_root+"index?&do=json",
tree: {
iconIndex: 1,
isPidData: true,
idName: 'id',
pidName: 'pid',
arrowType: 'arrow2',
getIcon: 'v-tree-icon-style2'
},
cols: [[
{field:'id',width:50,align:'center',title:'ID'},
{field:'title',align:'left',title:'分类',edit:'text'},
{field:'thumb',width:50,align:'center',title:'缩略图',templet:'<div><div class="files_itemw1"><img src="{{d.thumbpath}}" lay-event="article-event-image" /></div></div>'},
{field:'sort',width:50,align:'center',title:'排序',edit:'text'},
{field:"is_tj",width:80,align:'center',title:"是否推荐",templet:function(d){return '<input type="checkbox" name="is_tj" lay-skin="switch" lay-text="是|否" lay-filter="is_tj-chang" value="'+d.is_tj+'" data-json="'+encodeURIComponent(JSON.stringify(d))+'"'+(d.is_tj==1 ? ' checked' : '')+'>';},unresize:true,},
{fixed:'right',width:130,align:'center',toolbar:'<div><a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a><a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a></div>',title:'操作'}
]],
done: function(){ admin.vShow($('[lay-table-id="studycategory"]')); }
});
// 状态 - 开关操作
form.on('switch(is_tj-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});
});
/*展开或折叠*/
$('#studycategory-sz').click(function(){
var ob = $(this),i,t;
if(ob.attr('data')==1){
studycategorycateTb.expandAll();
i=0;t='<i class="layui-icon">&#xe67e;</i>折叠';
}else{
studycategorycateTb.foldAll();
i=1;t='<i class="layui-icon">&#xe624;</i>展开';
}
ob.attr('data',i).html(t);
});/**/
/*快编监听*/
treeTable.on('edit(studycategory)',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});
});/**/
/*工具条监听*/
treeTable.on('tool(studycategory)', function(obj){
var data = obj.data;
var id = data.id;
if(obj.event === 'edit'){
studycategoryOpen(data.id);
}else if(obj.event === 'del'){
del(id);
}else if(obj.event === 'article-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) studycategorycateTb.refresh();
});
},'post',{headersToken:true});
});
}/**/
$('#studycategory-add').on('click',function(){studycategoryOpen();});/**/
/*弹出窗*/
function studycategoryOpen(id=''){
if(id > 0){
var title = '编辑分类';
}else{
var title = '添加分类';
}
layer.open({
type: 2,
area: ['900px', '90%'],
title: title,
btn: ['确定', '关闭'],
content: app_root+'edit?id='+id,
yes: function(index, layero){
var data = window["layui-layer-iframe" + index].callbackdata();
$.ajax({
method: "post",
url: app_root+'/edit',
data: data,
dataType: "json",
success: function (res){
if(res.code===1) {
layer.msg(res.msg,{icon:1,shade:[0.4,'#000'],time:1500},function (){
layer.close(index);
studycategorycateTb.refresh();
});
}else{
layer.msg(res.msg,{icon:2,shade:[0.4,'#000'],time:1500},function (){
});
}
// layer.closeAll();
}
});
},
});
}/**/
});
</script>
\ No newline at end of file
{extend name="base/header" /}
{block name="body"}
<style>
.layui-table .widthtd{ width: 120px;}
</style>
<div style="margin: 0px 10px">
<table class="layui-table">
<tbody>
<tr>
<td class="widthtd"><strong>资料名称</strong></td>
<td>{$info.title}</td>
<td class="widthtd"><strong>资料类型</strong></td>
<td>{$info.type_text}</td>
</tr>
<tr>
<td class="widthtd"><strong>发布者</strong></td>
<td>{$info.getuserdata.username}</td>
<td class="widthtd"><strong>类别</strong></td>
<td>{$info.studycatedata.title}</td>
</tr>
<tr>
<td class="widthtd"><strong>审核状态</strong></td>
<td >
{if $info.status == 1}
{$info.status_text} - {$info.status_desc}
{else /}
{$info.status_text}
{/if}
</td>
<td class="widthtd"><strong>创建时间</strong></td>
<td>{$info.createtime}</td>
</tr>
<tr>
<td class="widthtd"><strong>资料简介</strong></td>
<td colspan="4">{$info.description}</td>
</tr>
{if $info.type != 'content'}
<tr>
<td class="widthtd"><strong>附件</strong></td>
<td colspan="3">
<table class="layui-table">
<thead>
<tr>
<th>文件名称</th>
<th>大小</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>{$info.filepath.filename}</td>
<td>{$info.filepath.filesize}KB</td>
<td >
{in name="info.filepath.fileext" value="jpg,png,jpeg"}
<img src="{$info.filepath.fileurl}" width="50" height="50" class="imgclick">
{else/}
<a class="layui-btn layui-btn-xs" href="/admin/study.study_information/downloadfile?fileid={$info.filepath.fileid}" target="_blank">下载</a>
{/in}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
{/if}
</tbody>
</table>
{if $info.type == 'content'}
<div class="layui-tab layui-tab-card" lay-filter="proputdemotest">
<ul class="layui-tab-title">
<li class="layui-this">资料内容</li>
</ul>
<div class="layui-tab-content" style=" background: #fff;">
<div class="layui-tab-item layui-show">
<style>
.projectdetail{width: 95%; margin: 10px auto;}
.projectdetail img{ width: 100%; height: auto;}
</style>
<div class="projectdetail">
{$info.content|raw}
</div>
</div>
</div>
</div>
{/if}
</div>
{/block}
{block name="script"}
<script type="text/javascript">
$(".imgclick").click(function (){
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']});
});
var callbackdata = function () {
};
</script>
{/block}
\ No newline at end of file
<div class="layui-fluid">
<style>
#studycategoryTreeBar{padding:10px 15px;border:1px solid #e6e6e6;background-color:#f2f2f2}
#studycategoryTree{border:1px solid #e6e6e6;border-top:none;padding:10px 5px;overflow:auto;height:-webkit-calc(100vh - 205px);height:-moz-calc(100vh - 205px);height:calc(100vh - 205px)}
.layui-tree-entry .layui-tree-txt{padding:0 5px;border:1px transparent solid;text-decoration:none!important}
.layui-tree-entry.organ-tree-click .layui-tree-txt{background-color:#fff3e0;border:1px #ffe6b0 solid}
.files_itemwstudyinformation{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_itemwstudyinformation img{max-width:28px;max-height:28px;border:0}
</style>
<div class="layui-row layui-col-space15">
<div class="layui-col-md2">
<div class="layui-card">
<div class="layui-card-body" style="padding:10px;">
<!-- 树工具栏 -->
<!-- 左树 -->
<div id="studycategoryTree"></div>
</div>
</div>
</div>
<div class="layui-col-md10">
<div class="layui-card">
<div class="layui-card-header">
<form class="layui-form render">
<input type="hidden" name="groupid" id="studyinformation-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" style="width:250px;"><input type="text" name="user" placeholder="用户名,用户手机" autocomplete="off" class="layui-input" lay-affix="clear"/></div>
<div class="layui-inline" style="width:150px;">
<select name="status" id="statusselect-studyinformation">
<option value="">审核状态</option>
<option value="0" {php}if(input('status') === '0'){echo 'selected';}{/php}>审核中</option>
<option value="1" {php}if(input('status') == 1){echo 'selected';}{/php}>审核失败</option>
<option value="2" {php}if(input('status') == 2){echo 'selected';}{/php}>审核通过</option>
</select>
</div>
<div class="layui-inline">
<div class="layui-btn-group">
<button class="layui-btn" lay-submit lay-filter="search-studyinformation"><i class="layui-icon layui-icon-search"></i> 搜索</button>
<a class="layui-btn" lay-submit lay-filter="search-studyinformation-all" onclick="$('#studyinformation-groupid').val('')"><i class="layui-icon layui-icon-light"></i>全部</a>
</div>
</div>
</div>
</form>
</div>
<div class="layui-card-body">
<table lay-filter="studyinformation" id="studyinformation"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="studyinformationDemo">
<div class="layui-clear-space">
<a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
{{# if(d.status === 0) { }}
<a class="layui-btn layui-btn-xs" lay-event="shenhei">审核</a>
{{# } }}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</div>
</script>
<script type="text/html" id="studystatus-demo">
{{# if (d.status === 2) { }}
<a class="layui-btn layui-btn-xs layui-btn-normal" >{{=d.status_text}}</a>
{{# } else { }}
{{# if(d.status === 1) { }}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="statuserror">{{=d.status_text}}</a>
{{# } else { }}
<a class="layui-btn layui-btn-xs">{{=d.status_text}}</a>
{{# } }}
{{# } }}
</script>
<!--JS部分-->
<script>
layui.use(['vinfo', 'buildItems','dropdown'], function(){
var map_root = layui.cache.maps;
var app_root = map_root + 'study.study_information/';
var layer = layui.layer,table=layui.table,form=layui.form,admin=layui.admin;
var dropdown = layui.dropdown;
organData = admin.util.toTree({$category|raw});
doTree(organData,'');
function doTree(data,load){
layui.tree.render({
id: 'organTree',
elem: '#studycategoryTree',
data: data,
onlyIconControl: true,
click: function(obj){
$('#studycategoryTree').find('.organ-tree-click').removeClass('organ-tree-click');
$(obj.elem).children('.layui-tree-entry').addClass('organ-tree-click');
organObj = obj.data;
$('#studyinformation-groupid').val(obj.data.id);
table.reloadData('studyinformation',{where:{cate_id:obj.data.id},page:{curr:1}});
}
});
// var item = $('#studycategoryTree .layui-tree-entry:first');
// load ? item.find('.layui-tree-main>.layui-tree-txt').trigger('click') : item.addClass('organ-tree-click');
}
/*初始渲染*/
/*==============左树结构END==============*/
var status = $("#statusselect-studyinformation").val();
/*渲染数据*/
table.render({
elem: '#studyinformation',
page: true,
limit:{$limit},
height: 'full-258',
url: app_root+"index?&do=json",
// css: 'td .layui-table-cell{height:80px;line-height:80px;padding:0 5px;}',
where:{status:status},
cols: [[
{type:'checkbox',fixed:'left'},
{field:'id',width:50,unresize:true,align:'center',title:'ID',sort:!0},
{field:'title',align:'center',title:'资料名称'},
{field:'username',align:'center',width:130,title:'发布者',templet:'<div>{{= d.getuserdata.username}}</div>'},
{field:'cate_name',width:120,align:'center',title:'类别',templet:'<div>{{= d.studycatedata.title}}</div>'},
{field:'type_text',align:'center',width:130,title:'资料类型'},
{field:'price',align:'center',width:130,title:'金额'},
{field:'sh_status',width:100,align:'center',title:'审核状态',templet:'#studystatus-demo'},
{field:'createtime',width:120,align:'center',title:'发布时间'},
{fixed:'right',width:150,align:'center', templet: '#studyinformationDemo',title:'操作'}
]],
done: function(){ admin.vShow($('[lay-table-id="studyinformation"]'));
}
});
// 状态 - 开关操作
form.on('switch(is_sell-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(studyinformation)',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(studyinformation)', function(obj){
var data = obj.data;
var id = data.id;
if(obj.event === 'detail'){
studyinformationOpen(data.id);
}else if(obj.event === 'del'){
del(id);
}else if(obj.event === 'studyinformation-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'){
}else if(obj.event === 'sethot'){
// 在此处输入 layer 的任意代码
layer.open({
type: 2, // page 层类型
area: ['500px', '300px'],
title: "项目推荐",
shade: 0.6, // 遮罩透明度
shadeClose: true, // 点击遮罩区域,关闭弹层
btn: ['确定', '关闭'],
content: '/admin/studyinformation.studyinformation/tuijian?id='+id,
yes: function(index, layero){
var data = window["layui-layer-iframe" + index].callbackdata();
$.ajax({
method: "post",
url: layui.cache.maps+'/studyinformation.studyinformation/tuijian',
data: data,
dataType: "json",
success: function (res){
if(res.code===1) {
layer.msg(res.msg,{icon:1,shade:[0.4,'#000'],time:1500},function (){
layer.close(index);
table.reloadData('studyinformation');
});
}else{
layer.msg(res.msg,{icon:2,shade:[0.4,'#000'],time:1500},function (){
});
}
// layer.closeAll();
}
});
}
});
}else if(obj.event === 'shenhei'){
layer.confirm('选择审核状态?', {
btn: ['审核通过', '审核不通过'],
btn1: function(index, layero, that){
shajax(data.id,1);
},
btn2: function(index, layero, that){
layer.prompt({
formType: 2,
value: '',
title: '请输入失败原因',
}, function(value, index, elem){
shajax(data.id,2,value);
});
},
});
}else if(obj.event === 'statuserror'){
layer.alert(data.status_desc,{title:'失败原因'});
}
});/**/
/*删除*/
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('studyinformation');
});
},'post',{headersToken:true});
});
}/**/
/*顶部删除按钮*/
$('#studyinformation-del').on('click', function(){
var checkRows = table.checkStatus('studyinformation').data;
if(checkRows.length === 0){return layer.msg('请选择需删除的记录');}
var ids = checkRows.map(function(d){return d.id;});
console.log(ids);
del(ids);
});/**/
/*弹出窗*/
function studyinformationOpen(id='',type=''){
var title = "资料详情";
layer.open({
type: 2,
area: ['900px', '90%'],
title: title,
btn: ['确定', '关闭'],
content: app_root+'/detail?id='+id+'&type='+type,
yes: function(index, layero){
layer.close(index);
},
});
}/**/
function shajax(id,shstatus,errordesc=''){
$.ajax({
method: "post",
url: app_root+'/shenhestudyinfomation',
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('studyinformation');
});
}else{
layer.msg(res.msg,{icon:2,shade:[0.4,'#000'],time:1500},function (){
});
}
}
});
}
});
</script>
\ No newline at end of file
{extend name="base/header" /}
{block name="body"}
<style>
.layui-table .widthtd{ width: 120px;}
</style>
<div style="margin: 0px 20px 0px 0px; background: #fff;">
<form class="layui-form layui-form-pane" style="margin-top: 20px;" id="fjfrom">
<div class="layui-form-item" pane="">
<label class="layui-form-label">推荐</label>
<div class="layui-input-block">
<input type="checkbox" name="is_hot" value="1" title="热门" {eq name="$info.is_hot|default=''" value="1"} checked {/eq} >
<input type="checkbox" name="is_tj" value="1" title="推荐" {eq name="$info.is_tj|default=''" value="1"} checked {/eq} >
</div>
</div>
<input type="hidden" name="id" value="{$info.id|default=0}">
</form>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
var course_id = "{$info.id}";
layui.use(['buildItems', 'form'], function () {
var form=layui.form;
});
var callbackdata = function () {
var data = $(".layui-form").serialize();
return data;
};
</script>
{/block}
\ No newline at end of file
......@@ -119,7 +119,7 @@ class ShCourse extends BaseController
//添加课程
public function createShCourse(Request $request)
{
$filed = ['title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description'];
$filed = ['title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description','is_zb'];
$vo = (new ShCourseValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
......@@ -135,7 +135,7 @@ class ShCourse extends BaseController
//修改课程
public function editShCourse(Request $request)
{
$filed = ['course_id', 'title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description'];
$filed = ['course_id', 'title', 'cate_id', 'thumb', 'teacher_id', 'detailthumb', 'content','tag_ids','teacher_id','price','description','is_zb'];
$vo = (new ShCourseValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
......
<?php
namespace app\api\controller\manage;
use app\api\middleware\Auth;
use app\BaseController;
use app\model\StudyInformation as StudyInformationModel;
use app\model\StudyCategory;
use app\Request;
use think\facade\Db;
use app\api\validate\StudyInformationValidate;
class StudyInformation extends BaseController
{
protected $middleware = [
Auth::class,
];
//添加学习资料
public function addStudyInformation(Request $request)
{
$filed = ['title', 'type', 'file_id', 'content', 'price', 'cate_id', 'description'];
$vo = (new StudyInformationValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
}
$data = $request->only($filed);
$data['user_id'] = $request->userId;
$result = StudyInformationModel::create($data);
return $this->returnMsg('操作成功', 1, $result);
}
/*
* 编辑学习资料
*/
public function editStudyInformation(Request $request)
{
$filed = ['study_information_id', 'title', 'type', 'file_id', 'content', 'price', 'cate_id', 'description'];
$vo = (new StudyInformationValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
}
$parm = $request->param();
$info = StudyInformationModel::where(['id' => $parm['study_information_id'], 'user_id' => $request->userId])->find();
if ($info['status'] == 2) {
return $this->returnMsg('已审核不能编辑');
}
$udpatedata = $request->only($filed);
unset($udpatedata['study_information_id']);
$result = $info->save($udpatedata);
return $this->returnMsg('操作成功', 1, $result);
}
//删除学习资料
public function deleteStudyInformation(Request $request)
{
$filed = ['study_information_id'];
$vo = (new StudyInformationValidate())->goCheck($filed);
if ($vo !== true) {
return $vo;
}
$parm = $request->param();
$info = StudyInformationModel::where(['id' => $parm['study_information_id'], 'user_id' => $request->userId])->find();
if (empty($info)) {
return $this->returnMsg('不存在或无权删除');
}
$result = $info->delete();
return $this->returnMsg('操作成功', 1, $result);
}
//学习资料列表
public function listStudyInformation(Request $request)
{
$parm = $request->param();
$where = ['user_id' => $request->userId];
$map = [];
if (isset($parm['searchKeyWords']) && $parm['searchKeyWords']) {
$map[] = ['title', 'like', '%' . $parm['searchKeyWords'] . '%'];
}
if (isset($parm['status']) && ($parm['status'] || $parm['status'] === '0')) {
$map[] = ['status', '=', $parm['status']];
}
if (isset($parm['cate_id']) && $parm['cate_id']) {
$map[] = ['cate_id', '=', $parm['cate_id']];
}
$page = $request->param('page', 1);
$pageSize = $request->param('pageSize', 10);
$list = StudyInformationModel::where($where)->where($map)
->order('createtime desc')
->with(['filepath','studycatedata'])
->append(['status_text'])
->paginate([
'page' => $page,
'list_rows' => $pageSize
]);
return $this->returnMsg('success', 1, $list);
}
//修改学习资料属性
public function updatestudyinfomationinfo(Request $request)
{
$vo = (new StudyInformationValidate())->goCheck(['study_information_id', 'updateField', 'updateValue']);
if ($vo !== true) {
return $vo;
}
$parm = $request->param();
$where = ['id' => $parm['study_information_id'], 'user_id' => $request->userId];
if($parm['updateField'] == 'is_sell'){
$status = StudyInformationModel::where($where)->value('status');
if($status != 2){
return $this->returnMsg('审核未通过不能上下架');
}
}
$result = StudyInformationModel::where($where)->update([$parm['updateField'] => $parm['updateValue']]);
return $this->returnMsg('操作成功', 1, $result);
}
//学习资料分类列表
public function getStudyCategoryList()
{
$list = (new StudyCategory)->getStudyCategoryList();
return $this->returnMsg('操作成功', 1, $list);
}
}
\ No newline at end of file
......@@ -27,6 +27,7 @@ class User extends BaseController
$info = Business::where(['user_id' => $request->userId, 'is_del' => '0'])
->with(['businessQualification', 'businessfrsfzqian', 'businessfrsfzhou'])
->append(['provice_city'])
->find();
return $this->returnMsg('操作成功', 1, $info);
......@@ -38,6 +39,7 @@ class User extends BaseController
$info = School::where(['user_id' => $request->userId, 'is_del' => '0'])
->with(['schoolQualification', 'schoolfrsfzqian', 'schoolfrsfzhou'])
->append(['provice_city'])
->find();
return $this->returnMsg('操作成功', 1, $info);
......@@ -92,6 +94,9 @@ class User extends BaseController
}
$keyword = $request->param('keyword', '');
if ($keyword) {
$where['subject'] = ['like', "%{$keyword}%"];
}
$query = Payment::where($where)
// ->leftJoin('course c', "p.order_id = c.id AND p.order_type = 1")
......@@ -114,9 +119,7 @@ class User extends BaseController
->with(['getuserdata'])
->append(['pay_method_text','pay_status_text','pay_time_text']);
if ($keyword) {
$query = $query->where('p.subject', 'like', "%{$keyword}%");
}
$list = $query->order('createtime', 'desc')
->paginate([
......
<?php
namespace app\api\validate;
class StudyInformationValidate extends BaseValidate
{
protected $rule = [
'study_information_id' => 'require',
'title' => 'require',
'type' => 'require',
'cate_id' => 'require',
'price' => 'between:0,99999',
'file_id' => 'requireCallback:filecontentcheck',
'content' => 'requireCallback:contentcheck',
'updateField' => 'require|in:is_sell',
'updateValue' => 'require',
];
protected $message = [
'study_information_id.require' => '资料id不能为空',
'title.require' => '标题不能为空',
'cate_id.require' => '请选择分类',
'type.require' => '请选择类型',
'price.between' => '金额错误',
'file_id.requireCallback' => '请上传文件',
'content.requireCallback' => '请填写内容',
'updateField.require' => '必填项不能为空',
'updateValue.require' => '必填项不能为空',
];
protected function filecontentcheck($value, $data=[])
{
if ($data['type'] != 'content') {
return true;
}
}
protected function contentcheck($value, $data=[])
{
if ($data['type'] == 'content') {
return true;
}
}
}
\ No newline at end of file
......@@ -32,6 +32,7 @@ define('ADDON_PATH', ROOT_PATH . 'addons' . VT_DS);
define('RUNTIME_PATH', ROOT_PATH . 'runtime' . VT_DS);
use app\model\system\SystemUploadFile;
use app\model\system\SystemArea;
//获取图片地址
function get_upload_file($fileid = '', $datatype = '')
{
......@@ -50,7 +51,12 @@ function get_upload_file($fileid = '', $datatype = '')
}
//从阿里云
//获取地区名称
function get_area_name($areaid)
{
return SystemArea::where('areaid', $areaid)->value('areaname');
}
/**
* md5判断
......
<?php
if(!function_exists('parse_padding')){
function parse_padding($source)
{
$length = strlen(strval(count($source['source']) + $source['first']));
return 40 + ($length - 1) * 8;
}
}
if(!function_exists('parse_class')){
function parse_class($name)
{
$names = explode('\\', $name);
return '<abbr title="'.$name.'">'.end($names).'</abbr>';
}
}
if(!function_exists('parse_file')){
function parse_file($file, $line)
{
return '<a class="toggle" title="'."{$file} line {$line}".'">'.basename($file)." line {$line}".'</a>';
}
}
if(!function_exists('parse_args')){
function parse_args($args)
{
$result = [];
foreach ($args as $key => $item) {
switch (true) {
case is_object($item):
$value = sprintf('<em>object</em>(%s)', parse_class(get_class($item)));
break;
case is_array($item):
if(count($item) > 3){
$value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3)));
} else {
$value = sprintf('[%s]', parse_args($item));
}
break;
case is_string($item):
if(strlen($item) > 20){
$value = sprintf(
'\'<a class="toggle" title="%s">%s...</a>\'',
htmlentities($item),
htmlentities(substr($item, 0, 20))
);
} else {
$value = sprintf("'%s'", htmlentities($item));
}
break;
case is_int($item):
case is_float($item):
$value = $item;
break;
case is_null($item):
$value = '<em>null</em>';
break;
case is_bool($item):
$value = '<em>' . ($item ? 'true' : 'false') . '</em>';
break;
case is_resource($item):
$value = '<em>resource</em>';
break;
default:
$value = htmlentities(str_replace("\n", '', var_export(strval($item), true)));
break;
}
$result[] = is_int($key) ? $value : "'{$key}' => {$value}";
}
return implode(', ', $result);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>系统发生错误</title>
<meta name="robots" content="noindex,nofollow" />
<style>
/* Base */
body {
color: #333;
font: 16px Verdana, "Helvetica Neue", helvetica, Arial, 'Microsoft YaHei', sans-serif;
margin: 0;
padding: 0 20px 20px;
}
h1{
margin: 10px 0 0;
font-size: 28px;
font-weight: 500;
line-height: 32px;
}
h2{
color: #4288ce;
font-weight: 400;
padding: 6px 0;
margin: 6px 0 0;
font-size: 18px;
border-bottom: 1px solid #eee;
}
h3{
margin: 12px;
font-size: 16px;
font-weight: bold;
}
abbr{
cursor: help;
text-decoration: underline;
text-decoration-style: dotted;
}
a{
color: #868686;
cursor: pointer;
}
a:hover{
text-decoration: underline;
}
.line-error{
background: #f8cbcb;
}
.echo table {
width: 100%;
}
.echo pre {
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
background-color: #f7f7f7;
border: 0;
border-radius: 3px;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
}
.echo pre > pre {
padding: 0;
margin: 0;
}
/* Exception Info */
.exception {
margin-top: 20px;
}
.exception .message{
padding: 12px;
border: 1px solid #ddd;
border-bottom: 0 none;
line-height: 18px;
font-size:16px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";
}
.exception .code{
float: left;
text-align: center;
color: #fff;
margin-right: 12px;
padding: 16px;
border-radius: 4px;
background: #999;
}
.exception .source-code{
padding: 6px;
border: 1px solid #ddd;
background: #f9f9f9;
overflow-x: auto;
}
.exception .source-code pre{
margin: 0;
}
.exception .source-code pre ol{
margin: 0;
color: #4288ce;
display: inline-block;
min-width: 100%;
box-sizing: border-box;
font-size:14px;
font-family: "Century Gothic",Consolas,"Liberation Mono",Courier,Verdana;
padding-left: <?php echo (isset($source) && !empty($source)) ? parse_padding($source) : 40; ?>px;
}
.exception .source-code pre li{
border-left: 1px solid #ddd;
height: 18px;
line-height: 18px;
}
.exception .source-code pre code{
color: #333;
height: 100%;
display: inline-block;
border-left: 1px solid #fff;
font-size:14px;
font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";
}
.exception .trace{
padding: 6px;
border: 1px solid #ddd;
border-top: 0 none;
line-height: 16px;
font-size:14px;
font-family: Consolas,"Liberation Mono",Courier,Verdana,"微软雅黑";
}
.exception .trace ol{
margin: 12px;
}
.exception .trace ol li{
padding: 2px 4px;
}
.exception div:last-child{
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
/* Exception Variables */
.exception-var table{
width: 100%;
margin: 12px 0;
box-sizing: border-box;
table-layout:fixed;
word-wrap:break-word;
}
.exception-var table caption{
text-align: left;
font-size: 16px;
font-weight: bold;
padding: 6px 0;
}
.exception-var table caption small{
font-weight: 300;
display: inline-block;
margin-left: 10px;
color: #ccc;
}
.exception-var table tbody{
font-size: 13px;
font-family: Consolas,"Liberation Mono",Courier,"微软雅黑";
}
.exception-var table td{
padding: 0 6px;
vertical-align: top;
word-break: break-all;
}
.exception-var table td:first-child{
width: 28%;
font-weight: bold;
white-space: nowrap;
}
.exception-var table td pre{
margin: 0;
}
/* Copyright Info */
.copyright{
margin-top: 24px;
padding: 12px 0;
border-top: 1px solid #eee;
}
/* SPAN elements with the classes below are added by prettyprint. */
pre.prettyprint .pln { color: #000 } /* plain text */
pre.prettyprint .str { color: #080 } /* string content */
pre.prettyprint .kwd { color: #008 } /* a keyword */
pre.prettyprint .com { color: #800 } /* a comment */
pre.prettyprint .typ { color: #606 } /* a type name */
pre.prettyprint .lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
pre.prettyprint .pun, pre.prettyprint .opn, pre.prettyprint .clo { color: #660 }
pre.prettyprint .tag { color: #008 } /* a markup tag name */
pre.prettyprint .atn { color: #606 } /* a markup attribute name */
pre.prettyprint .atv { color: #080 } /* a markup attribute value */
pre.prettyprint .dec, pre.prettyprint .var { color: #606 } /* a declaration; a variable name */
pre.prettyprint .fun { color: red } /* a function name */
</style>
</head>
<body>
<div class="echo">
<?php echo $echo;?>
</div>
<?php if(\think\facade\App::isDebug()) { ?>
<div class="exception">
<div class="message">
<div class="info">
<div>
<h2>[<?php echo $code; ?>]&nbsp;<?php echo sprintf('%s in %s', parse_class($name), parse_file($file, $line)); ?></h2>
</div>
<div><h1><?php echo nl2br(htmlentities($message)); ?></h1></div>
</div>
</div>
<?php if(!empty($source)){?>
<div class="source-code">
<pre class="prettyprint lang-php"><ol start="<?php echo $source['first']; ?>"><?php foreach ((array) $source['source'] as $key => $value) { ?><li class="line-<?php echo $key + $source['first']; ?>"><code><?php echo htmlentities($value); ?></code></li><?php } ?></ol></pre>
</div>
<?php }?>
<div class="trace">
<h2>Call Stack</h2>
<ol>
<li><?php echo sprintf('in %s', parse_file($file, $line)); ?></li>
<?php foreach ((array) $trace as $value) { ?>
<li>
<?php
// Show Function
if($value['function']){
echo sprintf(
'at %s%s%s(%s)',
isset($value['class']) ? parse_class($value['class']) : '',
isset($value['type']) ? $value['type'] : '',
$value['function'],
isset($value['args'])?parse_args($value['args']):''
);
}
// Show line
if (isset($value['file']) && isset($value['line'])) {
echo sprintf(' in %s', parse_file($value['file'], $value['line']));
}
?>
</li>
<?php } ?>
</ol>
</div>
</div>
<?php } else { ?>
<div class="exception">
<div class="info"><h1><?php echo htmlentities($message); ?></h1></div>
</div>
<?php } ?>
<?php if(!empty($datas)){ ?>
<div class="exception-var">
<h2>Exception Datas</h2>
<?php foreach ((array) $datas as $label => $value) { ?>
<table>
<?php if(empty($value)){ ?>
<caption><?php echo $label; ?><small>empty</small></caption>
<?php } else { ?>
<caption><?php echo $label; ?></caption>
<tbody>
<?php foreach ((array) $value as $key => $val) { ?>
<tr>
<td><?php echo htmlentities($key); ?></td>
<td>
<?php
if(is_array($val) || is_object($val)){
echo htmlentities(json_encode($val, JSON_PRETTY_PRINT));
} else if(is_bool($val)) {
echo $val ? 'true' : 'false';
} else if(is_scalar($val)) {
echo htmlentities($val);
} else {
echo 'Resource';
}
?>
</td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
</table>
<?php } ?>
</div>
<?php } ?>
<?php if(!empty($tables)){ ?>
<div class="exception-var">
<h2>Environment Variables</h2>
<?php foreach ((array) $tables as $label => $value) { ?>
<table>
<?php if(empty($value)){ ?>
<caption><?php echo $label; ?><small>empty</small></caption>
<?php } else { ?>
<caption><?php echo $label; ?></caption>
<tbody>
<?php foreach ((array) $value as $key => $val) { ?>
<tr>
<td><?php echo htmlentities($key); ?></td>
<td>
<?php
if(is_array($val) || is_object($val)){
echo htmlentities(json_encode($val, JSON_PRETTY_PRINT));
} else if(is_bool($val)) {
echo $val ? 'true' : 'false';
} else if(is_scalar($val)) {
echo htmlentities($val);
} else {
echo 'Resource';
}
?>
</td>
</tr>
<?php } ?>
</tbody>
<?php } ?>
</table>
<?php } ?>
</div>
<?php } ?>
<?php if(\think\facade\App::isDebug()) { ?>
<script>
var LINE = <?php echo $line; ?>;
function $(selector, node){
var elements;
node = node || document;
if(document.querySelectorAll){
elements = node.querySelectorAll(selector);
} else {
switch(selector.substr(0, 1)){
case '#':
elements = [node.getElementById(selector.substr(1))];
break;
case '.':
if(document.getElementsByClassName){
elements = node.getElementsByClassName(selector.substr(1));
} else {
elements = get_elements_by_class(selector.substr(1), node);
}
break;
default:
elements = node.getElementsByTagName();
}
}
return elements;
function get_elements_by_class(search_class, node, tag) {
var elements = [], eles,
pattern = new RegExp('(^|\\s)' + search_class + '(\\s|$)');
node = node || document;
tag = tag || '*';
eles = node.getElementsByTagName(tag);
for(var i = 0; i < eles.length; i++) {
if(pattern.test(eles[i].className)) {
elements.push(eles[i])
}
}
return elements;
}
}
$.getScript = function(src, func){
var script = document.createElement('script');
script.async = 'async';
script.src = src;
script.onload = func || function(){};
$('head')[0].appendChild(script);
}
;(function(){
var files = $('.toggle');
var ol = $('ol', $('.prettyprint')[0]);
var li = $('li', ol[0]);
// 短路径和长路径变换
for(var i = 0; i < files.length; i++){
files[i].ondblclick = function(){
var title = this.title;
this.title = this.innerHTML;
this.innerHTML = title;
}
}
// 设置出错行
var err_line = $('.line-' + LINE, ol[0])[0];
err_line.className = err_line.className + ' line-error';
$.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function(){
prettyPrint();
// 解决Firefox浏览器一个很诡异的问题
// 当代码高亮后,ol的行号莫名其妙的错位
// 但是只要刷新li里面的html重新渲染就没有问题了
if(window.navigator.userAgent.indexOf('Firefox') >= 0){
ol[0].innerHTML = ol[0].innerHTML;
}
});
})();
</script>
<?php } ?>
</body>
</html>
......@@ -249,7 +249,7 @@ class Project extends Model
{
return $this->hasOne(SystemUploadFile::class, 'fileid', 'thumb')
->where('isdel',0)
->field('fileid,filename,filesize,fileurl,filetype');
->field('fileid,filename,filesize,fileurl,filetype,storage');
}
......
<?php
/**
* ===========================================================================
* Veitool 快捷开发框架系统
* Author: Niaho 26843818@qq.com
* Copyright (c)2019-2025 www.veitool.com All rights reserved.
* Licensed: 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
* ---------------------------------------------------------------------------
*/
namespace app\model;
use app\model\system\SystemUploadFile;
use think\facade\Db;
use think\Model;
use think\model\concern\SoftDelete;
use tool\Tree;
/**
* 模型公用类
*/
class StudyCategory extends Model
{
use SoftDelete;
protected $deleteTime = 'deletetime';
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
public function catetree($cate_id = 0)
{
$category = $this->order('sort desc')->select()->toArray();
$tree = new Tree();
$tree->icon = ['&nbsp;&nbsp;│ ', '&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;└─ '];
$tree->nbsp = '&nbsp;&nbsp;';
$str = "<option value=@id @selected @disabled>@spacer @title</option>";
$tree->init($category);
$categorydata = $tree->getTree(0, $str, $cate_id);
return $categorydata;
}
public function getThumbpathAttr($value, $data)
{
return get_upload_file($data['thumb']);
}
public function children()
{
return $this->hasMany(StudyCategory::class, 'pid');
}
public function thumb()
{
return $this->hasOne(SystemUploadFile::class, 'fileid', 'thumb')
->where('isdel',0)
->field('fileid,filename,filesize,fileurl,filetype,storage');
}
public function getStudyCategoryList($pid = 0)
{
return $this->with(['children' => function($query) {
$query->order('sort', 'desc');
$query->with(['thumb']);
},'thumb'])
->where('pid', $pid)
->order('sort', 'desc')
->select();
}
}
\ 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 app\api\service\UtilService;
use app\model\project\User;
use app\model\system\SystemUploadFile;
use think\facade\Db;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 课程模型
*/
class StudyInformation extends Model
{
use SoftDelete;
protected $deleteTime = 'deletetime';
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
public function getStatusTextAttr($value, $data)
{
switch ($data['status']) {
case 1:
$statustxt = '审核失败';
break;
case 2:
$statustxt = '审核成功';
break;
default:
$statustxt = '待审核';
}
return $statustxt;
}
public function getTypeTextAttr($value, $data)
{
switch ($data['type']) {
case 'content':
$statustxt = '文本';
break;
default:
$statustxt = $data['type'];
}
return $statustxt;
}
public function studycatedata()
{
return $this->hasOne(StudyCategory::class, 'id', 'cate_id')
->field('id,title');
}
//用户信息
public function getuserdata()
{
return $this->belongsTo(User::class, 'user_id')
->field('username,mobile,id');
}
//附件
public function filepath()
{
return $this->hasOne(SystemUploadFile::class, 'fileid', 'file_id')
->where('isdel',0);
}
}
\ No newline at end of file
......@@ -120,6 +120,12 @@ class Business extends Model
return $data['province'].'-'.$data['city'].'-'.$data['area'];
}
//所在地区
public function getProviceCityAttr($value, $data)
{
return get_area_name($data['province']).'-'.get_area_name($data['city']);
}
public function getStatusTextAttr($value, $data)
{
switch ($data['status']) {
......
......@@ -115,7 +115,13 @@ class School extends Model
//详细地址
public function getAddressxxAttr($value, $data)
{
return $data['province'].'-'.$data['city'].'-'.$data['area'];
return get_area_name($data['province']).'-'.get_area_name($data['city']).'-'.$data['area'];
}
//所在地区
public function getProviceCityAttr($value, $data)
{
return get_area_name($data['province']).'-'.get_area_name($data['city']);
}
public function getStatusTextAttr($value, $data)
......
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