This commit is contained in:
wangjinlei
2020-11-13 10:10:23 +08:00
parent d4925b37b5
commit ba50974c16
1494 changed files with 298911 additions and 0 deletions

1
application/.htaccess Normal file
View File

@@ -0,0 +1 @@
deny from all

33
application/build.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 生成应用公共文件
'__file__' => ['common.php', 'config.php', 'database.php'],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'demo' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => ['User', 'UserType'],
'view' => ['index/index'],
],
// 其他更多的模块定义
// 定义api模块的自动生成
'api'=>[
'__dir__' => ['behavior','controller','model','widget'],
'controller'=> ['Index','Test','UserType'],
'model' => ['User','UserType'],
'view' => ['index/index','index/test'],
],
];

12
application/command.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [];

134
application/common.php Normal file
View File

@@ -0,0 +1,134 @@
<?php
use PHPMailer\PHPMailer\PHPMailer;
use think\Db;
//use TCPDF;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用公共文件
function authcode($str) {
$key = substr(md5('ThinkPHP.CN'), 5, 8);
$str1 = substr(md5($str), 8, 10);
return md5($key . $str1);
}
/**
* @function sendEmail
* @intro 发送邮件(带附件)
* @param $email 接收邮箱
* @param $title 邮件标题
* @param $from_name 发件人
* @param $content 邮件内容
* @param $memail 邮件内容
* @param $mpassword 邮件内容
* @param $attachmentFile 附件 string | array
* @return array
*/
function sendEmail($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
date_default_timezone_set('PRC');
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//charset
$mail->CharSet = 'UTF-8';
//Set the hostname of the mail server
$mail->Host = "smtp.qiye.aliyun.com"; //请填写你的邮箱服务器
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25; //端口号
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
//Password to use for SMTP authentication
$mail->Password = $mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
//Set who the message is to be sent from
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set an alternative reply-to address(用户直接回复邮件的地址)
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
//Set who the message is to be sent to
$mail->addAddress($email);
//Set the subject line
$mail->Subject = $title;
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($content);
//Replace the plain text body with one created manually
$mail->AltBody = '';
if (is_array($attachmentFile)) {
for ($i = 0; $i < count($attachmentFile); $i++) {
$mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
}
} else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, 'thanks.pdf');
}
}
//send the message, check for errors
if (!$mail->send()) {
$status = 0;
$data = "邮件发送失败" . $mail->ErrorInfo;
;
} else {
$status = 1;
$data = "邮件发送成功";
}
return ['status' => $status, 'data' => $data]; //返回值(可选)
}
/**
* 生成文章sn号
* @return type
*/
function getArticleSN($abbr,$type) {
$str = $abbr;
$str .= date('Y', time()).$type.date('md', time());
$where['accept_sn'] = ['like', "$str%"];
$nowres = Db::name('article')->where($where)->select();
$last_num = 1;
if ($nowres) {
foreach ($nowres as $v) {
$now_num = intval(substr($v['accept_sn'], -3));
$last_num = $now_num > $last_num ? $now_num : $last_num;
}
$last_num += 1;
}
$last_str = sprintf("%03d", $last_num);
$str .= $last_str;
return $str;
}
/**
* 增加usermsg
*/
function add_usermsg($userid, $content, $url) {
$msg_obj = Db::name('user_msg');
$msg_info = $msg_obj->where('user_id', $userid)
->where('url', $url)
->where('state', 0)
->find();
if ($msg_info) {
return true;
}
$msgdata['user_id'] = $userid;
$msgdata['content'] = $content;
$msgdata['url'] = $url;
$msgdata['ctime'] = time();
return $msg_obj->insert($msgdata);
}

273
application/config.php Normal file
View File

