jianqian

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvestorTypeAuthor         = "author"
	InvestorTypeOriginalAuthor = "originalAuthor"
	InvestorTypeCommunity      = "community"
	InvestorTypeCommonInvestor = "commonInvestor"
)
View Source
const ArticlesMapperName = "article"
View Source
const (
	BuyMapperName = "buyad"
)
View Source
const CoinsMapperName = "coins"
View Source
const (
	InvestMapperName = "investad"
)
View Source
const (
	InvestUncheckedMapperName = "investUnchecked"
)

Variables

This section is empty.

Functions

func GetInvestKey

func GetInvestKey(article []byte, user qbasetypes.Address, investorType string) []byte

func GetInvestUncheckedKey

func GetInvestUncheckedKey(article []byte, user qbasetypes.Address) []byte

func ResultArticleNotFoundError

func ResultArticleNotFoundError() common.Result

ResultArticleNotFoundError 文章不存在

func ResultBuyadExpiredError

func ResultBuyadExpiredError() common.Result

ResultBuyadExpiredError 购买过期

func ResultBuyadNotStartError

func ResultBuyadNotStartError() common.Result

ResultBuyadNotStartError 还未到购买时间

func ResultBuyadSaledError

func ResultBuyadSaledError() common.Result

ResultBuyadSaledError 已售

func ResultInvestadExpiredError

func ResultInvestadExpiredError() common.Result

ResultInvestadExpiredError 投资过期

Types

type ActivityAward

type ActivityAward struct {
	Address    types.Address
	Amount     types.BigInt
	CausesCode string
	CausesStr  string
}

type Articles

type Articles struct {
	Authoraddress       types.Address //作者地址(必填)
	OriginalAuthor      types.Address //原创作者地址(为空表示原创)
	ArticleHash         string        //作品唯一标识hash
	ShareAuthor         int           //作者收入比例(必填)
	ShareOriginalAuthor int           //原创收入比例(转载作品必填)
	ShareCommunity      int           //社区收入比例(必填)
	ShareInvestor       int           //投资者收入比例(必填)
	InvestDays          int           //可供投资的天数(必填)
	EndInvestDate       time.Time     //投资结束时间(必填)
	BuyDays             int           //可供购买广告位的天数(必填)
	EndBuyDate          time.Time     //广告位购买结果时间(必填)
	Gas                 types.BigInt
}

func QueryArticle

func QueryArticle(cdc *amino.Codec, ctx *context.CLIContext, hash string) (article *Articles, err error)

type ArticlesMapper

type ArticlesMapper struct {
	*mapper.BaseMapper
}

func NewArticlesMapper

func NewArticlesMapper(MapperName string) *ArticlesMapper

func (*ArticlesMapper) Copy

func (mapper *ArticlesMapper) Copy() mapper.IMapper

func (*ArticlesMapper) GetArticle

func (mapper *ArticlesMapper) GetArticle(articleHash string) *Articles

func (*ArticlesMapper) GetKey

func (mapper *ArticlesMapper) GetKey(key string) (v string)

func (*ArticlesMapper) SaveKV

func (mapper *ArticlesMapper) SaveKV(key string, value string)

func (*ArticlesMapper) SetArticle

func (mapper *ArticlesMapper) SetArticle(articleHash string, qscinfo *Articles) bool

type BuyMapper

type BuyMapper struct {
	*mapper.BaseMapper
}

func NewBuyMapper

func NewBuyMapper(mapperName string) *BuyMapper

func (*BuyMapper) Copy

func (bm *BuyMapper) Copy() mapper.IMapper

func (*BuyMapper) DeleteBuyer

func (bm *BuyMapper) DeleteBuyer(article []byte)

Set 删除用户投资

func (*BuyMapper) GetBuyer

func (bm *BuyMapper) GetBuyer(article []byte) (*Buyer, bool)

Get 查询用户投资情况

func (*BuyMapper) GetKey

func (bm *BuyMapper) GetKey(key string) (v string)

func (*BuyMapper) SaveKV

func (bm *BuyMapper) SaveKV(key string, value string)

func (*BuyMapper) SetBuyer

func (bm *BuyMapper) SetBuyer(article []byte, i Buyer)

Set 添加用户投资

type Buyer

type Buyer struct {
	ArticleHash []byte             `json:"articleHash"` // 文章hash
	Address     qbasetypes.Address `json:"address"`     // 买家地址
	Buy         qbasetypes.BigInt  `json:"buyad"`       // 购买金额
	BuyTime     time.Time          `json:"buyTime"`     // 购买时间
	CheckStatus CheckStatus        `json:"isChecked"`   // 验证状态
}

Buyer 买家

func QueryArticleBuyer

