update_qrcode_logic.go 852 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package whatsapp
  2. import (
  3. "context"
  4. "wechat-api/hook/aliyun"
  5. "wechat-api/internal/svc"
  6. "wechat-api/internal/types"
  7. "github.com/zeromicro/go-zero/core/logx"
  8. )
  9. type UpdateQrcodeLogic struct {
  10. logx.Logger
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. }
  14. func NewUpdateQrcodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateQrcodeLogic {
  15. return &UpdateQrcodeLogic{
  16. Logger: logx.WithContext(ctx),
  17. ctx: ctx,
  18. svcCtx: svcCtx}
  19. }
  20. func (l *UpdateQrcodeLogic) UpdateQrcode(req *types.UpdateQrcodeReq) (*types.BaseMsgResp, error) {
  21. resp := types.BaseMsgResp{Msg: "修改成功"}
  22. _, err := aliyun.UpdateCamsQrcode(req.Phone, req.WaId, req.GenerateQrImage, req.PrefilledMessage, req.QrdlCode)
  23. l.Logger.Infof("update qrcode err:%v\n", err)
  24. if err != nil {
  25. resp.Msg = err.Error()
  26. resp.Code = 1
  27. }
  28. return &resp, nil
  29. }