sso_sdk

package module
v1.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2022 License: MIT Imports: 8 Imported by: 0

README

sso

星耀九州统一登录门户golang sdk

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalanceChangeHistoryItem added in v1.1.11

type BalanceChangeHistoryItem struct {
	RespBase
	UserId      string `json:"user_id,omitempty" url:"user_id" form:"user_id"`
	PreOrderId  string `json:"pre_order_id,omitempty" url:"pre_order_id" form:"pre_order_id"`
	MapId       string `json:"map_id,omitempty" url:"map_id" form:"map_id"`
	Quantity    uint64 `json:"quantity,omitempty" url:"quantity" form:"quantity"` // 支付金额
	ProductUid  string `json:"product_uid,omitempty" url:"product_uid" form:"product_uid"`
	ProductName string `json:"product_name,omitempty" url:"product_name" form:"product_name"`
	ProductUrl  string `json:"product_url,omitempty" url:"product_url" form:"product_url"`
	Remark      string `json:"remark,omitempty" url:"remark" form:"remark"`
	OrderUid    string `json:"order_uid,omitempty" url:"order_uid" form:"order_uid"`
	PublicKey   string `json:"public_key,omitempty" url:"public_key" form:"public_key"`
	Extra       string `json:"extra" url:"extra" from:"extra"`
}

BalanceChangeHistoryItem 成交记录

type BalanceChangeHistoryResp added in v1.1.11

type BalanceChangeHistoryResp struct {
	Page     uint64                     `json:"page"`
	PageSize uint64                     `json:"page_size"`
	Data     []BalanceChangeHistoryItem `json:"data"`
	Total    uint64                     `json:"total"` //
}

type BaseUserInfo added in v1.1.5

type BaseUserInfo struct {
	NickName     string   `json:"nick_name"`
	AvatarUrl    string   `json:"avatar_url"`
	Powers       []string `json:"powers,omitempty"`
	ManagePowers []string `json:"manage_powers,omitempty"`
}

BaseUserInfo 基础用户信息

type ChangeInfoSendBodyResp added in v1.1.11

type ChangeInfoSendBodyResp struct {
	Event     string `json:"event,omitempty"` //app_change_info
	AvatarUrl string `json:"avatar_url,omitempty"`
	NickName  string `json:"nick_name,omitempty"`
	ToUser    string `json:"to_user,omitempty"`
	SignBase
}

ChangeInfoSendBodyResp 变更app里的用户基本信息

type ChangePhoneSendBodyResp added in v1.1.11

type ChangePhoneSendBodyResp struct {
	Event     string `json:"event,omitempty"` // user_change_phone
	PublicKey string `json:"public_key,omitempty"`
	ToUser    string `json:"to_user,omitempty"`
	Phone     string `json:"phone,omitempty"`
	SignBase
}

ChangePhoneSendBodyResp 变更用户手机号

type GetOrderInfoResp added in v1.1.11

type GetOrderInfoResp struct {
	Pay      BalanceChangeHistoryItem `json:"pay" form:"pay"`
	PreOrder PreOrderItem             `json:"pre_order"`
}

type HitImgResp added in v1.1.15

type HitImgResp struct {
	Success bool `json:"success"`
}

type HitTextResp added in v1.1.15

type HitTextResp struct {
	Success bool   `json:"success"`
	Msg     string `json:"msg"`
}

type JsonSchemaReq added in v1.1.13

type JsonSchemaReq struct {
	SendUserInfo struct {
		Mid       string `json:"mid" form:"mid" comment:"用户id" validate:"required"`
		PublicKey string `json:"public_key,omitempty" form:"public_key,omitempty"`
	} `json:"send_user_info" form:"send_user_info" validate:"required"`
	SendSignInfo SignBase `json:"send_sign_info,omitempty" form:"send_sign_info,omitempty"`
	FormId       string   `json:"form_id" form:"form_id" comment:"表单ID" validate:"required"`
	FormEng      string   `json:"form_eng,omitempty" form:"form_eng,omitempty" comment:"表单英文唯一"`
	Data         string   `json:"data" form:"data" comment:"表单数据" validate:"required"`
	InjectData   string   `json:"inject_data,omitempty" form:"inject_data,omitempty" comment:"注入数据"`
}

JsonSchemaReq 用户填写了表单的回调

type PowerChangeBodyResp added in v1.1.14

type PowerChangeBodyResp struct {
	SignBase
	PowerRespBase
	Open   bool   `json:"open"`
	Reason string `json:"reason,omitempty"`
}

PowerChangeBodyResp 用户能力变更通知

type PowerChangeReq added in v1.1.14

type PowerChangeReq struct {
	UidGetUserReq
	Eng    string `json:"eng" form:"eng"`
	Open   bool   `json:"open" form:"open" `    // 打开还是关闭
	Reason string `json:"reason" form:"reason"` // 理由
}

