This commit is contained in:
wangjinlei
2022-05-16 12:18:31 +08:00
parent 464d3b4cdf
commit 154f90ce3d
3 changed files with 44 additions and 13 deletions

View File

@@ -259,6 +259,37 @@ class User extends Controller
$this->user_obj->insertGetId($inser_data);
return jsonSuccess([]);
}
/**
* 获取所有编辑
*/
public function getAllEditor(){
$editors = $this->user_obj->where('type',2)->where('state',0)->select();
//获取编辑管理的期刊
foreach($editors as $k => $v){
$cache_journals = $this->journal_obj->where('editor_id',$v['user_id'])->where('state',0)->select();
$editors[$k]['journals'] = $cache_journals;
}
$re['editors'] = $editors;
return jsonSuccess($re);
}
/**
* 修改编辑密码
*/
public function changeEditorPassword(){
$data = $this->request->post();
// 验证规则
$rule = new Validate([
'user_id'=>'require|number',
'password'=>'require'
]);
if(!$rule->check($data)){
return json(['code' => 1,'msg'=>$rule->getError()]);
}
$this->user_obj->where('user_id',$data['user_id'])->update(['password'=>md5($data['password'])]);
return jsonSuccess([]);
}
/**