mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
增加保存管理员语言选择的API
This commit is contained in:
@@ -313,6 +313,14 @@ func (this *AdminDAO) UpdateAdminTheme(tx *dbs.Tx, adminId int64, theme string)
|
|||||||
UpdateQuickly()
|
UpdateQuickly()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateAdminLang 设置管理员语言
|
||||||
|
func (this *AdminDAO) UpdateAdminLang(tx *dbs.Tx, adminId int64, langCode string) error {
|
||||||
|
return this.Query(tx).
|
||||||
|
Pk(adminId).
|
||||||
|
Set("lang", langCode).
|
||||||
|
UpdateQuickly()
|
||||||
|
}
|
||||||
|
|
||||||
// CheckSuperAdmin 检查管理员是否为超级管理员
|
// CheckSuperAdmin 检查管理员是否为超级管理员
|
||||||
func (this *AdminDAO) CheckSuperAdmin(tx *dbs.Tx, adminId int64) (bool, error) {
|
func (this *AdminDAO) CheckSuperAdmin(tx *dbs.Tx, adminId int64) (bool, error) {
|
||||||
if adminId <= 0 {
|
if adminId <= 0 {
|
||||||
|
|||||||
@@ -740,3 +740,18 @@ func (this *AdminService) UpdateAdminTheme(ctx context.Context, req *pb.UpdateAd
|
|||||||
}
|
}
|
||||||
return this.Success()
|
return this.Success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateAdminLang 修改管理员使用的语言
|
||||||
|
func (this *AdminService) UpdateAdminLang(ctx context.Context, req *pb.UpdateAdminLangRequest) (*pb.RPCSuccess, error) {
|
||||||
|
adminId, err := this.ValidateAdmin(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var tx = this.NullTx()
|
||||||
|
|
||||||
|
err = models.SharedAdminDAO.UpdateAdminLang(tx, adminId, req.LangCode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return this.Success()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user