models

package
v0.0.0-...-6dbb2d7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Overview

Copyright 2018. box.la authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018. box.la authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018. box.la authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2018. box.la authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	MAX_ATTEMPTS = 5  // 密码最多尝试次数
	FROZEN_HOUR  = 8  // 账户冻结周期
	TOKEN_EXP    = 24 // token有效周期
)
View Source
const (
	TXTYPE_ID       = 0 // 根据id获取转账信息
	TXTYPE_ORDERNUM = 1 // 根据uuid获取转账信息
)
View Source
const (
	FLOW_PENDING    = 0 // 待审批
	FLOW_REJECTED   = 2 // 被拒绝
	FLOW_APPROVALED = 3 // 审批通过
	FLOW_INVALID    = 4 // 作废
)

审批流状态

View Source
const (
	TX_ALL        = -1 // 所有状态
	TX_WAITING    = 0  // 待审批
	TX_DOING      = 1  // 审批中,转账中
	TX_REJECTED   = 2  // 拒绝
	TX_APPROVALED = 3  // 审批通过
	TX_CANCEL     = 4  // 撤销
	TX_INVALID    = 5  // 作废
	TX_END        = -1 // 审批拒绝,转账失败
)

转账审批进度

Variables

This section is empty.

Functions

func AddBranch

func AddBranch(name string, createdBy int64) error

添加部门

func AddRegistration

func AddRegistration(regid, applyer, captain, msg, applicant_account, password string) (err error)

记录注册申请

func AddTempTransferArrivedInfo

func AddTempTransferArrivedInfo(wdhash, txid string, arrived int64) error

func AddTransferArrivedInfo

func AddTransferArrivedInfo(txInfo TradeInfo, wdhash, txid string, arrived int64) (err error)

记录提现到账信息

func ApplyTransfer

func ApplyTransfer(orderNumber, applyInfo, sign string, approversInfo FlowInfo, transferContent TransferContent, applyerAccInfo AccountInfo, currencyInfo CurrencyInfo) error

提交转账申请

func ApprovalTransfer

func ApprovalTransfer(transID, mAccID int64, progress int, signature, reason string) error

提交审批意见

func AttemptFrozen

func AttemptFrozen(appid string) (bool, int, error)

用户输入密码错误,记录尝试次数

func CancelTxApply

func CancelTxApply(transID, accID int64, reason string) error

撤销转账申请

func CaptainApprovalRegInfo

func CaptainApprovalRegInfo(regid, consent string) error

记录上级审批注册结果

func ChangeAccBranch

func ChangeAccBranch(appid, bid string) error

修改账号所属部门信息

func ChangeBranchIndex

func ChangeBranchIndex(index int64, branchInfo Branch) error

更改部门index

func ChangeBranchName

func ChangeBranchName(bid, name string) error

修改部门名称

func ChangeEmployee

func ChangeEmployee(appid string, underEmployee []AccountInfo) error

删除||替换员工

func DelBranch

func DelBranch(bid string) error

删除部门

func DelRegistrationInfoByDateTime

func DelRegistrationInfoByDateTime(start, end int64) error

删除多余的注册申请记录

func DepositHistory

func DepositHistory(orderNum, toAddr, amount, txID string, currencyID int64, fromArry []string) error

记录充值记录

func DisableFlows

func DisableFlows() error

func DisuseFlow

func DisuseFlow(flowID string) error

作废审批流

func FlowHashExist

func FlowHashExist(hash string) (bool, error)

业务流哈希是否存在

func GenAccount

func GenAccount(accountInfo AccountInfo, is_uploaded int) error

生成账号

func GenBusinessFlow

func GenBusinessFlow(flowID, flowHash, flowName, flow, sign, singleLimit string, founderID int64, flowLimit []flowLimit, period string) (int, error)

生成审批流

func GetRegistrationByRegIDWithAcc

func GetRegistrationByRegIDWithAcc(regid string) (regInfoWithAcc, error)

账户对应的注册信息

func GetTxInfoByApprover

func GetTxInfoByApprover(appID string, transID int64) (int64, error)

获取员工待审批的转账信息

func GetTxProgress

func GetTxProgress(flowContent []Approvalinfo, transID int64) (int, error)

func InitManagerComments

func InitManagerComments(flowContent []Approvalinfo, transID int64, location Location) error

func InitTxAmount

func InitTxAmount(currencyID, frozenTo int64, flowID string, amount_left float64) error

初始化额度

func InvalidTx

func InvalidTx(flowid string) error

作废转账申请

func ModifyPwd

func ModifyPwd(appid, newpwd string) error

修改密码

func ReleaseAmount

