feat: 初次启动
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/internal/svc"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type UpdateClientLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUpdateClientLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateClientLogic {
|
||||
return &UpdateClientLogic{ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx)}
|
||||
}
|
||||
|
||||
func (l *UpdateClientLogic) UpdateClient(in *system.ClientUpdateReq) (*system.CommonResp, error) {
|
||||
if err := l.svcCtx.DB.Model(&sysModel.SundynixClient{}).Where("id = ?", in.Id).Updates(map[string]interface{}{
|
||||
"client_id": in.ClientId, "name": in.Name, "grant_type": in.GrantType,
|
||||
"additional_info": in.AdditionalInfo, "active_timeout": in.ActiveTimeout,
|
||||
}).Error; err != nil {
|
||||
return nil, fmt.Errorf("更新客户端失败")
|
||||
}
|
||||
return &system.CommonResp{Code: 200, Msg: "success"}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user