func QueryArticleBuyer(cdc *amino.Codec, ctx *context.CLIContext, hash string) (buyer *Buyer, err error)

type CheckStatus

type CheckStatus int
const (
	CheckStatusInit CheckStatus = iota
	CheckStatusSuccess
	CheckStatusFail
)

type Coins

type Coins struct {
	Tx     string
	From   types.Address
	Data   []ActivityAward
	Status string //记录保存跨链结果
}

func QueryCoins

func QueryCoins(cdc *amino.Codec, ctx *context.CLIContext, tx string) (coins *Coins, err error)

type CoinsMapper

type CoinsMapper struct {
	*mapper.BaseMapper
}

func NewCoinsMapper

func NewCoinsMapper(kvMapperName string) *CoinsMapper

func (*CoinsMapper) Copy

func (cm *CoinsMapper) Copy() mapper.IMapper

func (*CoinsMapper) GetCoins

func (cm *CoinsMapper) GetCoins(key []byte) (*Coins, bool)

Get 查询活动奖励记录

func (*CoinsMapper) SetCoins

func (cm *CoinsMapper) SetCoins(i *Coins)

Set 保存活动奖励记录

func (*CoinsMapper) UpdateCoins

func (cm *CoinsMapper) UpdateCoins(key []byte, code string) bool

Set 更新跨链记录

type InvestMapper

type InvestMapper struct {
	*mapper.BaseMapper
}

func NewInvestMapper

func NewInvestMapper(mapperName string) *InvestMapper

func (*InvestMapper) AllInvestors

func (im *InvestMapper) AllInvestors(article []byte) Investors

Iterator

func (*InvestMapper) Copy

func (im *InvestMapper) Copy() mapper.IMapper

func (*InvestMapper) GetInvestor

func (im *InvestMapper) GetInvestor(key []byte) (Investor, bool)

Get 查询用户投资情况

func (*InvestMapper) GetKey

func (im *InvestMapper) GetKey(key string) (v string)

func (*InvestMapper) SaveKV

func (im *InvestMapper) SaveKV(key string, value string)

func (*InvestMapper) SetInvestor

func (im *InvestMapper) SetInvestor(key []byte, i Investor)

Set 添加用户投资

type InvestUnchecked

type InvestUnchecked struct {
	Article    []byte             `json:"article"`    // 文章hash
	Address    qbasetypes.Address `json:"address"`    // 投资者地址
	Invest     qbasetypes.BigInt  `json:"invest"`     // 投资金额
	InvestTime time.Time          `json:"investTime"` // 投资时间
	IsChecked  bool               `json:"isChecked"`  // 已确认
}

InvestUnchecked 投资者待确认

type InvestUncheckedMapper

type InvestUncheckedMapper struct {
	*mapper.BaseMapper
}

func NewInvestUncheckedMapper

func NewInvestUncheckedMapper(mapperName string) *InvestUncheckedMapper

func (*InvestUncheckedMapper) Copy

func (ium *InvestUncheckedMapper) Copy() mapper.IMapper

func (*InvestUncheckedMapper) GetInvestUncheckeds

func (ium *InvestUncheckedMapper) GetInvestUncheckeds(key []byte) (InvestUncheckeds, bool)

Get 查询用户投资情况

func (*InvestUncheckedMapper) GetKey

func (ium *InvestUncheckedMapper) GetKey(key string) (v string)

func (*InvestUncheckedMapper) SaveKV

func (ium *InvestUncheckedMapper) SaveKV(key string, value string)

func (*InvestUncheckedMapper) SetInvestUncheckeds

func (ium *InvestUncheckedMapper) SetInvestUncheckeds(key []byte, i InvestUncheckeds)

Set 添加用户投资

type InvestUncheckeds

type InvestUncheckeds []InvestUnchecked

type Investor

type Investor struct {
	InvestorType string             `json:"investorType"` // 投资者类型 author, originalAuthor, community, commonInvestor
	Address      qbasetypes.Address `json:"address"`      // 投资者地址
	Invest       qbasetypes.BigInt  `json:"investad"`     // 投资金额
	Revenue      qbasetypes.BigInt  `json:"revenue"`      // 投资收益
	InvestTime   time.Time          `json:"investTime"`   // 投资时间
}

Investor 投资者

type Investors

type Investors []Investor

func ListInvestors

func ListInvestors(ctx *context.CLIContext, cdc *amino.Codec, articleHash string) (Investors, error)

func (Investors) TotalInvest

func (is Investors) TotalInvest() qbasetypes.BigInt

TotalInvest 总投资

func (Investors) TotalRevenue

func (is Investors) TotalRevenue() qbasetypes.BigInt

总收益

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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