1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package logic
- import (
- "context"
- "GtDataStore/app/cmd/organization/internal/svc"
- "GtDataStore/app/cmd/organization/pb"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type EnableAppInfoLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewEnableAppInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EnableAppInfoLogic {
- return &EnableAppInfoLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *EnableAppInfoLogic) EnableAppInfo(in *pb.EnableAppInfoReq) (*pb.EnableAppInfoResp, error) {
- appInfo, err := l.svcCtx.AppInfo.FindOneByAppName(l.ctx, in.AppName)
- if err != nil {
- return nil, err
- }
- if appInfo.Status != 0 {
- appInfo.Status = 0
- err = l.svcCtx.AppInfo.Update(l.ctx, appInfo)
- if err != nil {
- return nil, err
- }
- }
- return &pb.EnableAppInfoResp{Ok: true}, nil
- }
|