1
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use hashids\hashids;
|
||||
|
||||
class Base extends Controller
|
||||
{
|
||||
@@ -63,11 +65,12 @@ class Base extends Controller
|
||||
protected $production_article_author_to_organ_obj = '';
|
||||
protected $production_article_frag_obj = '';
|
||||
protected $production_article_main_obj = '';
|
||||
protected $production_article_main_img_obj = '';
|
||||
protected $apply_reviewer_obj = '';
|
||||
protected $promotion_obj = '';
|
||||
protected $promotion_email_obj = '';
|
||||
|
||||
|
||||
|
||||
|
||||
public function __construct(\think\Request $request = null)
|
||||
{
|
||||
parent::__construct($request);
|
||||
@@ -128,13 +131,13 @@ class Base extends Controller
|
||||
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
|
||||
$this->production_article_frag_obj = Db::name('production_article_frag');
|
||||
$this->production_article_main_obj = Db::name('production_article_main');
|
||||
$this->production_article_main_img_obj = Db::name("production_article_main_img");
|
||||
$this->apply_reviewer_obj = Db::name("apply_reviewer");
|
||||
$this->promotion_obj = Db::name("promotion");
|
||||
$this->promotion_email_obj = Db::name("promotion_email");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function pdfAddProof($article_id)
|
||||
{
|
||||
$p_info = $this->production_article_obj->where('article_id', $article_id)->where('state', 0)->find();
|
||||
@@ -168,46 +171,49 @@ class Base extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function createYboardCert($user_info,$journal_info,$start_time,$year){
|
||||
if(!is_dir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'])){
|
||||
mkdir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id']);
|
||||
public function createYboardCert($user_info, $journal_info, $start_time, $year)
|
||||
{
|
||||
if (!is_dir(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id'])) {
|
||||
mkdir(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id']);
|
||||
}
|
||||
$sj_num = rand(1000,9999);
|
||||
$sj_num = rand(1000, 9999);
|
||||
$template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'yboard_template.png';
|
||||
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
|
||||
$ziti1 = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'Georgia0.ttf';
|
||||
$image = \think\Image::open($template);
|
||||
$ys = date("F Y",$start_time)." to ".date("F Y",strtotime("+ ".$year." year",$start_time));
|
||||
$ys = date("F Y", $start_time) . " to " . date("F Y", strtotime("+ " . $year . " year", $start_time));
|
||||
$image->text($user_info['realname'], $ziti, 45, '#000000', [1060, 750])
|
||||
->text($ys, $ziti1, 32, '#C49A6C', [1370, 1015])
|
||||
->text(date("Y.m.d",$start_time), $ziti, 25, '#000000', [500, 1280])
|
||||
->text($journal_info['title'], $ziti1, 36, '#C49A6C', [860, 930])
|
||||
->save(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'].DS. $user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png');
|
||||
return $journal_info['journal_id'].DS.$user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png';
|
||||
->text($ys, $ziti1, 32, '#C49A6C', [1370, 1015])
|
||||
->text(date("Y.m.d", $start_time), $ziti, 25, '#000000', [500, 1280])
|
||||
->text($journal_info['title'], $ziti1, 36, '#C49A6C', [860, 930])
|
||||
->save(ROOT_PATH . 'public' . DS . 'cert' . DS . $journal_info['journal_id'] . DS . $user_info['user_id'] . '_yboard_' . date('Y', $start_time) . $sj_num . '.png');
|
||||
return $journal_info['journal_id'] . DS . $user_info['user_id'] . '_yboard_' . date('Y', $start_time) . $sj_num . '.png';
|
||||
}
|
||||
|
||||
public function majorids($major_id){
|
||||
$frag[]=$major_id;
|
||||
$list = $this->major_obj->where('pid',$major_id)->select();
|
||||
foreach($list as $v){
|
||||
public function majorids($major_id)
|
||||
{
|
||||
$frag[] = $major_id;
|
||||
$list = $this->major_obj->where('pid', $major_id)->select();
|
||||
foreach ($list as $v) {
|
||||
$cache = self::majorids($v['major_id']);
|
||||
$frag = array_merge($frag,$cache);
|
||||
$frag = array_merge($frag, $cache);
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
|
||||
public function getMajorShu($major){
|
||||
if($major==0){
|
||||
public function getMajorShu($major)
|
||||
{
|
||||
if ($major == 0) {
|
||||
return '';
|
||||
}
|
||||
$res = $this->major_obj->where('major_id',$major)->find();
|
||||
if($res['pid']==1){
|
||||
$res = $this->major_obj->where('major_id', $major)->find();
|
||||
if ($res['pid'] == 1) {
|
||||
return $res['major_id'];
|
||||
}
|
||||
|
||||
$p = self::getMajorShu($res['pid']);
|
||||
return $p.','.$res['major_id'];
|
||||
return $p . ',' . $res['major_id'];
|
||||
}
|
||||
|
||||
public function getMajorStr($major_id)
|
||||
@@ -225,6 +231,11 @@ class Base extends Controller
|
||||
return $frag;
|
||||
}
|
||||
|
||||
public function getMajorOne($major_id){
|
||||
$major_info = $this->major_obj->where('major_id', $major_id)->find();
|
||||
return $major_info['major_title'];
|
||||
}
|
||||
|
||||
|
||||
public function save_article_file($article_id, $user_id, $username, $url, $type_name)
|
||||
{
|
||||
@@ -238,6 +249,8 @@ class Base extends Controller
|
||||
return true;
|
||||
} else if ($type_name == 'totalpage' && trim($url) == '') {
|
||||
return true;
|
||||
} else if ($type_name == "supplementary" && trim($url) == '') {
|
||||
return true;
|
||||
}
|
||||
$insert_data['article_id'] = $article_id;
|
||||
$insert_data['user_id'] = $user_id;
|
||||
@@ -260,101 +273,126 @@ class Base extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function getCvs($user_id){
|
||||
$list = $this->user_cv_obj->where('user_id',$user_id)->where('state',0)->select();
|
||||
public function getCvs($user_id)
|
||||
{
|
||||
$list = $this->user_cv_obj->where('user_id', $user_id)->where('state', 0)->select();
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**获取标准化用户库的人
|
||||
* @return void
|
||||
*/
|
||||
public function getLibraryList($lib,$type,$body,$pageIndex,$pageSize){
|
||||
public function getLibraryList($lib, $type, $body, $china_type, $pageIndex, $pageSize)
|
||||
{
|
||||
$frag = [];
|
||||
if($lib=="user"){//正式库
|
||||
$list = [];
|
||||
if($type=='major'){
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id = t_user.user_id",'left')
|
||||
->where("t_user_reviewer_info.major",'in',$this->majorids($body))
|
||||
->where('t_user.no_email',0)
|
||||
->where('t_user.state',0)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
}else{
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id = t_user.user_id",'left')
|
||||
->where("t_user_reviewer_info.field","like","%".$body."%")
|
||||
->where('t_user.no_email',0)
|
||||
->where('t_user.state',0)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
if ($lib == "user") {//正式库
|
||||
$where["t_user.state"] = 0;
|
||||
$where["t_user.no_email"] = 0;
|
||||
if ($type == "major") {
|
||||
$where['t_user_reviewer_info.major'] = ["in", $this->majorids($body)];
|
||||
} else {
|
||||
$where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"];
|
||||
}
|
||||
if($china_type==1){
|
||||
$where['t_user_reviewer_info.country'] = "China";
|
||||
}elseif ($china_type==2){
|
||||
$where['t_user_reviewer_info.country'] = ["<>","China"];
|
||||
}
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left')
|
||||
->where($where)
|
||||
->page($pageIndex, $pageSize)
|
||||
->select();
|
||||
//规整化数据整理
|
||||
foreach ($list as $v){
|
||||
foreach ($list as $v) {
|
||||
$ca['email'] = $v['email'];
|
||||
$ca['name'] = $v['realname']==""?$v['account']:$v['realname'];
|
||||
$ca['name'] = $v['realname'] == "" ? $v['account'] : $v['realname'];
|
||||
$ca['type'] = "user";
|
||||
$ca['id'] = $v['user_id'];
|
||||
$ca['major'] = $v['major'];
|
||||
$frag[] = $ca;
|
||||
}
|
||||
}elseif($lib == 'author'){//作者库
|
||||
$list = [];
|
||||
} elseif ($lib == 'author') {//作者库
|
||||
$exist = "select * from t_user_author where user_id = t_user.user_id";
|
||||
if($type=='major'){
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id = t_user.user_id",'left')
|
||||
->where("t_user_reviewer_info.major",'in',$this->majorids($body))
|
||||
->where('t_user.no_email',0)
|
||||
->where('t_user.state',0)
|
||||
->whereExists($exist)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
}else{
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info","t_user_reviewer_info.reviewer_id = t_user.user_id",'left')
|
||||
->where("t_user_reviewer_info.field","like","%".$body."%")
|
||||
->where('t_user.no_email',0)
|
||||
->where('t_user.state',0)
|
||||
->whereExists($exist)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
$where["t_user.state"] = 0;
|
||||
$where["t_user.no_email"] = 0;
|
||||
if ($type == "major") {
|
||||
$where['t_user_reviewer_info.major'] = ["in", $this->majorids($body)];
|
||||
} else {
|
||||
$where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"];
|
||||
}
|
||||
if($china_type==1){
|
||||
$where['t_user_reviewer_info.country'] = "China";
|
||||
}elseif ($china_type==2){
|
||||
$where['t_user_reviewer_info.country'] = ["<>","China"];
|
||||
}
|
||||
$list = $this->user_obj
|
||||
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left')
|
||||
->where($where)
|
||||
->whereExists($exist)
|
||||
->page($pageIndex, $pageSize)
|
||||
->select();
|
||||
//规整化数据整理
|
||||
foreach ($list as $v){
|
||||
foreach ($list as $v) {
|
||||
$ca['email'] = $v['email'];
|
||||
$ca['name'] = $v['realname']==""?$v['account']:$v['realname'];
|
||||
$ca['name'] = $v['realname'] == "" ? $v['account'] : $v['realname'];
|
||||
$ca['type'] = "user";
|
||||
$ca['id'] = $v['user_id'];
|
||||
$ca['major'] = $v['major'];
|
||||
$frag[] = $ca;
|
||||
}
|
||||
}else{//灰库
|
||||
} else {//灰库
|
||||
$list = [];
|
||||
if($type=='major'){
|
||||
$list = $this->user_ash_obj
|
||||
->where('major','in',$this->majorids($body))
|
||||
->where('no_email',0)
|
||||
->where('state',0)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
}else{
|
||||
$list = $this->user_ash_obj
|
||||
->where('major',$body)
|
||||
->where('field',"like","%".$body."%")
|
||||
->where('state',0)
|
||||
->page($pageIndex,$pageSize)
|
||||
->select();
|
||||
$where['state'] = 0;
|
||||
$where['no_email'] = 0;
|
||||
if ($type == "major") {
|
||||
$where['major'] = ["in", $this->majorids($body)];
|
||||
} else {
|
||||
$where['field'] = ["like", "%" . $body . "%"];
|
||||
}
|
||||
if($china_type==1){
|
||||
$where['country'] = "China";
|
||||
}elseif ($china_type==2){
|
||||
$where['country'] = ["<>","China"];
|
||||
}
|
||||
$list = $this->user_ash_obj
|
||||
->where($where)
|
||||
->page($pageIndex, $pageSize)
|
||||
->select();
|
||||
//规整化数据整理
|
||||
foreach ($list as $v){
|
||||
foreach ($list as $v) {
|
||||
$ca['email'] = $v['email'];
|
||||
$ca['name'] = $v['name'];
|
||||
$ca['type'] = "ash";
|
||||
$ca['id'] = $v['ash_id'];
|
||||
$ca['major'] = $v['major'];
|
||||
$frag[] = $ca;
|
||||
}
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
public function getJournalCycle($journal_id)
|
||||
{
|
||||
$journal_info = $this->journal_obj->where('journal_id', $journal_id)->find();
|
||||
$frag = "";
|
||||
if ($journal_info['cycle'] == 1) {
|
||||
$frag = "Monthly";
|
||||
} elseif ($journal_info['cycle'] == 2) {
|
||||
$frag = "Bimonthly";
|
||||
} elseif ($journal_info['cycle'] == 3) {
|
||||
$frag = "Quarterly";
|
||||
} else {
|
||||
$frag = "Continuities";
|
||||
}
|
||||
return $frag;
|
||||
}
|
||||
|
||||
public function creatUserCode($str){
|
||||
$hashids = hashids::instance(8,"tmrjournals");
|
||||
return $hashids->encode($str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user