123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package xunji_service
- import (
- "context"
- "github.com/suyuan32/simple-admin-common/msg/errormsg"
- "wechat-api/internal/utils/dberrorhandler"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type UpdateXunjiServiceLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewUpdateXunjiServiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateXunjiServiceLogic {
- return &UpdateXunjiServiceLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx}
- }
- func (l *UpdateXunjiServiceLogic) UpdateXunjiService(req *types.XunjiServiceInfo) (*types.BaseMsgResp, error) {
- err := l.svcCtx.DB.XunjiService.UpdateOneID(*req.Id).
- SetNotNilStatus(req.Status).
- SetNotNilXunjiID(req.XunjiId).
- SetNotNilAgentID(req.AgentId).
- SetNotNilWxid(req.Wxid).
- SetNotNilAPIBase(req.ApiBase).
- SetNotNilAPIKey(req.ApiKey).
- Exec(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
- }
|