agent

package
v0.0.0-...-4e81a15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2017 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentDB

type AgentDB struct {
	DB *sqlx.DB
}

func (*AgentDB) DeleteBank

func (db *AgentDB) DeleteBank(bankName string) error

DeleteBank 删除支持的银行

func (*AgentDB) ExistsBank

func (db *AgentDB) ExistsBank(bankName string) (bool, error)

ExistsBank 查询指定银行是否存在

func (*AgentDB) ExistsInviteCode

func (db *AgentDB) ExistsInviteCode(inviteCode string) (bool, error)

ExistsInviteCode 邀请码是否存在

func (*AgentDB) GetGoodsInfo

func (db *AgentDB) GetGoodsInfo() (*GoodsAgent, error)

GetGoodsInfo 获取代理商品信息

func (*AgentDB) GetUserByID

func (db *AgentDB) GetUserByID(userID int) (*User, error)

GetUserByID 获取用户的代理信息

func (*AgentDB) GetUserByInviteCode

func (db *AgentDB) GetUserByInviteCode(inviteCode string) (*User, error)

GetUserByInviteCode 通过邀请码获取用户的代理信息

func (*AgentDB) GetUserIncome

func (db *AgentDB) GetUserIncome(userID int, month time.Time) (*Income, error)

GetUserIncome 获取用户某月的收入

func (*AgentDB) GetUserIncomeSummary

func (db *AgentDB) GetUserIncomeSummary(userID int) (*IncomeSummary, error)

GetUserIncomeSummary 获取用户历史所有收入汇总,不包括当前月份,第一个返回值是总业绩,第二个返回值是总收入

func (*AgentDB) InsertBank

func (db *AgentDB) InsertBank(bankName, icon string) error

InsertBank 新增支持的银行

func (*AgentDB) IsAgentUser

func (db *AgentDB) IsAgentUser(userID int) bool

IsAgentUser 用户是否是合伙人用户

func (*AgentDB) ListBank

func (db *AgentDB) ListBank() ([]Bank, error)

ListBank 列出支持的银行

func (*AgentDB) ListDailyIncomes

func (db *AgentDB) ListDailyIncomes(userID, offset, limit int, level string, day time.Time) ([]IncomeDaily, error)

ListDailyIncomes 列出萌友日收入明细

func (*AgentDB) ListDailySales

func (db *AgentDB) ListDailySales(userID, offset, limit int, level string, day time.Time) ([]IncomeDaily, error)

ListDailySales 列出萌友日业绩明细

func (*AgentDB) ListIncomeByMonth

func (db *AgentDB) ListIncomeByMonth(month, pay, mobile string, offset, limit int) ([]Income, int, error)

ListIncomeByMonth 获取某月的所有月度收入汇总列表,month格式为201701

func (*AgentDB) ListIncomeMonths

func (db *AgentDB) ListIncomeMonths() ([]string, error)

ListIncomeMonths 获取有收入月的列表

func (*AgentDB) ListMonthIncomes

func (db *AgentDB) ListMonthIncomes(userID, offset, limit int, level string, month time.Time) ([]IncomeMonth, error)

ListMonthIncomes 列出用户的下属收入明细

func (*AgentDB) ListMonthSales

func (db *AgentDB) ListMonthSales(userID, offset, limit int, level string, month time.Time) ([]IncomeMonth, error)

ListMonthSales 列出用户的下属业绩明细

func (*AgentDB) ListUser

func (db *AgentDB) ListUser(pay, level, mobile string, offset, limit int) ([]User, int, error)

ListUser 分页列出梦想合伙人

func (*AgentDB) ListUserByUserIDs

func (db *AgentDB) ListUserByUserIDs(userIDs []int) ([]User, error)

ListUserByUserIDs 列出取指定userIDs的用户代理信息

func (*AgentDB) ListUserGrandsons

func (db *AgentDB) ListUserGrandsons(userID, offset, limit int) ([]User, error)

ListUserGrandsons 分页列出三级萌友

func (*AgentDB) ListUserIncomes

func (db *AgentDB) ListUserIncomes(userID int) ([]Income, error)

ListUserIncomes 获取用户月度收入汇总表

func (*AgentDB) ListUserSons

