Documentation ¶
Index ¶
- Constants
- func CleanUpExpiredDistributedMessages(ctx context.Context, shard string) (int64, error)
- func CreateWxClient() *wxpay.Client
- func CreateWxPayment(client *wxpay.Client, traceId int64, amount, wxOpenId string) (wxpay.Params, error)
- func FetchWxPayment(client *wxpay.Client, traceId int64) (wxpay.Params, error)
- func FindDistributedMessageRecipientId(ctx context.Context, id string) (string, error)
- func GetPayJsParams(client *wxpay.Client, params wxpay.Params) wxpay.Params
- func ListExpiredPackets(ctx context.Context, limit int) ([]string, error)
- func PaidMemberCount(ctx context.Context) (int64, error)
- func PingUserActiveAt(ctx context.Context, userId string) error
- func ReadProhibitedProperty(ctx context.Context) (bool, error)
- func ReadStatistic(ctx context.Context, user *User) (map[string]interface{}, error)
- func SendParticipantTransfer(ctx context.Context, packetId, userId string, amount string) error
- func SubscribersCount(ctx context.Context) (int64, error)
- func UniqueConversationId(userId, recipientId string) string
- func UpdateMessagesStatus(ctx context.Context, messages []*DistributedMessage) error
- type Asset
- type Blacklist
- type Coupon
- type DistributedMessage
- type Message
- type Order
- func CreateOrder(ctx context.Context, userId, amount, wxOpenId string) (*Order, wxpay.Params, wxpay.Params, error)
- func GetNotPaidOrders(ctx context.Context, limit int64) ([]*Order, error)
- func GetOrder(ctx context.Context, orderId string) (*Order, error)
- func MarkOrderAsPaidByTraceId(ctx context.Context, traceId int64, transactionId string) (*Order, error)
- type Packet
- func PayPacket(ctx context.Context, packetId string, assetId, amount string) (*Packet, error)
- func RefundPacket(ctx context.Context, packetId string) (*Packet, error)
- func SendPacketRefundTransfer(ctx context.Context, packetId string) (*Packet, error)
- func ShowPacket(ctx context.Context, packetId string) (*Packet, error)
- type Participant
- type Property
- type RecallMessage
- type User
- func AuthenticateUserByOAuth(ctx context.Context, authorizationCode string) (*User, error)
- func AuthenticateUserByToken(ctx context.Context, authenticationToken string) (*User, error)
- func FindUser(ctx context.Context, userId string) (*User, error)
- func Subscribers(ctx context.Context, offset time.Time, identity int64, keywords string) ([]*User, error)
- func (current *User) ClaimPacket(ctx context.Context, packetId string) (*Packet, error)
- func (user *User) Coupons(ctx context.Context) ([]*Coupon, error)
- func (user *User) CreateBlacklist(ctx context.Context, userId string) (*Blacklist, error)
- func (current *User) CreatePacket(ctx context.Context, assetId string, amount number.Decimal, totalCount int64, ...) (*Packet, error)
- func (user *User) DeleteUser(ctx context.Context, id string) error
- func (u *User) GetFullName() string
- func (user *User) GetRole() string
- func (current *User) ListAssets(ctx context.Context) ([]*Asset, error)
- func (user *User) Payment(ctx context.Context) error
- func (current *User) Prepare(ctx context.Context) (int64, error)
- func (current *User) ShowAsset(ctx context.Context, assetId string) (*Asset, error)
- func (user *User) Subscribe(ctx context.Context) error
- func (user *User) Unsubscribe(ctx context.Context) error
- func (user *User) UpdateProfile(ctx context.Context, fullName string) error
Constants ¶
View Source
const ( DistributeSubscriberLimit = 100 ExpiredDistributedMessageLimit = 100 PendingDistributedMessageLimit = 20 MessageStatusSent = "SENT" MessageStatusDelivered = "DELIVERED" )
View Source
const ( MessageStatePending = "pending" MessageStateSuccess = "success" MessageCategoryMessageRecall = "MESSAGE_RECALL" MessageCategoryPlainText = "PLAIN_TEXT" MessageCategoryPlainImage = "PLAIN_IMAGE" MessageCategoryPlainVideo = "PLAIN_VIDEO" MessageCategoryPlainData = "PLAIN_DATA" MessageCategoryPlainSticker = "PLAIN_STICKER" MessageCategoryPlainContact = "PLAIN_CONTACT" MessageCategoryPlainAudio = "PLAIN_AUDIO" MessageCategoryAppCard = "APP_CARD" )
View Source
const ( PacketStateInitial = "INITIAL" PacketStatePaid = "PAID" PacketStateExpired = "EXPIRED" PacketStateRefunded = "REFUNDED" )
View Source
const ( PaymentStatePending = "pending" PaymentStatePaid = "paid" PayMethodMixin = "mixin" PayMethodWechat = "wechat" PayMethodCoupon = "coupon" PayMethodOffer = "offer" UserActivePeriod = 5 * time.Minute )
View Source
const (
PacketMinAmount = "0.0001"
)
View Source
const (
ProhibitedMessage = "prohibited-message-property"
)
View Source
const WX_TN_PREFIX = "tn-"
Variables ¶
This section is empty.
Functions ¶
func CreateWxClient ¶
func CreateWxPayment ¶
func FetchWxPayment ¶
func ReadStatistic ¶
func SendParticipantTransfer ¶
func UniqueConversationId ¶
func UpdateMessagesStatus ¶
func UpdateMessagesStatus(ctx context.Context, messages []*DistributedMessage) error
Types ¶
type Coupon ¶
type Coupon struct { CouponId string Code string UserId string OccupiedBy sql.NullString OccupiedAt pq.NullTime CreatedAt time.Time FullName string }
func CreateCoupons ¶
type DistributedMessage ¶
type DistributedMessage struct { MessageId string ConversationId string RecipientId string UserId string ParentId string QuoteMessageId string Shard string Category string Data string Status string CreatedAt time.Time }
func FindDistributedMessage ¶
func FindDistributedMessage(ctx context.Context, id string) (*DistributedMessage, error)
type Message ¶
type Message struct { MessageId string UserId string Category string QuoteMessageId string Data string CreatedAt time.Time UpdatedAt time.Time State string LastDistributeAt time.Time FullName sql.NullString }
func CreateMessage ¶
func LastestMessageWithUser ¶
type Order ¶
type Order struct { OrderId string UserId string TraceId int64 PrepayId string State string Amount string Channel string TransactionId string CreatedAt time.Time PaidAt pq.NullTime }
func CreateOrder ¶
type Packet ¶
type Packet struct { PacketId string UserId string AssetId string Amount string Greeting string TotalCount int64 RemainingCount int64 RemainingAmount string State string CreatedAt time.Time User *User Asset *Asset Participants []*Participant }
type Participant ¶
type Participant struct { PacketId string UserId string Amount string CreatedAt time.Time PaidAt pq.NullTime FullName string AvatarURL string }
func ListPendingParticipants ¶
func ListPendingParticipants(ctx context.Context, limit int) ([]*Participant, error)
type Property ¶
func CreateProperty ¶
type RecallMessage ¶
type RecallMessage struct {
MessageId string `json:"message_id"`
}
type User ¶
type User struct { UserId string IdentityNumber int64 FullName string AccessToken string AvatarURL string TraceId string State string ActiveAt time.Time SubscribedAt time.Time PayMethod string AuthenticationToken string // contains filtered or unexported fields }
func AuthenticateUserByOAuth ¶
func AuthenticateUserByToken ¶
func Subscribers ¶
func (*User) ClaimPacket ¶
func (*User) CreateBlacklist ¶
func (*User) CreatePacket ¶
func (*User) GetFullName ¶
Click to show internal directories.
Click to hide internal directories.