sms_lib.go 720 字节
package smslib

import (
	"context"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc/pkg/gateway"
	"net/http"
)

type SMSService struct {
	gateway.Service
}

func (svc *SMSService) SendSmsCode(ctx context.Context, request RequestSendSmsCode) (*DataSendSmsCode, error) {
	var result DataSendSmsCode
	if err := svc.Do(ctx, "/service/sendSms", http.MethodPost, request, &result); err != nil {
		return nil, err
	}
	return &result, nil
}

func (svc *SMSService) CheckSmsCode(ctx context.Context, request RequestCheckSmsCode) (*DataCheckSmsCode, error) {
	var result DataCheckSmsCode
	if err := svc.Do(ctx, "/service/checkSmsCode", http.MethodPost, request, &result); err != nil {
		return nil, err
	}
	return &result, nil
}