type PowerNeedVerifyBodyResp added in v1.1.14

type PowerNeedVerifyBodyResp struct {
	SignBase
	PowerRespBase
}

PowerNeedVerifyBodyResp 用户能力提交申请等待审核通知

type PowerRespBase added in v1.1.14

type PowerRespBase struct {
	Eng string `json:"eng"`
	Uid string `json:"uid"`
}

type PowerSettingChangeBodyResp added in v1.1.14

type PowerSettingChangeBodyResp struct {
	SignBase
	PowerRespBase
	Body string `json:"body"`
}

PowerSettingChangeBodyResp 用户能力设置变更通知

type PowerSettingReq added in v1.1.14

type PowerSettingReq struct {
	UidGetUserReq
	Eng string `json:"eng" form:"eng"`
}

type PowerSettingResp added in v1.1.14

type PowerSettingResp struct {
	UpdateAt string `json:"update_at"`
	Data     string `json:"data"`
}

type PreOrder added in v1.1.5

type PreOrder struct {
	Uid        string    `json:"uid"`       // 对应商品UID 可不传
	Count      uint64    `json:"count"`     // 对应商品数量 可不传
	Substance  string    `json:"substance"` // 传什么吐什么
	Name       string    `json:"name"`
	Price      uint64    `json:"price"` // 不允许有免费的出现
	Desc       string    `json:"desc"`
	ImgUrl     string    `json:"img_url"`
	PreviewUrl []string  `json:"preview_url"`
	Extra      string    `json:"extra"` // 传什么吐什么
	ExpireTime time.Time `json:"expire_time"`
	SignBase
}

PreOrder 预下单 除了name 和price之外都可以不传

type PreOrderItem added in v1.1.11

type PreOrderItem struct {
	RespBase
	AppId       string      `json:"app_id"`
	ProductInfo ProductInfo `json:"product_info"`
	Substance   string      `json:"substance"`
	Extra       string      `json:"extra"`
	ExpireTime  time.Time   `json:"expire_time"`
}

type PreOrderResp added in v1.1.5

type PreOrderResp struct {
	PreOrderId string `json:"pre_order_id" form:"pre_order_id"`
}

PreOrderResp 预下单返回

type ProductInfo added in v1.1.11

type ProductInfo struct {
	Uid        string   `json:"uid" comment:"唯一ID"`
	Count      uint64   `json:"count" comment:"对应数量"`
	Name       string   `json:"name"  comment:"商品名"`
	Price      uint64   `json:"price"  comment:"价格"`
	Desc       string   `json:"desc" comment:"描述"`
	ImgUrl     string   `json:"img_url"  comment:"主图"`
	PreviewUrl []string `json:"preview_url"  comment:"预览图"` // 其他图片
}

type ProductPayBase

type ProductPayBase struct {
	ProductUid   string `json:"product_uid" form:"product_uid"`      // 商品uid
	ProductName  string `json:"product_name" form:"product_name" `   // 商品名 必填
	ProductUrl   string `json:"product_url" form:"product_url" `     // 商品url
	ProductPrice uint64 `json:"product_price" form:"product_price" ` // 商品价格 必填
	Remark       string `json:"remark" form:"remark" `               // 备注
}

ProductPayBase 商品支付基础

type ProductPayResp

type ProductPayResp struct {
	OrderNo string `json:"order_no" form:"order_no"`
	Detail  string `json:"detail" form:"detail"`
}

ProductPayResp 商品收款返回

type ProductPaySendBodyResp added in v1.1.11

type ProductPaySendBodyResp struct {
	Event      string      `json:"event,omitempty"` // product_pay
	ToUser     string      `json:"to_user,omitempty"`
	Extra      string      `json:"extra,omitempty"`
	Substance  string      `json:"substance,omitempty"`
	Remark     string      `json:"remark,omitempty"`
	OrderNo    string      `json:"order_no,omitempty"`
	PreOrderId string      `json:"pre_order_id,omitempty"`
	Product    ProductInfo `json:"product"`
	SignBase
}

ProductPaySendBodyResp 预下单商品支付完成

type ProductReceipt

type ProductReceipt struct {
	Uid string `json:"uid"` // 用户uid
	ProductPayBase
	SignBase
}

ProductReceipt 商品收款

type RespBase added in v1.1.11

type RespBase struct {
	Id       string    `json:"id,omitempty" url:"id" form:"id"`
	UpdateAt time.Time `json:"update_at" url:"update_at" form:"update_at"`
	CreateAt time.Time `json:"create_at" url:"create_at" form:"create_at"`
}

type SignBase

type SignBase struct {
	Sign      string `json:"sign" form:"sign" url:"sign"`
	RandomStr string `json:"random_str" form:"random_str" url:"random_str"`
	T         string `json:"t" form:"t" url:"t"` // unix时间戳字符串
}

SignBase 签名请求基础

