This commit is contained in:
wangjinlei
2024-08-13 14:37:16 +08:00
parent 0a6126543b
commit 5d8391e597
2 changed files with 52 additions and 57 deletions

View File

@@ -75,6 +75,7 @@ class Base extends Controller
protected $board_group_obj = "";
protected $committee_to_journal_obj = '';
protected $editor_to_journal_obj = '';
protected $email_account_obj;
public function __construct(\think\Request $request = null)
@@ -145,6 +146,7 @@ class Base extends Controller
$this->board_group_obj = Db::name("board_group");
$this->committee_to_journal_obj = Db::name("committee_to_journal");
$this->editor_to_journal_obj = Db::name("editor_to_journal");
$this->email_account_obj = Db::name("email_account");
}

View File

@@ -3,70 +3,19 @@
namespace app\api\controller;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\Queue;
use think\Env;
use think\Validate;
class Email extends Controller
class Email extends Base
{
protected $article_obj = '';
protected $user_obj = '';
protected $user_act_obj = '';
protected $journal_obj = '';
protected $user_log_obj = '';
protected $user_reviewer_info_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $article_reviewer_question_obj = '';
protected $article_msg_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_author_obj = '';
protected $article_transfer_obj = '';
protected $chief_to_journal_obj = '';
protected $login_auto_obj = '';
protected $major_obj = "";
protected $major_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_dialog_obj = '';
protected $article_proposal_obj = '';
protected $article_response_to_reviewer_obj = '';
protected $user_black_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $email_log_obj = '';
protected $email_template_obj = '';
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
$this->user_log_obj = Db::name('user_log');
$this->user_reviewer_info_obj = Db::name("user_reviewer_info");
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
$this->article_msg_obj = Db::name('article_msg');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_author_obj = Db::name('article_author');
$this->article_transfer_obj = Db::name('article_transfer');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->login_auto_obj = Db::name('login_auto');
$this->major_obj = Db::name("major");
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
$this->article_dialog_obj = Db::name('article_dialog');
$this->article_proposal_obj = Db::name('article_proposal');
$this->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer');
$this->user_black_obj = Db::name('user_black');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->email_log_obj = Db::name('email_log');
$this->email_template_obj = Db::name('email_template');
}
@@ -240,10 +189,10 @@ class Email extends Controller
// $a[] = ["wangjinlei1","testtesttest1","751475802@qq.com"];
// $a[] = ["Aubree Zhu","testtesttest2","1300364247@qq.com"];
echo "<pre>";
var_dump($a);
echo "</pre>";
die;
//echo "<pre>";
//var_dump($a);
//echo "</pre>";
//die;
$journal_info = $this->journal_obj->where("journal_id",23)->find();
// $email = "1300364247@qq.com";
@@ -299,6 +248,50 @@ die;
public function getEmailAccounts(){
$list = $this->email_account_obj->where("state",0)->select();
$re['list'] = $list;
return jsonSuccess($re);
}
public function addEmailAccount(){
$data = $this->request->post();
$rule = new Validate([
"user"=>"require",
"password"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$entity["user"] = trim($data['user']);
$entity['password'] = md5($data['password']);
$entity['domain'] = "tmrjournals.com.cn";
$entity['email'] = trim($data['user'])."@tmrjournals.com.cn";
$entity['home'] = "/var/mail/tmrjournals.com.cn/".$data['user']."/";
$this->email_account_obj->insert($entity);
return jsonSuccess([]);
}
public function changePassword(){
$data = $this->request->post();
$rule = new Validate([
"id"=>"require",
"password"=>"password"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->email_account_obj->where("id",$data['id'])->update(['password'=>md5($data['password'])]);
return jsonSuccess([]);
}
public function lsPushEmail()
{
// $journal_info = $this->journal_obj->where("journal_id", 4)->find();