@@ -0,0 +1,273 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
// 应用调试模式
'app_debug' => true,
// 应用Trace
'app_trace' => false,
// 应用模式状态
'app_status' => '',
// 是否支持多模块
'app_multi_module' => true,
// 入口自动绑定模块
'auto_bind_module' => false,
// 注册的根命名空间
'root_namespace' => [],
// 扩展函数文件
'extra_file_list' => [THINK_PATH . 'helper' . EXT],
// 默认输出类型
'default_return_type' => 'html',
// 默认AJAX 数据返回格式,可选json xml ...
'default_ajax_return' => 'json',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
// 默认时区
'default_timezone' => 'PRC',
// 是否开启多语言
'lang_switch_on' => false,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀
'class_suffix' => false,
// 控制器类后缀
'controller_suffix' => false,
// +----------------------------------------------------------------------
// | 模块设置
// +----------------------------------------------------------------------
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
'deny_module_list' => ['common'],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 默认验证器
'default_validate' => '',
// 默认的空控制器名
'empty_controller' => 'Error',
// 操作方法后缀
'action_suffix' => '',
// 自动搜索控制器
'controller_auto_search' => false,
// +----------------------------------------------------------------------
// | URL设置
// +----------------------------------------------------------------------
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => false,
// URL参数方式 0 按名称成对解析 1 按顺序解析
'url_param_type' => 0,
// 是否开启路由
'url_route_on' => true,
// 路由使用完整匹配
'route_complete_match' => false,
// 路由配置文件(支持配置多个)
'route_config_file' => ['route'],
// 是否开启路由解析缓存
'route_check_cache' => false,
// 是否强制使用路由
'url_route_must' => false,
// 域名部署
'url_domain_deploy' => false,
// 域名根如thinkphp.cn
'url_domain_root' => '',
// 是否自动转换URL中的控制器和操作名
'url_convert' => true,
// 默认的访问控制器层
'url_controller_layer' => 'controller',
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// 全局请求缓存排除规则
'request_cache_except' => [],
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
'template' => [
// 模板引擎类型 支持 php think 支持扩展
'type' => 'Think',
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写
'auto_rule' => 1,
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DS,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
],
// 视图输出字符串内容替换
'view_replace_str' => [],
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
// +----------------------------------------------------------------------
// | 异常及错误设置
// +----------------------------------------------------------------------
// 异常页面的模板文件
'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => '',
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
'log' => [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => LOG_PATH,
// 日志记录级别
'level' => [],
],
// +----------------------------------------------------------------------
// | Trace设置 开启 app_trace 后 有效
// +----------------------------------------------------------------------
'trace' => [
// 内置Html Console 支持扩展
'type' => 'Html',
],
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
'cache' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => CACHE_PATH,
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
],
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
'session' => [
'id' => '',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// SESSION 前缀
'prefix' => 'think',
// 驱动方式 支持redis memcache memcached
'type' => '',
// 是否自动开启 SESSION
'auto_start' => true,
],
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
'cookie' => [
// cookie 名称前缀
'prefix' => '',
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
],
//分页配置
'paginate' => [
'type' => 'bootstrap',
'var_page' => 'page',
'list_rows' => 15,
],
//验证码配置(用户注册)
'captcha' => [
//验证码的字符集
'codeSet' => '1234567890',
//设置验证码大小
'fontSize' => 12,
//设置图片的高度、宽度
'imageW' => 140,
'imageH' => 30,
//验证码位数
'length' =>5,
//验证成功后重置
'reset' =>false,
'useNoise'=>false
],
//验证码配置(密码找回)
'captcha_retrieve' => [
//验证码的字符集
'codeSet' => '1234567890',
//设置验证码大小
'fontSize' => 12,
//设置图片的高度、宽度
'imageW' => 93,
'imageH' => 30,
//验证码位数
'length' =>4,
//验证成功后重置
'reset' =>false,
'useNoise'=>false
],
];

58
application/database.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
// 'hostname' => 'tmrdatebase.cubychyntk7p.ap-southeast-1.rds.amazonaws.com',
'hostname' => 'localhost',
// 数据库名
'database' => 'journal',
// 用户名
// 'username' => 'tmradmin',
'username' => 'root',
// 密码
// 'password' => 'UhUKzkifVWkTnoJ63Qfs',
'password' => 'root',
// 端口
'hostport' => '3306',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'j_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 自动读取主库数据
'read_master' => false,
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
];

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,5 @@
<?php
//配置文件
return [
];

View File

@@ -0,0 +1,10 @@
<?php
namespace app\demo\controller;
class Index
{
public function index()
{
return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_bd568ce7058a1091"></thinkad>';
}
}

View File

@@ -0,0 +1,7 @@
<?php
namespace app\demo\controller;
class Test
{
}

View File

@@ -0,0 +1,7 @@
<?php
namespace app\demo\controller;
class UserType
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\demo\model;
use think\Model;
class User extends Model
{
}

View File

@@ -0,0 +1,9 @@
<?php
namespace app\demo\model;
use think\Model;
class UserType extends Model
{
}

View File

