This commit is contained in:
wangjinlei
2022-02-28 10:00:50 +08:00
parent 4c6f6d97c1
commit 7b0edf5da5
6 changed files with 289 additions and 68 deletions

View File

@@ -2,8 +2,8 @@
use PHPMailer\PHPMailer\PHPMailer;
use think\Db;
//use TCPDF;
//use TCPDF;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
@@ -93,13 +93,13 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
}
function object_to_array($obj) {
$obj = (array)$obj;
$obj = (array) $obj;
foreach ($obj as $k => $v) {
if (gettype($v) == 'resource') {
return;
}
if (gettype($v) == 'object' || gettype($v) == 'array') {
$obj[$k] = (array)object_to_array($v);
$obj[$k] = (array) object_to_array($v);
}
}
return $obj;
@@ -109,9 +109,9 @@ function object_to_array($obj) {
* 生成文章sn号
* @return type
*/
function getArticleSN($abbr,$type) {
function getArticleSN($abbr, $type) {
$str = $abbr;
$str .= date('Y', time()).$type.date('md', time());
$str .= date('Y', time()) . $type . date('md', time());
$where['accept_sn'] = ['like', "$str%"];
$nowres = Db::name('article')->where($where)->select();
$last_num = 1;
@@ -127,9 +127,9 @@ function getArticleSN($abbr,$type) {
return $str;
}
function translateType($type){
function translateType($type) {
$frag = '';
switch ($type){
switch ($type) {
case "A":
$frag = 'Article';
break;
@@ -151,9 +151,41 @@ function translateType($type){
case "T":
$frag = 'Comment';
break;
case "O":
$frag = 'Others';
case 'CT':
$frag = 'CORRECTION';
break;
case 'HT':
$frag = 'HYPOTHESIS';
break;
case 'PF':
$frag = 'PREFACE';
break;
case 'ET':
$frag = 'EDITORIAL';
break;
case 'RP':
$frag = 'REPORT';
break;
case 'EF':
$frag = 'EMPIRICAL FORMULA';
break;
case 'EM':
$frag = 'EVIDENCE-BASED MEDICINE';
break;
case 'EC':
$frag = 'EXPERT CONSENSUS';
break;
case 'LTE':
$frag = 'LETTER TO EDITOR';
break;
case 'QI':
$frag = 'QUESTIONNAIRE INVESTIGATION';
break;
case 'PT':
$frag = 'PROTOCOL';
break;
default:
$frag = 'OTHERS';
}
return $frag;
}
@@ -164,9 +196,9 @@ function translateType($type){
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();
->where('url', $url)
->where('state', 0)
->find();
if ($msg_info) {
return true;
}
@@ -177,59 +209,53 @@ function add_usermsg($userid, $content, $url) {
return $msg_obj->insert($msgdata);
}
function jsonSuccess($data){
return json(['code'=>0,'msg'=>'success','data'=>$data]);
function jsonSuccess($data) {
return json(['code' => 0, 'msg' => 'success', 'data' => $data]);
}
function jsonError($msg){
return json(['code'=>1,'msg'=>$msg]);
function jsonError($msg) {
return json(['code' => 1, 'msg' => $msg]);
}
function choiseJabbr($article_id,$jabbr){
if($article_id<1799&&$jabbr=="Cancer Adv"){
function choiseJabbr($article_id, $jabbr) {
if ($article_id < 1799 && $jabbr == "Cancer Adv") {
return "TMR Cancer";
}
if($article_id<910&&$jabbr=="Microenviron Microecol Res"){
if ($article_id < 910 && $jabbr == "Microenviron Microecol Res") {
return "Tumor Microenviron Res";
}
if($article_id<1799&&$jabbr=="Med Theor Hypothesis"){
if ($article_id < 1799 && $jabbr == "Med Theor Hypothesis") {
return "TMR Theory Hypoth";
}
return $jabbr;
}
function myPost($url, $param=array()){
function myPost($url, $param = array()) {
if(!is_array($param)){
if (!is_array($param)) {
throw new Exception("参数必须为array");
}
$httph =curl_init($url);
$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_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_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);
$rst = curl_exec($httph);
curl_close($httph);
return $rst;
}
}