func (*SignBase) GenSign added in v1.1.11

func (c *SignBase) GenSign()

type Sso

type Sso struct {
	Host      string
	PublicKey string
	SecretKey string
	Prefix    string
}
var (
	Sdk Sso
)

func New

func New(publicKey, secretKey string) Sso

func (*Sso) ChangeUserPower added in v1.1.14

func (c *Sso) ChangeUserPower(data PowerChangeReq) (bool, error)

ChangeUserPower 主动变更用户能力

func (*Sso) CheckSign

func (c *Sso) CheckSign(sign, randomStr, timeUnix string) bool

CheckSign 验证加密

func (*Sso) GetUploadKey added in v1.1.4

func (c *Sso) GetUploadKey() (UploadKeyResp, error)

GetUploadKey 获取上传凭据

func (*Sso) HitImage added in v1.1.15

func (c *Sso) HitImage(imageUrl string) (*HitImgResp, error)

HitImage 检测图像是否违规

func (*Sso) HitText added in v1.1.15

func (c *Sso) HitText(content string) (*HitTextResp, error)

HitText 检测文字是否违规

func (*Sso) OrderIdGetInfo added in v1.1.11

func (c *Sso) OrderIdGetInfo(orderId string) (GetOrderInfoResp, error)

OrderIdGetInfo 通过orderId获取成交记录

func (*Sso) PreOrderIdGetSuccessList added in v1.1.11

func (c *Sso) PreOrderIdGetSuccessList(preOrderId string, page, pageSize uint64) (*BalanceChangeHistoryResp, error)

PreOrderIdGetSuccessList 通过预下单ID获取成交列表

func (*Sso) ProductPreOrder added in v1.1.5

func (c *Sso) ProductPreOrder(data PreOrder) (PreOrderResp, error)

ProductPreOrder 预下单

func (*Sso) RunTr

func (c *Sso) RunTr(data ProductReceipt, receipt bool) (ProductPayResp, error, int)

RunTr 发起交易 receipt 是否是商品收款

func (*Sso) SetHost

func (c *Sso) SetHost(host string)

func (*Sso) Sign

func (c *Sso) Sign() (string, string, string)

Sign 生成一次加密

func (*Sso) UidGetUserInfo

func (c *Sso) UidGetUserInfo(uid string) (UidGetUserResp, error)

UidGetUserInfo 通过uid获取用户信息

func (*Sso) UidGetUserPowerSetting added in v1.1.14

func (c *Sso) UidGetUserPowerSetting(uid string, eng string) (PowerSettingResp, error)

UidGetUserPowerSetting 获取用户能力设置

func (*Sso) UploadImage added in v1.1.12

func (c *Sso) UploadImage(imgPath string, maxWidth int) (UploadImageResp, error)

UploadImage 上传图片

func (*Sso) UrlGen

func (c *Sso) UrlGen(prefix string, p string) string

UrlGen 请求url路径生成

type TrSendBodyResp added in v1.1.11

type TrSendBodyResp struct {
	Event     string `json:"event,omitempty"` // cash_receive
	Name      string `json:"name,omitempty"`
	OrderNo   string `json:"order_no,omitempty"`
	ToUser    string `json:"to_user,omitempty"`
	PayUser   string `json:"pay_user,omitempty"`
	Remark    string `json:"remark,omitempty"`
	Price     uint64 `json:"price,omitempty"`
	DetailUrl string `json:"detail_url,omitempty"`
	SignBase
}

TrSendBodyResp 收银台收款

type UidGetUserReq added in v1.1.11

type UidGetUserReq struct {
	Uid string `json:"uid" form:"uid"`
	SignBase
}

type UidGetUserResp added in v1.1.5

type UidGetUserResp struct {
	User UserInfo     `json:"user"`
	Info BaseUserInfo `json:"info"`
}

func (*UidGetUserResp) HasManagePower added in v1.1.14

func (c *UidGetUserResp) HasManagePower(name string) bool

func (*UidGetUserResp) HasPower added in v1.1.14

func (c *UidGetUserResp) HasPower(name string) bool

type UploadImageResp added in v1.1.12

type UploadImageResp struct {
	Origin    string `json:"origin"`
	Thumbnail string `json:"thumbnail"`
}

type UploadKeyResp added in v1.1.4

type UploadKeyResp struct {
	SecretID     string
	SecretKey    string
	SessionToken string
	ExpiredTime  uint64
	Prefix       string
	Visit        string
}

UploadKeyResp 上传key请求resp

type UserInfo

type UserInfo struct {
	BaseUserInfo
	Id            string `json:"id"`
	UniqueId      string `json:"unique_id,omitempty"`
	TelPhone      string `json:"tel_phone"`       // 手机号
	Balance       uint64 `json:"balance"`         // 余额
	PromoteUserId string `json:"promote_user_id"` // 推荐人
}

UserInfo 用户信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL