Kaynağa Gözat

更新代码

XMLWAN 4 yıl önce
ebeveyn
işleme
8216a056ed

+ 1 - 1
conf/app.conf Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9529
2
+httpport = 9531
3 3
 runmode = dev
4 4
 
5 5
 

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_base_controller.go Dosyayı Görüntüle

@@ -23,6 +23,8 @@ func (this *MobileBaseAPIController) Prepare() {
23 23
 	// beego.Trace("============================================================")
24 24
 }
25 25
 
26
+//
27
+
26 28
 func (this *MobileBaseAPIController) GetMobileAdminUserInfo() *MobileAdminUserInfo {
27 29
 	userInfo := this.GetSession("mobile_admin_user_info")
28 30
 	if userInfo == nil {

+ 28 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Dosyayı Görüntüle

@@ -1772,14 +1772,24 @@ func (this *NewDialysisApiController) GetOrgName() {
1772 1772
 func (this *NewDialysisApiController) GetRoleName() {
1773 1773
 	id, _ := this.GetInt64("id")
1774 1774
 	fmt.Println("id", id)
1775
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1775
+	orgid, _ := this.GetInt64("orgid")
1776 1776
 	fmt.Println("orgid", orgid)
1777
-	appid := this.GetMobileAdminUserInfo().App.Id
1778
-	fmt.Println("appid", appid)
1779
-	name, err := service.GetRoleName(id, orgid, appid)
1777
+	//跟剧机构ID获取APPID
1778
+	app, _ := service.GetAppId(orgid)
1779
+	name, err := service.GetRoleName(id, orgid, app.Id)
1780 1780
 	//获取管理员
1781 1781
 	admin, err := service.GetAdmin(id)
1782
-	positionName, err := service.GetPositionName(id, orgid, appid)
1782
+	positionName, err := service.GetPositionName(id, orgid, app.Id)
1783
+	role_ids := strings.Split(positionName.RoleIds, ",")
1784
+	var names = ""
1785
+	for _, item := range role_ids {
1786
+		id, _ := strconv.ParseInt(item, 10, 64)
1787
+		role, _ := service.GetRole(id)
1788
+		if len(role.RoleName) != 0 {
1789
+			names = role.RoleName + "," + names
1790
+		}
1791
+	}
1792
+	fmt.Println("role_ids--------------", role_ids)
1783 1793
 	if err != nil {
1784 1794
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1785 1795
 		return
@@ -1788,6 +1798,7 @@ func (this *NewDialysisApiController) GetRoleName() {
1788 1798
 		"name":         name,
1789 1799
 		"positionName": positionName,
1790 1800
 		"admin":        admin,
1801
+		"names":        names,
1791 1802
 	})
1792 1803
 }
1793 1804
 
@@ -2382,3 +2393,15 @@ func (this *NewDialysisApiController) GetCurrentOrg() {
2382 2393
 		"signToken": signToken,
2383 2394
 	})
2384 2395
 }
2396
+
2397
+func (this *NewDialysisApiController) GetMyMobile() {
2398
+	id, _ := this.GetInt64("id")
2399
+	mobile, err := service.GetMyMobile(id)
2400
+	if err != nil {
2401
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2402
+		return
2403
+	}
2404
+	this.ServeSuccessJSON(map[string]interface{}{
2405
+		"mobile": mobile,
2406
+	})
2407
+}

+ 1 - 0
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Dosyayı Görüntüle

@@ -148,4 +148,5 @@ func NewMobileAPIControllersRegisterRouters() {
148 148
 	beego.Router("/m/api/patient/savenametwo", &NewDialysisApiController{}, "Get:SaveNameTwo")
149 149
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150 150
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
151
+	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
151 152
 }

+ 17 - 16
models/dialysis.go Dosyayı Görüntüle

@@ -804,22 +804,23 @@ func (GobalTemplate) TableName() string {
804 804
 }
805 805
 
806 806
 type SgjUserAdminRole struct {
807
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
808
-	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
809
-	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
810
-	AppId       int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
811
-	RoleId      int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
812
-	UserName    string `gorm:"column:user_name" json:"user_name" form:"user_name"`
813
-	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
814
-	UserType    int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
815
-	UserTitle   int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
816
-	Intro       string `gorm:"column:intro" json:"intro" form:"intro"`
817
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
818
-	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
-	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
-	Message     string `gorm:"column:message" json:"message" form:"message"`
821
-	Sex         int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
-	Birthday    int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
807
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
808
+	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
809
+	OrgId         int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
810
+	AppId         int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
811
+	RoleId        int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
812
+	UserName      string `gorm:"column:user_name" json:"user_name" form:"user_name"`
813
+	Avatar        string `gorm:"column:avatar" json:"avatar" form:"avatar"`
814
+	UserType      int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
815
+	UserTitle     int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
816
+	Intro         string `gorm:"column:intro" json:"intro" form:"intro"`
817
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
818
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
+	Message       string `gorm:"column:message" json:"message" form:"message"`
821
+	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
+	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
823
+	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
823 824
 }
824 825
 
825 826
 func (SgjUserAdminRole) TableName() string {

+ 6 - 0
service/manage_service.go Dosyayı Görüntüle

@@ -416,6 +416,12 @@ func GetOrgName(orgid int64) (models.Org, error) {
416 416
 	return org, err
417 417
 }
418 418
 
419
+func GetMyMobile(id int64) (models.SgjUserAdmin, error) {
420
+	admin := models.SgjUserAdmin{}
421
+	err := UserReadDB().Model(&admin).Where("id=? and status = 1", id).Find(&admin).Error
422
+	return admin, err
423
+}
424
+
419 425
 func CreateCulture(culture *models.DeviceCulture) error {
420 426
 
421 427
 	err := writeUserDb.Create(&culture).Error

+ 12 - 0
service/patientmanage_service.go Dosyayı Görüntüle

@@ -1310,6 +1310,12 @@ func CreateLoginLod(log *models.SgjUserAdminLoginLog) error {
1310 1310
 	return err
1311 1311
 }
1312 1312
 
1313
+func GetAppId(orgid int64) (models.OrgApp, error) {
1314
+	app := models.OrgApp{}
1315
+	err := UserReadDB().Model(&app).Where("org_id = ? and status = 1 and app_type = 3", orgid).Find(&app).Error
1316
+	return app, err
1317
+}
1318
+
1313 1319
 func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1314 1320
 
1315 1321
 	role := models.Roles{}
@@ -1317,6 +1323,12 @@ func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error)
1317 1323
 	return role, err
1318 1324
 }
1319 1325
 
1326
+func GetRole(id int64) (models.Role, error) {
1327
+	role := models.Role{}
1328
+	err := UserReadDB().Model(&role).Where("id = ? and status =1", id).Find(&role).Error
1329
+	return role, err
1330
+}
1331
+
1320 1332
 func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1321 1333
 
1322 1334
 	role := models.App_Role{}