func (db *AgentDB) ListUserSons(userID, offset, limit int) ([]User, error)

ListUserSons 分页列出二级萌友

func (*AgentDB) UpdateGoodsInfo

func (db *AgentDB) UpdateGoodsInfo(label, buttonLabel, coverImage, zoomImage string, price float32) error

UpdateGoodsInfo 更新代理商品信息

func (*AgentDB) UpdateIncomePayState

func (db *AgentDB) UpdateIncomePayState(adminID, monthID int, adminName, bankName, branchName, bankCode, bankUser, alipay string, userID int, month time.Time, totalPay float32) error

UpdateIncomePayState 更新某月收入的支付状态为已支付

func (*AgentDB) UpdateUserBank

func (db *AgentDB) UpdateUserBank(userID int, bankName, branchName, bankCode, bankUser, alipay string) error

UpdateUserBank 更新合伙人收款帐号信息

type AgentTx

type AgentTx struct {
	Tx *sqlx.Tx
}

func (*AgentTx) ExistsInviteCode

func (tx *AgentTx) ExistsInviteCode(inviteCode string) (bool, error)

ExistsInviteCode 邀请码是否存在

func (*AgentTx) ExistsUserIncomeDaily

func (tx *AgentTx) ExistsUserIncomeDaily(userID int, day time.Time) (bool, error)

ExistsUserIncomeDaily 查询用户天收入记录是否存在

func (*AgentTx) ExistsUserIncomeMonth

func (tx *AgentTx) ExistsUserIncomeMonth(userID int, month time.Time) (bool, error)

ExistsUserIncomeMonth 查询用户月收入记录是否存在

func (*AgentTx) InsertIncome

func (tx *AgentTx) InsertIncome(userID int, nickname, mobile string, month time.Time, sale, income float32) error

InsertIncome 新增用户某月收入记录

func (*AgentTx) InsertIncomeDaily

func (tx *AgentTx) InsertIncomeDaily(userID, fatherID, grandpaID int, nickname, avatar, mobile string,
	month, day time.Time, sale, fatherIncome, grandpaIncome float32) error

InsertIncomeDaily 新增用户某天消费记录

func (*AgentTx) InsertIncomeMonth

func (tx *AgentTx) InsertIncomeMonth(userID, fatherID, grandpaID int, nickname, avatar, mobile string,
	month time.Time, sale, fatherIncome, grandpaIncome float32) error

InsertIncomeMonth 新增用户某月消费记录

func (*AgentTx) InsertUser

func (tx *AgentTx) InsertUser(userID int, nickname, avatar, mobile string, fatherID, grandpaID int) error

InsertUser 插入代理用户

func (*AgentTx) UpdateChildCount

func (tx *AgentTx) UpdateChildCount(fatherID, grandpaID int) error

UpdateChildCount 更新代理用户的自用户数量

func (*AgentTx) UpdateFatherIncome

func (tx *AgentTx) UpdateFatherIncome(userID int, month time.Time, sale, income float32) error

UpdateFatherIncome 更新邀请人月收入

func (*AgentTx) UpdateGrandpaIncome

func (tx *AgentTx) UpdateGrandpaIncome(userID int, month time.Time, sale, income float32) error

UpdateGrandpaIncome 更新邀请人上级月收入

func (*AgentTx) UpdateIncomeDaily

func (tx *AgentTx) UpdateIncomeDaily(userID int, daily time.Time, sale, fatherIncome, grandpaIncome float32) error

UpdateIncomeDaily 更新用户天消费

func (*AgentTx) UpdateIncomeMonth

func (tx *AgentTx) UpdateIncomeMonth(userID int, month time.Time, sale, fatherIncome, grandpaIncome float32) error

UpdateIncomeMonth 更新用户月消费

func (*AgentTx) UpdateUserInfo

func (tx *AgentTx) UpdateUserInfo(userID int, nickname, avatar string) error

UpdateUserInfo 更新合伙人资料

func (*AgentTx) UpdateUserParent

func (tx *AgentTx) UpdateUserParent(userID, fatherID, grandpaID int) error

UpdateUserParent 更新用户邀请人和邀请人上级

func (*AgentTx) UpdateUserPayState

