httplib_worth_service_gateway.go 1.1 KB
package service_gateway

import (
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/constant"
	"strings"
	"time"
)

type HttplibWorthServiceGateway struct {
	httplibBaseServiceGateway
}

// ChangePhoneCallback 修改手机号码回调,通知价值APP端中台
func (serviceGateway *HttplibWorthServiceGateway) ChangePhoneCallback(oldPhone string, newPhone string) (map[string]interface{}, error) {
	url := strings.Join([]string{serviceGateway.baseURL, "/v1/auth/forceRevoke"}, "/")
	request := serviceGateway.createRequest(url, "post")
	options := make(map[string]interface{})
	options["phone"] = oldPhone
	request.JSONBody(options)
	response := make(map[string]interface{})
	request.ToJSON(&response)
	data, err := serviceGateway.responseHandle(response)
	return data, err
}

func NewHttplibWorthServiceGateway() *HttplibWorthServiceGateway {
	return &HttplibWorthServiceGateway{
		httplibBaseServiceGateway: httplibBaseServiceGateway{
			baseURL:          constant.ABILITY_SERVICE_HOST,
			connectTimeout:   100 * time.Second,
			readWriteTimeout: 30 * time.Second,
		},
	}
}