Documentation ¶
Overview ¶
*
- 提现
Index ¶
- Constants
- Variables
- func AddFriendToDB(userId, friendId, friendName, friendPor string)
- func AuditEnterpriseCert(userId string, pass bool, reason string)
- func BindOauth(userId, openId string, platform int) error
- func BindPhone(userId, phonenum, password string) error
- func CheckOauth(openId string, platform int) bool
- func CreateBackpayRecord(record *models.BackpayRecord) error
- func CreateEnterpriseCert(material *models.EnterpriseCertMaterial) error
- func CreateNewUser(phonenum, password string) (error, *models.TokenInfo, *models.TokenInfo)
- func CreateRedpacket(userId string, binding *models.SendRedpacketBinding) (string, error)
- func CreateScanning(form *models.SendScannigBinding) uint32
- func CreateUserByQQ(openId string, qqUerInfo *models.QQUserInfo) (error, *models.TokenInfo, *models.TokenInfo)
- func CreateUserByWeibo(uid string, weiboUerInfo *models.WeiboUserInfo) (error, *models.TokenInfo, *models.TokenInfo)
- func CreateUserByWeixin(openId string, weixinUser *models.WeixinUserInfo) (error, *models.TokenInfo, *models.TokenInfo)
- func DoingRedpacket(userId, redpacketId, deviceId string) uint32
- func EditEnterpriseCertInfo(userId string, info *models.EnterpriseCertInfoBinding) error
- func Filter(userId string) *models.UserExpireList
- func FindAccessToken(userId string) string
- func FindPayPhoneRecordById(tradeno string) (*models.PayPhoneRecord, error)
- func FindRefreshToken(userId string) string
- func FindUserByAccount(username string) *models.User
- func FindUserByOpenId(openId string, platform int) *models.User
- func FindUserDataById(userId string) (*models.User, error)
- func FindUserIdByAccount(account string) string
- func FindUserRcToken(userId string) string
- func FinishRedpacket(userId, redpacketId, deviceId string) uint32
- func GenAlgorithms(redpktId string, total, number uint32) bool
- func GetDailyGrab(userId string) int
- func GetEnterpriseCertMaterial(userId string) (*models.EnterpriseCertMaterial, error)
- func GetEnterpriseCertStatus(userId string) int
- func GetIncomeRank(userId string) int
- func GetRedpacketNotice(userId string) []models.SysNoticeItem
- func GetRedpacketPerMoney(redpacketId string) int
- func GetRedpktIdList(startIdx uint32) []string
- func GetScanListByTag(startIdx uint32, tag string) *models.ScanningList
- func GetScanListByTag1(startIdx uint32, tag string) *models.ScanningList
- func GetScanningRedpkt(redpktId, userId string) uint32
- func GetStatistics(redpacketId string) *models.RedpktStatistics
- func GetSystemNoticeList(userId string) []models.SysNoticeItem
- func GetUserData(userId string) (*models.User, error)
- func GetUserLevel(userId string) int
- func GetUserOwnedCount(userId string, redpktType int) int
- func GiveupRedpacket(userId, redpacketId string)
- func GrabRedpacket(userId, redpacketId, deviceId string) uint32
- func HandleBackpayRecord(id string, success bool) error
- func IncUserCacheField(userId, field string, value interface{})
- func Init()
- func InitRedpacket()
- func InitScanning()
- func Isfriends(fromId, targetId string) bool
- func PayRedpacketBy3rdParty(redpktId string, fee int) bool
- func PayRedpacketByBalance(userId, redpktId string) bool
- func PushRemoteNotice(userId, txt string)
- func PushSystemNotice(userId, txt string)
- func RefreshRcUser(userId, name, portraitUri string)
- func RefreshTokens(userId, accessStr, refreshStr string, oper int) (error, *models.TokenInfo, *models.TokenInfo)
- func ResetPassword(userData *models.User, pwd string) (error, *models.TokenInfo, *models.TokenInfo)
- func ResetPhone(userId, phonenum string) error
- func ScanRecordList(redpacketId string, cursor int) map[string]int64
- func SendAddBlacklistReqToRcServer(userId, blackUserId string)
- func SendAddFriendReqToRcServer(fromId, targetId string) error
- func SendAgreeNotifyToRcServer(fromId, targetId, targetName string)
- func UnBindOauth(userId string, platform int) error
- func UpdateDailyGrab(userId string)
- func UpdateMoney(userId string, money int64)
- func UpdateNameToFriends(userId, nickName string)
- func UpdatePayPhoneRecordFinish(tradeno string) error
- func UpdateUserById(userId string, update interface{}) error
- func UpdateUserCacheField(userId string, args ...interface{})
- func UpdateVerify(redpktId string, status int) bool
- func VerifySmsCode(phone, zone, code string) error
- type AppRedpacket
- func (this *AppRedpacket) Doing(userId, deviceId string) uint32
- func (this *AppRedpacket) Finish(userId, deviceId string) uint32
- func (this *AppRedpacket) GetExpires(userId string) *models.RedpacketExpire
- func (this *AppRedpacket) GiveUp(userId string)
- func (this *AppRedpacket) Grab(userId, deviceId string) uint32
- type IRedpacket
- type RcTokenResponse
- type RedpacketBase
- func (this *RedpacketBase) GetRedpacketData() *models.RedPacket
- func (this *RedpacketBase) GetRedpktType() int
- func (this *RedpacketBase) IsGrabed(userId string) bool
- func (this *RedpacketBase) IsStart() bool
- func (this *RedpacketBase) ScanRecord(cursor int) map[string]int64
- func (this *RedpacketBase) ZRevRange(key string, start, stop int, record map[string]int64)
- type ShareRedpacket
- func (this *ShareRedpacket) Doing(userId, deviceId string) uint32
- func (this *ShareRedpacket) Finish(userId, deviceId string) uint32
- func (this *ShareRedpacket) GetExpires(userId string) *models.RedpacketExpire
- func (this *ShareRedpacket) GiveUp(userId string)
- func (this *ShareRedpacket) Grab(userId, deviceId string) uint32
Constants ¶
const (
RankLimit = 100000
)
const (
RefreshTokenDiff = 10 * 86400 // 如果refresh token的有效期低于10天,则生成新的refresh token,旧的token也有效
)
Variables ¶
var CloseTime chan struct{}
var RedpacketContainers map[string]IRedpacket
var UpdateTime int64
Functions ¶
func CreateEnterpriseCert ¶
func CreateEnterpriseCert(material *models.EnterpriseCertMaterial) error
创建企业认证
func CreateNewUser ¶
创建新用户
func CreateRedpacket ¶
func CreateRedpacket(userId string, binding *models.SendRedpacketBinding) (string, error)
生成红包,等待付款后上架
func CreateScanning ¶
func CreateScanning(form *models.SendScannigBinding) uint32
/////////////////////////////////////////////////////// public 创建一个扫红包
func CreateUserByQQ ¶
func CreateUserByQQ(openId string, qqUerInfo *models.QQUserInfo) (error, *models.TokenInfo, *models.TokenInfo)
通过QQ注册用户
func CreateUserByWeibo ¶
func CreateUserByWeixin ¶
func CreateUserByWeixin(openId string, weixinUser *models.WeixinUserInfo) (error, *models.TokenInfo, *models.TokenInfo)
通过微信注册用户
func DoingRedpacket ¶
完成分享等待截图确认(红包任务进行中,分享类需要)
func EditEnterpriseCertInfo ¶
func EditEnterpriseCertInfo(userId string, info *models.EnterpriseCertInfoBinding) error
修改信息
func FindPayPhoneRecordById ¶
func FindPayPhoneRecordById(tradeno string) (*models.PayPhoneRecord, error)
/////////////////////////////////////////////////////// 话费充值数据库查询相关 /////////////////////////////////////////////////////// 根据userid获取充值记录
func FindUserByOpenId ¶
通过第三方openid查询用户数据
func FindUserDataById ¶
/////////////////////////////////////////////////////// 用户数据库查找相关 /////////////////////////////////////////////////////// 根据userid获取user
func GenAlgorithms ¶
生成红包列表的算法 @total 红包总金额 @number 红包个数
func GetEnterpriseCertMaterial ¶
func GetEnterpriseCertMaterial(userId string) (*models.EnterpriseCertMaterial, error)
获取企业认证材料
func GetEnterpriseCertStatus ¶
获取认证状态 返回值 0=无认证,1=认证中,2=认证通过
func GetRedpacketPerMoney ¶
/////////////////////////////////////////////////////// public 获取红包的实际单价
func GetScanListByTag ¶
func GetScanListByTag(startIdx uint32, tag string) *models.ScanningList
根据商品类型获取扫红包列表
func GetScanListByTag1 ¶
func GetScanListByTag1(startIdx uint32, tag string) *models.ScanningList
func GetStatistics ¶
func GetStatistics(redpacketId string) *models.RedpktStatistics
func InitRedpacket ¶
func InitRedpacket()
func InitScanning ¶
func InitScanning()
func RefreshTokens ¶
func RefreshTokens(userId, accessStr, refreshStr string, oper int) (error, *models.TokenInfo, *models.TokenInfo)
登陆时,刷新token
func ResetPassword ¶
重置密码并且重新生成盐
func ResetPhone ¶
func SendAddBlacklistReqToRcServer ¶
func SendAddBlacklistReqToRcServer(userId, blackUserId string)
向融云服务器发送拉黑请求
func SendAddFriendReqToRcServer ¶
发送加好友请求到融云服务器
func SendAgreeNotifyToRcServer ¶
func SendAgreeNotifyToRcServer(fromId, targetId, targetName string)
发送成为好友的通知
func UpdateMoney ¶
/////////////////////////////////////////////////////// 用户数据相关操作 /////////////////////////////////////////////////////// 更新用户的账户余额
func UpdateUserById ¶
/////////////////////////////////////////////////////// 封装用户数据的数据库更新 ///////////////////////////////////////////////////////
func UpdateUserCacheField ¶
func UpdateUserCacheField(userId string, args ...interface{})
更新用户缓存字段(重新设置)
Types ¶
type AppRedpacket ¶
type AppRedpacket struct {
RedpacketBase
}
func (*AppRedpacket) Doing ¶
func (this *AppRedpacket) Doing(userId, deviceId string) uint32
app和游戏下载类不需要
func (*AppRedpacket) Finish ¶
func (this *AppRedpacket) Finish(userId, deviceId string) uint32
func (*AppRedpacket) GetExpires ¶
func (this *AppRedpacket) GetExpires(userId string) *models.RedpacketExpire
获取用户抢到该红包的到期时间
func (*AppRedpacket) GiveUp ¶
func (this *AppRedpacket) GiveUp(userId string)
func (*AppRedpacket) Grab ¶
func (this *AppRedpacket) Grab(userId, deviceId string) uint32
/////////////////////////////////////////////////////// public 抢红包
type IRedpacket ¶
type IRedpacket interface { GetRedpktType() int // 获取红包的类型 GetRedpacketData() *models.RedPacket // 获取红包信息 IsStart() bool // 红包是否开始 Grab(userId, deviceId string) uint32 // 抢红包 Doing(userId, deviceId string) uint32 // 红包任务进行中 Finish(userId, deviceId string) uint32 // 完成红包任务 GiveUp(userId string) // 放弃红包 GetExpires(userId string) *models.RedpacketExpire // 获取红包的到期时间信息 ScanRecord(cursor int) map[string]int64 // 红包领取记录 IsGrabed(userId string) bool // 用户是否抢到了红包 }
红包的接口
func GetRedpacketCon ¶
func GetRedpacketCon(redpktId string) IRedpacket
func NewAppRedpacket ¶
func NewAppRedpacket(redpkt *models.RedPacket) IRedpacket
func NewShareRedpacket ¶
func NewShareRedpacket(redpkt *models.RedPacket) IRedpacket
type RcTokenResponse ¶
type RcTokenResponse struct { Code int `json:"code"` // 返回码 Token string `json:"token"` // 融云token UserId string `json:"userId"` // 用户id }
func GetRcTokenFromRcSrv ¶
func GetRcTokenFromRcSrv(userId, name, portrait string) (*RcTokenResponse, error)
从融云server获取新的token
type RedpacketBase ¶
type RedpacketBase struct { Id string // 红包id CloseTimer chan struct{} // 关闭定时器 ColdData *models.RedPacket // 红包冷数据 GrabStatusKey string // 用户抢红包的状态 GrabKey string // 抢红包的用户队列 RecordKey string // 已领取红包的用户队列 DeviceKey string // 用户设备映射 }
func (*RedpacketBase) GetRedpacketData ¶
func (this *RedpacketBase) GetRedpacketData() *models.RedPacket
func (*RedpacketBase) GetRedpktType ¶
func (this *RedpacketBase) GetRedpktType() int
func (*RedpacketBase) IsStart ¶
func (this *RedpacketBase) IsStart() bool
/////////////////////////////////////////////////////// public
func (*RedpacketBase) ScanRecord ¶
func (this *RedpacketBase) ScanRecord(cursor int) map[string]int64
type ShareRedpacket ¶
type ShareRedpacket struct {
}func (*ShareRedpacket) Doing ¶
func (this *ShareRedpacket) Doing(userId, deviceId string) uint32
func (*ShareRedpacket) Finish ¶
func (this *ShareRedpacket) Finish(userId, deviceId string) uint32
func (*ShareRedpacket) GetExpires ¶
func (this *ShareRedpacket) GetExpires(userId string) *models.RedpacketExpire
获取用户抢到该红包的到期时间
func (*ShareRedpacket) GiveUp ¶
func (this *ShareRedpacket) GiveUp(userId string)
func (*ShareRedpacket) Grab ¶
func (this *ShareRedpacket) Grab(userId, deviceId string) uint32
/////////////////////////////////////////////////////// public 抢红包