func ReleaseAmount(period string, currencyID int64, flowID string, amount float64) error

释放转账额度

func ReplaceEmployee

func ReplaceEmployee(oAppid, dAppid string) error

替换员工

func ResetAttempts

func ResetAttempts(appid string) error

重置用户密码尝试次数

func ResetTxAmount

func ResetTxAmount(currencyID int64, flowID string, amount float64) error

重置额度

func TransferFailed

func TransferFailed(transID int64) error

转账失败

func UpdateAccountsPubkeyUploadInfo

func UpdateAccountsPubkeyUploadInfo(accInfos []AccountInfo) error

func UpdateCaptainApprovalInfo

func UpdateCaptainApprovalInfo(regid, consent string) error

记录上级审批记录结果

func UpdateFlowAmount

func UpdateFlowAmount(timestamp int64) error

更新审批流的额度信息

func UpdateFlowStatus

func UpdateFlowStatus(id string, status int) error

更新审批流上链状态

func UpdateFlowStatusByRPC

func UpdateFlowStatusByRPC() (bool, error)

func UpdateTxAmount

func UpdateTxAmount(currencyID int64, flowID string, new_amount_left float64, amountExp string) error

更新额度

func UpdateTxProgress

func UpdateTxProgress(transID, progress int64) error

更新订单进度

Types

type AccBriefInfo

type AccBriefInfo struct {
	ID          int64
	AppID       string
	Account     string
	Depth       int64
	EmployeeNum int64
	BranchID    int64
}

账号简要信息

func GetAccountsListByBid

func GetAccountsListByBid(bid string, lft, rgt int64) ([]AccBriefInfo, error)

type AccountInfo

type AccountInfo struct {
	RegID        string `json:"reg_id,omitempty"`
	Pubkey       string `json:"pub_key,omitempty"`
	EnPubkey     string `json:"msg,omitempty"`
	CipherText   string `json:"cipher_text,omitempty"`
	AccLft       int64  `json:"lft,omitempty"`
	AccRgt       int64  `json:"rgt,omitempty"`
	Uploaded     bool   `json:"is_uploaded,omitempty"`
	Departured   bool   `json:"departured,omitempty"`
	ManagerAppID string `json:"manager_account_id"`
	ID           int64  `json:"id,omitempty"`
	AppID        string `json:"app_account_id,omitempty"`
	Account      string `json:"account,omitempty"`
	Depth        int64  `json:"depth,omitempty"`
	EmployeeNum  int64  `json:"employee_num"`
	BranchID     int64
	BranchName   string

	Frozen   bool
	Attempts int
	FrozenTo int64
	// contains filtered or unexported fields
}

user ================================================================= 账户信息

func ChangeCipherInfo

func ChangeCipherInfo(employeeAccInfo []AccountInfo, cipherTexts []AccountInfo) []AccountInfo

更新摘要信息

func GetAccDetailByAppID

func GetAccDetailByAppID(appid string) (accountinfo AccountInfo, err error)

获取用户账号详情

func GetAccountInfoByAppID

func GetAccountInfoByAppID(appid string) (accountinfo AccountInfo, err error)

根据appID获取账号信息

func GetEmployeeEnPubKeyInfo

func GetEmployeeEnPubKeyInfo(appid string) (AccountInfo, error)

func GetEmployeeEnPubKeyInfoList

func GetEmployeeEnPubKeyInfoList(captainID string) ([]AccountInfo, error)

func GetRootAccountByUnderlingAcc

func GetRootAccountByUnderlingAcc(lft, rgt int64) (AccountInfo, error)

获取账号对应的根节点账号

func GetUnderlingInfoByManagerAccountID

func GetUnderlingInfoByManagerAccountID(depth, lft, rgt int64) ([]AccountInfo, error)

上级获取下属账号信息

type AmountLeftInfo

type AmountLeftInfo struct {
	FlowID     string
	CurrencyID int64
	Frozen     bool
	FrozenTo   int64
	AmountLeft string
	Period     int64
	Amount     string
}

func TransferLimitByCurrencyID

func TransferLimitByCurrencyID(currencyID int64, flowID string) (AmountLeftInfo, error)

查询转账额度

type Approvalinfo

type Approvalinfo struct {
	Require   int        `json:"require"`
	Approvers []Approver `json:"approvers"`
	Total     int64      `json:"total"`
}

type Approver

type Approver struct {
	ID       int64  `json:"id"`
	Account  string `json:"account"`
	ItemType int    `json:"itemType"`
	PubKey   string `json:"pub_key"`
	AppID    string `json:"app_account_id"`
	Progress int64  `json:"progress"`
	Sign     string `json:"sign"`
}

