You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
875 B
Go
39 lines
875 B
Go
1 year ago
|
package dictionary_admin
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/rpc/core/types/core"
|
||
|
"github.com/jinzhu/copier"
|
||
|
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/svc"
|
||
|
"git.noahlan.cn/n-admin/n-admin-server/api/internal/types"
|
||
|
|
||
|
"net/http"
|
||
|
)
|
||
|
|
||
|
type UpdateDictionaryAdminLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
r *http.Request
|
||
|
}
|
||
|
|
||
|
func NewUpdateDictionaryAdminLogic(r *http.Request, ctx context.Context, svcCtx *svc.ServiceContext) *UpdateDictionaryAdminLogic {
|
||
|
return &UpdateDictionaryAdminLogic{
|
||
|
r: r,
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (l *UpdateDictionaryAdminLogic) UpdateDictionaryAdmin(req *types.DictionaryInfo) error {
|
||
|
var rpcReq core.DictionaryInfo
|
||
|
_ = copier.Copy(&rpcReq, req)
|
||
|
|
||
|
_, err := l.svcCtx.CoreRpc.UpdateDictionary(l.ctx, &rpcReq)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|