667 lines
22 KiB
PHP
667 lines
22 KiB
PHP
<?php
|
||
namespace app\master\controller;
|
||
|
||
use think\Controller;
|
||
use think\Db;
|
||
|
||
/**
|
||
* @title 系统接口
|
||
* @description 系统相关操作
|
||
* @group 系统相关
|
||
*/
|
||
class Mysystem extends Controller {
|
||
//put your code here
|
||
protected $admin_obj = '';
|
||
protected $sys_obj = '';
|
||
protected $sys_abs_obj = '';
|
||
protected $sys_scient_obj = '';
|
||
protected $sys_book_obj = '';
|
||
protected $sys_not_obj = '';
|
||
protected $de_topic_obj = '';
|
||
protected $de_topic_to_article = '';
|
||
|
||
public function __construct(\think\Request $request = null) {
|
||
parent::__construct($request);
|
||
$this->admin_obj = Db::name('admin');
|
||
$this->sys_obj = Db::name('system');
|
||
$this->sys_abs_obj = Db::name('system_abstracting');
|
||
$this->sys_scient_obj = Db::name('system_scient');
|
||
$this->sys_book_obj = Db::name('system_books');
|
||
$this->sys_not_obj = Db::name('system_notices');
|
||
$this->de_topic_obj = Db::name('de_topic');
|
||
$this->de_topic_to_article = Db::name('de_topic_to_article');
|
||
}
|
||
|
||
/**
|
||
* @title 获取系统基本信息
|
||
* @description 获取系统基本信息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getSysBase
|
||
* @method POST
|
||
*
|
||
* @return account:copyright
|
||
* @return phone:email
|
||
* @return realname:website
|
||
*/
|
||
public function getSysBase(){
|
||
$res = $this->sys_obj->where('system_id = 1')->find();
|
||
return json(['code'=>0,'msg'=>'success','data'=>$res]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑系统基本信息
|
||
* @description 编辑系统基本信息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editSysBase
|
||
* @method POST
|
||
*
|
||
*
|
||
* @param name:copyright type:string require:1
|
||
* @param name:email type:string require:1
|
||
* @param name:website type:string require:1
|
||
*
|
||
*/
|
||
public function editSysBase(){
|
||
$data = $this->request->post();
|
||
$this->sys_obj->where('system_id = 1')->update(['copyright'=>$data['copyright'],'email'=>$data['email'],'website'=>$data['website']]);
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}
|
||
|
||
/**
|
||
* @title 获取abs列表
|
||
* @description 获取abs列表
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getAbsList
|
||
* @method POST
|
||
*
|
||
*
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return count:总数据数
|
||
* @return abslist:数据@
|
||
* @abslist title:标题 url:地址 sort:权重 is_show:是否显示(1显示0不显示)
|
||
*
|
||
*/
|
||
public function getAbsList(){
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$res = $this->sys_abs_obj
|
||
->order('sort desc')
|
||
->limit($limit_start,$data['pageSize'])
|
||
->select();
|
||
$count = $this->sys_abs_obj->count();
|
||
return json(['code'=>0,'msg'=>'success','data'=>['count'=>$count,'abslist'=>$res]]);
|
||
}
|
||
|
||
/**
|
||
* @title 增加abs
|
||
* @description 增加abs
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addAbs
|
||
* @method POST
|
||
*
|
||
*
|
||
* @param name:title type:int require:1 desc:标题
|
||
* @param name:url type:string require:1 desc:地址
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
* @param name:is_show type:int require:1 default:1 desc:是否显示(1yes0no)
|
||
*
|
||
*
|
||
*/
|
||
public function addAbs(){
|
||
$data = $this->request->post();
|
||
$add_data['title'] = $data['title'];
|
||
$add_data['url'] = $data['url'];
|
||
$add_data['sort'] = $data['sort']?$data['sort']:0;
|
||
$add_data['is_show'] = $data['is_show'];
|
||
$res = $this->sys_abs_obj->insert($add_data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error!']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 获取abs详情
|
||
* @description 获取abs详情
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getAbsDetail
|
||
* @method POST
|
||
*
|
||
*
|
||
* @param name:system_abstracting_id type:int require:1 desc:id主键
|
||
*
|
||
* @return system_abstracting_id:主键
|
||
* @return title:标题
|
||
* @return url:地址
|
||
* @return sort:权重
|
||
* @return is_show:是否显示(1显示2不显示)
|
||
*
|
||
*/
|
||
public function getAbsDetail(){
|
||
$data = $this->request->post();
|
||
$res = $this->sys_abs_obj->where('system_abstracting_id',$data['system_abstracting_id'])->find();
|
||
return json(['code'=>0,'msg'=>'success','data'=>$res]);
|
||
}
|
||
|
||
|
||
/**
|
||
* @title 更改abs详情
|
||
* @description 更改abs详情
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editAbs
|
||
* @method POST
|
||
*
|
||
*
|
||
* @param name:system_abstracting_id type:int require:1 desc:id主键
|
||
* @param name:title type:int require:1 desc:标题
|
||
* @param name:url type:string require:1 desc:地址
|
||
* @param name:sort type:int require:1 default:0 desc:权重
|
||
*/
|
||
public function editAbs(){
|
||
$data = $this->request->post();
|
||
$res = $this->sys_abs_obj->update($data);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error!']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 更改abs显示状态
|
||
* @description 更改abs显示状态
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/changeShow
|
||
* @method POST
|
||
*
|
||
* @param name:system_abstracting_id type:int require:1 desc:id主键
|
||
* @param name:is_show type:int require:1 desc:id主键
|
||
*/
|
||
public function changeShow(){
|
||
$data = $this->request->post();
|
||
$res = $this->sys_abs_obj->where('system_abstracting_id',$data['system_abstracting_id'])->update(['is_show'=>$data['is_show']]);
|
||
if($res){
|
||
return json(['code'=>0,'msg'=>'success']);
|
||
}else{
|
||
return json(['code'=>1,'msg'=>'system error!']);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 图片上传
|
||
* @description 图片上传
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/up_file
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 default:system desc:文件域名称
|
||
*
|
||
* @return upurl:图片地址
|
||
*/
|
||
public function up_file() {
|
||
$file = request()->file('system');
|
||
if ($file) {
|
||
$info = $file->move(ROOT_PATH . 'public' . DS . 'system');
|
||
if ($info) {
|
||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||
} else {
|
||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||
}
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @title 增加scient
|
||
* @description 增加scient
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addScient
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 desc:名字
|
||
* @param name:intro type:string require:1 desc:简介
|
||
* @param name:icon type:string require:1 desc:头像
|
||
*/
|
||
public function addScient(){
|
||
$data = $this->request->post();
|
||
$insert['name'] = $data['name'];
|
||
$insert['intro'] = $data['intro'];
|
||
$insert['icon'] = $data['icon'];
|
||
$this->sys_scient_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除scient
|
||
* @description 删除scient
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/delScient
|
||
* @method POST
|
||
*
|
||
* @param name:system_scient_id type:int require:1 desc:主键id
|
||
*/
|
||
public function delScient(){
|
||
$data = $this->request->post();
|
||
$this->sys_scient_obj->where('system_scient_id',$data['system_scient_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑scient
|
||
* @description 编辑scient
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editScient
|
||
* @method POST
|
||
*
|
||
* @param name:system_scient_id type:int require:1 desc:主键id
|
||
* @param name:name type:string require:1 desc:名字
|
||
* @param name:intro type:string require:1 desc:简介
|
||
* @param name:icon type:string require:1 desc:头像
|
||
*/
|
||
public function editScient(){
|
||
$data = $this->request->post();
|
||
$update['name'] = $data['name'];
|
||
$update['intro'] = $data['intro'];
|
||
$update['icon'] = $data['icon'];
|
||
$this->sys_scient_obj->where('system_scient_id',$data['system_scient_id'])->update($update);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取scient
|
||
* @description 获取scient
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getScient
|
||
* @method POST
|
||
*
|
||
* @return scients:array#
|
||
*/
|
||
public function getScient(){
|
||
$list = $this->sys_scient_obj->where('state',0)->select();
|
||
|
||
$re['scients'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 增加book
|
||
* @description 增加book
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addBook
|
||
* @method POST
|
||
*
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:language type:string require:1 desc:语言
|
||
* @param name:author type:string require:1 desc:作者
|
||
* @param name:isbn type:string require:1
|
||
* @param name:price type:string require:1
|
||
* @param name:pdf type:string require:1 desc:pdf地址
|
||
* @param name:phone type:string require:1
|
||
* @param name:icon type:string require:1 desc:书皮图片
|
||
* @param name:sale_icon type:string require:1 desc:销售二维码
|
||
* @param name:sale_url type:string require:1 desc:销售链接
|
||
*
|
||
*/
|
||
public function addBook(){
|
||
$data = $this->request->post();
|
||
$insert['title'] = $data['title'];
|
||
$insert['language'] = $data['language'];
|
||
$insert['author'] = $data['author'];
|
||
$insert['isbn'] = $data['isbn'];
|
||
$insert['price'] = $data['price'];
|
||
$insert['pdf'] = $data['pdf'];
|
||
$insert['phone'] = $data['phone'];
|
||
$insert['icon'] = $data['icon'];
|
||
$insert['sale_icon'] = $data['sale_icon'];
|
||
$insert['sale_url'] = $data['sale_url'];
|
||
$this->sys_book_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除book
|
||
* @description 删除book
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/delBook
|
||
* @method POST
|
||
*
|
||
* @param name:system_book_id type:int require:1 desc:主键
|
||
*
|
||
*/
|
||
public function delBook(){
|
||
$data = $this->request->post();
|
||
$this->sys_book_obj->where('system_book_id',$data['system_book_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑book
|
||
* @description 编辑book
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editBook
|
||
* @method POST
|
||
*
|
||
* $param name:system_book_id type:int require:1 desc:主键
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:language type:string require:1 desc:语言
|
||
* @param name:author type:string require:1 desc:作者
|
||
* @param name:isbn type:string require:1
|
||
* @param name:pdf type:string require:1 desc:pdf地址
|
||
* @param name:price type:string require:1
|
||
* @param name:phone type:string require:1
|
||
* @param name:icon type:string require:1 desc:书皮图片
|
||
* @param name:sale_icon type:string require:1 desc:销售二维码
|
||
* @param name:sale_url type:string require:1 desc:销售链接
|
||
*/
|
||
public function editBook(){
|
||
$data = $this->request->post();
|
||
$upload['title'] = $data['title'];
|
||
$upload['language'] = $data['language'];
|
||
$upload['author'] = $data['author'];
|
||
$upload['isbn'] = $data['isbn'];
|
||
$upload['pdf'] = $data['pdf'];
|
||
$upload['price'] = $data['price'];
|
||
$upload['phone'] = $data['phone'];
|
||
$upload['icon'] = $data['icon'];
|
||
$upload['sale_icon'] = $data['sale_icon'];
|
||
$upload['sale_url'] = $data['sale_url'];
|
||
$this->sys_book_obj->where('system_book_id',$data['system_book_id'])->update($upload);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取book
|
||
* @description 获取book
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getBooks
|
||
* @method POST
|
||
*
|
||
* @return books:array#
|
||
*/
|
||
public function getBooks(){
|
||
$list = $this->sys_book_obj->where('state',0)->select();
|
||
$re['books'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 增加出版集团消息
|
||
* @description 增加出版集团消息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addNotices
|
||
* @method POST
|
||
*
|
||
* @param name:title type:string require:1 desc:消息标题
|
||
* @param name:content type:string require:1 desc:内容
|
||
* @param name:icon type:string require:1 desc:图标
|
||
* @param name:ctime type:string require:1 desc:时间
|
||
*/
|
||
public function addNotices(){
|
||
$data = $this->request->post();
|
||
$insert['title'] = $data['title'];
|
||
$insert['content'] = $data['content'];
|
||
$insert['icon'] = $data['icon'];
|
||
$insert['ctime'] = $data['ctime']==''?time():strtotime($data['ctime']);
|
||
$this->sys_not_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除出版集团消息
|
||
* @description 删除出版集团消息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/delNotices
|
||
* @method POST
|
||
*
|
||
* @param name:system_notices_id type:int require:1 desc:消息id
|
||
*/
|
||
public function delNotices(){
|
||
$data = $this->request->post();
|
||
$this->sys_not_obj->where('system_notices_id',$data['system_notices_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑出版集团消息
|
||
* @description 编辑出版集团消息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editNotices
|
||
* @method POST
|
||
*
|
||
* @param name:system_notices_id type:int require:1 desc:消息标题
|
||
* @param name:title type:string require:1 desc:消息标题
|
||
* @param name:icon type:string require:1 desc:图标
|
||
* @param name:content type:string require:1 desc:内容
|
||
*/
|
||
public function editNotices(){
|
||
$data = $this->request->post();
|
||
$update['title'] = $data['title'];
|
||
$update['icon'] = $data['icon'];
|
||
$update['content'] = $data['content'];
|
||
$this->sys_not_obj->where('system_notices_id',$data['system_notices_id'])->update($update);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取出版集团消息
|
||
* @description 获取出版集团消息
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getNotices
|
||
* @method POST
|
||
*
|
||
* @return notices:消息array#
|
||
*/
|
||
public function getNotices(){
|
||
$data = $this->request->post();
|
||
$list = $this->sys_not_obj->where('state',0)->select();
|
||
$re['notices'] = $list;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 增加总话题
|
||
* @description 增加总话题
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addTopic
|
||
* @method POST
|
||
*
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:intro type:string require:0 desc:简介
|
||
* @param name:icon type:string require:1 desc:图片地址
|
||
*
|
||
*/
|
||
public function addTopic(){
|
||
$data = $this->request->post();
|
||
$insert['title'] = trim($data['title']);
|
||
$insert['intro'] = isset($data['intro'])?trim($data['intro']):'';
|
||
$insert['icon'] = $data['icon'];
|
||
$this->de_topic_obj->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除总话题
|
||
* @description 删除总话题
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/delTopic
|
||
* @method POST
|
||
*
|
||
* @param name:de_topic_id type:int require:1 desc:主键id
|
||
*
|
||
*/
|
||
public function delTopic(){
|
||
$data = $this->request->post();
|
||
$this->de_topic_obj->where('de_topic_id',$data['de_topic_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 编辑总话题
|
||
* @description 编辑总话题
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/editTopic
|
||
* @method POST
|
||
*
|
||
* @param name:de_topic_id type:int require:1 desc:主键id
|
||
* @param name:title type:string require:1 desc:标题
|
||
* @param name:intro type:string require:0 desc:简介
|
||
* @param name:icon type:string require:1 desc:图片地址
|
||
*
|
||
*/
|
||
public function editTopic(){
|
||
$data = $this->request->post();
|
||
$update['title'] = trim($data['title']);
|
||
$update['intro'] = isset($data['intro'])?trim($data['intro']):'';
|
||
$update['icon'] = $data['icon'];
|
||
$this->de_topic_obj->where('de_topic_id',$data['de_topic_id'])->update($update);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取总话题列表
|
||
* @description 获取总话题列表
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getTopicList
|
||
* @method POST
|
||
*
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return topics:topic@
|
||
* @return count:总数
|
||
* @topics title:标题 intro:简介 icon:图片路径
|
||
*/
|
||
public function getTopicList(){
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$list = $this->de_topic_obj->where('state',0)->limit($limit_start,$data['pageSize'])->select();
|
||
$count = $this->de_topic_obj->where('state',0)->count();
|
||
|
||
$re['topics'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 添加话题文章对应关系
|
||
* @description 添加话题文章对应关系
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/addTopicToArticle
|
||
* @method POST
|
||
*
|
||
* @param name:de_topic_id type:int require:1 desc:话题id
|
||
* @param name:article_id type:int require:1 desc:文章id
|
||
*/
|
||
public function addTopicToArticle(){
|
||
$data = $this->request->post();
|
||
$insert['de_article_id'] = $data['de_article_id'];
|
||
$insert['article_id'] = $data['article_id'];
|
||
$this->de_topic_to_article->insert($insert);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 删除话题文章对应关系
|
||
* @description 删除话题文章对应关系
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/delTopicToArticle
|
||
* @method POST
|
||
*
|
||
* @param name:de_topic_to_article_id type:int require:1 desc:对应关系id
|
||
*/
|
||
public function delTopicToArticle(){
|
||
$data = $this->request->post();
|
||
$this->de_topic_to_article->where('de_topic_to_article_id',$data['de_topic_to_article_id'])->update(['state'=>1]);
|
||
return jsonSuccess([]);
|
||
}
|
||
|
||
/**
|
||
* @title 获取话题通过文章
|
||
* @description 获取话题通过文章
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getTopicByArticle
|
||
* @method POST
|
||
*
|
||
* @param name:article_id type:int require:1 desc:文章id
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return topics:topic@
|
||
* @return count:总数
|
||
* @topics title:标题 intro:简介 icon:图片路径
|
||
*/
|
||
public function getTopicByArticle(){
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$list = $this->de_topic_to_article
|
||
->field('j_de_topic.*')
|
||
->join('j_de_topic','j_de_topic_to_article.de_topic_id = j_de_topic.de_topic_id','LEFT')
|
||
->where('j_de_topic_to_article.article_id',$data['article_id'])
|
||
->where('j_de_topic_to_article.state',0)
|
||
->limit($limit_start,$data['pageSize'])
|
||
->select();
|
||
$count = $this->de_topic_to_article->where('state',0)->where('article_id',$data['article_id'])->count();
|
||
|
||
$re['topics'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title 获取文章通过话题
|
||
* @description 获取文章通过话题
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/getArticleByTopic
|
||
* @method POST
|
||
*
|
||
* @param name:de_topic_id type:int require:1 desc:话题id
|
||
* @param name:pageIndex type:int require:1 desc:当前页码数
|
||
* @param name:pageSize type:int require:1 desc:单页数据条数
|
||
*
|
||
* @return articles:article@
|
||
* @return count:总数
|
||
* @articles title:标题 type:类型 icon:图片路径 doi:doi号
|
||
*/
|
||
public function getArticleByTopic(){
|
||
$data = $this->request->post();
|
||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||
$list = $this->de_topic_to_article
|
||
->field('j_article.*')
|
||
->join('j_article','j_de_topic_to_article.article_id = j_article.article_id','LEFT')
|
||
->where('j_de_topic_to_article.de_topic_id',$data['de_topic_id'])
|
||
->where('j_de_topic_to_article.state',0)
|
||
->limit($limit_start,$data['pageSize'])
|
||
->select();
|
||
$count = $this->de_topic_to_article->where('state',0)->where('de_topic_id',$data['de_topic_id'])->count();
|
||
|
||
$re['articles'] = $list;
|
||
$re['count'] = $count;
|
||
return jsonSuccess($re);
|
||
}
|
||
|
||
/**
|
||
* @title pdf上传
|
||
* @description pdf上传
|
||
* @author wangjinlei
|
||
* @url /master/Mysystem/up_pdf_file
|
||
* @method POST
|
||
*
|
||
* @param name:name type:string require:1 default:bookpdf desc:文件域名称
|
||
*
|
||
* @return upurl:图片地址
|
||
*/
|
||
public function up_pdf_file() {
|
||
$file = request()->file('bookpdf');
|
||
if ($file) {
|
||
$info = $file->move(ROOT_PATH . 'public' . DS . 'bookpdf');
|
||
if ($info) {
|
||
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||
} else {
|
||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||
}
|
||
}
|
||
}
|
||
}
|