func GetTxApprovalInfoByAccID

func GetTxApprovalInfoByAccID(appid string, tx_id int64) (txSignInfo Approver, err error)

获取用户转账申请的审批信息

type Asset

type Asset struct {
	CurrencyName string `json:"currency"`
	Balance      string `json:"balance"`
}

获取资产列表

func GetAssets

func GetAssets(page, limit int64) (data []Asset, err error)

type Branch

type Branch struct {
	ID            int64
	Name          string
	Index         int64
	Employees     int64
	CreatedAt     string
	UpdatedAt     string
	EmployeesList []AccBriefInfo
}

部门

func GetBranchInfoByID

func GetBranchInfoByID(bid string) (Branch, error)

获取部门信息

func GetBranchList

func GetBranchList(accID, lft, rgt int64) ([]Branch, error)

获取部门列表

type CoinListInfo

type CoinListInfo struct {
	RspNo      string
	CoinStatus []CoinStatu
}

获取可用的代币列表

type CoinStatu

type CoinStatu struct {
	Name     string
	Category int64
	Decimals int64
	Used     bool
}

type CurrencyInfo

type CurrencyInfo struct {
	CurrencyID int64  `json:"currency_id"`
	Factor     string `json:"factor"`
	Currency   string `json:"currency"`
	Balance    string `json:"balance"`
	Addr       string `json:"address"`
	TokenAddr  string `json:"tokenAddr"`
}

币种信息

func GetCurrencyInfoByID

func GetCurrencyInfoByID(currencyID string) (currencyInfo CurrencyInfo, err error)

func GetCurrencyInfoByName

func GetCurrencyInfoByName(currency string) (currencyInfo CurrencyInfo, err error)

获取币种信息

func GetCurrencyList

func GetCurrencyList(keywords string) (result []CurrencyInfo, err error)

获取币种列表

type EmployeeList

type EmployeeList struct {
	PageCount
	List []AccountInfo `json:"list"`
}

api struct =================================================================

func GetEmployeeAccInfoByCaptainID

func GetEmployeeAccInfoByCaptainID(depth, c_lft, c_rgt, page, limit int64) (EmployeeList, error)

根据直属上级appid获取下属账号信息

func SearchAccountInfoByAccount

func SearchAccountInfoByAccount(keywords string, page, limit int64) (data EmployeeList, err error)

搜索获取下属员工账号列表

type FlowContent

type FlowContent struct {
	Name         string         `json:"flow_name"`
	SingleLimit  string         `json:"single_limit"`
	ApprovalInfo []Approvalinfo `json:"approval_info"`
}

type FlowInfo

type FlowInfo struct {
	ID           string         `json:"id"`
	FlowID       string         `json:"flow_id"`
	Hash         string         `json:"flow_hash"`
	Name         string         `json:"flow_name"`
	Progress     int64          `json:"progress"`
	FounderID    int64          `json:"founder_id"`
	ApprovalInfo []Approvalinfo `json:"approval_info"`
	SingleLimit  string         `json:"single_limit"`
	Period       string         `json:"period"`
	CreatedAt    string         `json:"created_at"`
	CreatedBy    string         `json:"createdBy"`
	UpdatedAt    string         `json:"updated_at"`
	ApprovalAt   string         `json:"approval_at"`
	FlowLimit    []flowLimit    `json:"flow_limit"`
	PendingTxNum int64          `json:"pending_tx_num"`
}

business ================================================================= 审批流信息

func GetBusinessFlowInfoByFlowID

func GetBusinessFlowInfoByFlowID(flowid string, paramType int64) (FlowInfo, error)

func GetFlowInfoByID

func GetFlowInfoByID(flowID string, mAccid int64) (FlowInfo, error)

根据根节点获取审批流内容

type FlowListInfo

type FlowListInfo struct {
	PageCount
	List []FlowInfo `json:"list"`
}

func GetFlowList

func GetFlowList(founderID, page, limit, statu int64, currencyName, currencyID string) (FlowListInfo, error)

func SearchFlowByName

func SearchFlowByName(keywords string, founderID, page, limit, statu int64, currencyName, currencyID string) (FlowListInfo, error)

type Location

type Location struct {
	Number  int
	Level   int
	Require int
}

func GetManagerLocation

func GetManagerLocation(flowContent []Approvalinfo, appID string) Location

获取审批者在审批流中的位置

type OpLog

type OpLog struct {
	Operator      string
	Progress      int
	Reason        string
	OpTime        int64
	FinalProgress int
}

func GetTxOperationHistoryByNum

func GetTxOperationHistoryByNum(transNum string) ([]OpLog, error)

获取指定转账申请的操作记录

type PageCount

