This commit is contained in:
Administrator
2022-03-25 15:42:31 +08:00
parent 44cbb62a4e
commit 98f1944b39
4 changed files with 347 additions and 184 deletions

View File

@@ -28,6 +28,7 @@ class User extends Controller {
protected $board_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_author_obj = '';
protected $user_black_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -45,6 +46,7 @@ class User extends Controller {
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
$this->article_author_obj = Db::name('article_author');
$this->user_black_obj = Db::name('user_black');
}
/**
@@ -62,10 +64,9 @@ class User extends Controller {
*/
public function checkLogin() {
$data = $this->request->post();
if($data['username']=='fariba'||$data['username']=='zc'||$data['username']=='Mohammad Hossein'||$data['username']=='xiaoyueyue'||$data['username']=='sethlee000'||$data['username']=='yuanying9908'){
return json(['code'=>1,'msg'=>'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']);
if ($data['username'] == 'fariba' || $data['username'] == 'zc' || $data['username'] == 'Mohammad Hossein' || $data['username'] == 'xiaoyueyue' || $data['username'] == 'sethlee000' || $data['username'] == 'yuanying9908') {
return json(['code' => 1, 'msg' => 'Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.']);
}
//判断是否管理员登录
if ($data['username'] == 'superadmin' || $data['username'] == 'wuxiongzhi2') {
$where_admin['account'] = $data['username'];
@@ -86,28 +87,32 @@ class User extends Controller {
->find();
if ($user_info == null) {//登陆失败
return json(['code' => 1]);
} else {//登陆成功
$up_data['last_login_time'] = time();
$up_data['last_login_ip'] = $this->request->ip();
$this->user_obj->where('user_id = ' . $user_info['user_id'])->update($up_data);
$roles = $this->getUserRoles($user_info['account']);
$re['roles'] = $roles;
$re['userinfo'] = $user_info;
return jsonSuccess($re);
}
//黑名单验证
$blackCheck = $this->user_black_obj->where('user_id',$user_info['user_id'])->where('black_state',0)->find();
if($blackCheck){
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$up_data['last_login_time'] = time();
$up_data['last_login_ip'] = $this->request->ip();
$this->user_obj->where('user_id = ' . $user_info['user_id'])->update($up_data);
$roles = $this->getUserRoles($user_info['account']);
$re['roles'] = $roles;
$re['userinfo'] = $user_info;
return jsonSuccess($re);
}
}
/**
* 为所有用户发送邮件
*/
public function pushEmail(){
public function pushEmail() {
die;
$list = $this->user_obj->where('state',0)->select();
$list = $this->user_obj->where('state', 0)->select();
//发送邮件通知审稿人
foreach($list as $v){
$content = "Dear Researcher<br/><br/>";
foreach ($list as $v) {
$content = "Dear Researcher<br/><br/>";
$content .= "We sincerely invite you to subscribe to our journal <b>Traditional Medicine Research</b> (TMR) (ISSN 2413-3973).<br/>";
$content .= "If you are interested in our journalit is easy to subscribe to journals and topics on our official website. Please click here:<br/>";
$content .= "<a href='https://www.tmrjournals.com/draw_up.html?issn=2413-3973'>https://www.tmrjournals.com/draw_up.html?issn=2413-3973</a><br/><br/>";
@@ -121,10 +126,104 @@ class User extends Controller {
$maidata['content'] = $content;
$maidata['tmail'] = "tmrweb@tmrjournals.com";
$maidata['tpassword'] = "Wu999999tmrwe";
Queue::push( 'app\api\job\mail@fire' , $maidata , "tmail" );
Queue::push('app\api\job\mail@fire', $maidata, "tmail");
}
}
/**
* @title 获取所有用户
* @description 获取所有用户
* @author wangjinlei
* @url /api/User/getAllUser
* @method POST
*
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
* @param type:username type:string require:1 desc:用户名或邮箱
*
* @return users:用户列表#
* @return count:总数
*/
public function getAllUser() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$frag = [];
$count = 0;
if ($data['username'] == "") {
$frag = $this->user_obj->where('state', 0)->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->count();
} else {
$frag = $this->user_obj->where('state', 0)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->count();
}
$re['users'] = $frag;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 拉黑用户
* @description 拉黑用户
* @author wangjinlei
* @url /api/User/pushUserToBlack
* @method POST
*
* @param name:user_id type:int require:1 desc:用户id
* @param name:reason type:string require:1 desc:拉黑原因
*
*/
public function pushUserToBlack() {
$data = $this->request->post();
$insert['user_id'] = $data['user_id'];
$insert['reason'] = trim($data['reason']);
$insert['black_ctime'] = time();
$this->user_black_obj->insert($insert);
return jsonSuccess($data);
}
/**
* @title 获取黑名单列表
* @description 获取黑名单列表
* @author wangjinlei
* @url /api/User/getUserBlackList
* @method POST
*
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
*
* @return blacks:黑名单列表#
* @return count:总数
*/
public function getUserBlackList() {
$data = $this->request->post();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->user_black_obj
->field("t_user.account,t_user.email,t_user_black.*")
->join('t_user', 't_user.user_id = t_user_black.user_id', 'left')
->where('t_user_black.black_state', 0)
->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_black_obj->where('black_state', 0)->count();
$re['blacks'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* @title 消除黑名单
* @description 消除黑名单
* @author wangjinlei
* @url /api/User/clearBlack
* @method POST
*
* @param name:black_id type:int require:1 desc:黑名单id
*
*/
public function clearBlack() {
$data = $this->request->post();
$this->user_black_obj->where("black_id", $data['black_id'])->update(['black_state' => 1]);
return jsonSuccess([]);
}
/**
* @title 申请期刊审稿人对于审稿人
* @description 申请期刊审稿人对于审稿人
@@ -136,15 +235,15 @@ class User extends Controller {
* @param name:journal_id type:int require:1 desc:期刊id
*
*/
public function applyReviewerForReviewer(){
public function applyReviewerForReviewer() {
$data = $this->request->post();
$user_info = $this->user_obj->where('account', trim($data['username']))->find();
$journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id',$journal_info['editor_id'])->find();
$reviewer_info_info = $this->user_reviewer_info_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
$check = $this->reviewer_to_journal_obj->where("reviewer_id",$user_info['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
$check1 = $this->user_reviewer_obj->where('name',trim($data['username']))->where('journal_id',$data['journal_id'])->find();
if($check||$check1){
$journal_info = $this->journal_obj->where('journal_id', $data['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
$reviewer_info_info = $this->user_reviewer_info_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
$check = $this->reviewer_to_journal_obj->where("reviewer_id", $user_info['user_id'])->where('journal_id', $data['journal_id'])->where('state', 0)->find();
$check1 = $this->user_reviewer_obj->where('name', trim($data['username']))->where('journal_id', $data['journal_id'])->find();
if ($check || $check1) {
return jsonError("You are already in the reviewer list of this journal");
}
$insert_data['journal_id'] = $data['journal_id'];
@@ -166,7 +265,7 @@ class User extends Controller {
sendEmail($editor_info['email'], $journal_info['title'], $journal_info['title'], $tt, $journal_info['email'], $journal_info['epassword']);
//发送消息信息--编辑
add_usermsg($journal_info['editor_id'], '新增审稿人申请,申请人(' . $data['username'] . ')', '/reviewerApplyDetail?id=' . $res);
return jsonSuccess([]);
}
@@ -197,7 +296,7 @@ class User extends Controller {
// return json(['code' => 0, 'userinfo' => $user_info]);
// }
// }
/**
* @title 获取用户身份列表
* @description 获取用户身份列表
@@ -210,39 +309,39 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
public function getUserRole(){
public function getUserRole() {
$data = $this->request->post();
$roles = $this->getUserRoles($data['account']);
$re['roles'] = $roles;
return jsonSuccess($re);
}
private function getUserRoles($account) {
$user_info = $this->user_obj->where('account',$account)->find();
if($user_info['type']==2){
$user_info = $this->user_obj->where('account', $account)->find();
if ($user_info['type'] == 2) {
$ros[] = 'editor';
return $ros;
}
$roles[] = 'author';
$reviewer_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
if($reviewer_res!=null){
$reviewer_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
if ($reviewer_res != null) {
$roles[] = 'reviewer';
}
$yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('is_yboard',1)->where('state',0)->find();
if($yboard_res!=null){
$yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('is_yboard', 1)->where('state', 0)->find();
if ($yboard_res != null) {
$roles[] = 'yboard';
}
$chief_res = $this->chief_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
if($chief_res != null){
$chief_res = $this->chief_to_journal_obj->where('user_id', $user_info['user_id'])->where('state', 0)->find();
if ($chief_res != null) {
$roles[] = 'chief';
}
$board_res = $this->board_to_journal_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
if($board_res != null){
$board_res = $this->board_to_journal_obj->where('user_id', $user_info['user_id'])->where('state', 0)->find();
if ($board_res != null) {
$roles[] = 'board';
}
return $roles;
}
/**
* @title 升级审稿人至青年编委
* @description 升级审稿人至青年编委
@@ -256,12 +355,12 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
public function upReviewerToYboard(){
public function upReviewerToYboard() {
$data = $this->request->post();
$this->reviewer_to_journal_obj->where('journal_id',$data['journal_id'])->where('reviewer_id',$data['user_id'])->where('state',0)->update(['is_yboard'=>1]);
$this->reviewer_to_journal_obj->where('journal_id', $data['journal_id'])->where('reviewer_id', $data['user_id'])->where('state', 0)->update(['is_yboard' => 1]);
return jsonSuccess([]);
}
/**
* @title 降级青年编委至审稿人
* @description 降级青年编委至审稿人
@@ -275,9 +374,9 @@ class User extends Controller {
* @return roles:角色列表#
*
*/
public function downReviewerToYboard(){
public function downReviewerToYboard() {
$data = $this->request->post();
$this->reviewer_to_journal_obj->where('journal_id',$data['journal_id'])->where('reviewer_id',$data['user_id'])->where('state',0)->update(['is_yboard'=>0]);
$this->reviewer_to_journal_obj->where('journal_id', $data['journal_id'])->where('reviewer_id', $data['user_id'])->where('state', 0)->update(['is_yboard' => 0]);
return jsonSuccess([]);
}
@@ -451,7 +550,6 @@ class User extends Controller {
return $nowcode == $mbcode ? true : false;
}
/**
* @title 获取审稿人列表
* @description 获取审稿人列表
@@ -467,28 +565,28 @@ class User extends Controller {
*/
public function getreviewerList() {
$data = $this->request->post();
$editor_info = $this->user_obj->where('account',$data['username'])->where('state',0)->find();
$editor_info = $this->user_obj->where('account', $data['username'])->where('state', 0)->find();
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$jous = [];
if($data['journalId'] == 0){
$jous = $this->journal_obj->where('editor_id',$editor_info['user_id'])->where('state',0)->column('journal_id');
}else{
if ($data['journalId'] == 0) {
$jous = $this->journal_obj->where('editor_id', $editor_info['user_id'])->where('state', 0)->column('journal_id');
} else {
$jous[] = $data['journalId'];
}
$res = $this->reviewer_to_journal_obj
->field('t_reviewer_to_journal.is_yboard,t_user_reviewer_info.*,t_journal.*,t_user.*')
->join('t_journal','t_journal.journal_id = t_reviewer_to_journal.journal_id','left')
->join('t_user','t_user.user_id = t_reviewer_to_journal.reviewer_id','left')
->join('t_journal', 't_journal.journal_id = t_reviewer_to_journal.journal_id', 'left')
->join('t_user', 't_user.user_id = t_reviewer_to_journal.reviewer_id', 'left')
->join('t_user_reviewer_info', 't_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id', 'LEFT')
->where('t_reviewer_to_journal.journal_id','in',$jous)
->where('t_reviewer_to_journal.state',0)
->limit($limit_start,$data['pageSize'])
->where('t_reviewer_to_journal.journal_id', 'in', $jous)
->where('t_reviewer_to_journal.state', 0)
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj->where('t_reviewer_to_journal.journal_id','in',$jous)->where('t_reviewer_to_journal.state',0)->count();
$count = $this->reviewer_to_journal_obj->where('t_reviewer_to_journal.journal_id', 'in', $jous)->where('t_reviewer_to_journal.state', 0)->count();
return json(['code' => 0, 'data' => $res, 'total' => $count]);
// $where['t_user.is_reviewer'] = 1;
// if ($data['journalId'] == 0) {
// $subQuery = $this->user_obj->field('user_id')->where('account', $data['username'])->buildSql();
@@ -574,7 +672,7 @@ class User extends Controller {
return json(['code' => 1]);
}
}
/**
* @title 获取作者转审稿人列表
* @description 获取作者转审稿人列表
@@ -587,27 +685,27 @@ class User extends Controller {
*
* @return reviewerTrans:列表#
*/
public function getAuthorToReviewerList(){
public function getAuthorToReviewerList() {
$data = $this->request->post();
$user_info = $this->user_obj->where('account',$data['username'])->find();
$journals = $this->journal_obj->where("editor_id",$user_info['user_id'])->where('state',0)->column("journal_id");
$user_info = $this->user_obj->where('account', $data['username'])->find();
$journals = $this->journal_obj->where("editor_id", $user_info['user_id'])->where('state', 0)->column("journal_id");
$where['t_reviewer_from_author.rfa_state'] = 0;
if($data['journal_id']==0){
$where['t_reviewer_from_author.journal_id'] = ["in",$journals];
}else{
if ($data['journal_id'] == 0) {
$where['t_reviewer_from_author.journal_id'] = ["in", $journals];
} else {
$where['t_reviewer_from_author.journal_id'] = $data['journal_id'];
}
$list = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
->join("t_article_author", "t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id", "left")
->join("t_journal", "t_journal.journal_id = t_reviewer_from_author.journal_id", "left")
->where($where)
->select();
$re['reviewerTrans'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取作者转审稿人详情
* @description 获取作者转审稿人详情
@@ -619,19 +717,19 @@ class User extends Controller {
*
* @return reviewerTrans:列表#
*/
public function getAuthorToReviewerDetail(){
public function getAuthorToReviewerDetail() {
$data = $this->request->post();
$detail = $this->reviewer_from_author_obj
->field("t_reviewer_from_author.rfa_id,t_article_author.*,t_journal.title journal_title")
->join("t_article_author","t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id","left")
->join("t_journal","t_journal.journal_id = t_reviewer_from_author.journal_id","left")
->where("rfa_id",$data['rfa_id'])
->join("t_article_author", "t_reviewer_from_author.art_aut_id = t_article_author.art_aut_id", "left")
->join("t_journal", "t_journal.journal_id = t_reviewer_from_author.journal_id", "left")
->where("rfa_id", $data['rfa_id'])
->find();
$re['reviewerTran'] = $detail;
return jsonSuccess($re);
}
/**
* @title 作者转审稿人提交信息并通过
* @description 作者转审稿人提交信息并通过
@@ -652,24 +750,24 @@ class User extends Controller {
*
*
*/
public function ReviewerFromAuthorAdopt(){
public function ReviewerFromAuthorAdopt() {
$data = $this->request->post();
$rfa_info = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$rfa_info['journal_id'])->find();
$art_aut_info = $this->article_author_obj->where('art_aut_id',$rfa_info['art_aut_id'])->find();
$user_info = $this->user_obj->where('email',$art_aut_info['email'])->where('state',0)->find();
if(!$user_info){
$rfa_info = $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->find();
$journal_info = $this->journal_obj->where('journal_id', $rfa_info['journal_id'])->find();
$art_aut_info = $this->article_author_obj->where('art_aut_id', $rfa_info['art_aut_id'])->find();
$user_info = $this->user_obj->where('email', $art_aut_info['email'])->where('state', 0)->find();
if (!$user_info) {
return jsonError("user no find!");
}
$check = $this->reviewer_to_journal_obj->where("journal_id",$journal_info['journal_id'])->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
if($check){
$check = $this->reviewer_to_journal_obj->where("journal_id", $journal_info['journal_id'])->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
if ($check) {
return jsonError("has reviewer");
}
Db::startTrans();
$insert_info['reviewer_id'] = $user_info['user_id'];
$insert_info['gender'] = $data['gender'];
$insert_info['technical'] = $data['author_title'];
@@ -680,17 +778,17 @@ class User extends Controller {
$insert_info['field'] = $data['field'];
$insert_info['qualifications'] = $data['qualifications'];
$res = $this->user_reviewer_info_obj->insertGetId($insert_info);
$insert_to['reviewer_id'] = $user_info['user_id'];
$insert_to['journal_id'] = $rfa_info['journal_id'];
$insert_to['account'] = $user_info['account'];
$insert_to['journal_title'] = $journal_info['title'];
$insert_to['ctime'] = time();
$res1 = $this->reviewer_to_journal_obj->insertGetId($insert_to);
$res2 = $this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>1]);
if($res && $res1 && $res2){
$res2 = $this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->update(['rfa_state' => 1]);
if ($res && $res1 && $res2) {
Db::commit();
return jsonSuccess([]);
} else {
@@ -698,7 +796,7 @@ class User extends Controller {
return jsonError("system error!");
}
}
/**
* @title 作者转审稿人拒绝
* @description 作者转审稿人拒绝
@@ -710,9 +808,9 @@ class User extends Controller {
*
*
*/
public function ReviewerFromAuthorReject(){
public function ReviewerFromAuthorReject() {
$data = $this->request->post();
$this->reviewer_from_author_obj->where('rfa_id',$data['rfa_id'])->update(['rfa_state'=>2]);
$this->reviewer_from_author_obj->where('rfa_id', $data['rfa_id'])->update(['rfa_state' => 2]);
return jsonSuccess([]);
}
@@ -724,12 +822,12 @@ class User extends Controller {
$where['reviewer_apply_id'] = $reviewerId;
$apply_info = $this->user_reviewer_obj->where($where)->find();
$journal_info = $this->journal_obj->where('journal_id', $apply_info['journal_id'])->find();
$has_res = $this->user_obj->where('account', $apply_info['name'])->whereOr("email",$apply_info['email'])->find();
$has_res = $this->user_obj->where('account', $apply_info['name'])->whereOr("email", $apply_info['email'])->find();
//检测是否已经存在此审稿人
if($has_res){
$check = $this->reviewer_to_journal_obj->where('reviewer_id',$has_res['user_id'])->where('journal_id',$journal_info['journal_id'])->where('state',0)->find();
if($check){
$this->user_reviewer_obj->where($where)->update(['state'=>1]);
if ($has_res) {
$check = $this->reviewer_to_journal_obj->where('reviewer_id', $has_res['user_id'])->where('journal_id', $journal_info['journal_id'])->where('state', 0)->find();
if ($check) {
$this->user_reviewer_obj->where($where)->update(['state' => 1]);
return jsonError("has reviewer!");
}
}
@@ -838,7 +936,7 @@ class User extends Controller {
return json(['code' => 0]);
}
}
/**
* @title 审查用户是否是审稿人
* @description 审查用户是否是审稿人
@@ -851,15 +949,15 @@ class User extends Controller {
* @return is:0否1是
*
*/
public function checkUserIsReviewer(){
public function checkUserIsReviewer() {
$data = $this->request->post();
$user_info = $this->user_obj->where('account',$data['username'])->find();
$check = $this->reviewer_to_journal_obj->where('reviewer_id',$user_info['user_id'])->where('state',0)->find();
$re['is'] = $check==null?0:1;
$user_info = $this->user_obj->where('account', $data['username'])->find();
$check = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('state', 0)->find();
$re['is'] = $check == null ? 0 : 1;
return jsonSuccess($re);
}
/**
* @title 审查用户是否存在通过用户名或邮箱
* @description 审查用户是否存在通过用户名或邮箱
@@ -872,11 +970,11 @@ class User extends Controller {
* @return has:0无1有
*
*/
public function checkUserByAccountOrEmail(){
public function checkUserByAccountOrEmail() {
$data = $this->request->post();
$check_info = $this->user_obj->where("account|email",$data['username'])->where("state",0)->find();
$re['has'] = $check_info==null?0:1;
$check_info = $this->user_obj->where("account|email", $data['username'])->where("state", 0)->find();
$re['has'] = $check_info == null ? 0 : 1;
return jsonSuccess($re);
}
@@ -926,6 +1024,11 @@ class User extends Controller {
if ($user == null) {
Cache::set($r->orcid, $res, 3600);
}
//确定用户是否属于黑名单
$black_check = $this->user_black_obj->where('user_id', $user['user_id'])->where('black_state', 0)->find();
if ($black_check) {
return jsonError("Your account has been blocked. Please contact the publisher for details: publisher@tmrjournals.com.");
}
$roles = $this->getUserRoles($user['account']);
$re['roles'] = $roles;
$re['userinfo'] = $user;
@@ -989,6 +1092,13 @@ class User extends Controller {
$data = $this->request->post();
$cache = Cache::get($data['orcid']);
$res = $this->object2array(json_decode($cache));
$check1 = $this->user_obj->where("account", trim($data['username']))->where("state", 0)->find();
$check2 = $this->user_obj->where("email", trim($data['email']))->where("state", 0)->find();
if ($check1 || $check2) {
return jsonError("User has registed");
}
$insert['account'] = trim($data['username']);
$insert['password'] = md5($data['password']);
$insert['realname'] = trim($data['name']);