20201112
This commit is contained in:
@@ -1,33 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 生成应用公共文件
|
// 生成应用公共文件
|
||||||
'__file__' => ['common.php', 'config.php', 'database.php'],
|
'__file__' => ['common.php', 'config.php', 'database.php'],
|
||||||
|
|
||||||
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
|
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
|
||||||
'demo' => [
|
'demo' => [
|
||||||
'__file__' => ['common.php'],
|
'__file__' => ['common.php'],
|
||||||
'__dir__' => ['behavior', 'controller', 'model', 'view'],
|
'__dir__' => ['behavior', 'controller', 'model', 'view'],
|
||||||
'controller' => ['Index', 'Test', 'UserType'],
|
'controller' => ['Index', 'Test', 'UserType'],
|
||||||
'model' => ['User', 'UserType'],
|
'model' => ['User', 'UserType'],
|
||||||
'view' => ['index/index'],
|
'view' => ['index/index'],
|
||||||
],
|
],
|
||||||
// 其他更多的模块定义
|
// 其他更多的模块定义
|
||||||
|
|
||||||
// 定义api模块的自动生成
|
// 定义api模块的自动生成
|
||||||
'api'=>[
|
'api'=>[
|
||||||
'__dir__' => ['behavior','controller','model','widget'],
|
'__dir__' => ['behavior','controller','model','widget'],
|
||||||
'controller'=> ['Index','Test','UserType'],
|
'controller'=> ['Index','Test','UserType'],
|
||||||
'model' => ['User','UserType'],
|
'model' => ['User','UserType'],
|
||||||
'view' => ['index/index','index/test'],
|
'view' => ['index/index','index/test'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,142 +1,177 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use PHPMailer\PHPMailer\PHPMailer;
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
use think\Db;
|
use think\Db;
|
||||||
//use TCPDF;
|
//use TCPDF;
|
||||||
|
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: 流年 <liu21st@gmail.com>
|
// | Author: 流年 <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// 应用公共文件
|
// 应用公共文件
|
||||||
function authcode($str) {
|
function authcode($str) {
|
||||||
$key = substr(md5('ThinkPHP.CN'), 5, 8);
|
$key = substr(md5('ThinkPHP.CN'), 5, 8);
|
||||||
$str1 = substr(md5($str), 8, 10);
|
$str1 = substr(md5($str), 8, 10);
|
||||||
return md5($key . $str1);
|
return md5($key . $str1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function sendEmail
|
* @function sendEmail
|
||||||
* @intro 发送邮件(带附件)
|
* @intro 发送邮件(带附件)
|
||||||
* @param $email 接收邮箱
|
* @param $email 接收邮箱
|
||||||
* @param $title 邮件标题
|
* @param $title 邮件标题
|
||||||
* @param $from_name 发件人
|
* @param $from_name 发件人
|
||||||
* @param $content 邮件内容
|
* @param $content 邮件内容
|
||||||
* @param $memail 邮件内容
|
* @param $memail 邮件内容
|
||||||
* @param $mpassword 邮件内容
|
* @param $mpassword 邮件内容
|
||||||
* @param $attachmentFile 附件 (string | array)
|
* @param $attachmentFile 附件 (string | array)
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function sendEmail($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
|
function sendEmail($email = '', $title = '', $from_name = '', $content = '', $memail = '', $mpassword = '', $attachmentFile = '') {
|
||||||
date_default_timezone_set('PRC');
|
date_default_timezone_set('PRC');
|
||||||
//Create a new PHPMailer instance
|
//Create a new PHPMailer instance
|
||||||
$mail = new PHPMailer;
|
$mail = new PHPMailer;
|
||||||
//Tell PHPMailer to use SMTP
|
//Tell PHPMailer to use SMTP
|
||||||
$mail->isSMTP();
|
$mail->isSMTP();
|
||||||
//Enable SMTP debugging
|
//Enable SMTP debugging
|
||||||
// 0 = off (for production use)
|
// 0 = off (for production use)
|
||||||
// 1 = client messages
|
// 1 = client messages
|
||||||
// 2 = client and server messages
|
// 2 = client and server messages
|
||||||
$mail->SMTPDebug = 0;
|
$mail->SMTPDebug = 0;
|
||||||
//Ask for HTML-friendly debug output
|
//Ask for HTML-friendly debug output
|
||||||
$mail->Debugoutput = 'html';
|
$mail->Debugoutput = 'html';
|
||||||
//charset
|
//charset
|
||||||
$mail->CharSet = 'UTF-8';
|
$mail->CharSet = 'UTF-8';
|
||||||
//Set the hostname of the mail server
|
//Set the hostname of the mail server
|
||||||
$mail->Host = "smtp.qiye.aliyun.com"; //请填写你的邮箱服务器
|
$mail->Host = "smtp.qiye.aliyun.com"; //请填写你的邮箱服务器
|
||||||
//Set the SMTP port number - likely to be 25, 465 or 587
|
//Set the SMTP port number - likely to be 25, 465 or 587
|
||||||
$mail->Port = 25; //端口号
|
$mail->Port = 25; //端口号
|
||||||
//Whether to use SMTP authentication
|
//Whether to use SMTP authentication
|
||||||
$mail->SMTPAuth = true;
|
$mail->SMTPAuth = true;
|
||||||
//Username to use for SMTP authentication
|
//Username to use for SMTP authentication
|
||||||
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
|
$mail->Username = $memail == '' ? "tmrweb@tmrjournals.com" : $memail; //发件邮箱用户名
|
||||||
//Password to use for SMTP authentication
|
//Password to use for SMTP authentication
|
||||||
$mail->Password = $mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
|
$mail->Password = $mpassword == '' ? "Wu999999tmrwe" : $mpassword; //发件邮箱密码
|
||||||
//Set who the message is to be sent from
|
//Set who the message is to be sent from
|
||||||
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
$mail->setFrom($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||||
//Set an alternative reply-to address(用户直接回复邮件的地址)
|
//Set an alternative reply-to address(用户直接回复邮件的地址)
|
||||||
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
$mail->addReplyTo($memail == '' ? "tmrweb@tmrjournals.com" : $memail, $from_name);
|
||||||
//Set who the message is to be sent to
|
//Set who the message is to be sent to
|
||||||
$mail->addAddress($email);
|
$mail->addAddress($email);
|
||||||
//Set the subject line
|
//Set the subject line
|
||||||
$mail->Subject = $title;
|
$mail->Subject = $title;
|
||||||
//Read an HTML message body from an external file, convert referenced images to embedded,
|
//Read an HTML message body from an external file, convert referenced images to embedded,
|
||||||
//convert HTML into a basic plain-text alternative body
|
//convert HTML into a basic plain-text alternative body
|
||||||
$mail->msgHTML($content);
|
$mail->msgHTML($content);
|
||||||
//Replace the plain text body with one created manually
|
//Replace the plain text body with one created manually
|
||||||
$mail->AltBody = '';
|
$mail->AltBody = '';
|
||||||
if (is_array($attachmentFile)) {
|
if (is_array($attachmentFile)) {
|
||||||
for ($i = 0; $i < count($attachmentFile); $i++) {
|
for ($i = 0; $i < count($attachmentFile); $i++) {
|
||||||
$mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
|
$mail->addAttachment($attachmentFile[$i], 'thanks.pdf' . $i); //这里可以是多维数组,然后循环附件的文件和名称
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($attachmentFile != '') {
|
if ($attachmentFile != '') {
|
||||||
//Attach an image file
|
//Attach an image file
|
||||||
$mail->addAttachment($attachmentFile, 'thanks.pdf');
|
$mail->addAttachment($attachmentFile, 'thanks.pdf');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//send the message, check for errors
|
//send the message, check for errors
|
||||||
if (!$mail->send()) {
|
if (!$mail->send()) {
|
||||||
$status = 0;
|
$status = 0;
|
||||||
$data = "邮件发送失败" . $mail->ErrorInfo;
|
$data = "邮件发送失败" . $mail->ErrorInfo;
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
$status = 1;
|
$status = 1;
|
||||||
$data = "邮件发送成功";
|
$data = "邮件发送成功";
|
||||||
}
|
}
|
||||||
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
return ['status' => $status, 'data' => $data]; //返回值(可选)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成文章sn号
|
* 生成文章sn号
|
||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
function getArticleSN($abbr,$type) {
|
function getArticleSN($abbr,$type) {
|
||||||
$str = $abbr;
|
$str = $abbr;
|
||||||
$str .= date('Y', time()).$type.date('md', time());
|
$str .= date('Y', time()).$type.date('md', time());
|
||||||
$where['accept_sn'] = ['like', "$str%"];
|
$where['accept_sn'] = ['like', "$str%"];
|
||||||
$nowres = Db::name('article')->where($where)->select();
|
$nowres = Db::name('article')->where($where)->select();
|
||||||
$last_num = 1;
|
$last_num = 1;
|
||||||
if ($nowres) {
|
if ($nowres) {
|
||||||
foreach ($nowres as $v) {
|
foreach ($nowres as $v) {
|
||||||
$now_num = intval(substr($v['accept_sn'], -3));
|
$now_num = intval(substr($v['accept_sn'], -3));
|
||||||
$last_num = $now_num > $last_num ? $now_num : $last_num;
|
$last_num = $now_num > $last_num ? $now_num : $last_num;
|
||||||
}
|
}
|
||||||
$last_num += 1;
|
$last_num += 1;
|
||||||
}
|
}
|
||||||
$last_str = sprintf("%03d", $last_num);
|
$last_str = sprintf("%03d", $last_num);
|
||||||
$str .= $last_str;
|
$str .= $last_str;
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加usermsg
|
* 增加usermsg
|
||||||
*/
|
*/
|
||||||
function add_usermsg($userid, $content, $url) {
|
function add_usermsg($userid, $content, $url) {
|
||||||
$msg_obj = Db::name('user_msg');
|
$msg_obj = Db::name('user_msg');
|
||||||
$msg_info = $msg_obj->where('user_id', $userid)
|
$msg_info = $msg_obj->where('user_id', $userid)
|
||||||
->where('url', $url)
|
->where('url', $url)
|
||||||
->where('state', 0)
|
->where('state', 0)
|
||||||
->find();
|
->find();
|
||||||
if ($msg_info) {
|
if ($msg_info) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$msgdata['user_id'] = $userid;
|
$msgdata['user_id'] = $userid;
|
||||||
$msgdata['content'] = $content;
|
$msgdata['content'] = $content;
|
||||||
$msgdata['url'] = $url;
|
$msgdata['url'] = $url;
|
||||||
$msgdata['ctime'] = time();
|
$msgdata['ctime'] = time();
|
||||||
return $msg_obj->insert($msgdata);
|
return $msg_obj->insert($msgdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonSuccess($data){
|
function jsonSuccess($data){
|
||||||
return json(['code'=>0,'msg'=>'success','data'=>$data]);
|
return json(['code'=>0,'msg'=>'success','data'=>$data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonError($msg){
|
function jsonError($msg){
|
||||||
return json(['code'=>1,'msg'=>$msg]);
|
return json(['code'=>1,'msg'=>$msg]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function myPost($url, $param=array()){
|
||||||
|
|
||||||
|
if(!is_array($param)){
|
||||||
|
|
||||||
|
throw new Exception("参数必须为array");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$httph =curl_init($url);
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_SSL_VERIFYHOST, 1);
|
||||||
|
|
||||||
|
curl_setopt($httph,CURLOPT_RETURNTRANSFER,1);
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_POST, 1);//设置为POST方式
|
||||||
|
|
||||||
|
curl_setopt($httph, CURLOPT_POSTFIELDS, $param);
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_RETURNTRANSFER,0);
|
||||||
|
|
||||||
|
// curl_setopt($httph, CURLOPT_HEADER,1);
|
||||||
|
|
||||||
|
$rst=curl_exec($httph);
|
||||||
|
|
||||||
|
curl_close($httph);
|
||||||
|
|
||||||
|
return $rst;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +1,58 @@
|
|||||||
<?php
|
<?php
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// | Author: liu21st <liu21st@gmail.com>
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// 数据库类型
|
// 数据库类型
|
||||||
'type' => 'mysql',
|
'type' => 'mysql',
|
||||||
// 服务器地址
|
// 服务器地址
|
||||||
// 'hostname' => 'tmrdatebase.cubychyntk7p.ap-southeast-1.rds.amazonaws.com',
|
// 'hostname' => 'tmrdatebase.cubychyntk7p.ap-southeast-1.rds.amazonaws.com',
|
||||||
'hostname' => 'localhost',
|
'hostname' => 'localhost',
|
||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => 'journal',
|
'database' => 'journal',
|
||||||
// 用户名
|
// 用户名
|
||||||
// 'username' => 'tmradmin',
|
// 'username' => 'tmradmin',
|
||||||
'username' => 'root',
|
'username' => 'root',
|
||||||
// 密码
|
// 密码
|
||||||
// 'password' => 'UhUKzkifVWkTnoJ63Qfs',
|
// 'password' => 'UhUKzkifVWkTnoJ63Qfs',
|
||||||
'password' => 'root',
|
'password' => 'root',
|
||||||
// 端口
|
// 端口
|
||||||
'hostport' => '3306',
|
'hostport' => '3306',
|
||||||
// 连接dsn
|
// 连接dsn
|
||||||
'dsn' => '',
|
'dsn' => '',
|
||||||
// 数据库连接参数
|
// 数据库连接参数
|
||||||
'params' => [],
|
'params' => [],
|
||||||
// 数据库编码默认采用utf8
|
// 数据库编码默认采用utf8
|
||||||
'charset' => 'utf8',
|
'charset' => 'utf8',
|
||||||
// 数据库表前缀
|
// 数据库表前缀
|
||||||
'prefix' => 'j_',
|
'prefix' => 'j_',
|
||||||
// 数据库调试模式
|
// 数据库调试模式
|
||||||
'debug' => true,
|
'debug' => true,
|
||||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||||
'deploy' => 0,
|
'deploy' => 0,
|
||||||
// 数据库读写是否分离 主从式有效
|
// 数据库读写是否分离 主从式有效
|
||||||
'rw_separate' => false,
|
'rw_separate' => false,
|
||||||
// 读写分离后 主服务器数量
|
// 读写分离后 主服务器数量
|
||||||
'master_num' => 1,
|
'master_num' => 1,
|
||||||
// 指定从服务器序号
|
// 指定从服务器序号
|
||||||
'slave_no' => '',
|
'slave_no' => '',
|
||||||
// 自动读取主库数据
|
// 自动读取主库数据
|
||||||
'read_master' => false,
|
'read_master' => false,
|
||||||
// 是否严格检查字段是否存在
|
// 是否严格检查字段是否存在
|
||||||
'fields_strict' => true,
|
'fields_strict' => true,
|
||||||
// 数据集返回类型
|
// 数据集返回类型
|
||||||
'resultset_type' => 'array',
|
'resultset_type' => 'array',
|
||||||
// 自动写入时间戳字段
|
// 自动写入时间戳字段
|
||||||
'auto_timestamp' => false,
|
'auto_timestamp' => false,
|
||||||
// 时间字段取出后的默认时间格式
|
// 时间字段取出后的默认时间格式
|
||||||
'datetime_format' => 'Y-m-d H:i:s',
|
'datetime_format' => 'Y-m-d H:i:s',
|
||||||
// 是否需要进行SQL性能分析
|
// 是否需要进行SQL性能分析
|
||||||
'sql_explain' => false,
|
'sql_explain' => false,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ return [
|
|||||||
'app\api\controller\Article',
|
'app\api\controller\Article',
|
||||||
'app\api\controller\Special',
|
'app\api\controller\Special',
|
||||||
'app\api\controller\Main',
|
'app\api\controller\Main',
|
||||||
'app\super\controller\Main'
|
'app\super\controller\Publish'
|
||||||
],
|
],
|
||||||
'filter_method' => [
|
'filter_method' => [
|
||||||
//过滤 不解析的方法名称
|
//过滤 不解析的方法名称
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ use think\Db;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 总监Main接口
|
* @title 总监Main接口
|
||||||
* @description 文章web相关操作
|
* @description 总监Main接口
|
||||||
* @group 文章web相关
|
* @group 总监Main接口
|
||||||
*/
|
*/
|
||||||
class Publish extends Controller
|
class Publish extends Controller{
|
||||||
|
|
||||||
{
|
const JURL = 'http://www.tougao.com/api/Article/getArticleForJournal';
|
||||||
|
// const JURL = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getJournalCites';
|
||||||
|
|
||||||
protected $admin_obj = '';
|
protected $admin_obj = '';
|
||||||
protected $journal_obj = '';
|
protected $journal_obj = '';
|
||||||
protected $article_obj = '';
|
protected $article_obj = '';
|
||||||
@@ -29,7 +31,9 @@ class Publish extends Controller
|
|||||||
protected $journal_paper_art_obj = '';
|
protected $journal_paper_art_obj = '';
|
||||||
protected $subscribe_journal_obj = '';
|
protected $subscribe_journal_obj = '';
|
||||||
protected $subscribe_topic_obj = '';
|
protected $subscribe_topic_obj = '';
|
||||||
|
protected $super_danger_obj = '';
|
||||||
|
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null) {
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
$this->admin_obj = Db::name('admin');
|
$this->admin_obj = Db::name('admin');
|
||||||
@@ -49,19 +53,100 @@ class Publish extends Controller
|
|||||||
$this->journal_paper_art_obj = Db::name('journal_paper_art');
|
$this->journal_paper_art_obj = Db::name('journal_paper_art');
|
||||||
$this->subscribe_journal_obj = Db::name('subscribe_journal');
|
$this->subscribe_journal_obj = Db::name('subscribe_journal');
|
||||||
$this->subscribe_topic_obj = Db::name('subscribe_topic');
|
$this->subscribe_topic_obj = Db::name('subscribe_topic');
|
||||||
|
$this->super_danger_obj = Db::name('super_danger');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取期刊列表
|
||||||
|
* @description 获取期刊列表
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /super/Publish/getMain
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @return journals:期刊信息array#
|
||||||
|
*/
|
||||||
public function getMain(){
|
public function getMain(){
|
||||||
|
$journals = $this->journal_obj->where('state',0)->select();
|
||||||
|
foreach ($journals as $k => $v){
|
||||||
|
$journals[$k]['mark'] = $this->calMark($v['journal_id']);
|
||||||
|
$last_stage = $this->journal_stage_obj
|
||||||
|
->where('journal_id',$v['journal_id'])
|
||||||
|
->where('is_publish',1)
|
||||||
|
->where('state',0)
|
||||||
|
->order('journal_stage_id desc')
|
||||||
|
->limit(1)
|
||||||
|
->select();
|
||||||
|
$stage_now = $last_stage?$last_stage[0]:['issue_date'=>'2020-05-15'];
|
||||||
|
$ctime = strtotime($stage_now['issue_date']);
|
||||||
|
$cs = [];
|
||||||
|
$cs['issn'] = $v['issn'];
|
||||||
|
$cs['ctime'] = $ctime;
|
||||||
|
$cache_arts = $this->object_to_array(json_decode(myPost(self::JURL,$cs)));
|
||||||
|
$journals[$k]['arts'] = $cache_arts['data'];
|
||||||
|
$journals[$k]['artCount'] = count($cache_arts['data']);
|
||||||
|
}
|
||||||
|
$re['journals'] = $journals;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动任务存储危险值
|
||||||
|
*/
|
||||||
|
public function autoDanger(){
|
||||||
|
$journals = $this->journal_obj->where('state',0)->select();
|
||||||
|
foreach ($journals as $k => $v){
|
||||||
|
$cah_res = $this->calMark($v['journal_id']);
|
||||||
|
$insert['journal_id'] = $v['journal_id'];
|
||||||
|
$insert['date'] = date('Ymd');
|
||||||
|
$insert['danger'] = $cah_res['mk'];
|
||||||
|
$this->super_danger_obj->insert($insert);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取历史危险值
|
||||||
|
* @description 获取历史危险值
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /super/Publish/getDangerHistory
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @return dates:日期数组#
|
||||||
|
* @return journals:期刊信息array#
|
||||||
|
*/
|
||||||
|
public function getDangerHistory(){
|
||||||
|
$dates = [];
|
||||||
|
for ($index = 8; $index > 0; $index--) {
|
||||||
|
$dates[] = date("Ymd",strtotime("-$index week Sunday"));
|
||||||
|
}
|
||||||
|
$re['dates'] = $dates;
|
||||||
|
$journals = $this->journal_obj->where('state',0)->select();
|
||||||
|
foreach ($journals as $k => $v){
|
||||||
|
$fr = [];
|
||||||
|
$cache = $this->super_danger_obj
|
||||||
|
->where('journal_id',$v['journal_id'])
|
||||||
|
->where('state',0)
|
||||||
|
->order('super_danger_id desc')
|
||||||
|
->limit(8)
|
||||||
|
->column('danger');
|
||||||
|
for($in=0;$in<8-count($cache);$in++){
|
||||||
|
$fr[] = 0;
|
||||||
|
}
|
||||||
|
foreach ($cache as $val){
|
||||||
|
$fr[] = $val;
|
||||||
|
}
|
||||||
|
$journals[$k]['ma'] = $fr;
|
||||||
|
}
|
||||||
|
$re['journals'] = $journals;
|
||||||
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test(){
|
public function test(){
|
||||||
echo $this->calMark(1);
|
echo strtotime('2021-02-24');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
echo THINK_VERSION;
|
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>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,18 +165,38 @@ class Publish extends Controller
|
|||||||
->order('journal_stage_id desc')
|
->order('journal_stage_id desc')
|
||||||
->limit(1)
|
->limit(1)
|
||||||
->select();
|
->select();
|
||||||
$stage_now = $last_stage[0];
|
$stage_now = $last_stage?$last_stage[0]:['issue_date'=>'2020-05-15'];
|
||||||
$cday = intval((time()-strtotime($stage_now['issue_date']))/(3600*24));
|
$cday = intval((time()-strtotime($stage_now['issue_date']))/(3600*24));
|
||||||
$cycle = $journal_info['cycle']==0?2:$journal_info['cycle'];
|
$cycle = $journal_info['cycle']==0?2:$journal_info['cycle'];
|
||||||
$art_num = $journal_info['art_num']==0?5:$journal_info['art_num'];
|
$art_num = $journal_info['art_num']==0?5:$journal_info['art_num'];
|
||||||
|
|
||||||
|
$frag = [];
|
||||||
|
$frag['count'] = $count;
|
||||||
|
$frag['sy'] = $cycle*30 - $cday;
|
||||||
|
$frag['ntime'] = strtotime($stage_now['issue_date'])+($cycle*30*3600*24);
|
||||||
|
|
||||||
if($cday>($cycle*30)){
|
if($cday>($cycle*30)){
|
||||||
return 100;
|
$frag['mk'] = 100;
|
||||||
|
return $frag;
|
||||||
}
|
}
|
||||||
$lart = intval($cday*$art_num/($cycle*30));
|
$lart = intval($cday*$art_num/($cycle*30));
|
||||||
if($count>=$lart){
|
if($count>=$lart){
|
||||||
return 0;
|
$frag['mk'] = 0;
|
||||||
}else{
|
}else{
|
||||||
return ($lart - $count)*100/$art_num;
|
$frag['mk'] = intval(($lart - $count)*100/$art_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function object_to_array($obj){
|
||||||
|
$_arr=is_object($obj)?get_object_vars($obj):$obj;
|
||||||
|
$arr = null;
|
||||||
|
foreach($_arr as $key=>$val){
|
||||||
|
$val=(is_array($val))||is_object($val)?$this->object_to_array($val):$val;
|
||||||
|
$arr[$key]=$val;
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user