Documentation ¶
Overview ¶
*
- Copyright 2015 @ 56x.net.
- name : account
- author : jarryliu
- date : 2015-07-24 08:48
- description :
- history :
*
- Copyright 2014 @ 56x.net.
- name :
- author : jarryliu
- date : 2014-02-05 20:12
- description :
- history :
*
- Copyright 2015 @ 56x.net.
- name : gift.go
- author : jarryliu
- date : 2016-06-24 16:50
- description :
- history :
*
- Copyright 2015 @ 56x.net.
- name : invitaton_manager
- author : jarryliu
- date : -- :
- description :
- history :
*
- Copyright 2015 @ 56x.net.
- name : level_manager
- author : jarryliu
- date : 2016-05-26 11:33
- description :
- history :
Index ¶
- Constants
- Variables
- type Account
- type AccountOperateData
- type AccountType
- type BalanceLog
- type BankCard
- type BankInfo_
- type BuyerGroup
- type ComplexMember
- type ConsigneeAddress
- type Favorite
- type FlowAccountLog
- type IAccount
- type IDeliverAddress
- type IFavoriteManager
- type IGiftCardManager
- type IInvitationManager
- type ILevelManager
- type IMember
- type IMemberManager
- type IMemberRepo
- type IProfileManager
- type IntegralLog
- type InviteRelation
- type Level
- type LevelUpLog
- type Member
- type MmLockHistory
- type MmLockInfo
- type Profile
- type ReceiptsCode
- type TrustedInfo
- type WalletAccountLog
Constants ¶
View Source
const ( // KindCustom 自定义的业务类型 KindCustom int = 30 // KindCharge 会员充值 KindCharge = 1 // KindCarry 入账 KindCarry = 2 // KindConsume 消耗 KindConsume = 3 // KindAdjust 客服调整 KindAdjust = 4 // KindDiscount 支付抵扣 KindDiscount = 5 // KindRefund 退款 KindRefund int = 6 // KindExchange 兑换充值, 比如将钱包充值到余额 KindExchange int = 7 // KindTransferIn 转入 KindTransferIn int = 8 // KindTransferOut 转出 KindTransferOut int = 9 // KindExpired 失效 KindExpired int = 10 // KindFreeze 冻结 KindFreeze int = 11 // KindUnfreeze 解冻 KindUnfreeze int = 12 )
View Source
const ( // TypeIntegralPresent 赠送 TypeIntegralPresent = 1 // TypeIntegralFreeze 积分冻结 TypeIntegralFreeze = 3 // TypeIntegralUnfreeze 积分解冻 TypeIntegralUnfreeze = 4 // TypeIntegralShoppingPresent 购物赠送 TypeIntegralShoppingPresent = 5 // TypeIntegralPaymentDiscount 支付抵扣 TypeIntegralPaymentDiscount = 6 )
View Source
const ( StateStopped = 0 //已停用 StateOk = 1 //正常 BankNoLock = 0 BankLocked = 1 )
View Source
const ( // FavTypeShop 收藏店铺 FavTypeShop = iota + 1 // FavTypeGoods 收藏商品 FavTypeGoods )
View Source
const ( // PremiumNormal 普通会员 PremiumNormal int = 0 // PremiumGold 金会员 PremiumGold int = 1 // PremiumWhiteGold 白金会员 PremiumWhiteGold int = 2 // PremiumSuper 黑钻会员 PremiumSuper int = 3 )
View Source
const ( // LAutoUpgrade 自动升级 LAutoUpgrade = 1 // LServiceAgentUpgrade 客服更改 LServiceAgentUpgrade = 2 // LProgramUpgrade 程序升级,todo: 暂时未对其进行区分 LProgramUpgrade = 3 )
View Source
const ( // FlagActive 已激活(1) FlagActive = 1 << iota // FlagLocked 已锁定的(2) FlagLocked = 2 // FlagTrusted 已实名认证的(4) FlagTrusted = 4 // FlagTempPassword 密码为临时密码,需要重置 FlagTempPassword = 32 // FlagSeller 商户(64) FlagSeller = 64 // FlagNoTradePasswd 交易密码未设置(64) FlagNoTradePasswd = 128 // FlagStopRebate 禁用返利权限的(8) FlagAffiliateDisabled = 256 // FlagProfileCompleted 已完善的资料(16) FlagProfileCompleted = 512 )
View Source
const ( RegisterModeNormal = 1 // 正常注册 RegisterModeClosed = 2 // 关闭注册 RegisterModeMustRedirect = 3 // 必须直接注册 RegisterModeMustInvitation = 4 // 必须邀请注册 )
View Source
const ( // DefaultRelateUser 默认操作用户 DefaultRelateUser int64 = 0 )
View Source
const (
StatusOK = 1
)
Variables ¶
View Source
var ( ErrIncorrectInfo = domain.NewError( "err_incorrect_info", "非法数据") ErrRegOff = domain.NewError( "err_reg_off", "CODE:1010,系统暂停注册") ErrRegMissingInviteCode = domain.NewError( "err_reg_must_invitation", "CODE:1011,请填写邀请码") ErrRegOffInvitation = domain.NewError( "err_reg_off_invitation", "CODE:1012,系统关闭邀请注册") ErrInviteCode = domain.NewError( "member_err_invation_code", "CODE:1013,邀请码错误") ErrSessionTimeout = domain.NewError( "member_session_time_out", "会员会话超时") ErrMemberLocked = domain.NewError( "err_member_locked", "会员已被停用") ErrMemberHasActive = domain.NewError( "err_member_has_active", "会员已激活") ErrPremiumValue = domain.NewError( "err_member_premium_value", "premium not match") ErrInvalidSession = domain.NewError( "member_invalid_session", "异常会话") ErrNoSuchAddress = domain.NewError( "member_no_such_deliver_address", "配送地址错误") ErrLevelUsed = domain.NewError( "member_level_used", "此等级已被会员使用") ErrMaxLevel = domain.NewError( "err_member_max_level", "已经为最高等级") ErrLevelUpPass = domain.NewError( "err_member_level_up_pass", "会员升级已经审核") ErrLevelUpReject = domain.NewError( "err_member_level_up_reject", "会员升级已经被退回") ErrLevelUpConfirm = domain.NewError( "err_member_level_up_confirm", "会员升级已经确认") ErrLevelUpLaterConfirm = domain.NewError( "err_member_level_up_later_confirm", "请稍后二分钟后确认") ErrNoSuchLevel = domain.NewError( "err_member_no_such_level", "等级不存在") ErrNoSuchLevelUpLog = domain.NewError( "err_member_no_such_level_up_log", "不存在升级信息") ErrLevelDisabled = domain.NewError( "member_level_disabled", "等级未启用") ErrExistsSameProgramSignalLevel = domain.NewError( "member_exists_same_program_signal_level", "存在相同可编程签名的等级") ErrMustMoreThanMaxLevel = domain.NewError( "member_level_must_more_than_max_level", "经验值必须大于最大等级") ErrLessThanLevelRequireExp = domain.NewError( "member_level_less_than_exp", "经验值必须大于前一等级") ErrMoreThanLevelRequireExp = domain.NewError( "member_level_more_than_exp", "经验值必须小于后一等级") ErrNoSuchMember = domain.NewError( "member_no_such_member", "会员不存在") ErrInvalidInviter = domain.NewError( "member_in_valid_inviter", "邀请码不正确") ErrExistsInviter = domain.NewError( "member_exists_inviter", "已绑定邀请人") ErrInvalidInviteLevel = domain.NewError( "member_invalid_inviter_level", "不合法的邀请人(邀请人为下级)") ErrDeliverAddressLen = domain.NewError( "err_deliver_address_len", "请填写详细的配送地址") ErrDeliverContactPersonName = domain.NewError( "err_deliver_contact_person_name", "收货人不正确") ErrDeliverContactPhone = domain.NewError( "err_deliver_phone_is_null", "联系人电话有误") ErrNotSetArea = domain.NewError( "err_not_set_area", "地址不正确") ErrBankCardIsExists = domain.NewError( "err_member_bank_card_is_exists", "银行卡已绑定") ErrBankInfo = domain.NewError( "err_member_bank_info", "银行卡信息不正确") ErrBankName = domain.NewError( "err_member_bank_name", "请选择开户银行") ErrBankAccountName = domain.NewError( "err_member_bank_account_name", "开户银行户名不正确") ErrBankAccount = domain.NewError( "err_member_bank_account", "开户银行账号不正确") ErrBankNetwork = domain.NewError( "err_member_bank_network", "开户银行支行不正确") ErrBankNoSuchCard = domain.NewError( "err_bank_no_such_card", "该银行卡号未绑定") ErrIncorrectAmount = domain.NewError( "err_balance_amount", "金额错误") ErrLessTakeAmount = domain.NewError( "err_account_less_take_amount", "单笔最低提现金额为%s") ErrOutTakeAmount = domain.NewError( "err_account_out_take_amount", "单笔最高提现金额为%s") ErrTakeOutLevelNoPerm = domain.NewError( "err_account_take_out_level_no_perm", "%s会员无法提现") ErrTakeOutNotTrust = domain.NewError( "err_account_take_out_not_trust", "必须通过实名认证后才可提现") ErrIncorrectQuota = domain.NewError( "err_member_incorrent_quote", "金额/数量错误") ErrOutOfBalance = domain.NewError( "err_out_of_balance", "余额不足") ErrAccountOutOfTakeOutTimes = domain.NewError( "err_account_out_of_take_out_times", "今日已达到提现次数上限") ErrTransferAccountSMemberLevelNoPerm = domain.NewError( "err_account_transfer_accounts_level_no_perm", "%s不允许转账") ErrUserLength = domain.NewError( "err_user_length", "用户名至少6位", ) ErrUserValidErr = domain.NewError( "err_user_valid_err", "用户名为6位以上字符和数字的组合") ErrInvalidUsername = domain.NewError( "err_member_invalid_username", "用户名不正确") ErrSameUser = domain.NewError( "err_same_user", "用户名与原来相同") ErrUserExist = domain.NewError( "err_member_user_exist", "用户名已存在") ErrEmptyNickname = domain.NewError( "err_member_nil_nick_name", "昵称不能为空") ErrInvalidHeadPortrait = domain.NewError( "err_member_invalid_head_portrait", "头像不合法") ErrAddress = domain.NewError( "err_member_address", "请填写详细地址") ErrInvalidEmail = domain.NewError( "err_member_email_valid_err", "邮箱不正确") ErrPhoneHasBind = domain.NewError( "err_member_phone_has_bind", "手机号码已经使用") ErrMissingPhone = domain.NewError( "err_member_missing_phone", "请填写手机号码") ErrMissingIM = domain.NewError( "err_member_missing_im", "请填写IM") ErrInvalidPhone = domain.NewError( "err_invalid_phone", "手机号码格式不正确") ErrInvalidQq = domain.NewError( "err_qq_valid_err", "QQ号码不正确") ErrNotSetTradePassword = domain.NewError("err_not_set_trade_pwd", "交易密码未设置") ErrIncorrectTradePassword = domain.NewError("err_incorrect_trade_pwd", "交易密码错误") ErrNoSuchLogTitleOrRemark = domain.NewError("err_member_no_such_log_title_or_remark", "缺少账户变动的标题和备注") ErrNotSupportAccountType = domain.NewError("err_account_not_support", "账户类型不支持此操作") ErrNotSupportPaymentAccountType = domain.NewError("err_account_not_support_payment", "不支持支付的账户类型") ErrAccountNotEnoughAmount = domain.NewError("err_not_enough_amount", "账户余额不足") ErrWithdrawState = domain.NewError("err_member_take_out_state", "提现申请状态错误") ErrNotSupportTakeOutBusinessKind = domain.NewError("err_not_support_take_out_business_kind", "不支持的提现业务类型") ErrBusinessKind = domain.NewError( "err_not_support_business_kind", "不支持的业务类型") ErrNotSupportChargeMethod = domain.NewError( "err_account_not_support_charge_method", "不支持的充值方式") ErrNotSupportTransfer = domain.NewError( "err_account_not_support_transfer", "不支持的转账方式") ErrNoSuchRelateUser = domain.NewError( "err_account_no_such_relate_user", "未提供操作人编号") ErrMissingTrustedInfo = domain.NewError( "err_missing_trusted_info", "信息不完整、无法完成实名认证") ErrEmptyReviewRemark = domain.NewError( "err_member_empty_remark", "原因不能为空") ErrNotTrusted = domain.NewError( "err_member_not_trusted", "尚未实名认证") ErrNoChangedTrustInfo = domain.NewError( "err_member_no_changed_trust_info", "请修改实名信息后再进行提交") ErrRealName = domain.NewError( "err_real_name", "请输入真实姓名") ErrTrustCardId = domain.NewError( "err_member_trust_car_id", "身份证号码不正确") ErrCarIdExists = domain.NewError( "err_member_trust_car_id", "身份证号码已使用") ErrTrustMissingImage = domain.NewError( "err_member_trust_missing_image", "请上传认证照片") ErrTrustMissingCardImage = domain.NewError( "err_member_trust_missing_card_image", "请上传证件照片") ErrFavored = domain.NewError( "err_favored", "已经收藏过了") ErrAccountBalanceNotEnough = domain.NewError( "err_account_balance_not_enough ", "账户余额不足") ErrNoSuchIntegral = domain.NewError( "err_account_no_such_integral", "账户积分不足") ErrMissingOuterNo = domain.NewError( "err_account_missing_outer_no", "缺少订单号") ErrReceiptsNoIdentity = domain.NewError( "err_member_receipts_no_identity", "无法识别收款码") ErrReceiptsNoName = domain.NewError( "err_member_receipts_no_name", "未填写收款账户") ErrReceiptsNameLen = domain.NewError( "err_member_receipts_name_len", "收款账户超出长度") ErrReceiptsRepeated = domain.NewError( "err_member_collection_repeated", "已添加相同类型的收款码") )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { // 会员编号 MemberId int64 `db:"member_id" pk:"yes"` // 积分 Integral int `db:"integral"` // 不可用积分 FreezeIntegral int `db:"freeze_integral"` // 余额 Balance int64 `db:"balance"` // 不可用余额 FreezeBalance int64 `db:"freeze_balance"` // 失效的账户余额 ExpiredBalance int64 `db:"expired_balance"` // 钱包代码 WalletCode string `db:"wallet_code"` //奖金账户余额 WalletBalance int64 `db:"wallet_balance"` //冻结赠送金额 FreezeWallet int64 `db:"freeze_wallet"` //失效的赠送金额 ExpiredWallet int64 `db:"expired_wallet"` //总赠送金额 TotalWalletAmount int64 `db:"total_wallet_amount"` //流动账户余额 FlowBalance int64 `db:"flow_balance"` //当前理财账户余额 GrowBalance int64 `db:"grow_balance"` //理财总投资金额,不含收益 GrowAmount int64 `db:"grow_amount"` //当前收益金额 GrowEarnings int64 `db:"grow_earnings"` //累积收益金额 GrowTotalEarnings int64 `db:"grow_total_earnings"` //总消费金额 TotalExpense int64 `db:"total_expense"` //总充值金额 TotalCharge int64 `db:"total_charge"` //总支付额 TotalPay int64 `db:"total_pay"` // 优先(默认)支付选项 PriorityPay int `db:"priority_pay"` //更新时间 UpdateTime int64 `db:"update_time"` }
Account 账户值对象
type AccountOperateData ¶ added in v0.4.4
type AccountType ¶
type AccountType int
const ( // AccountBalance 余额账户 AccountBalance AccountType = 1 // AccountIntegral 积分账户 AccountIntegral AccountType = 2 // AccountWallet 钱包账户 AccountWallet AccountType = 3 // AccountFlow 流通金账户 AccountFlow AccountType = 4 // AccountGrow 增长金账户 AccountGrow AccountType = 7 )
type BalanceLog ¶
type BalanceLog struct { Id int64 `db:"id" auto:"yes" pk:"yes"` MemberId int64 `db:"member_id"` OuterNo string `db:"outer_no"` // 业务类型 Kind int `db:"kind"` Title string `db:"subject"` // 金额 Amount int64 `db:"change_value"` // 余额 Balance int `db:"balance"` // 手续费 ProcedureFee int64 `db:"procedure_fee"` // 关联操作人,仅在客服操作时,记录操作人 RelateUser int64 `db:"rel_user"` // 状态 ReviewState int32 `db:"audit_state"` // 备注 Remark string `db:"remark"` // 创建时间 CreateTime int64 `db:"create_time"` // 更新时间 UpdateTime int64 `db:"update_time"` }
BalanceLog 余额日志
type BankCard ¶
type BankCard struct { // 编号 Id int64 `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 银行账号 BankAccount string `db:"bank_account"` // 户名 AccountName string `db:"account_name"` // 银行编号 BankId int `db:"bank_id"` // 银行名称 BankName string `db:"bank_name"` // 银行卡代码 BankCode string `db:"bank_code"` // 网点 Network string `db:"network"` // 快捷支付授权码 AuthCode string `db:"auth_code"` // 状态 State int16 `db:"state"` // 添加时间 CreateTime int64 `db:"create_time"` }
银行卡
type BankInfo_ ¶
type BankInfo_ struct { //会员编号 MemberId int64 `db:"member_id" pk:"yes"` //名称 BankName string `db:"name"` //账号 Account string `db:"account"` //账户名 AccountName string `db:"account_name"` //支行网点 Network string `db:"network"` //状态 State int `db:"state"` //是否锁定 IsLocked int `db:"is_locked"` //更新时间 UpdateTime int64 `db:"update_time"` }
银行卡信息,因为重要且非频繁更新的数据 所以需要用IsLocked来标记是否锁定
type BuyerGroup ¶
type BuyerGroup struct { // 编号 ID int32 `db:"id" pk:"yes" auto:"yes"` Name string `db:"name"` IsDefault int32 `db:"is_default"` }
买家(客户)分组
type ComplexMember ¶
type ComplexMember struct { // 昵称 Nickname string // 真实姓名 RealName string // 头像 Avatar string // 手机号码 Phone string // 经验值 Exp int // 等级 Level int // 等级名称 LevelName string // 实名认证状态 TrustAuthState int // 交易密码是否已设置 TradePasswordHasSet bool // 高级会员类型 PremiumUser int // 会员标志 Flag int // 更新时间 UpdateTime int64 }
ComplexMember 会员概览信息
type ConsigneeAddress ¶
type ConsigneeAddress struct { //编号 Id int64 `db:"id" pk:"yes" auto:"yes"` //会员编号 MemberId int64 `db:"member_id"` //收货人 ConsigneeName string `db:"consignee_name"` //电话 ConsigneePhone string `db:"consignee_phone"` //省 Province int32 `db:"province"` //市 City int32 `db:"city"` //区 District int32 `db:"district"` //地区(省市区连接文本) Area string `db:"area"` //地址 DetailAddress string `db:"detail_address"` //是否默认 IsDefault int `db:"is_default"` }
收货地址
type Favorite ¶
type Favorite struct { // 编号 Id int32 `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 收藏类型 FavType int `db:"fav_type"` // 引用编号 ReferId int64 `db:"refer_id"` // 收藏时间 CreateTime int64 `db:"create_time"` }
收藏
type FlowAccountLog ¶
type FlowAccountLog struct { Id int64 `db:"id" auto:"yes" pk:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 外部单号 OuterNo string `db:"outer_no"` // 业务类型 Kind int `db:"kind"` // 标题 Title string `db:"subject"` // 金额 Amount int64 `db:"change_value"` // 手续费 CsnFee int64 `db:"procedure_fee"` // 引用编号 RelateUser int64 `db:"rel_user"` // 审核状态 ReviewState int `db:"audit_state"` // 备注 Remark string `db:"remark"` // 创建时间 CreateTime int64 `db:"create_time"` // 更新时间 UpdateTime int64 `db:"update_time"` }
FlowAccountLog 活动账户日志信息(todo: 活动账户还在用,暂时不删除)
type IAccount ¶
type IAccount interface { // GetDomainId 获取领域对象编号 GetDomainId() int64 // GetValue 获取账户值 GetValue() *Account // Save 保存 Save() (int64, error) // Wallet 电子钱包 Wallet() wallet.IWallet // SetPriorityPay 设置优先(默认)支付方式, account 为账户类型 SetPriorityPay(account AccountType, enabled bool) error // Charge 用户充值,金额放大100倍(应只充值钱包) Charge(account AccountType, title string, amount int, outerNo string, remark string) error // CarryTo 入账,freeze是否先冻结, procedureFee手续费; 返回日志ID CarryTo(account AccountType, d AccountOperateData, freeze bool, procedureFee int) (int, error) // Consume 消耗 Consume(account AccountType, title string, amount int, outerNo string, remark string) error // Adjust 客服调整 Adjust(account AccountType, title string, amount int, remark string, relateUser int64) error // Discount 抵扣, 如果账户扣除后不存在为消耗,反之为抵扣(内部,购物时需要抵扣一部分) Discount(account AccountType, title string, amount int, outerNo string, remark string) error // Refund 退款 Refund(account AccountType, title string, amount int, outerNo string, remark string) error // Freeze 账户冻结 Freeze(account AccountType, p AccountOperateData, relateUser int64) (int, error) // Unfreeze 账户解冻 Unfreeze(account AccountType, p AccountOperateData, relateUser int64) error // PaymentDiscount 支付单抵扣消费,tradeNo为支付单单号 PaymentDiscount(tradeNo string, amount int, remark string) error // FreezeExpired 将冻结金额标记为失效 FreezeExpired(account AccountType, amount int, remark string) error // GetWalletLog 获取钱包账户日志 GetWalletLog(id int64) wallet.WalletLog // RequestWithdrawal 申请提现,applyType:提现方式,返回info_id,交易号 及错误 RequestWithdrawal(takeKind int, title string, amount int, tradeFee int, bankAccountNo string) (int64, string, error) // ReviewWithdrawal 确认提现 ReviewWithdrawal(id int64, pass bool, remark string) error // FinishWithdrawal 完成提现 FinishWithdrawal(id int64, tradeNo string) error // TransferAccount 转账 TransferAccount(account AccountType, toMember int64, amount int, tradeFee int, remark string) error // ReceiveTransfer 接收转账 ReceiveTransfer(account AccountType, fromMember int64, tradeNo string, amount int, remark string) error // TransferBalance 转账余额到其他账户 TransferBalance(account AccountType, amount int, tradeNo string, toTitle, fromTitle string) error // TransferFlow 转账活动账户,kind为转账类型,如 KindBalanceTransfer等 // commission手续费 TransferFlow(kind int, amount int, commission float32, tradeNo string, toTitle string, fromTitle string) error // TransferFlowTo 将活动金转给其他人 TransferFlowTo(memberId int64, kind int, amount int, commission float32, tradeNo string, toTitle string, fromTitle string) error }
type IDeliverAddress ¶
type IDeliverAddress interface { GetDomainId() int64 GetValue() ConsigneeAddress SetValue(*ConsigneeAddress) error Save() (int64, error) }
收货地址
type IFavoriteManager ¶
type IFavoriteManager interface { // Favorite 收藏 Favorite(favType int, referId int64) error // Favored 是否已收藏 Favored(favType int, referId int64) bool // Cancel 取消收藏 Cancel(favType int, referId int64) error }
IFavoriteManager 收藏服务
type IGiftCardManager ¶
type IGiftCardManager interface { // 可用的优惠券分页数据 PagedAvailableCoupon(start, end int) (total int, rows []*dto.SimpleCoupon) // 所有的优惠券 PagedAllCoupon(start, end int) (total int, rows []*dto.SimpleCoupon) // 过期的优惠券 PagedExpiresCoupon(start, end int) (total int, rows []*dto.SimpleCoupon) }
type IInvitationManager ¶
type IInvitationManager interface { // 获取邀请人数组 InviterArray(memberId int64, depth int) []int64 // 判断是否由会员邀请 InvitationBy(memberId int64) bool // 获取我邀请的会员 GetInvitationMembers(begin, end int) (total int, rows []*dto.InvitationMember) // 获取邀请会员下级邀请数量 GetSubInvitationNum(memberIdArr []int32) map[int32]int // 获取邀请我的会员 GetInvitationMeMember() *Member // 更换邀请人,async是否异步更新 UpdateInviter(inviterId int64, sync bool) error }
type ILevelManager ¶
type ILevelManager interface { // 获取等级设置 GetLevelSet() []*Level // 获取最高已启用的等级 GetHighestLevel() *Level // 获取等级,todo:返回error GetLevelById(id int) *Level // 根据可编程字符获取会员等级 GetLevelByProgramSign(sign string) *Level // 获取下一个等级 GetNextLevelById(id int) *Level // 删除等级 DeleteLevel(id int) error // 保存等级 SaveLevel(*Level) (int, error) // 根据经验值获取等级值 GetLevelIdByExp(exp int) int }
type IMember ¶
type IMember interface { // GetAggregateRootId 获取聚合根编号 GetAggregateRootId() int64 // Complex 会员汇总信息 Complex() *ComplexMember // Profile 会员资料服务 Profile() IProfileManager // Favorite 会员收藏服务 Favorite() IFavoriteManager // GiftCard 礼品卡服务 GiftCard() IGiftCardManager // Invitation 邀请管理 Invitation() IInvitationManager // GetValue 获取值 GetValue() Member // GetAccount 获取账户 GetAccount() IAccount // SendCheckCode 发送验证码,传入操作及消息类型,并返回验证码,及错误 SendCheckCode(operation string, mssType int) (string, error) // CompareCode 对比验证码 CompareCode(code string) error // Active 激活 Active() error // Lock 锁定会员,如minutes为-1, 则永久锁定 Lock(minutes int, remark string) error // Unlock 解锁会员 Unlock() error // ContainFlag 判断是否包含标志 ContainFlag(f int) bool // GetRelation 获取关联的会员 GetRelation() *InviteRelation // BindInviter 绑定邀请人,如果已邀请,force为true时更新 BindInviter(memberId int64, force bool) error // AddExp 增加经验值 AddExp(exp int) error // Premium 升级为高级会员 Premium(v int, expires int64) error // GetLevel 获取等级 GetLevel() *Level // GrantFlag 标志赋值, 如果flag小于零, 则异或运算(去除) GrantFlag(flag int) error // TestFlag 是否包含标志 TestFlag(flag int) bool // ChangeLevel 更改会员等级,@paymentId:支付单编号,@review:是否需要审核 ChangeLevel(level int, paymentId int, review bool) error // ReviewLevelUp 审核升级请求 ReviewLevelUp(id int, pass bool) error // ConfirmLevelUp 标记已经处理升级 ConfirmLevelUp(id int) error // ChangeUser 更换用户名 ChangeUsername(string) error // UpdateLoginTime 更新登录时间 UpdateLoginTime() error // Save 保存 Save() (int64, error) }
type IMemberManager ¶
type IMemberManager interface { // 等级服务 LevelManager() ILevelManager // 检查手机绑定,同时检查手机格式 CheckPhoneBind(phone string, memberId int64) error // 检查注册信息是否正确 PrepareRegister(v *Member, pro *Profile, invitationCode string) ( invitationId int64, err error) // 检查邀请注册 CheckInviteRegister(code string) (inviterId int64, err error) // 获取所有买家分组 GetAllBuyerGroups() []*BuyerGroup // 获取买家分组 GetBuyerGroup(id int32) *BuyerGroup // 保存买家分组 SaveBuyerGroup(*BuyerGroup) (int32, error) }
会员服务
type IMemberRepo ¶
type IMemberRepo interface { // 获取管理服务 GetManager() IMemberManager // 获取资料或初始化 GetProfile(memberId int64) *Profile // 保存资料 SaveProfile(v *Profile) error // 获取会员等级 GetMemberLevels_New() []*Level // 获取等级对应的会员数 GetMemberNumByLevel_New(id int) int // 删除会员等级 DeleteMemberLevel_New(id int) error // 保存会员等级 SaveMemberLevel_New(v *Level) (int, error) // 根据用户名获取会员 GetMemberByUser(user string) *Member // 根据手机号码获取会员 GetMemberValueByPhone(phone string) *Member // 获取会员 GetMember(memberId int64) IMember // 创建会员 CreateMember(*Member) IMember // 删除会员 DeleteMember(memberId int64) error // 创建会员,仅作为某些操作使用,不保存 CreateMemberById(memberId int64) IMember // 保存 SaveMember(v *Member) (int64, error) // 获取会员最后更新时间 GetMemberLatestUpdateTime(id int64) int64 // 根据手机号获取会员编号 GetMemberIdByPhone(phone string) int64 // 根据邮箱地址获取会员编号 GetMemberIdByEmail(email string) int64 // 获取会员编号 GetMemberIdByUser(user string) int64 // 根据编码获取会员 GetMemberIdByCode(code string) int64 // CheckUserExist 用户名是否存在 CheckUserExist(user string, memberId int64) bool // CheckNicknameIsUse 昵称是否使用 CheckNicknameIsUse(nickname string, memberId int64) bool // CheckPhoneBind 手机号码是否使用 CheckPhoneBind(phone string, memberId int64) bool // 保存绑定 SaveRelation(*InviteRelation) error // 获取账户 GetAccount(memberId int64) *Account // 保存账户,传入会员编号 SaveAccount(*Account) (int64, error) // 获取银行卡 BankCards(memberId int64) []BankCard // 保存银行卡信息 SaveBankCard(card *BankCard) error // 移除银行卡 RemoveBankCard(id int64, no string) error // 获取收款码 ReceiptsCodes(memberId int64) []ReceiptsCode // 保存收款码 SaveReceiptsCode(code *ReceiptsCode, memberId int64) (int, error) // 保存积分记录 SaveIntegralLog(*IntegralLog) error // 保存余额日志 SaveBalanceLog(*BalanceLog) (int32, error) // 保存钱包账户日志 SaveWalletAccountLog(*WalletAccountLog) (int32, error) // 获取钱包账户日志信息 GetWalletLog(id int32) *WalletAccountLog // 增加会员当天提现次数 AddTodayTakeOutTimes(memberId int64) error // 获取会员每日提现次数 GetTodayTakeOutTimes(memberId int64) int // 获取会员关联 GetRelation(memberId int64) *InviteRelation // 保存实名信息 SaveTrustedInfo(id int, v *TrustedInfo) (int, error) // 获取实名信息 GetTrustedInfo(memberId int) *TrustedInfo // 获取经验值对应的等级 GetLevelValueByExp(mchId int64, exp int64) int // 获取会员升级记录 GetLevelUpLog(id int) *LevelUpLog // 保存会员升级记录 SaveLevelUpLog(l *LevelUpLog) (int32, error) // 保存地址 SaveDeliverAddress(*ConsigneeAddress) (int64, error) // 获取全部配送地址 GetDeliverAddress(memberId int64) []*ConsigneeAddress // 获取配送地址 GetSingleDeliverAddress(memberId, addressId int64) *ConsigneeAddress // 删除配送地址 DeleteAddress(memberId, addressId int64) error // 邀请 GetMyInvitationMembers(memberId int64, begin, end int) (total int, rows []*dto.InvitationMember) // 获取下级会员数量 GetSubInvitationNum(memberId int64, memberIdArr []int32) map[int32]int // 获取推荐我的人 GetInvitationMeMember(memberId int64) *Member // 保存余额变动信息 SaveFlowAccountInfo(v *FlowAccountLog) (int32, error) // 保存理财账户信息 SaveGrowAccount(memberId int64, balance, totalAmount, growEarnings, totalGrowEarnings float32, updateTime int64) error //收藏,favType 为收藏类型, referId为关联的ID Favorite(memberId int64, favType int, referId int64) error //是否已收藏 Favored(memberId int64, favType int, referId int64) bool //取消收藏 CancelFavorite(memberId int64, favType int, referId int64) error // 获取会员分页的优惠券列表 GetMemberPagedCoupon(memberId int64, start, end int, where string) (total int, rows []*dto.SimpleCoupon) // Select MmBuyerGroup SelectMmBuyerGroup(where string, v ...interface{}) []*BuyerGroup // Save MmBuyerGroup SaveMmBuyerGroup(v *BuyerGroup) (int, error) // Save 会员锁定历史 SaveLockHistory(v *MmLockHistory) (int, error) // Save 会员锁定记录 SaveLockInfo(v *MmLockInfo) (int, error) // Delete 会员锁定记录 DeleteLockInfos(memberId int64) error // 注册解锁任务 RegisterUnlockJob(info *MmLockInfo) // 获取会员邀请的会员编号列表 GetInviteChildren(id int64) []int64 }
type IProfileManager ¶
type IProfileManager interface { // GetProfile 获取资料 GetProfile() Profile // SaveProfile 保存资料 SaveProfile(v *Profile) error // ChangePhone 更改手机号码,不验证手机格式 ChangePhone(string) error // ChangeNickname 修改昵称 ChangeNickname(nickname string, limitTime bool) error // ChangeHeadPortrait 设置头像 ChangeHeadPortrait(string) error // ProfileCompleted 资料是否完善 ProfileCompleted() bool // CheckProfileComplete 检查资料是否完善 CheckProfileComplete() error // ChangePassword 修改密码,旧密码可为空; 传入原始密码。密码均为密文 ChangePassword(newPwd, oldPwd string) error // ChangeTradePassword 修改交易密码,旧密码可为空; 传入原始密码。密码均为密文 ChangeTradePassword(newPassword, oldPwd string) error // GetBankCards 获取提现银行信息 GetBankCards() []BankCard // GetBankCard 获取绑定的银行卡 GetBankCard(cardNo string) *BankCard // AddBankCard 添加银行卡 AddBankCard(*BankCard) error // RemoveBankCard 移除银行卡 RemoveBankCard(cardNo string) error // ReceiptsCodes 获取收款码 ReceiptsCodes() []ReceiptsCode // SaveReceiptsCode 保存收款码 SaveReceiptsCode(c *ReceiptsCode) error // GetTrustedInfo 实名认证信息 GetTrustedInfo() *TrustedInfo // SaveTrustedInfo 保存实名认证信息 SaveTrustedInfo(v *TrustedInfo) error // ReviewTrustedInfo 审核实名认证,若重复审核将返回错误 ReviewTrustedInfo(pass bool, remark string) error // CreateDeliver 创建配送地址 CreateDeliver(*ConsigneeAddress) IDeliverAddress // GetDeliverAddress 获取配送地址 GetDeliverAddress() []IDeliverAddress // GetAddress 获取配送地址 GetAddress(addressId int64) IDeliverAddress // SetDefaultAddress 设置默认地址 SetDefaultAddress(addressId int64) error // GetDefaultAddress 获取默认收货地址 GetDefaultAddress() IDeliverAddress // DeleteAddress 删除配送地址 DeleteAddress(addressId int64) error }
IProfileManager 会员资料服务
type IntegralLog ¶
type IntegralLog struct { // 编号 Id int `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int `db:"member_id"` // 类型 Kind int `db:"kind"` // 标题 Title string `db:"subject"` // 关联的编号 OuterNo string `db:"outer_no"` // 积分值 Value int `db:"change_value"` // 余额 Balance int `db:"balance"` // 备注 Remark string `db:"remark"` // 关联用户 RelateUser int `db:"rel_user"` // 审核状态 ReviewState int16 `db:"audit_state"` // 创建时间 CreateTime int64 `db:"create_time"` // 更新时间 UpdateTime int64 `db:"update_time"` }
IntegralLog 积分记录
type InviteRelation ¶
type InviteRelation struct { // 会员编号 MemberId int64 `db:"member_id" pk:"yes"` // 会员卡号 CardCard string `db:"card_no"` // 邀请人(会员) InviterId int64 `db:"inviter_id"` // 邀请会员编号(depth2) InviterD2 int64 `db:"inviter_d2"` // 邀请会员编号(depth3) InviterD3 int64 `db:"inviter_d3"` // 注册关联商户编号 RegMchId int64 `db:"reg_mchid"` }
会员邀请关联表
type Level ¶
type Level struct { // 编号 Id int `db:"id" auto:"yes" pk:"yes"` // 等级名称 Name string `db:"name"` // 需要经验值 RequireExp int `db:"require_exp"` // 可编程等级签名,可根据此签名来进行编程 ProgramSignal string `db:"program_signal"` // 是否启用 Enabled int `db:"enabled"` // 是否为正式会员/非正式 IsOfficial int `db:"is_official"` // 是否允许自动升级 AllowUpgrade int `db:"allow_upgrade"` }
会员等级
type LevelUpLog ¶
type LevelUpLog struct { Id int `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 原来等级 OriginLevel int `db:"origin_level"` // 现在等级 TargetLevel int `db:"target_level"` // 是否为免费升级的会员 IsFree int `db:"is_free"` // 支付单编号 PaymentId int `db:"payment_id"` // 是否审核及处理 ReviewState int `db:"review_state"` // 升级方式,1:自动升级 2:客服更改 3:系统升级 UpgradeMode int `db:"upgrade_mode"` // 升级时间 CreateTime int64 `db:"create_time"` }
会员升级日志
type Member ¶
type Member struct { // 编号 Id int64 `db:"id" auto:"yes" pk:"yes"` // 用户编码 UserCode string `db:"user_code"` // 昵称 Nickname string `db:"nickname"` // 真实姓名 RealName string `db:"real_name"` // 用户名 Username string `db:"username"` // 加密盐 Salt string `db:"salt"` // 密码 Password string `db:"password"` // 头像 Portrait string `db:"portrait"` // 交易密码 TradePassword string `db:"trade_pwd"` // 经验值 Exp int `db:"exp"` // 等级 Level int `db:"level"` // 高级用户类型 PremiumUser int `db:"premium_user"` // 高级用户过期时间 PremiumExpires int64 `db:"premium_expires"` // 手机号码 Phone string `db:"phone"` // 电子邮箱 Email string `db:"email"` // 注册来源 RegFrom string `db:"reg_from"` // 注册IP RegIp string `db:"reg_ip"` // 注册时间 RegTime int64 `db:"reg_time"` // 校验码 CheckCode string `db:"check_code"` // 校验码过期时间 CheckExpires int64 `db:"check_expires"` // 会员标志 UserFlag int `db:"user_flag"` // 状态 State int `db:"state"` // 登录时间 LoginTime int64 `db:"login_time"` // 最后登录时间 LastLoginTime int64 `db:"last_login_time"` // 更新时间 UpdateTime int64 `db:"update_time"` // 超时时间 TimeoutTime int64 `db:"-"` }
type MmLockHistory ¶
type MmLockHistory struct { // 编号 Id int `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 锁定时间 LockTime int64 `db:"lock_time"` // 锁定持续分钟数 Duration int `db:"duration"` // 备注 Remark string `db:"remark"` }
MmLockHistory 会员锁定历史
type MmLockInfo ¶
type MmLockInfo struct { // 编号 Id int `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 锁定时间 LockTime int64 `db:"lock_time"` // 解锁时间 UnlockTime int64 `db:"unlock_time"` // 备注 Remark string `db:"remark"` }
MmLockInfo 会员锁定记录
type Profile ¶
type Profile struct { //会员编号 MemberId int64 `db:"member_id" pk:"yes" auto:"no"` //昵称 Name string `db:"name"` //头像 Avatar string `db:"avatar"` //性别 Gender int32 `db:"gender"` //生日 BirthDay string `db:"birthday"` //电话 Phone string `db:"phone"` //地址 Address string `db:"address"` //即时通讯 Im string `db:"im"` //电子邮件 Email string `db:"email"` // 省 Province int32 `db:"province"` // 市 City int32 `db:"city"` // 区 District int32 `db:"district"` //备注 Remark string `db:"remark"` // 扩展1 Ext1 string `db:"ext_1"` // 扩展2 Ext2 string `db:"ext_2"` // 扩展3 Ext3 string `db:"ext_3"` // 扩展4 Ext4 string `db:"ext_4"` // 扩展5 Ext5 string `db:"ext_5"` // 扩展6 Ext6 string `db:"ext_6"` //更新时间 UpdateTime int64 `db:"update_time"` }
会员资料
type ReceiptsCode ¶
type ReceiptsCode struct { // 编号 Id int `db:"id" pk:"yes" auto:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 账户标识,如:alipay Identity string `db:"identity"` // 账户名称 Name string `db:"name"` // 账号 AccountId string `db:"account_id"` // 收款码地址 CodeUrl string `db:"code_url"` // 是否启用 State int `db:"state"` }
收款码
type TrustedInfo ¶
type TrustedInfo struct { // 会员编号 MemberId int64 `db:"member_id" pk:"yes"` // 真实姓名 RealName string `db:"real_name"` // 国家代码 CountryCode string `db:"country_code"` // 证件类型 CardType int `db:"card_type"` // 证件号码 CardId string `db:"card_id"` // 证件图片 CardImage string `db:"card_image"` // 证件反面图片 CardReverseImage string `db:"card_reverse_image"` // 认证图片,人与身份证的图像等 TrustImage string `db:"trust_image"` // 是否人工审核认证 ManualReview int `db:"manual_review"` // 是否审核通过 ReviewState int `db:"review_state"` // 审核时间 ReviewTime int64 `db:"review_time"` // 审核备注 Remark string `db:"remark"` // 更新时间 UpdateTime int64 `db:"update_time"` }
实名认证信息
type WalletAccountLog ¶
type WalletAccountLog struct { Id int64 `db:"id" auto:"yes" pk:"yes"` // 会员编号 MemberId int64 `db:"member_id"` // 外部单号 OuterNo string `db:"outer_no"` // 业务类型 Kind int `db:"kind"` // 标题 Title string `db:"title"` // 金额 Amount int64 `db:"amount"` // 手续费 ProcedureFee int64 `db:"procedure_fee"` // 关联操作人,仅在客服操作时,记录操作人 RelateUser int64 `db:"rel_user"` // 状态 ReviewState int32 `db:"review_state"` // 备注 Remark string `db:"remark"` // 创建时间 CreateTime int64 `db:"create_time"` // 更新时间 UpdateTime int64 `db:"update_time"` }
WalletAccountLog 钱包账户日志
Click to show internal directories.
Click to hide internal directories.