golang 接口 interface

接口变量自带指针,指的是接口的实现时,接收者为指针类型

type MemberCRMStore interface {
	doGet(url string, params map[string]string, v interface{}) *errors.CRMError
	doPush(url string, vPostBody interface{}, v interface{}) *errors.CRMError

	//会员查询
	MemberGet(memberQueryReq *request.MemberQueryReq) (*model.Member, *errors.CRMError)
	//验证会员信息
	MemberCheck(memberValidationReq *request.MemberValidationReq) *errors.CRMError
	//会员注册
	MemberAdd(memberRegisteredReq *request.MemberAddReq) (*model.Member, *errors.CRMError)
	//会员更新
	MemberUpdate(memberUpdateReq *request.MemberUpdateReq) (*model.Member, *errors.CRMError)

	//会员宠物查询
	MemberPetGet(memberPetQueryReq *request.MemberPetQueryReq) ([]*model.MemberPet, *errors.CRMError)
	//会员宠物添加
	MemberPetAdd(memberPetAddReq *request.MemberPetAddReq) (*model.MemberPet, *errors.CRMError)
	//会员宠物更新
	MemberPetUpdate(memberPetUpdateReq *request.MemberPetUpdateReq) (*model.MemberPet, *errors.CRMError)
	//会员删除 批量
	MemberPetDelete(memberPetDeleteReq *request.MemberPetDeleteReq) *errors.CRMError

	//会员地址查询
	MemberAddressGet(memberAddressQueryReq *request.MemberAddressQueryReq) ([]*model.MemberAddress, *errors.CRMError)
	//会员地址添加
	MemberAddressAdd(memberAddressAddReq *request.MemberAddressAddReq) (*model.MemberAddress, *errors.CRMError)
	//会员地址更新
	MemberAddressUpdate(memberAddressUpdateReq *request.MemberAddressUpdateReq) (*model.MemberAddress, *errors.CRMError)
	//会员地址删除 批量
	MemberAddressDelete(memberAddressDeleteReq *request.MemberAddressDeleteReq) *errors.CRMError

	//会员积分明细
	MemberAccountHistory(memberAccountHistoryReq *request.MemberAccountHistoryReq) ([]*model.MemberAccountHistory, *errors.CRMError)
	//会员积分更新
	MemberAccountUpdate(memberAccountUpdateReq *request.MemberAccountUpdateReq) (*model.MemberAccountHistory, *errors.CRMError)
}

var (
	CRMHost = "http://miniapp-test.royalcanin.com.cn:7080/crm"

	MemberCRM  MemberCRMStore
	ProductCRM ProductCRMStore
	CouponCRM  CouponCRMStore
)

func InitCRM() {
	MemberCRM = &memberCRMStore{CRMClient: &http.Client{Timeout: 5 * time.Second}}
	ProductCRM = &productCRMStore{CrmClient: &http.Client{Timeout: 5 * time.Second}}
	CouponCRM = &couponCRMStore{CrmClient: &http.Client{Timeout: 5 * time.Second}}
}

 

你可能感兴趣的:(go)