123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package Wx
- import (
- "context"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- "wechat-api/internal/utils/dberrorhandler"
- "github.com/suyuan32/simple-admin-common/msg/errormsg"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type UpdateWxLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewUpdateWxLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWxLogic {
- return &UpdateWxLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *UpdateWxLogic) UpdateWx(req *types.WxInfo) (*types.BaseMsgResp, error) {
- err := l.svcCtx.DB.Wx.UpdateOneID(*req.Id).
- SetNotNilStatus(req.Status).
- SetNotNilServerID(req.ServerId).
- SetNotNilPort(req.Port).
- SetNotNilProcessID(req.ProcessId).
- SetNotNilCallback(req.Callback).
- SetNotNilWxid(req.Wxid).
- SetNotNilAccount(req.Account).
- SetNotNilNickname(req.Nickname).
- SetNotNilTel(req.Tel).
- SetNotNilHeadBig(req.HeadBig).
- Exec(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
- }
|