type PageCount struct {
	Count       int64 `json:"count"`
	TotalPage   int64 `json:"total_pages"`
	CurrentPage int64 `json:"current_page"`
}

type RPCFlowInfo

type RPCFlowInfo struct {
	Hash      string
	Name      string
	AppId     string
	CaptainId string
	Flow      string
	Sign      string
	Status    string
}

type RegistrationInfo

type RegistrationInfo struct {
	ID               int64  `json:"id,omitempty"`
	RegID            string `json:"reg_id,omitempty"`
	Msg              string `json:"msg,omitempty"`
	ApplicantID      string `json:"applyer_id,omitempty"`
	CaptainID        string `json:"manager_id,omitempty"`
	ApplicantAccount string `json:"applyer_account,omitempty"`
	Consent          string `json:"consent,omitempty"`
	// contains filtered or unexported fields
}

注册信息

func GetRegistrationByRegID

func GetRegistrationByRegID(regid string, is_deleted int) (reginfo RegistrationInfo, err error)

根据registration_id获取注册申请

func Registration

func Registration(captain string) ([]RegistrationInfo, error)

获取注册申请

type TokenInfo

type TokenInfo struct {
	TokenName    string
	Decimals     int64
	ContractAddr string
	Category     int64
}

type TokenListInfo

type TokenListInfo struct {
	RspNo      int
	TokenInfos []TokenInfo
}

获取可用的代币列表

type TradeHistory

type TradeHistory struct {
	PageCount
	List []TradeInfo `json:"list"`
}

func GetTradeHistoryListByAppID

func GetTradeHistoryListByAppID(name string, id, page, limit int64) (TradeHistory, error)

获取交易记录

type TradeInfo

type TradeInfo struct {
	Amount     string `json:"amount"`
	Currency   string `json:"currency"`
	ApplyAt    int64  `json:"apply_at"`
	TradeType  int64  `json:"type"`
	CurrencyID int64  `json:"currency_id"`
	// contains filtered or unexported fields
}

func GetTransferInfoByWdHash

func GetTransferInfoByWdHash(wdhash string) (result TradeInfo, err error)

获取转账记录详情

type TransferContent

type TransferContent struct {
	TxInfo         string `json:"tx_info"`    // 申请理由
	ToAddr         string `json:"to_address"` // 目的地址
	Miner          string `json:"miner"`      // 矿工费
	Amount         string `json:"amount"`     // 转账金额
	Currency       string `json:"currency"`   // 币种
	ApplyTimestamp string `json:"timestamp"`  // 申请时间戳
}

转账内容

type TransferInfo

type TransferInfo struct {
	TxID int64 `json:"trans_id"`

	TxHash       string `json:"transfer_hash"`
	Applyer      string `json:"applyer"`
	ApplyerAppID string `json:"applyer_uid"`

	ApplyInfo    string           `json:"apply_info"`
	SingleLimit  string           `json:"single_limit"`
	ApprovalInfo []TxApprovalInfo `json:"approvaled_info"`
	CurrencyID   int64            `json:"currency_id"`
	Amount       string           `json:"amount"`
	FlowName     string           `json:"flow_name"`
	// contains filtered or unexported fields
}

转账信息

func GetTransferInfo

func GetTransferInfo(orderNum string, orderType int) (flow_id string, txInfo TransferInfo, err error)

type TransferRecordInfo

type TransferRecordInfo struct {
	PageCount
	List []TxRecordInfo `json:"list"`
}

func GetTransferRecordListByCaptainID

func GetTransferRecordListByCaptainID(accid, progress int64, page, limit string) (result TransferRecordInfo, err error)

根据审批者获取转账记录

func GetTransferRecordsListByApplyerID

func GetTransferRecordsListByApplyerID(accid, progress int64, page, limit string) (result TransferRecordInfo, err error)

根据申请者获取转账记录

type TxApprovalInfo

type TxApprovalInfo struct {
	Approvalinfo
	CurrentProgress int `json:"current_progress"`
}

func GetApprovalInfoByTxID

func GetApprovalInfoByTxID(flowInfo FlowInfo, txID int64) (approvalInfo []TxApprovalInfo, err error)

获取指定订单的审批详情

type TxRecordInfo

type TxRecordInfo struct {
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
	ApplyAt  int64  `json:"apply_at"`
	// contains filtered or unexported fields
}

capital ================================================================= 转账记录

type TxSignInfo

type TxSignInfo struct {
	AppID     string `json:"appid"`
	Signature string `json:"sign"`
}

获取各级人员审批信息

func GetTxApproversSign

func GetTxApproversSign(approvalInfo []Approvalinfo, transID int64) []TxSignInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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