XMLWAN 4 år sedan
förälder
incheckning
214d53c96f
1 ändrade filer med 7 tillägg och 3 borttagningar
  1. 7 3
      controllers/role_controller.go

+ 7 - 3
controllers/role_controller.go Visa fil

@@ -1,6 +1,7 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
+	"fmt"
4 5
 	"github.com/jinzhu/gorm"
5 6
 	"strconv"
6 7
 	"strings"
@@ -486,7 +487,9 @@ func (this *RoleAPIController) AddAdmin() {
486 487
 	userTitle, _ := this.GetInt("title")
487 488
 	roleIds := this.GetString("role")
488 489
 	user_title_name := this.GetString("user_title_name")
489
-
490
+	sort, _ := this.GetInt64("sort")
491
+	fmt.Println("sort--------------------------------", sort)
492
+	fmt.Println("sort", sort)
490 493
 	if len(mobile) == 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || len(roleIds) <= 0 {
491 494
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
492 495
 		return
@@ -499,7 +502,7 @@ func (this *RoleAPIController) AddAdmin() {
499 502
 		return
500 503
 	} else {
501 504
 		if adminUser == nil { //新增账号和用户
502
-			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle)
505
+			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, sort)
503 506
 			if createErr != nil {
504 507
 				//beego.Error("创建管理员失败:", createErr)
505 508
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
@@ -632,7 +635,7 @@ func (this *RoleAPIController) EditAdmin() {
632 635
 	roleIds := this.GetString("role")
633 636
 	intro := this.GetString("intro")
634 637
 	user_title_name := this.GetString("user_title_name")
635
-
638
+	sort, _ := this.GetInt64("sort")
636 639
 	_, titleExist := models.UserTitle[userTitle]
637 640
 	if adminUserId <= 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || !titleExist || len(roleIds) <= 0 {
638 641
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -657,6 +660,7 @@ func (this *RoleAPIController) EditAdmin() {
657 660
 	appRole.Intro = intro
658 661
 	appRole.UserTitleName = user_title_name
659 662
 	appRole.ModifyTime = time.Now().Unix()
663
+	appRole.Sort = sort
660 664
 	saveErr := service.SaveAppRole(appRole)
661 665
 	if saveErr != nil {
662 666
 		//beego.Error("修改App_Role失败:", saveErr)