func (tx *AgentTx) UpdateUserPayState(userID int, isPay bool) error

UpdateUserPayState 更新代理用户礼包支付状态

type Bank

type Bank struct {
	Active     bool      `json:"active" db:"active"`          // 是否有效
	BankName   string    `json:"bankName" db:"bank_name"`     // 银行名称
	Icon       string    `json:"icon" db:"icon"`              // 银行logo
	CreateTime time.Time `json:"createTime" db:"create_time"` // 创建时间
}

Bank 代理收款银行信息

type GoodsAgent

type GoodsAgent struct {
	Label       string    `json:"label" db:"label"`              // 名称
	ButtonLabel string    `json:"buttonLabel" db:"button_label"` // 购买页面底部按钮文字
	Price       float32   `json:"price" db:"price"`              // 价格
	CoverImage  string    `json:"coverImage" db:"cover_image"`   // 封面图
	ZoomImage   string    `json:"zoomImage" db:"zoom_image"`     // 缩略图
	UpdateTime  time.Time `json:"updateTime" db:"update_time"`   // 更新时间
}

GoodsAgent 代理商品信息

type Income

type Income struct {
	MonthID        int       `json:"monthID" db:"month_id"`               // 代理月度ID
	IsPay          bool      `json:"isPay" db:"is_pay"`                   // 是否已打款
	UserID         int       `json:"userID" db:"user_id"`                 // 用户ID
	Nickname       string    `json:"nickname" db:"nickname"`              // 用户昵称
	MobileNumber   string    `json:"mobileNumber" db:"mobile_number"`     // 用户手机号
	Month          time.Time `json:"month" db:"month"`                    // 哪个月
	SonSale        float32   `json:"sonSale" db:"son_sale"`               // 一级销售业绩
	SonIncome      float32   `json:"sonIncome" db:"son_income"`           // 一级收入
	GrandsonSale   float32   `json:"grandsonSale" db:"grandson_sale"`     // 二级销售业绩
	GrandsonIncome float32   `json:"grandsonIncome" db:"grandson_income"` // 二级收入
	AdminID        int       `json:"adminID" db:"admin_id"`               // 管理员ID
	AdminName      string    `json:"adminName" db:"admin_name"`           // 管理员名称
	BankName       string    `json:"bankName" db:"bank_name"`             // 银行卡名称
	BranchName     string    `json:"branchName" db:"branch_name"`         // 支行名称
	BankCode       string    `json:"bankCode" db:"bank_code"`             // 卡号
	BankUser       string    `json:"bankUser" db:"bank_user"`             // 收款人名称
	Alipay         string    `json:"alipay" db:"alipay"`                  // 支付宝帐号
	TotalPay       float32   `json:"totalPay" db:"total_pay"`             // 财务实际打款金额
	PayTime        time.Time `json:"payTime" db:"pay_time"`               // 支付时间
	CreateTime     time.Time `json:"createTime" db:"create_time"`         // 创建时间
	UpdateTime     time.Time `json:"updateTime" db:"update_time"`         // 更新时间
}

Income 代理用户月度收入汇总

type IncomeDaily

type IncomeDaily struct {
	UserID        int       `json:"userID" db:"user_id"`               // 用户ID
	Nickname      string    `json:"nickname" db:"nickname"`            // 用户昵称
	Avatar        string    `json:"avatar" db:"avatar"`                // 用户头像
	MobileNumber  string    `json:"mobileNumber" db:"mobile_number"`   // 用户手机号
	Month         time.Time `json:"month" db:"month"`                  // 哪个月
	Day           time.Time `json:"day" db:"day"`                      // 哪一天的
	GrandpaID     int       `json:"grandpaID" db:"grandpa_id"`         // 爷爷辈的用户ID
	GrandpaSale   float32   `json:"grandpaSale" db:"grandpa_sale"`     // 爷爷辈的销售业绩
	GrandpaIncome float32   `json:"grandpaIncome" db:"grandpa_income"` // 爷爷辈的收入
	FatherID      int       `json:"fatherID" db:"father_id"`           // 爸爸辈的用户ID
	FatherSale    float32   `json:"fatherSale" db:"father_sale"`       // 爸爸辈的销售业绩
	FatherIncome  float32   `json:"fatherIncome" db:"father_income"`   // 爸爸辈的收入
	CreateTime    time.Time `json:"createTime" db:"create_time"`       // 创建时间
	UpdateTime    time.Time `json:"updateTime" db:"update_time"`       // 更新时间
}

