1
This commit is contained in:
@@ -32,6 +32,7 @@ class User extends Controller
|
|||||||
protected $reviewer_from_author_obj = '';
|
protected $reviewer_from_author_obj = '';
|
||||||
protected $article_author_obj = '';
|
protected $article_author_obj = '';
|
||||||
protected $user_black_obj = '';
|
protected $user_black_obj = '';
|
||||||
|
protected $user_to_special_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null)
|
public function __construct(\think\Request $request = null)
|
||||||
{
|
{
|
||||||
@@ -51,6 +52,7 @@ class User extends Controller
|
|||||||
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
|
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
|
||||||
$this->article_author_obj = Db::name('article_author');
|
$this->article_author_obj = Db::name('article_author');
|
||||||
$this->user_black_obj = Db::name('user_black');
|
$this->user_black_obj = Db::name('user_black');
|
||||||
|
$this->user_to_special_obj = Db::name('user_to_special');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -334,6 +336,70 @@ class User extends Controller
|
|||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户详细信息
|
||||||
|
*/
|
||||||
|
public function getUserDetail(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'user_id' => 'require'
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$user_info = $this->user_obj->where("user_id",$data['user_id'])->where('state',0)->find();
|
||||||
|
$user_info['roles'] = $this->getUserRoles($user_info['account']);
|
||||||
|
//获取用户的客座期刊的详细信息
|
||||||
|
$list = $this->user_to_special_obj->where('user_id',$user_info['user_id'])->where('uts_state',0)->select();
|
||||||
|
$specials = [];
|
||||||
|
foreach($list as $k => $v){
|
||||||
|
$cache_info = $this->getSpecialDetailById($v['special_id']);
|
||||||
|
$cache_journal = $this->journal_obj->where('issn',$cache_info['journal_issn']);
|
||||||
|
$cache_info['journal_id'] = $cache_journal['journal_id'];
|
||||||
|
$specials[] = $cache_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_info['specials'] = $specials;
|
||||||
|
$re['user'] = $user_info;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getSpecialDetailById($special_id){
|
||||||
|
$base_url = Env::get('base_url');
|
||||||
|
$api_url = $base_url."/master/special/getSpecialDetailById";
|
||||||
|
$res = object_to_array(json_decode(myPost($api_url,['journal_special_id'=>$special_id])));
|
||||||
|
$special_info = $res['data']['special'];
|
||||||
|
unset($special_info['journal_id']);
|
||||||
|
return $special_info;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加用户身份
|
||||||
|
*/
|
||||||
|
public function addUserRole(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'user_id' => 'require',
|
||||||
|
'role_type'=> 'require'
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
if($data['role_type']=='special'){
|
||||||
|
if(!isset($data['special_id'])){
|
||||||
|
return jsonError("添加客座编辑身份时,客座id是必传项");
|
||||||
|
}
|
||||||
|
$insert_uts['user_id'] = $data['user_id'];
|
||||||
|
$insert_uts['special_id'] = $data['special_id'];
|
||||||
|
$insert_uts['uts_ctime'] = time();
|
||||||
|
$this->user_to_special_obj->insert($insert_uts);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 审稿系统登录功能
|
* @title 审稿系统登录功能
|
||||||
* @description 审稿系统登录功能
|
* @description 审稿系统登录功能
|
||||||
@@ -406,6 +472,10 @@ class User extends Controller
|
|||||||
if ($board_res != null) {
|
if ($board_res != null) {
|
||||||
$roles[] = 'board';
|
$roles[] = 'board';
|
||||||
}
|
}
|
||||||
|
$special_res = $this->user_to_special_obj->where('user_id',$user_info['user_id'])->where("uts_state",0)->find();
|
||||||
|
if($special_res != null){
|
||||||
|
$roles[] = 'special';
|
||||||
|
}
|
||||||
return $roles;
|
return $roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user