Documentation ¶
Overview ¶
Nging is a toolbox for webmasters Copyright (C) 2018-present Wenhui Shen <swh@admpub.com>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func AssetTypeList() []*echo.KV
- func ClearPasswordData(rawCustomer *dbschema.OfficialCustomer) dbschema.OfficialCustomer
- func ComplaintProcessAdd(key, name string)
- func ComplaintProcessList() []*echo.KV
- func ComplaintTargetAdd(key, name string, fn ComplaintFunc, ...)
- func ComplaintTargetList() []*echo.KV
- func ComplaintTypeAdd(key, name string, fn ComplaintFunc)
- func ComplaintTypeList() []*echo.KV
- func CustomerPermTTL(c echo.Context) int64
- func CustomerPermission(c echo.Context, customers ...*dbschema.OfficialCustomer) *xrole.RolePermission
- func CustomerRoles(c echo.Context, customers ...*dbschema.OfficialCustomer) (roleList []*xrole.CustomerRoleWithPermissions)
- func ExecComplaintTargetFunc(key string, mdl *dbschema.OfficialCommonComplaint) error
- func ExecComplaintTypeFunc(key string, mdl *dbschema.OfficialCommonComplaint) error
- func FireSignIn(customer *dbschema.OfficialCustomer) error
- func FireSignOut(customer *dbschema.OfficialCustomer) error
- func OnSignIn(f Event)
- func OnSignOut(f Event)
- type Complaint
- func (f *Complaint) Add() (pk interface{}, err error)
- func (f *Complaint) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Complaint) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Complaint) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*ComplaintExt, error)
- type ComplaintExt
- type ComplaintFunc
- type Counter
- func (u *Counter) Add() (interface{}, error)
- func (u *Counter) Decr(target string, n uint64) error
- func (u *Counter) Exists() (bool, error)
- func (u *Counter) GetTotal(target string) (uint64, error)
- func (u *Counter) GetTotals(targets ...string) (map[string]uint64, error)
- func (u *Counter) Incr(target string, n uint64) error
- type Customer
- func (f *Customer) APIData(customers ...*dbschema.OfficialCustomer) echo.H
- func (f *Customer) Add() (pk interface{}, err error)
- func (f *Customer) AddExperience(amount float64, customerID uint64, sourceType string, sourceTable string, ...) error
- func (f *Customer) AddIntegral(amount float64, customerID uint64, sourceType string, sourceTable string, ...) error
- func (f *Customer) AddRewardOnSignIn(amount float64) error
- func (f *Customer) AddRewardOnSignUp(amount float64) error
- func (f *Customer) CheckNewPassword(pass string) error
- func (f *Customer) CheckNewSafePwd(pass string) error
- func (f *Customer) CheckSafePassword(pass string) error
- func (f *Customer) CheckSignInPassword(pass string) error
- func (f *Customer) ClearPasswordData(customers ...*dbschema.OfficialCustomer) dbschema.OfficialCustomer
- func (f *Customer) DecrFileSizeAndNum(customerID uint64, fileSize uint64, fileNum uint64) error
- func (f *Customer) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Customer) Exists(name string, fields ...string) (bool, error)
- func (f *Customer) ExistsOther(name string, id uint64, fields ...string) (bool, error)
- func (f *Customer) FireSignInSuccess(co *CustomerOptions, options ...CustomerOption) (err error)
- func (f *Customer) FireSignUpSuccess(co *CustomerOptions, options ...CustomerOption) (err error)
- func (f *Customer) GetByJWT() (*dbschema.OfficialCustomer, error)
- func (f *Customer) GetDetail(cond db.Compound) (*CustomerAndGroup, error)
- func (f *Customer) IncrFileSizeAndNum(customerID uint64, fileSize uint64, fileNum uint64) error
- func (f *Customer) IncrLoginFails() error
- func (f *Customer) IsSameDay(assetType string, sourceType string) error
- func (f *Customer) JWTClaims(customers ...*dbschema.OfficialCustomer) *jwt.StandardClaims
- func (f *Customer) JWTSignedString(key interface{}, customers ...*dbschema.OfficialCustomer) (string, error)
- func (f *Customer) LevelUpOnSignIn(set echo.H) error
- func (f *Customer) LinkOAuthUser() error
- func (f *Customer) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*CustomerAndGroup, error)
- func (f *Customer) NewLoginLog(username string) *model.LoginLog
- func (f *Customer) ResetLoginFails() error
- func (f *Customer) SetSession(customers ...*dbschema.OfficialCustomer)
- func (f *Customer) SignIn(user, pass, signInType string, options ...CustomerOption) error
- func (f *Customer) SignUp(user, pass, mobile, email string, options ...CustomerOption) error
- func (f *Customer) UnsetSession() error
- func (f *Customer) UpdateSafePassword(pass string) error
- func (f *Customer) UpdateSignInPassword(pass string) error
- func (f *Customer) VerifySession(customers ...*dbschema.OfficialCustomer) error
- type CustomerAndGroup
- type CustomerOption
- func CustomerDeviceNo(deviceNo string) CustomerOption
- func CustomerEmail(email string) CustomerOption
- func CustomerMaxAge(maxAge time.Duration) CustomerOption
- func CustomerMaxAgeSeconds(maxAgeSeconds int) CustomerOption
- func CustomerMobile(mobile string) CustomerOption
- func CustomerName(name string) CustomerOption
- func CustomerPassword(password string) CustomerOption
- func CustomerPlatform(platform string) CustomerOption
- func CustomerScense(scense string) CustomerOption
- func CustomerSignInType(signInType string) CustomerOption
- func GenerateOptionsFromHeader(c echo.Context, maxAge ...int) []CustomerOption
- type CustomerOptions
- type Device
- func (f *Device) Add() (pk interface{}, err error)
- func (f *Device) CleanCustomer(customer *dbschema.OfficialCustomer, options ...CustomerOption) (err error)
- func (f *Device) CleanExceedLimit(customerID uint64, multideviceSignin *multidivicesignin.MultideviceSignin) error
- func (f *Device) CleanExpired() (err error)
- func (f *Device) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Device) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Device) Exists(customerID uint64, scense, platform, deviceNo string) (bool, error)
- func (f *Device) ExistsOther(customerID uint64, scense, platform, deviceNo string, excludeIDs uint64) (bool, error)
- func (f *Device) Kick(customerID uint64) (err error)
- func (f *Device) SetDefaults()
- func (f *Device) SetOptions(options *CustomerOptions) *Device
- func (f *Device) SignOut(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Device) Upsert() (pk interface{}, err error)
- type Event
- type Events
- type Following
- type FollowingAndCustomer
- type Invitation
- func (f *Invitation) Add() (pk interface{}, err error)
- func (f *Invitation) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Invitation) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Invitation) Exists(code string, excludeIDs ...uint) (bool, error)
- func (f *Invitation) FindCode(invitationCode string) error
- func (f *Invitation) UseCode(invitationID uint, customer *dbschema.OfficialCustomer) error
- type InvitationCustomer
- type InvitationCustomerExt
- type InvitationCustomerWithCode
- type Level
- func (f *Level) Add() (pk interface{}, err error)
- func (f *Level) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Level) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Level) Exists(customerID uint64, levelID uint) (bool, error)
- func (f *Level) HasLevel(customerID uint64, levelIds ...interface{}) (bool, error)
- type Message
- func (f *Message) AddData(customer *dbschema.OfficialCustomer, user *dbschemaNging.NgingUser) (pk interface{}, err error)
- func (f *Message) CheckRecvCustomerPerm(customer *dbschema.OfficialCustomer) bool
- func (f *Message) CheckRecvPerm(customer *dbschema.OfficialCustomer) bool
- func (f *Message) CheckRecvUserPerm(customer *dbschema.OfficialCustomer) bool
- func (f *Message) CountTodaySends(customerID uint64) int64
- func (f *Message) CountUnread(viewerID uint64, groupIDs []uint, isSystemMessage bool, viewerTypes ...string) int64
- func (f *Message) CustomerMaxPerDay() (int64, int64)
- func (f *Message) DecodeContent(row *dbschema.OfficialCommonMessage) *dbschema.OfficialCommonMessage
- func (f *Message) Delete(args ...interface{}) error
- func (f *Message) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Message) GetWithViewed(row *dbschema.OfficialCommonMessage) (*MessageWithViewed, error)
- func (f *Message) IsSystemMessage() bool
- func (f *Message) LastSend(customerID uint64) (*dbschema.OfficialCommonMessage, error)
- func (f *Message) ListAll(onlyUnread bool, otherCond db.Compound) ([]*MessageWithViewed, error)
- func (f *Message) ListWithViewedByRecipient(viewerID uint64, groupIDs []uint, isSystemMessage bool, onlyUnread bool, ...) ([]*MessageWithViewed, error)
- func (f *Message) ListWithViewedBySender(senderID uint64, onlyUnread bool, otherCond db.Compound, viewerTypes ...string) ([]*MessageWithViewed, error)
- func (f *Message) MsgUser() *MsgUser
- func (f *Message) ToTable(m sqlbuilder.Name_) string
- func (f *Message) View(row *dbschema.OfficialCommonMessage, viewerID uint64, groupIDs []uint, ...) error
- func (f *Message) WithViewedByAll(rows []*dbschema.OfficialCommonMessage) ([]*MessageWithViewed, error)
- func (f *Message) WithViewedByRecipient(rows []*dbschema.OfficialCommonMessage, viewerID uint64, viewerType string) ([]*MessageWithViewed, error)
- func (f *Message) WithViewedBySender(rows []*dbschema.OfficialCommonMessage) ([]*MessageWithViewed, error)
- type MessageWithViewed
- type MsgUser
- type OAuth
- func (f *OAuth) Add() (pk interface{}, err error)
- func (f *OAuth) CopyFrom(user *goth.User) *OAuth
- func (f *OAuth) DelSession()
- func (f *OAuth) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *OAuth) Exists(customerID uint64, unionID string, openID string, typ string) (bool, error)
- func (f *OAuth) ExistsOtherBinding(customerID uint64, id uint64) (bool, error)
- func (f *OAuth) GetByOutUser(user *goth.User) (err error)
- func (f *OAuth) GetSession() (*goth.User, bool, error)
- func (f *OAuth) OAuthUserGender(ouser *goth.User) string
- func (f *OAuth) SaveSession(ouser *goth.User) error
- func (f *OAuth) SignUpCustomer(ouser *goth.User) (*Customer, error)
- func (f *OAuth) Upsert(mw func(db.Result) db.Result, args ...interface{}) (interface{}, error)
- type PrepaidCard
- func (f *PrepaidCard) Add() (pk interface{}, err error)
- func (f *PrepaidCard) BatchGenerate(uid uint, count int, amount uint, salePrice float64, start uint, end uint, ...) error
- func (f *PrepaidCard) Delete(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *PrepaidCard) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *PrepaidCard) Exists(number string, excludeIDs ...uint64) (bool, error)
- func (f *PrepaidCard) UseCard(customerID uint64, number string, password string) error
- type Role
- func (u *Role) Add() (interface{}, error)
- func (u *Role) CancelDefault(excludeID ...uint) error
- func (u *Role) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (u *Role) Exists(name string) (bool, error)
- func (u *Role) Exists2(name string, excludeID uint) (bool, error)
- func (u *Role) GetDefault() error
- func (u *Role) ListByCustomer(customer *dbschema.OfficialCustomer) (roleList []*dbschema.OfficialCustomerRole)
- func (u *Role) ListRoleIDsByCustomer(customer *dbschema.OfficialCustomer) (roleIDs []uint)
- type RolePermission
- type U2F
- func (u *U2F) Add() (interface{}, error)
- func (u *U2F) HasType(customerID uint64, authType string, step uint) (bool, error)
- func (u *U2F) ListPageByType(customerID uint64, authType string, step uint, sorts ...interface{}) error
- func (u *U2F) Unbind(customerID uint64, authType string, step uint) error
- func (u *U2F) UnbindByToken(customerID uint64, authType string, step uint, token string) error
- type Wallet
- func (f *Wallet) Add() (pk interface{}, err error)
- func (f *Wallet) AddFlow(flows ...*dbschema.OfficialCustomerWalletFlow) (err error)
- func (f *Wallet) AddRepeatableFlow(flows ...*dbschema.OfficialCustomerWalletFlow) (err error)
- func (f *Wallet) Edit(mw func(db.Result) db.Result, args ...interface{}) error
- func (f *Wallet) FlowListPage(cond *db.Compounds, orderby ...interface{}) ([]*WalletFlowExt, error)
- func (f *Wallet) GetAsset(assetType string, customerID uint64) (*dbschema.OfficialCustomerWallet, error)
- func (f *Wallet) GetAssetBalance(assetType string, customerID uint64) (float64, error)
- func (f *Wallet) GetBalance(assetType string, customerID uint64) (float64, error)
- func (f *Wallet) ListCustomerAllAssets(customerID uint64) (map[string]*dbschema.OfficialCustomerWallet, error)
- func (f *Wallet) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*WalletExt, error)
- type WalletExt
- type WalletFlowExt
- type WalletSettings
Constants ¶
const ( AssetTypeMoney = `money` AssetTypeIntegral = `integral` AssetTypeCredit = `credit` AssetTypePoint = `point` AssetTypeGold = `gold` AssetTypeSilver = `silver` AssetTypeCopper = `copper` AssetTypeExperience = `experience` )
资产类型
const ( AmountTypeBalance = `balance` AmountTypeFreeze = `freeze` )
金额类型
const ( //状态(pending-待确认;confirmed-已确认;canceled-已取消) FlowStatusPending = `pending` FlowStatusConfirmed = `confirmed` FlowStatusCanceled = `canceled` )
资金流水记录状态
Variables ¶
var ( ComplaintTypes = echo.NewKVData() ComplaintTargets = echo.NewKVData() )
var ( PrivateFields = []string{ `session_id`, `id_card_no`, `real_name`, `password`, `salt`, `safe_pwd`, `created`, `updated`, `file_num`, `file_size`, } PrivateFieldsWithMobileEmail = append([]string{ `mobile_bind`, `mobile`, `email_bind`, `email`, }, PrivateFields...) //CusomterSafeFields 可公开的客户信息字段 CusomterSafeFields = []interface{}{ `id`, `name`, `gender`, `uid`, `group_id`, `avatar`, `online`, `following`, `followers`, `agent_level`, } CusomterSafeFieldsSelector = func(sel sqlbuilder.Selector) sqlbuilder.Selector { return sel.Columns(CusomterSafeFields...) } //UserSafeFields 可公开的后台用户信息字段 UserSafeFields = []interface{}{ `id`, `username`, `gender`, `avatar`, `online`, } UserSafeFieldsSelector = func(sel sqlbuilder.Selector) sqlbuilder.Selector { return sel.Columns(UserSafeFields...) } )
var ( // CustomerPasswordMinLength 客户登录密码最小长度 CustomerPasswordMinLength = 8 // CustomerSafePwdMinLength 客户安全密码最小长度 CustomerSafePwdMinLength = 6 )
var ( DevicePlatforms = echo.NewKVData() DeviceScenses = echo.NewKVData() DefaultDevicePlatform = `pc` DefaultDeviceScense = `web` )
var ( // AssetTypes 资产类型 AssetTypes = echo.NewKVData() // AmountTypes 金额类型 AmountTypes = echo.NewKVData() // 资金流水记录状态 FlowStatus = echo.NewKVData() )
var (
ComplaintProcesses = echo.NewKVData()
)
var ErrCardNumberAlreadyExists = errors.New(`Card number already exists`)
var ErrInvalidSession = errors.New(`invalid session`)
var ErrSameDay = errors.New("same day")
ErrSameDay 同一天不能领取两次奖励
var JWTMaxLifeTime int64 = 90 * 86400
JWTMaxLifeTime JWT寿命(单位:秒)
Functions ¶
func AssetTypeList ¶
func ClearPasswordData ¶
func ClearPasswordData(rawCustomer *dbschema.OfficialCustomer) dbschema.OfficialCustomer
func ComplaintProcessAdd ¶
func ComplaintProcessAdd(key, name string)
func ComplaintProcessList ¶
func ComplaintTargetAdd ¶
func ComplaintTargetAdd(key, name string, fn ComplaintFunc, urlFormat func(*dbschema.OfficialCommonComplaint) string)
func ComplaintTargetList ¶
func ComplaintTypeAdd ¶
func ComplaintTypeAdd(key, name string, fn ComplaintFunc)
func ComplaintTypeList ¶
func CustomerPermTTL ¶
func CustomerPermission ¶
func CustomerPermission(c echo.Context, customers ...*dbschema.OfficialCustomer) *xrole.RolePermission
func CustomerRoles ¶
func CustomerRoles(c echo.Context, customers ...*dbschema.OfficialCustomer) (roleList []*xrole.CustomerRoleWithPermissions)
func ExecComplaintTargetFunc ¶
func ExecComplaintTargetFunc(key string, mdl *dbschema.OfficialCommonComplaint) error
func ExecComplaintTypeFunc ¶
func ExecComplaintTypeFunc(key string, mdl *dbschema.OfficialCommonComplaint) error
func FireSignIn ¶
func FireSignIn(customer *dbschema.OfficialCustomer) error
func FireSignOut ¶
func FireSignOut(customer *dbschema.OfficialCustomer) error
Types ¶
type Complaint ¶
type Complaint struct {
*dbschema.OfficialCommonComplaint
}
func NewComplaint ¶
type ComplaintExt ¶
type ComplaintExt struct { *dbschema.OfficialCommonComplaint Customer *dbschema.OfficialCustomer `db:"-,relation=id:customer_id"` TypeName string `db:"-"` TargetTypeName string `db:"-"` // contains filtered or unexported fields }
func (*ComplaintExt) SetURLFormat ¶
func (c *ComplaintExt) SetURLFormat(fn func(*dbschema.OfficialCommonComplaint) string) *ComplaintExt
func (*ComplaintExt) URLFormat ¶
func (c *ComplaintExt) URLFormat() string
type ComplaintFunc ¶
type ComplaintFunc func(*dbschema.OfficialCommonComplaint) error
type Counter ¶
type Counter struct {
*dbschema.OfficialCustomerCounter
}
func NewCounter ¶
type Customer ¶
type Customer struct {
*dbschema.OfficialCustomer
}
func NewCustomer ¶
func (*Customer) APIData ¶
func (f *Customer) APIData(customers ...*dbschema.OfficialCustomer) echo.H
APIData 返回给API接口的数据
func (*Customer) AddExperience ¶
func (f *Customer) AddExperience(amount float64, customerID uint64, sourceType string, sourceTable string, sourceID uint64, description string) error
AddExperience 增加经验值
func (*Customer) AddIntegral ¶
func (f *Customer) AddIntegral(amount float64, customerID uint64, sourceType string, sourceTable string, sourceID uint64, description string) error
AddIntegral 增加消费积分
func (*Customer) AddRewardOnSignIn ¶
AddRewardOnSignIn 登录时奖励
func (*Customer) AddRewardOnSignUp ¶
AddRewardOnSignUp 注册时奖励
func (*Customer) CheckNewPassword ¶
func (*Customer) CheckNewSafePwd ¶
func (*Customer) CheckSafePassword ¶
func (*Customer) CheckSignInPassword ¶
func (*Customer) ClearPasswordData ¶
func (f *Customer) ClearPasswordData(customers ...*dbschema.OfficialCustomer) dbschema.OfficialCustomer
func (*Customer) DecrFileSizeAndNum ¶
func (*Customer) ExistsOther ¶
func (*Customer) FireSignInSuccess ¶
func (f *Customer) FireSignInSuccess(co *CustomerOptions, options ...CustomerOption) (err error)
func (*Customer) FireSignUpSuccess ¶
func (f *Customer) FireSignUpSuccess(co *CustomerOptions, options ...CustomerOption) (err error)
func (*Customer) GetDetail ¶
func (f *Customer) GetDetail(cond db.Compound) (*CustomerAndGroup, error)
func (*Customer) IncrFileSizeAndNum ¶
func (*Customer) IncrLoginFails ¶
func (*Customer) JWTClaims ¶
func (f *Customer) JWTClaims(customers ...*dbschema.OfficialCustomer) *jwt.StandardClaims
func (*Customer) JWTSignedString ¶
func (f *Customer) JWTSignedString(key interface{}, customers ...*dbschema.OfficialCustomer) (string, error)
func (*Customer) LevelUpOnSignIn ¶
LevelUpOnSignIn 登录时检查是否可升级
func (*Customer) LinkOAuthUser ¶
func (*Customer) ListPage ¶
func (f *Customer) ListPage(cond *db.Compounds, orderby ...interface{}) ([]*CustomerAndGroup, error)
func (*Customer) ResetLoginFails ¶
func (*Customer) SetSession ¶
func (f *Customer) SetSession(customers ...*dbschema.OfficialCustomer)
SetSession 记录登录信息
func (*Customer) SignIn ¶
func (f *Customer) SignIn(user, pass, signInType string, options ...CustomerOption) error
SignIn 用户登录
func (*Customer) SignUp ¶
func (f *Customer) SignUp(user, pass, mobile, email string, options ...CustomerOption) error
SignUp 注册用户
func (*Customer) UpdateSafePassword ¶
func (*Customer) UpdateSignInPassword ¶
func (*Customer) VerifySession ¶
func (f *Customer) VerifySession(customers ...*dbschema.OfficialCustomer) error
type CustomerAndGroup ¶
type CustomerAndGroup struct { *dbschema.OfficialCustomer Group *dbschema.OfficialCommonGroup `db:"-,relation=id:group_id|gtZero"` Level *dbschema.OfficialCustomerLevel `db:"-,relation=id:level_id|gtZero"` Agent *dbschema.OfficialCustomerAgentLevel `db:"-,relation=id:agent_level|gtZero"` Roles []*dbschema.OfficialCustomerRole `db:"-,relation=id:role_ids|notEmpty|split"` }
func (*CustomerAndGroup) AsMap ¶
func (d *CustomerAndGroup) AsMap() param.Store
type CustomerOption ¶
type CustomerOption func(*CustomerOptions)
func CustomerDeviceNo ¶
func CustomerDeviceNo(deviceNo string) CustomerOption
func CustomerEmail ¶
func CustomerEmail(email string) CustomerOption
func CustomerMaxAge ¶
func CustomerMaxAge(maxAge time.Duration) CustomerOption
func CustomerMaxAgeSeconds ¶
func CustomerMaxAgeSeconds(maxAgeSeconds int) CustomerOption
func CustomerMobile ¶
func CustomerMobile(mobile string) CustomerOption
func CustomerName ¶
func CustomerName(name string) CustomerOption
func CustomerPassword ¶
func CustomerPassword(password string) CustomerOption
func CustomerPlatform ¶
func CustomerPlatform(platform string) CustomerOption
func CustomerScense ¶
func CustomerScense(scense string) CustomerOption
func CustomerSignInType ¶
func CustomerSignInType(signInType string) CustomerOption
func GenerateOptionsFromHeader ¶
func GenerateOptionsFromHeader(c echo.Context, maxAge ...int) []CustomerOption
type CustomerOptions ¶
type CustomerOptions struct { *dbschema.OfficialCustomer MaxAge time.Duration // 登录状态有效时长 SignInType string // 登录方式 Scense string // 场景 Platform string // 系统平台 DeviceNo string // 设备编号 }
func NewCustomerOptions ¶
func NewCustomerOptions(customerM *dbschema.OfficialCustomer, noClear ...bool) *CustomerOptions
type Device ¶
type Device struct {
*dbschema.OfficialCustomerDevice
}
func (*Device) CleanCustomer ¶
func (f *Device) CleanCustomer(customer *dbschema.OfficialCustomer, options ...CustomerOption) (err error)
func (*Device) CleanExceedLimit ¶
func (f *Device) CleanExceedLimit(customerID uint64, multideviceSignin *multidivicesignin.MultideviceSignin) error
func (*Device) CleanExpired ¶
func (*Device) ExistsOther ¶
func (*Device) SetDefaults ¶
func (f *Device) SetDefaults()
func (*Device) SetOptions ¶
func (f *Device) SetOptions(options *CustomerOptions) *Device
type Event ¶
type Event func(*dbschema.OfficialCustomer) error
type Following ¶
type Following struct {
*dbschema.OfficialCustomerFollowing
}
func NewFollowing ¶
type FollowingAndCustomer ¶
type FollowingAndCustomer struct { *dbschema.OfficialCustomerFollowing Customer echo.H }
type Invitation ¶
type Invitation struct {
*dbschema.OfficialCustomerInvitation
}
func NewInvitation ¶
func NewInvitation(ctx echo.Context) *Invitation
func (*Invitation) Add ¶
func (f *Invitation) Add() (pk interface{}, err error)
func (*Invitation) Exists ¶
func (f *Invitation) Exists(code string, excludeIDs ...uint) (bool, error)
func (*Invitation) FindCode ¶
func (f *Invitation) FindCode(invitationCode string) error
func (*Invitation) UseCode ¶
func (f *Invitation) UseCode(invitationID uint, customer *dbschema.OfficialCustomer) error
type InvitationCustomer ¶
type InvitationCustomer struct {
*dbschema.OfficialCustomerInvitationUsed
}
func NewInvitationCustomer ¶
func NewInvitationCustomer(ctx echo.Context) *InvitationCustomer
func (*InvitationCustomer) ListCustomer ¶
func (f *InvitationCustomer) ListCustomer(cond *db.Compounds, orderby ...interface{}) ([]*InvitationCustomerExt, error)
func (*InvitationCustomer) ListCustomerWithCode ¶
func (f *InvitationCustomer) ListCustomerWithCode(cond *db.Compounds, orderby ...interface{}) ([]*InvitationCustomerWithCode, error)
type InvitationCustomerExt ¶
type InvitationCustomerExt struct { *dbschema.OfficialCustomerInvitationUsed Customer *dbschema.OfficialCustomer `db:"-,relation=id:customer_id|gtZero"` Level *dbschema.OfficialCustomerLevel `db:"-,relation=id:level_id|gtZero"` AgentLevel *dbschema.OfficialCustomerAgentLevel `db:"-,relation=id:agent_level_id|gtZero"` RoleList []*dbschema.OfficialCustomerRole `db:"-,relation=id:role_ids|split"` }
type InvitationCustomerWithCode ¶
type InvitationCustomerWithCode struct { *dbschema.OfficialCustomerInvitationUsed Customer *dbschema.OfficialCustomer `db:"-,relation=id:customer_id|gtZero"` Level *dbschema.OfficialCustomerLevel `db:"-,relation=id:level_id|gtZero"` AgentLevel *dbschema.OfficialCustomerAgentLevel `db:"-,relation=id:agent_level_id|gtZero"` RoleList []*dbschema.OfficialCustomerRole `db:"-,relation=id:role_ids|split"` Invitation *dbschema.OfficialCustomerInvitation `db:"-,relation=id:invitation_id|gtZero"` }
type Message ¶
type Message struct { *dbschema.OfficialCommonMessage Viewed *dbschema.OfficialCommonMessageViewed }
func (*Message) AddData ¶
func (f *Message) AddData(customer *dbschema.OfficialCustomer, user *dbschemaNging.NgingUser) (pk interface{}, err error)
AddData 添加消息 * customer 操作客户 * user 操作后台用户
func (*Message) CheckRecvCustomerPerm ¶
func (f *Message) CheckRecvCustomerPerm(customer *dbschema.OfficialCustomer) bool
func (*Message) CheckRecvPerm ¶
func (f *Message) CheckRecvPerm(customer *dbschema.OfficialCustomer) bool
CheckRecvPerm 检查是否为收信人权限
func (*Message) CheckRecvUserPerm ¶
func (f *Message) CheckRecvUserPerm(customer *dbschema.OfficialCustomer) bool
func (*Message) CountTodaySends ¶
func (*Message) CountUnread ¶
func (*Message) CustomerMaxPerDay ¶
func (*Message) DecodeContent ¶
func (f *Message) DecodeContent(row *dbschema.OfficialCommonMessage) *dbschema.OfficialCommonMessage
func (*Message) GetWithViewed ¶
func (f *Message) GetWithViewed(row *dbschema.OfficialCommonMessage) (*MessageWithViewed, error)
func (*Message) IsSystemMessage ¶
func (*Message) LastSend ¶
func (f *Message) LastSend(customerID uint64) (*dbschema.OfficialCommonMessage, error)
func (*Message) ListWithViewedByRecipient ¶
func (f *Message) ListWithViewedByRecipient(viewerID uint64, groupIDs []uint, isSystemMessage bool, onlyUnread bool, otherCond db.Compound, viewerTypes ...string) ([]*MessageWithViewed, error)
ListWithViewedByRecipient 收件箱列表
func (*Message) ListWithViewedBySender ¶
func (f *Message) ListWithViewedBySender(senderID uint64, onlyUnread bool, otherCond db.Compound, viewerTypes ...string) ([]*MessageWithViewed, error)
ListWithViewedBySender 发件箱列表
func (*Message) WithViewedByAll ¶
func (f *Message) WithViewedByAll(rows []*dbschema.OfficialCommonMessage) ([]*MessageWithViewed, error)
func (*Message) WithViewedByRecipient ¶
func (f *Message) WithViewedByRecipient(rows []*dbschema.OfficialCommonMessage, viewerID uint64, viewerType string) ([]*MessageWithViewed, error)
func (*Message) WithViewedBySender ¶
func (f *Message) WithViewedBySender(rows []*dbschema.OfficialCommonMessage) ([]*MessageWithViewed, error)
type MessageWithViewed ¶
type MessageWithViewed struct { *dbschema.OfficialCommonMessage MsgFrom *MsgUser `json:",omitempty"` MsgTo *MsgUser `json:",omitempty"` IsViewed bool }
func (*MessageWithViewed) MsgUser ¶
func (m *MessageWithViewed) MsgUser() *MsgUser
type OAuth ¶
type OAuth struct {
*dbschema.OfficialCustomerOauth
}
func (*OAuth) DelSession ¶
func (f *OAuth) DelSession()
func (*OAuth) ExistsOtherBinding ¶
func (*OAuth) SignUpCustomer ¶
SignUpCustomer 用户不存在,需要新注册
type PrepaidCard ¶
type PrepaidCard struct {
*dbschema.OfficialCustomerPrepaidCard
}
func NewPrepaidCard ¶
func NewPrepaidCard(ctx echo.Context) *PrepaidCard
func (*PrepaidCard) Add ¶
func (f *PrepaidCard) Add() (pk interface{}, err error)
func (*PrepaidCard) BatchGenerate ¶
func (f *PrepaidCard) BatchGenerate(uid uint, count int, amount uint, salePrice float64, start uint, end uint, bgImage string) error
BatchGenerate 批量生成
type Role ¶
type Role struct { *dbschema.OfficialCustomerRole // contains filtered or unexported fields }
func (*Role) CancelDefault ¶
func (*Role) GetDefault ¶
func (*Role) ListByCustomer ¶
func (u *Role) ListByCustomer(customer *dbschema.OfficialCustomer) (roleList []*dbschema.OfficialCustomerRole)
func (*Role) ListRoleIDsByCustomer ¶
func (u *Role) ListRoleIDsByCustomer(customer *dbschema.OfficialCustomer) (roleIDs []uint)
type RolePermission ¶
type RolePermission struct {
*dbschema.OfficialCustomerRolePermission
}
func NewRolePermission ¶
func NewRolePermission(ctx echo.Context) *RolePermission
func (*RolePermission) Add ¶
func (u *RolePermission) Add() (interface{}, error)
type U2F ¶
type U2F struct {
*dbschema.OfficialCustomerU2f
}
func (*U2F) ListPageByType ¶
type Wallet ¶
type Wallet struct { Wallet *dbschema.OfficialCustomerWallet Flow *dbschema.OfficialCustomerWalletFlow // contains filtered or unexported fields }
func (*Wallet) AddFlow ¶
func (f *Wallet) AddFlow(flows ...*dbschema.OfficialCustomerWalletFlow) (err error)
AddFlow 添加不允许重复的流水记录
func (*Wallet) AddRepeatableFlow ¶
func (f *Wallet) AddRepeatableFlow(flows ...*dbschema.OfficialCustomerWalletFlow) (err error)
AddRepeatableFlow 添加允许重复的流水记录 unique_key: customer_id, asset_type, amount_type, source_type, source_table, source_id, number
func (*Wallet) FlowListPage ¶
func (f *Wallet) FlowListPage(cond *db.Compounds, orderby ...interface{}) ([]*WalletFlowExt, error)
func (*Wallet) GetAssetBalance ¶
func (*Wallet) GetBalance ¶
func (*Wallet) ListCustomerAllAssets ¶
func (f *Wallet) ListCustomerAllAssets(customerID uint64) (map[string]*dbschema.OfficialCustomerWallet, error)
ListCustomerAllAssets 列出客户所有资产
type WalletExt ¶
type WalletExt struct { *dbschema.OfficialCustomerWallet Customer *dbschema.OfficialCustomer `db:"-,relation=id:customer_id"` AssetTypeName string `db:"-"` }
type WalletFlowExt ¶
type WalletFlowExt struct { *dbschema.OfficialCustomerWalletFlow Customer *dbschema.OfficialCustomer `db:"-,relation=id:customer_id"` SrcCustomer *dbschema.OfficialCustomer `db:"-,relation=id:source_customer|gtZero"` AssetTypeName string `db:"-"` }
type WalletSettings ¶
func NewWalletSettings ¶
func NewWalletSettings() *WalletSettings
func (*WalletSettings) FromStore ¶
func (s *WalletSettings) FromStore(r echo.H) *WalletSettings
Source Files ¶
- complaint.go
- complaint_ext.go
- complaint_process.go
- complaint_types.go
- counter.go
- customer.go
- customer_context_utils.go
- customer_counter.go
- customer_events.go
- customer_ext.go
- customer_filter_fields.go
- customer_helper.go
- customer_jwt.go
- customer_option.go
- customer_password.go
- customer_session.go
- customer_sign_in.go
- customer_sign_up.go
- device.go
- device_ext.go
- following.go
- following_ext.go
- invitation.go
- invitation_customer.go
- invitation_ext.go
- level.go
- message.go
- oauth.go
- prepaid_card.go
- role.go
- role_permission.go
- u2f.go
- wallet.go
- wallet_ext.go
- wallet_settings.go
- wallet_types.go