33
application/extra/doc.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
return [
'title' => "journal接口文档", //文档title
'version'=>'1.0.0', //文档版本
'copyright'=>'Powered By 王金磊', //版权信息
'password' => '', //访问密码,为空不需要密码
//静态资源路径--默认为云上路径解决很多人nginx配置问题
//可将assets目录拷贝到public下面具体路径课自行配置
'static_path' => '',
'controller' => [
//需要生成文档的类
'app\master\controller\Admin',
'app\master\controller\Journal',
'app\master\controller\Mysystem'
],
'filter_method' => [
//过滤 不解析的方法名称
'_empty'
],
'return_format' => [
//数据格式
'code' => "0/1",
'msg' => "message",
],
'public_header' => [
//全局公共头部参数
//如:['name'=>'version', 'require'=>1, 'default'=>'', 'desc'=>'版本号(全局)']
],
'public_param' => [
//全局公共请求参数,设置了所以的接口会自动增加次参数
//如:['name'=>'token', 'type'=>'string', 'require'=>1, 'default'=>'', 'other'=>'' ,'desc'=>'验证(全局)')']
],
];

View File

@@ -0,0 +1,23 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [
// 'connector' => 'Sync'
'connector' => 'Redis', // Redis 驱动
'expire' => null, // 任务的过期时间默认为60秒; 若要禁用,则设置为 null
'default' => 'mail', // 默认的队列名称
'host' => '127.0.0.1', // redis 主机ip
'port' => 6379, // redis 端口
'password' => '', // redis 密码
'select' => 0, // 使用哪一个 db默认为 db0
'timeout' => 0, // redis连接的超时时间
'persistent' => false, // 是否是长连接
];

View File

@@ -0,0 +1,10 @@
<?php
namespace app\index\controller;
class Index
{
public function index()
{
return '<style type="text/css">*{ padding: 0; margin: 0; } .think_default_text{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ad_bd568ce7058a1091"></think>';
}
}

View File

@@ -0,0 +1 @@
<?php

View File

@@ -0,0 +1,5 @@
<?php
//配置文件
return [
];

View File