IncomeDaily 下线用户每天明细

type IncomeMonth

type IncomeMonth struct {
	UserID        int       `json:"userID" db:"user_id"`               // 用户ID
	Nickname      string    `json:"nickname" db:"nickname"`            // 用户昵称
	Avatar        string    `json:"avatar" db:"avatar"`                // 用户头像
	MobileNumber  string    `json:"mobileNumber" db:"mobile_number"`   // 用户手机号
	Month         time.Time `json:"month" db:"month"`                  // 哪个月
	GrandpaID     int       `json:"grandpaID" db:"grandpa_id"`         // 爷爷辈的用户ID
	GrandpaSale   float32   `json:"grandpaSale" db:"grandpa_sale"`     // 爷爷辈的销售业绩
	GrandpaIncome float32   `json:"grandpaIncome" db:"grandpa_income"` // 爷爷辈的收入
	FatherID      int       `json:"fatherID" db:"father_id"`           // 爸爸辈的用户ID
	FatherSale    float32   `json:"fatherSale" db:"father_sale"`       // 爸爸辈的销售业绩
	FatherIncome  float32   `json:"fatherIncome" db:"father_income"`   // 爸爸辈的收入
	CreateTime    time.Time `json:"createTime" db:"create_time"`       // 创建时间
	UpdateTime    time.Time `json:"updateTime" db:"update_time"`       // 更新时间
}

IncomeMonth 下线用户月度明细

type IncomeSummary

type IncomeSummary struct {
	CurrentSonSale        float32 `json:"currentSonSale" db:"current_son_sale"`
	CurrentGrandsonSale   float32 `json:"currentGrandsonSale" db:"current_grandson_sale"`
	SonSale               float32 `json:"sonSale" db:"son_sale"`
	GrandsonSale          float32 `json:"grandsonSale" db:"grandson_sale"`
	CurrentSonIncome      float32 `json:"currentSonIncome" db:"current_son_income"`
	CurrentGrandsonIncome float32 `json:"currentGrandsonIncome" db:"current_grandson_income"`
	SonIncome             float32 `json:"sonIncome" db:"son_income"`
	GrandsonIncome        float32 `json:"grandsonIncome" db:"grandson_income"`
}

IncomeSummary 当月和历史收入汇总

type User

type User struct {
	UserID        int       `json:"userID" db:"user_id"`               // 用户ID
	Nickname      string    `json:"nickname" db:"nickname"`            // 用户昵称
	Avatar        string    `json:"avatar" db:"avatar"`                // 用户头像
	MobileNumber  string    `json:"mobileNumber" db:"mobile_number"`   // 用户手机号
	FatherID      int       `json:"fatherID" db:"father_id"`           // 父辈ID
	GrandpaID     int       `json:"grandpaID" db:"grandpa_id"`         // 爷爷辈ID
	InviteCode    string    `json:"inviteCode" db:"invite_code"`       // 邀请码
	SonCount      int       `json:"sonCount" db:"son_count"`           // 子辈用户数量
	GrandsonCount int       `json:"grandsonCount" db:"grandson_count"` // 孙子辈用户数量
	BankName      string    `json:"bankName" db:"bank_name"`           // 银行卡名称
	BranchName    string    `json:"branchName" db:"branch_name"`       // 支行名称
	BankCode      string    `json:"bankCode" db:"bank_code"`           // 卡号
	BankUser      string    `json:"bankUser" db:"bank_user"`           // 收款人名称
	Alipay        string    `json:"alipay" db:"alipay"`                // 支付宝帐号
	IsPay         bool      `json:"isPay" db:"is_pay"`                 // 是否已支付99元合伙人升级费用,升级后才有返现
	PayTime       time.Time `json:"payTime" db:"pay_time"`             // 支付时间
	CreateTime    time.Time `json:"createTime" db:"create_time"`       // 创建时间
	UpdateTime    time.Time `json:"updateTime" db:"update_time"`       // 更新时间
}

User 合伙人用户信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL