Versions in this module Expand all Collapse all v1 v1.1.0 Aug 2, 2019 Changes in this version + const DistributeSubscriberLimit + const ExpiredDistributedMessageLimit + const MessageCategoryAppCard + const MessageCategoryMessageRecall + const MessageCategoryPlainAudio + const MessageCategoryPlainContact + const MessageCategoryPlainData + const MessageCategoryPlainImage + const MessageCategoryPlainSticker + const MessageCategoryPlainText + const MessageCategoryPlainVideo + const MessageStatePending + const MessageStateSuccess + const MessageStatusDelivered + const MessageStatusSent + const PacketMinAmount + const PacketStateExpired + const PacketStateInitial + const PacketStatePaid + const PacketStateRefunded + const PayMethodCoupon + const PayMethodMixin + const PayMethodOffer + const PayMethodWechat + const PaymentStatePaid + const PaymentStatePending + const PendingDistributedMessageLimit + const ProhibitedMessage + const UserActivePeriod + const WX_TN_PREFIX + 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 struct + AssetId string + Balance string + IconURL string + Name string + PriceBTC string + PriceUSD string + Symbol string + type Blacklist struct + UserId string + type Coupon struct + Code string + CouponId string + CreatedAt time.Time + FullName string + OccupiedAt pq.NullTime + OccupiedBy sql.NullString + UserId string + func CreateCoupons(ctx context.Context, user *User, quantity int) ([]*Coupon, error) + func Occupied(ctx context.Context, code string, user *User) (*Coupon, error) + func ReadCoupons(ctx context.Context) ([]*Coupon, error) + type DistributedMessage struct + Category string + ConversationId string + CreatedAt time.Time + Data string + MessageId string + ParentId string + QuoteMessageId string + RecipientId string + Shard string + Status string + UserId string + func FindDistributedMessage(ctx context.Context, id string) (*DistributedMessage, error) + func PendingActiveDistributedMessages(ctx context.Context, shard string, limit int64) ([]*DistributedMessage, error) + type Message struct + Category string + CreatedAt time.Time + Data string + FullName sql.NullString + LastDistributeAt time.Time + MessageId string + QuoteMessageId string + State string + UpdatedAt time.Time + UserId string + func CreateMessage(ctx context.Context, user *User, ...) (*Message, error) + func FindMessage(ctx context.Context, id string) (*Message, error) + func LastestMessageWithUser(ctx context.Context, limit int64) ([]*Message, error) + func PendingMessages(ctx context.Context, limit int64) ([]*Message, error) + func (message *Message) Distribute(ctx context.Context) error + func (message *Message) Leapfrog(ctx context.Context, reason string) error + type Order struct + Amount string + Channel string + CreatedAt time.Time + OrderId string + PaidAt pq.NullTime + PrepayId string + State string + TraceId int64 + TransactionId string + UserId string + 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 struct + Amount string + Asset *Asset + AssetId string + CreatedAt time.Time + Greeting string + PacketId string + Participants []*Participant + RemainingAmount string + RemainingCount int64 + State string + TotalCount int64 + User *User + UserId string + 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) + func (packet *Packet) GetParticipants(ctx context.Context) error + type Participant struct + Amount string + AvatarURL string + CreatedAt time.Time + FullName string + PacketId string + PaidAt pq.NullTime + UserId string + func ListPendingParticipants(ctx context.Context, limit int) ([]*Participant, error) + type Property struct + CreatedAt time.Time + Name string + Value string + func CreateProperty(ctx context.Context, name string, value bool) (*Property, error) + func ReadProperty(ctx context.Context, name string) (*Property, error) + type RecallMessage struct + MessageId string + type User struct + AccessToken string + ActiveAt time.Time + AuthenticationToken string + AvatarURL string + FullName string + IdentityNumber int64 + PayMethod string + State string + SubscribedAt time.Time + TraceId string + UserId string + 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 (current *User) CreatePacket(ctx context.Context, assetId string, amount number.Decimal, totalCount int64, ...) (*Packet, error) + func (current *User) ListAssets(ctx context.Context) ([]*Asset, error) + func (current *User) Prepare(ctx context.Context) (int64, error) + func (current *User) ShowAsset(ctx context.Context, assetId string) (*Asset, error) + func (u *User) GetFullName() string + func (user *User) Coupons(ctx context.Context) ([]*Coupon, error) + func (user *User) CreateBlacklist(ctx context.Context, userId string) (*Blacklist, error) + func (user *User) DeleteUser(ctx context.Context, id string) error + func (user *User) GetRole() string + func (user *User) Payment(ctx context.Context) 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