@@ -0,0 +1,220 @@
<?php
namespace app\master\controller;
use think\Controller;
use think\Db;
/**
* @title 管理员接口
* @description 管理员相关操作
* @group 管理员相关
*/
class Admin extends Controller
{
protected $admin_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->admin_obj = Db::name('admin');
}
public function index()
{
}
/**
* @title 测试demo接口
* @description 接口说明
* @author 开发者
* @url /index/demo
* @method GET
*
* @header name:device require:1 default: desc:设备号
*
* @param name:id type:int require:1 default:1 other: desc:唯一ID
*
* @return name:名称
* @return mobile:手机号
* @return list_messages:消息列表@
* @list_messages message_id:消息ID content:消息内容
* @return object:对象信息@!
* @object attribute1:对象属性1 attribute2:对象属性2
* @return array:数组值#
* @return list_user:用户列表@
* @list_user name:名称 mobile:手机号 list_follow:关注列表@
* @list_follow user_id:用户id name:名称
*/
public function demo()
{
//接口代码
$device = $this->request->header('device');
echo json_encode(["code"=>200, "message"=>"success", "data"=>['device'=>$device]]);
}
/**
* @title 管理员登陆
* @description 管理员登陆
* @author wangjinlei
* @url /master/Admin/login
* @method POST
*
*
* @param name:account type:string require:1
* @param name:password type:string require:1
*
* @return account:名称
* @return phone:手机号
* @return realname:真是姓名
* @return role:角色(0管理员1编辑)
*/
public function login(){
$data = $this->request->post();
$where['account'] = $data['account'];
$where['password'] = md5($data['password']);
$res = $this->admin_obj->where($where)->find();
if($res){
return json(['code'=>0,'msg'=>'','data'=>$res]);
}else{
return json(['code'=>1,'msg'=>'account or password error!']);
}
}
/**
* @title 更改密码
* @description 更改密码
* @author wangjinlei
* @url /master/Admin/changepasswd
* @method POST
*
*
* @param name:account type:string require:1
* @param name:password type:string require:1
* @param name:new_password type:string require:1
* @param name:re_password type:string require:1
*
*/
public function changepasswd(){
$data = $this->request->post();
//验证密码是否一致
if($data['new_password']!=$data['re_password']){
return json(['code'=>1,'msg'=>'The two passwords do not match']);
}
//验证用户名密码是否正确
$check_res = $this->admin_obj->where('account',$data['account'])->where('password', md5($data['password']))->find();
if($check_res==null){
return json(['code'=>1,'msg'=>'account or password is error!']);
}
//修改逻辑
$this->admin_obj->where('account',$data['account'])->update(['password'=> md5($data['new_password'])]);
return json(['code'=>0,'msg'=>'success']);
}
/**
* @title 获取管理员信息
* @description 获取管理员信息
* @author wangjinlei
* @url /master/Admin/getAdminBase
* @method POST
*
*
* @param name:account type:string require:1
*
* @return account:名称
* @return phone:手机号
* @return realname:真实姓名
* @return role:角色(0管理员1编辑)
*/
public function getAdminBase(){
$data = $this->request->post();
$res = $this->admin_obj->where('account',$data['account'])->find();
return json(['code'=>0,'msg'=>'success','data'=>$res]);
}
/**
* @title 管理员信息修改
* @description 管理员信息修改
* @author wangjinlei
* @url /master/Admin/editAdminBase
* @method POST
*
*
* @param name:account type:string require:1
* @param name:password type:string require:1 desc:密码
* @param name:realname type:string require:1
* @param name:phone type:string require:1
*
*/
public function editAdminBase(){
$data = $this->request->post();
$this->admin_obj->where('account',$data['account'])->update(['realname'=>$data['realname'],'password'=> md5($data['password']),'phone'=>$data['phone']]);
return json(['code'=>0,'msg'=>'success']);
}
/**
* @title 添加管理员
* @description 添加管理员
* @author wangjinlei
* @url /master/Admin/addAdmin
* @method POST
*
*
* @param name:account type:string require:1
* @param name:password type:string require:1 desc:密码
* @param name:realname type:string require:1
* @param name:phone type:string require:1
* @param name:role type:int require:1 default:1 desc:角色0admin1editor
*
*/
public function addAdmin(){
$data = $this->request->post();
$add_data['account'] = trim($data['account']);
$add_data['password'] = md5($data['password']);
$add_data['realname'] = $data['realname'];
$add_data['phone'] = $data['phone'];
$add_data['role'] = $data['role'];
$res = $this->admin_obj->insert($add_data);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title 获取管理员列表
* @description 获取管理员列表
* @author wangjinlei
* @url /master/Admin/getAdminList
* @method POST
*
*
* @return adminlist:管理员列表@
* @adminlist account:账号 realname:真实姓名 role:角色 phone:电话
*
*/
public function getAdminList(){
$list = $this->admin_obj->where('state',0)->select();
return json(['code'=>0,'msg'=>'success','adminlist'=>$list]);
}
/**
* @title 删除管理员
* @description 删除管理员
* @author wangjinlei
* @url /master/Admin/delAdmin
* @method POST
*
* @param name:admin_id type:int require:1 desc:管理员主键
*
*/
public function delAdmin(){
$data = $this->request->post();
$res = $this->admin_obj->where('admin_id',$data['admin_id'])->update(['state'=>1]);
return json(['code'=>0,'msg'=>'success']);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace app\master\controller;
class Index
{
public function index()
{
echo THINK_VERSION;
// return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_bd568ce7058a1091"></thinkad>';
}
}

View File

@@ -0,0 +1,212 @@
<?php
namespace app\master\controller;
use think\Controller;
use think\Db;
/**
* @title 期刊接口
* @description 期刊相关操作
* @group 期刊相关
*/
class Journal extends Controller {
//put your code here
protected $admin_obj = '';
protected $journal_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->admin_obj = Db::name('admin');
$this->journal_obj = Db::name('journal');
}
/**
* @title 获取期刊列表
* @description 获取期刊列表
* @author wangjinlei
* @url /master/Journal/getJournalList
* @method POST
*
*
* @return journalList:期刊列表@
* @journalList title:标题 issn:issn editorinchief:editorinchief acceptance:acceptance finaldecision:finaldecision apc:apc
*
*/
public function getJournalList(){
$res = $this->journal_obj->field('j_journal.*,j_admin.realname realname')->join('j_admin','j_admin.admin_id = j_journal.editor_id','LEFT')->where('j_journal.state',0)->order('j_journal.sort desc')->select();
return json(['code'=>0,'msg'=>'success','data'=>['journalList'=>$res]]);
}
/**
* @title 添加期刊
* @description 添加期刊
* @author wangjinlei
* @url /master/Journal/addJournal
* @method POST
*
* @param name:title type:string require:1 desc:标题
* @param name:issn type:string require:1
* @param name:editorinchief type:string require:1
* @param name:acceptance type:string require:1 desc:受理度
* @param name:finaldecision type:string require:1 desc:最终受理
* @param name:sort type:int require:1 detault:0 desc:权重值
* @param name:apc type:string require:1
* @param name:icon type:string require:1
* @param name:editor_id type:int require:1 desc:编辑id
* @param name:system_color type:string require:1
* @param name:submission_url type:string require:1
*
*/
public function addJournal(){
$data = $this->request->post();
$insert_data['title'] = $data['title'];
$insert_data['issn'] = $data['issn'];
$insert_data['editorinchief'] = $data['editorinchief'];
$insert_data['acceptance'] = $data['acceptance'];
$insert_data['finaldecision'] = $data['finaldecision'];
$insert_data['sort'] = $data['sort'];
$insert_data['apc'] = $data['apc'];
$insert_data['icon'] = $data['icon'];
$insert_data['editor_id'] = $data['editor_id'];
$insert_data['system_color'] = $data['system_color'];
$insert_data['submission_url'] = $data['submission_url'];
$res = $this->journal_obj->insert($insert_data);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title 获取期刊详情
* @description 获取期刊详情
* @author wangjinlei
* @url /master/Journal/getJournalDetail
* @method POST
*
* @param name:journal_id require:1 desc:主键
*
* @return
*
*/
public function getJournalDetail(){
// $data = $this->request->post();
// $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
}
/**
* @title 删除期刊
* @description 删除期刊
* @author wangjinlei
* @url /master/Journal/delJournal
* @method POST
*
* @param name:journal_id require:1 desc:主键
*
*/
public function delJournal(){
$data = $this->request->post();
$res = $this->journal_obj->where('journal_id',$data['journal_id'])->update(['state'=>1]);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title 修改期刊详情
* @description 修改期刊详情
* @author wangjinlei
* @url /master/Journal/editJournalDetail
* @method POST
*
* @param name:journal_id require:1 desc:主键
* @param name:title type:string require:1 desc:标题
* @param name:issn type:string require:1
* @param name:editorinchief type:string require:1
* @param name:acceptance type:string require:1 desc:受理度
* @param name:finaldecision type:string require:1 desc:最终受理
* @param name:sort type:int require:1 detault:0 desc:权重值
* @param name:apc type:string require:1
* @param name:icon type:string require:1
* @param name:editor_id type:int require:1 desc:编辑id
* @param name:system_color type:string require:1
* @param name:submission_url type:string require:1
*
*/
public function editJournalDetail(){
$data = $this->request->post();
$insert_data['title'] = $data['title'];
$insert_data['issn'] = $data['issn'];
$insert_data['editorinchief'] = $data['editorinchief'];
$insert_data['acceptance'] = $data['acceptance'];
$insert_data['finaldecision'] = $data['finaldecision'];
$insert_data['sort'] = $data['sort'];
$insert_data['apc'] = $data['apc'];
$insert_data['icon'] = $data['icon'];
$insert_data['editor_id'] = $data['editor_id'];
$insert_data['system_color'] = $data['system_color'];
$insert_data['submission_url'] = $data['submission_url'];
$res = $this->journal_obj->where('journal_id',$data['journal_id'])->update($insert_data);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'Please confirm you have changed the journal information.']);
}
}
/**
* @title 获取编辑列表
* @description 获取编辑列表
* @author wangjinlei
* @url /master/Journal/getEditorList
* @method POST
*
*
* @return editorList:编辑列表@
* @editorList account:账号 realname:真实姓名 role:角色代号0admin1editor
*
*/
public function getEditorList(){
$editor_list = $this->admin_obj->where('role',1)->select();
return json(['code'=>0,'msg'=>'success','data'=>['editorList'=>$editor_list]]);
}
/**
* @title 图片上传
* @description 图片上传
* @author wangjinlei
* @url /master/Journal/up_file
* @method POST
*
* @param name:name type:string require:1 default:journalicon desc:文件域名称
*
*
* @return upurl:图片地址
*
*/
public function up_file() {
$file = request()->file('journalicon');
if ($file) {
$info = $file->move(ROOT_PATH . 'public' . DS . 'journalicon');
if ($info) {
return json(['code'=>0 , 'msg'=>'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
} else {
return json(['code' => 1, 'msg' => $file->getError()]);
}
}
}
}

View File

@@ -0,0 +1,184 @@
<?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 = '';
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');
}
/**
* @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!']);
}
}
}

21
application/route.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
'__pattern__' => [
'name' => '\w+',
],
'[hello]' => [
':id' => ['index/hello', ['method' => 'get'], ['id' => '\d+']],
':name' => ['index/hello', ['method' => 'post']],
],
];

28
application/tags.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return [
// 应用初始化
'app_init' => [],
// 应用开始
'app_begin' => [],
// 模块初始化
'module_init' => [],
// 操作开始执行
'action_begin' => [],
// 视图内容过滤
'view_filter' => [],
// 日志写入
'log_write' => [],
// 应用结束
'app_end' => [],
];