|
@@ -3,10 +3,10 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\controller;
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use app\admin\model\AdminAccount;
|
|
|
|
use app\BaseController;
|
|
use app\BaseController;
|
|
|
|
+use think\App;
|
|
use think\facade\Db;
|
|
use think\facade\Db;
|
|
-use think\Request;
|
|
|
|
|
|
+
|
|
|
|
|
|
class User extends BaseController
|
|
class User extends BaseController
|
|
{
|
|
{
|
|
@@ -15,8 +15,9 @@ class User extends BaseController
|
|
*
|
|
*
|
|
* @return \think\Response
|
|
* @return \think\Response
|
|
*/
|
|
*/
|
|
- public function list()
|
|
|
|
|
|
+ public function __construct(App $app)
|
|
{
|
|
{
|
|
|
|
+ parent::__construct($app);
|
|
$post =$this->request->post();
|
|
$post =$this->request->post();
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
if($token==""){
|
|
if($token==""){
|
|
@@ -26,12 +27,19 @@ class User extends BaseController
|
|
if(!empty($effetc) && $effetc['code']!=0){
|
|
if(!empty($effetc) && $effetc['code']!=0){
|
|
return error_show($effetc['code'],$effetc['message']);
|
|
return error_show($effetc['code'],$effetc['message']);
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function list()
|
|
|
|
+ {
|
|
|
|
+ $post =$this->request->post();
|
|
|
|
+
|
|
$page = isset($post['page'])&& $post['page']!='' ? intval($post['page']) : 1;
|
|
$page = isset($post['page'])&& $post['page']!='' ? intval($post['page']) : 1;
|
|
$size = isset($post['size'])&& $post['size']!='' ? intval($post['size']) : 10;
|
|
$size = isset($post['size'])&& $post['size']!='' ? intval($post['size']) : 10;
|
|
$condition = ['page'=>$page,'size'=>$size];
|
|
$condition = ['page'=>$page,'size'=>$size];
|
|
- $data = GetUserlist($token,$condition);
|
|
|
|
|
|
+ $token = isset($post['token']) ? trim($post['token']) : "";
|
|
|
|
+ $data = Getlist($token,$condition);
|
|
if(!empty($data) && $data['code']!=0){
|
|
if(!empty($data) && $data['code']!=0){
|
|
- return error_show($effetc['code'],$effetc['message']);
|
|
|
|
|
|
+ return error_show($data['code'],$data['message']);
|
|
}
|
|
}
|
|
$list=[];
|
|
$list=[];
|
|
foreach($data['data']['list'] as $key=>$value){
|
|
foreach($data['data']['list'] as $key=>$value){
|
|
@@ -53,14 +61,6 @@ class User extends BaseController
|
|
public function userInfo(){
|
|
public function userInfo(){
|
|
$post =$this->request->post();
|
|
$post =$this->request->post();
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
- if($token==""){
|
|
|
|
- return app_show(101,'token不能为空');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $effetc = VerifyTokens($token);
|
|
|
|
- if(!empty($effetc) && $effetc['code']!=0){
|
|
|
|
- return app_show($effetc['code'],$effetc['message']);
|
|
|
|
- }
|
|
|
|
$userinfo=GetUserInfo($token);
|
|
$userinfo=GetUserInfo($token);
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
return app_show(1002,"员工信息不存在");
|
|
return app_show(1002,"员工信息不存在");
|
|
@@ -114,13 +114,6 @@ class User extends BaseController
|
|
public function userAll(){
|
|
public function userAll(){
|
|
$post =$this->request->post();
|
|
$post =$this->request->post();
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
- if($token==""){
|
|
|
|
- return app_show(101,'token不能为空');
|
|
|
|
- }
|
|
|
|
- $effetc = VerifyTokens($token);
|
|
|
|
- if(!empty($effetc) && $effetc['code']!=0){
|
|
|
|
- return app_show($effetc['code'],$effetc['message']);
|
|
|
|
- }
|
|
|
|
$userinfo=GetAccountall($token);
|
|
$userinfo=GetAccountall($token);
|
|
|
|
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
@@ -147,13 +140,6 @@ class User extends BaseController
|
|
public function userList(){
|
|
public function userList(){
|
|
$post =$this->request->post();
|
|
$post =$this->request->post();
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
- if($token==""){
|
|
|
|
- return app_show(101,'token不能为空');
|
|
|
|
- }
|
|
|
|
- $effetc = VerifyTokens($token);
|
|
|
|
- if(!empty($effetc) && $effetc['code']!=0){
|
|
|
|
- return app_show($effetc['code'],$effetc['message']);
|
|
|
|
- }
|
|
|
|
$userinfo=GetList($token,$post);
|
|
$userinfo=GetList($token,$post);
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
if(empty($userinfo)||$userinfo['code']!=0){
|
|
return app_show($userinfo['code'],$userinfo['msg']);
|
|
return app_show($userinfo['code'],$userinfo['msg']);
|
|
@@ -174,13 +160,6 @@ class User extends BaseController
|
|
public function setRole(){
|
|
public function setRole(){
|
|
$post =$this->request->post();
|
|
$post =$this->request->post();
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
$token = isset($post['token']) ? trim($post['token']) : "";
|
|
- if($token==""){
|
|
|
|
- return app_show(101,'token不能为空');
|
|
|
|
- }
|
|
|
|
- $effetc = VerifyTokens($token);
|
|
|
|
- if(!empty($effetc) && $effetc['code']!=0){
|
|
|
|
- return app_show($effetc['code'],$effetc['message']);
|
|
|
|
- }
|
|
|
|
$uid = isset($post['id'])&&$post['id']!=='' ? intval($post['id']) :"";
|
|
$uid = isset($post['id'])&&$post['id']!=='' ? intval($post['id']) :"";
|
|
if($uid===''){
|
|
if($uid===''){
|
|
return error_show(1004,"参数id 不能为空");
|
|
return error_show(1004,"参数id 不能为空");
|