db

package
v0.0.0-...-7cf6ef0 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: 24 Imported by: 13

Documentation

Overview

Copyright 2018. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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. bolaxy.org 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 (
	ETH_LINK       = "https://etherscan.io/tx/"
	BTC_LINK       = "https://www.blockchain.com/btc/tx/"
	LTC_LINK       = "https://chainz.cryptoid.info/ltc/tx.dws?"
	AuthTypeZhPath = "./static/lang/auth/auth_zh.toml"
	AuthTypeEnPath = "./static/lang/auth/auth_en.toml"
)

blockchain explorer url

Variables

View Source
var AllMasterAddress map[string]string
View Source
var AsyncBlockChains = &AsyncBlockChain{}
View Source
var AuthMaps = make(map[string]map[string]interface{})
View Source
var BTCTransferCh = make(chan TransferSend, 10000)
View Source
var ConfigMap map[string]string
View Source
var ETHTransferCh = make(chan TransferSend, 20000)
View Source
var LTCTransferCh = make(chan TransferSend, 10000)
View Source
var MergeETHTransferCh = make(chan TransferSend, 1000)
View Source
var TemplateChains = TemplateChain{
	Lock:           new(sync.Mutex),
	TemplateChains: []Template{},
}
View Source
var USDT_PPID = ""

Functions

This section is empty.

Types

type AccDBService

type AccDBService struct {
}

func (*AccDBService) AccountByID

func (*AccDBService) AccountByID(acc_id int) (*Account, error)

AccountByID find account by id

func (*AccDBService) AccountByName

func (*AccDBService) AccountByName(name string) ([]Account, error)

AccountByName find account by account name

func (*AccDBService) AccoutIsFrozen

func (*AccDBService) AccoutIsFrozen(name string) (int, time.Time, error)

AccoutIsFrozen check account is forzen

func (*AccDBService) AddAccount

func (*AccDBService) AddAccount(account *Account) error

AddAccount add account info to db

func (*AccDBService) AddAdmin

func (*AccDBService) AddAdmin(accountID int) error

AddAdmin set account as admin

func (*AccDBService) DelAdmin

func (*AccDBService) DelAdmin(accountID int) error

DelAdmin remove admin

func (*AccDBService) DelayTaskNum

func (*AccDBService) DelayTaskNum() (task DelayTask)

DelayTaskNum count todos(other account to be verified)

func (*AccDBService) DisableAcc

func (*AccDBService) DisableAcc(accID int) error

DisableAcc disable account by id

func (*AccDBService) ExistAccount

func (*AccDBService) ExistAccount(name string) (*Account, error)

ExistAccount check if account is existed and return salt

func (*AccDBService) FindAccountByAppId

func (*AccDBService) FindAccountByAppId(appId string) (*Account, error)

FindAccountByAppId find account by app id

func (*AccDBService) FindAllUsers

func (*AccDBService) FindAllUsers() ([]Account, error)

FindAllUsers get all account and order by level

func (*AccDBService) GetAccountsByType

func (*AccDBService) GetAccountsByType(userType int) ([]Account, error)

GetAccountsByType get account info by user type 0: member, 1: admin, 2: owner

func (*AccDBService) GetAdminCount

func (*AccDBService) GetAdminCount() (count int, err error)

GetAdminCount get admin count

func (*AccDBService) GetAllUsers

func (*AccDBService) GetAllUsers() ([]Account, error)

GetAllUsers get all available accounts

func (*AccDBService) GetPubkeys

func (*AccDBService) GetPubkeys(name string) ([]Account, error)

GetPubkeys get public keys by name

func (*AccDBService) GetSalt

func (*AccDBService) GetSalt(name string) (string, string, error)

GetSalt get salt password

func (*AccDBService) GetUserByID

func (*AccDBService) GetUserByID(id int) ([]Account, error)

GetUserByID get user info by id

func (*AccDBService) IsOwner

func (*AccDBService) IsOwner(name string) (bool, error)

IsOwner check if user is owner by name

func (*AccDBService) Login

func (*AccDBService) Login(name string, pwd string) (bool, *Account, error)

Login check name and password and login

func (*AccDBService) ModifyPassword

func (*AccDBService) ModifyPassword(name, new_pwd string) error

ModifyPassword modify password

func (*AccDBService) RecordAttempts

func (*AccDBService) RecordAttempts(name string) (result int, frozentime time.Time)

RecordAttempts record incorrect password attempts

func (*AccDBService) ReplaceMsg

func (*AccDBService) ReplaceMsg(rep string, appId string) error

ReplaceMsg 替换 msg

func (*AccDBService) ResetAccount

func (*AccDBService) ResetAccount(appid string) (bool, error)

ResetAccount resume frozen account by app id

func (*AccDBService) ResetAttempts

func (*AccDBService) ResetAttempts(name string) error

ResetAttempts resume frozen account by name

func (*AccDBService) SavePubkeySign

func (*AccDBService) SavePubkeySign(account *Account) error

SavePubkeySign update msg(sign)

func (*AccDBService) SetUser

func (*AccDBService) SetUser(authID string, depID int, accID int, userType int) error

SetUser update user info (auth, user type, department)

func (*AccDBService) VerifyUser

func (*AccDBService) VerifyUser(account *Account, reg *Registration) bool

VerifyUser verify account and add user info to table account

type AccManageService

type AccManageService struct {
}

func (*AccManageService) AddChildAccount

func (*AccManageService) AddChildAccount(coinId, amount int, tag string, adds, deeps []string) int

AddChildAccount add sub-address by coin id, auto set tag for created addresses

func (*AccManageService) AddressList

func (*AccManageService) AddressList(id int, condition string, page, tp int) ([]AsCapital, string, error)

AddressList list of address info

func (*AccManageService) AddressTopTen

func (*AccManageService) AddressTopTen(id int) ([]AsCapital, string, error)

AddressTopTen statistical the 10 assets address

func (*AccManageService) ApplyForContract

func (*AccManageService) ApplyForContract() error

ApplyForContract When creating thetemplate flow for the first time, if there is no contract, you should apply to create contract from voucher.

func (*AccManageService) ChildStatistical

func (*AccManageService) ChildStatistical(id int) (int, int)

ChildStatistical Statistical sub-account information

func (*AccManageService) ContractAddr

func (*AccManageService) ContractAddr() (*output, error)

func (*AccManageService) CountAllChild

func (*AccManageService) CountAllChild(id int) (string, int, error)

CountAllChild Statistical sub-address number and assets of them

func (*AccManageService) FindAddressByAddress

func (*AccManageService) FindAddressByAddress(addr string, coinName string) bool

FindAddressByAddress get address detail info by address

func (*AccManageService) FindAddressByBTCAddress

func (*AccManageService) FindAddressByBTCAddress(addr []string, coinId int) ([]Address, bool)

FindAddressByBTCAddress get the BTC and LTC address info by address

func (*AccManageService) FindAddressById

func (*AccManageService) FindAddressById(id int) (*Address, error)

FindAddressById get the address info by address id

func (*AccManageService) GetMasterAddress

func (*AccManageService) GetMasterAddress() []Address

GetMasterAddress get the main address infos of all coin

func (*AccManageService) MainAccAssets

func (*AccManageService) MainAccAssets() (string, error)

MainAccAssets get the assets info of main address

func (*AccManageService) MergeAccount

func (*AccManageService) MergeAccount(coinId, mold int, ids []int) int

func (*AccManageService) SaveMasterAddress

func (*AccManageService) SaveMasterAddress(address *Address) bool

SaveMasterAddress save main address to db

func (*AccManageService) SetTag

func (*AccManageService) SetTag(id int, tag string) int64

SetTag set tag for address

func (*AccManageService) Statistical

func (*AccManageService) Statistical() []CoinAccount

Statistical Statistical account information

func (*AccManageService) TokenList

func (*AccManageService) TokenList(id int) ([]TokenBalance, error)

TokenList token info list

func (*AccManageService) TokenRecord

func (*AccManageService) TokenRecord(id, coinId int) ([]TrRecord, error)

func (*AccManageService) TransferRecord

func (*AccManageService) TransferRecord(id int) ([]TrRecord, error)

TransferRecord transfer order info, include deposit and withdraw

func (*AccManageService) UpdateBalance

func (*AccManageService) UpdateBalance(capital *Capital) bool

UpdateBalance update the balance by address

type Account

type Account struct {
	ID           int       `gorm:"AUTO_INCREMENT"`
	AppId        string    `gorm:"column:appId"`
	Name         string    `gorm:"column:name"`
	Pwd          string    `gorm:"column:pwd"`
	Salt         string    `gorm:"column:salt"`
	PubKey       string    `gorm:"column:pubKey"`
	IsDeleted    int       `gorm:"column:isDeleted"`
	Msg          string    `gorm:"column:msg"`
	DepartmentId int       `gorm:"column:departmentId"`
	UserType     int       `gorm:"column:userType"`
	Frozen       int       `gorm:"column:frozen"`
	Attempts     int       `gorm:"column:attempts"`
	FrozenTo     time.Time `gorm:"column:frozenTo"`
	SourceAppId  string    `gorm:"column:sourceAppId"`
	Level        int       `gorm:"column:level"`
	CreatedAt    time.Time `gorm:"column:createdAt"`
	UpdatedAt    time.Time `gorm:"column:updatedAt"`
}

account

func (Account) TableName

func (dep Account) TableName() string

type Address

type Address struct {
	ID        int
	Address   string
	Type      int
	CoinId    int `gorm:"column:coinId"`
	Tag       string
	TagIndex  int    `gorm:"column:tagIndex"`
	IsDeleted int    `gorm:"column:isDeleted"`
	CoinName  string `gorm:"column:coinName"`
	UsedBy    int    `gorm:"column:usedBy"`
	Deep      string `gorm:"column:deep"`
}

address

func (Address) TableName

func (addr Address) TableName() string

type AddressJson

type AddressJson struct {
	Address string
	Deep    []uint32
}

AddressJson represents the address of its deep info

type AddressSign

type AddressSign struct {
	CoinName      string `json:"coinName"`
	MasterAddress string `json:"masterAddress"`
	Sign          string `json:"sign"`
}

type AddressSigns

type AddressSigns struct {
	Account     string        `json:"account"`
	AddressInfo []AddressSign `json:"addressSign"`
}

type ApprovalInfo

type ApprovalInfo struct {
	Require   int         `json:"require"`
	Approvers []Approvers `json:"approvers"`
}

ApprovalInfo represents the approval info defined for a template

type Approvers

type Approvers struct {
	Account string `json:"account"`
	PubKey  string `json:"pubkey"`
}

Approvers represents approvers info of a template

type AsCapital

type AsCapital struct {
	ID       int    // address id
	Address  string // address
	Tag      string // address tag
	Balance  string // balance of the address
	Amount   int    // the number of address tags
	Type     int    // address type 0-master address 1-normal address 2-contract address
	TagIndex int    `gorm:"column:tagIndex"` // tag index
}

AsCapital represents the top 10 assets

type AsyncBlockChain

type AsyncBlockChain struct {
	List             []interface{}
	AggregatedStatus int
}

type Auth

type Auth struct {
	ID       int    `gorm:"AUTO_INCREMENT"`
	Name     string `gorm:"column:name"`
	AuthType string `gorm:"column:authType"`
}

auth

func (Auth) TableName

func (auth Auth) TableName() string

type AuthMap

type AuthMap struct {
	ID        int `gorm:"AUTO_INCREMENT"`
	AccountId int `gorm:"column:accountId"`
	AuthId    int `gorm:"column:authId"`
}

authmap

func (AuthMap) TableName

func (authMap AuthMap) TableName() string

type AuthService

type AuthService struct {
}

AuthService db

func (*AuthService) AddAuthToAccount

func (*AuthService) AddAuthToAccount(add []int, id int) int

AddAuthToAccount 账户添加权限

func (*AuthService) AuthCheck

func (*AuthService) AuthCheck(authType string, accountID int) error

AuthCheck 权限检查

func (*AuthService) DelAuthFromAccount

func (*AuthService) DelAuthFromAccount(authID int, accountID int) error

DelAuthFromAccount 移除账户权限

func (*AuthService) GetAuthAccounts

func (*AuthService) GetAuthAccounts(id int) ([]Account, error)

GetAuthAccounts 获取单个权限下成员列表

func (*AuthService) GetAuthAccountsCount

func (*AuthService) GetAuthAccountsCount(id int) int

GetAuthAccountsCount 获取指定权限下成员数

func (*AuthService) GetAuthByID

func (*AuthService) GetAuthByID(authID int) ([]Auth, error)

GetAuthByID 获取单个权限

func (*AuthService) GetAuthList

func (*AuthService) GetAuthList() ([]Auth, error)

GetAuthList 获取权限列表

func (*AuthService) GetAuthMapByAccID

func (*AuthService) GetAuthMapByAccID(accountID int) ([]AuthMap, error)

GetAuthMapByAccID 获取用户所有权限

type BalanceEntity

type BalanceEntity struct {
	CoinName     string `gorm:"column:coinName"`
	TokenAddress string `gorm:"column:tokenAddress"`
	Address      string `gorm:"column:address"`
	CapitalId    int    `gorm:"column:capitalId"`
	TokenType    int    `gorm:"column:tokenType"`
}

type BaseServer

type BaseServer struct {
	Tx *gorm.DB
}

type Capital

type Capital struct {
	ID        int
	AddressID int    `gorm:"column:addressId"`
	CoinName  string `gorm:"column:coinName"`
	Balance   string
	CoinId    int       `gorm:"column:coinId"`
	CreatedAt time.Time `gorm:"column:createdAt"`
	Address   string    `gorm:"column:address"`
}

capital

func (Capital) TableName

func (capital Capital) TableName() string

type Coin

type Coin struct {
	ID           int    `gorm:"AUTO_INCREMENT"`
	Name         string `gorm:"column:name"`
	FullName     string `gorm:"column:fullName"`
	Precise      int    `gorm:"column:precise"`
	Balance      string `gorm:"column:balance"`
	TokenType    int    `gorm:"column:tokenType"`
	TokenAddress string `gorm:"column:tokenAddress"`
	Available    int    `gorm:"column:available"`
}

coin

func (Coin) TableName

func (dep Coin) TableName() string

type CoinAccount

type CoinAccount struct {
	ID          int    // currency id
	Name        string // currency name
	Main        int    // number of main accounts
	Child       int    // number of sub accounts
	HasToken    bool   // whether it contains tokens
	HasMerge    bool   // whether it can be merged
	HasAddChild bool   // whether it can add sub accounts
}

CoinAccount represents the coin statistical data it is applicable to account and asset information corresponding to the statistical currency.

type CoinBalance

type CoinBalance struct {
	Name     string `gorm:"column:name"`
	Balance  string `gorm:"column:balance"`
	FullName string `gorm:"column:fullName"`
	Id       int
}

CoinBalance the struct of balance info by coin

type CoinService

type CoinService struct {
}

func (*CoinService) AddCoin

func (*CoinService) AddCoin(symbol, name string, precise int, tokenAddress string) error

AddCoin add noe token to this system

func (*CoinService) CoinBalance

func (*CoinService) CoinBalance() ([]CoinBalance, error)

CoinBalance get all master coin balance info

func (*CoinService) CoinIsExist

func (*CoinService) CoinIsExist(address, name string) (bool, error)

CoinIsExist check if the coin is existed by given token address and its name

func (*CoinService) CoinList

func (*CoinService) CoinList(typecoin int) ([]Coin, error)

CoinList get the coin list from db

func (*CoinService) CoinListByTransfer

func (*CoinService) CoinListByTransfer() ([]CoinVo, error)

CoinListByTransfer get coin info available

func (*CoinService) CoinStauts

func (*CoinService) CoinStauts(id, status int) (*Coin, error)

CoinStauts enable or disable the given coin

func (*CoinService) GetCoinById

func (*CoinService) GetCoinById(id int) (*Coin, error)

GetCoinById get coin info by id

func (*CoinService) GetCoins

func (*CoinService) GetCoins() ([]Coin, error)

GetCoins get all coins

func (*CoinService) GetETH

func (*CoinService) GetETH() (*Coin, error)

GetETH get eth info from db

func (*CoinService) QRcode

func (*CoinService) QRcode(id int) (map[string]string, error)

QRcode get the deposit address

type CoinVo

type CoinVo struct {
	ID           int
	Name         string `gorm:"column:name"`
	FullName     string `gorm:"column:fullName"`
	Precise      int    `gorm:"column:precise"`
	Balance      string `gorm:"column:balance"`
	TokenType    int    `gorm:"column:tokenType"`
	TokenAddress string `gorm:"column:tokenAddress"`
	Available    int    `gorm:"column:available"`
	Currency     string `gorm:"column:currency"`
}

CoinVo coins info of available coin

type Configs

type Configs struct {
	ID    int
	Key   string `gorm:"column:con_key"`
	Value string `gorm:"column:con_value"`
}

configs

func InitConfigs

func InitConfigs() []Configs

InitConfigs 获取配置

func (Configs) TableName

func (con Configs) TableName() string

type ConfigsService

type ConfigsService struct {
}

func (*ConfigsService) Configs

func (*ConfigsService) Configs() ([]Configs, error)

查询部门

type Content

type Content struct {
	Name string `json:"name"`
	Msg  string `json:"msg"`
}

Content represent content

type DelayTask

type DelayTask struct {
	Number int
	Reason string
}

type DelayTasks

type DelayTasks struct {
	Transfer DelayTask
	Account  DelayTask
	Template DelayTask
}

DelayTasks represents the struct of to-do task

type DepService

type DepService struct {
}

func (*DepService) AddDepartment

func (d *DepService) AddDepartment(depName string, creatorID int) error

AddDepartment add new department

func (*DepService) DelDepartment

func (*DepService) DelDepartment(id int) error

DelDepartment delete a existed department

func (*DepService) DepartmentList

func (*DepService) DepartmentList() ([]Department, error)

DepartmentList get the existed department list

func (*DepService) DepartmentNameExists

func (*DepService) DepartmentNameExists(departmentName string, id int) (bool, error)

DepartmentNameExists check if the department exists by given name and its id

func (*DepService) EditDepartment

func (*DepService) EditDepartment(dep *Department) error

EditDepartment edit a existed department

func (*DepService) GetAccountByDepartment

func (*DepService) GetAccountByDepartment(id int, authID int) ([]Account, []AuthMap, error)

GetAccountByDepartment get all the members belong to the given department

func (*DepService) GetDepAccCount

func (*DepService) GetDepAccCount(depID int) int

GetDepAccCount count the member of given department

func (*DepService) GetDepByID

func (*DepService) GetDepByID(id int) ([]Department, error)

GetDepByID get the department info by given account

func (*DepService) GetDepCount

func (*DepService) GetDepCount() int

GetDepCount count the existed department

func (*DepService) SortDep

func (d *DepService) SortDep(depID []string) error

SortDep sort the department order by app

type Department

type Department struct {
	ID           int
	Name         string
	CreatorAccId int `gorm:"column:creatorAccId"`
	Available    int
	Order        int       `gorm:"column:order"`
	CreatedAt    time.Time `gorm:"column:createdAt"`
	UpdatedAt    time.Time `gorm:"column:updatedAt"`
}

department

func (Department) TableName

func (dep Department) TableName() string

type Deposit

type Deposit struct {
	ID           string
	CoinId       int    `gorm:"column:coinId"`
	CoinName     string `gorm:"column:coinName"`
	FromAddr     string `gorm:"column:fromAddr"`
	ToAddr       string `gorm:"column:toAddr"`
	Amount       string
	TxId         string `gorm:"column:txId"`
	BlockNum     string `gorm:"column:blockNumber"`
	Confirm      int
	CreatedAt    time.Time `gorm:"column:createdAt"`
	IsUpdate     int       `gorm:"column:isUpdate"`
	TokenAddress string    `gorm:"column:tokenAddress"`
	Precise      int       `gorm:"column:precise"`
	UpdatedAt    time.Time `gorm:"column:updatedAt"`
}

deposit

func (Deposit) TableName

func (deposit Deposit) TableName() string

type DepositEntity

type DepositEntity struct {
	CoinName     string `gorm:"column:coinName"`
	TokenType    int    `gorm:"column:tokenType"`
	TokenAddress string `gorm:"column:tokenAddress"`
	ToAddr       string `gorm:"column:toAddr"`
	CoinId       int    `gorm:"column:coinId"`
	AddressId    int    `gorm:"column:addressId"`
	DepositId    string `gorm:"column:depositId"`
	Confirm      int    `gorm:"column:confirm"`
	Nowconfirm   int    `gorm:"column:nowconfirm"`
	ExtValid     int    `gorm:"column:ext_valid"`
	Deep         string `gorm:"column:deep"`
}

type EthBalance

type EthBalance struct {
	Balance string
	Address string
}

type LogService

type LogService struct {
}

LogService 操作日志 db

func (*LogService) AddLog

func (*LogService) AddLog(logger *Logger) error

AddLog 添加日志

func (*LogService) GetLogs

func (*LogService) GetLogs(logType string, limit int, offset int, pos string) ([]Logger, error)

GetLogs 获取日志

type Logger

type Logger struct {
	ID        int       `gorm:"AUTO_INCREMENT"`
	Detail    string    `gorm:"column:detail"`
	Note      string    `gorm:"column:note"`
	Operator  string    `gorm:"column:operator"`
	LogType   string    `gorm:"column:logType"`
	CreatedAt time.Time `gorm:"column:createdAt"`
	Pos       string    `gorm:"column:pos"`
}

func (Logger) TableName

func (logger Logger) TableName() string

type MergeAccount

type MergeAccount struct {
	ToAddr       string
	FromAddr     string `gorm:"column:fromAddr"`
	CoinName     string `gorm:"column:coinName"`
	Balance      string `gorm:"column:balance"`
	Deep         string `gorm:"column:deep"`
	TokenAddress string `gorm:"column:tokenAddress"`
}

合并账户--------------------

type Message

type Message struct {
	ID        int       `gorm:"AUTO_INCREMENT"`
	Title     string    `gorm:"column:title"`
	CreatedAt time.Time `gorm:"column:createdAt"`
	Content   string    `gorm:"column:content"`
	Padding   string    `gorm:"column:padding"`
	Receiver  string    `gorm:"column:receiver"`
	Reader    string    `gorm:"column:reader"`
	Type      int       `gorm:"column:type"`
	WarnType  int       `gorm:"column:warnType"`
	Param     string    `gorm:"column:param"`
}

func (Message) TableName

func (Message Message) TableName() string

type MessageService

type MessageService struct {
}

func (*MessageService) AddAdmin

func (*MessageService) AddAdmin(ids []int, accountId int) error

AddAdmin 添加管理员消息通知

func (*MessageService) AddAuth

func (*MessageService) AddAuth(add, authIds []int, userType int, operator string) (err error)

AddAuth 添加权限消息

func (*MessageService) AysncBlockChainStatus

func (*MessageService) AysncBlockChainStatus(types int) (err error)

func (*MessageService) CancelTemplate

func (*MessageService) CancelTemplate(opername, userAcc, name, id string) (err error)

CancelTemplate 作废审批流消息

func (*MessageService) CancelTransfer

func (*MessageService) CancelTransfer(ApplyerId int, CoinName, Amount, id string, isCalcelUser bool) (err error)

CancelTransfer 作废转账消息

func (*MessageService) ChangeNode

func (*MessageService) ChangeNode() (err error)

ChangeNode 切换节点

func (*MessageService) DelAdmin

func (*MessageService) DelAdmin(accountID, id int) (err error)

DelAdmin 取消管理员消息通知

func (*MessageService) DelAuth

func (*MessageService) DelAuth(authId, accountId, userType int, account string) (err error)

DelAuth 取消权限消息

func (*MessageService) FailVerifyTemp

func (*MessageService) FailVerifyTemp(opername, name, id string, creatorId int) (err error)

FailVerifyTemp 审批流 审批失败

func (*MessageService) FailVerifyTrans

func (*MessageService) FailVerifyTrans(CoinName, Amount, reason string, ApplyerId int, id string) (err error)

FailVerifyTrans 转账审批失败消息

func (*MessageService) GetMessageById

func (*MessageService) GetMessageById(id int) (Message, error)

GetMessageById get message info by id

func (*MessageService) LetterList

func (*MessageService) LetterList() (msgListAsc []Message, msgListDesc []Message, err error)

LetterList 站内信列表

func (*MessageService) ReadLetter

func (*MessageService) ReadLetter(id int, readers string) error

ReadLetter app read message

func (*MessageService) SuccessVerifyTemp

func (*MessageService) SuccessVerifyTemp(name, id string, creatorId int) (err error)

SuccessVerifyTemp 审批流 审批成功

func (*MessageService) SuccessVerifyTrans

func (*MessageService) SuccessVerifyTrans(CoinName, Amount string, ApplyerId int, id string) (err error)

SuccessVerifyTrans 转账审批成功消息

func (*MessageService) TransferApprovalTimeOut

func (*MessageService) TransferApprovalTimeOut(coinName, amount, transferId string, applyerId, warnType int) (err error)

func (*MessageService) TransferFail

func (*MessageService) TransferFail(coinName, amount, transferId string, applyerId, warnType int) (err error)

TransferFail 转账失败消息

func (*MessageService) TransferFailOutOfDate

func (*MessageService) TransferFailOutOfDate(coinName, amount, transferId string, applyerId, warnType int) (err error)

TransferFailOutOfDate 由于过期而转账失败消息

func (*MessageService) TransferPartialSuccessful

func (*MessageService) TransferPartialSuccessful(coinName, amount, orderId string, applyerId int) (err error)

TransferPartialSuccessful 部分转账成功

func (*MessageService) TransferSuccess

func (*MessageService) TransferSuccess(coinName, amount, orderId string, applyerId int) (err error)

TransferSuccess 转账成功消息

func (*MessageService) VoucherWarn

func (*MessageService) VoucherWarn(accountId, warnNum, pageType int, param_json string) (*Message, error)

VoucherWarn 签名机警告消息

type MessageTitle

type MessageTitle string

MessageTitle station letter

type OrderDetail

type OrderDetail struct {
	FullName        string    `gorm:"column:fullName"`
	CoinName        string    `gorm:"column:coinName"`
	ApplyerName     string    `gorm:"column:applyerName"`
	AppId           string    `gorm:"column:appId"`
	ApplyReason     string    `gorm:"column:applyReason"`
	Deadline        time.Time `gorm:"column:deadline"`
	CreatedAt       time.Time `gorm:"column:createdAt"`
	OrderAddress    []interface{}
	StrTemplate     string `gorm:"column:strtemplate"`
	Amount          string `gorm:"column:amount"`
	Status          int    `gorm:"column:status"`
	NowLevel        int    `gorm:"column:nowLevel"`
	Msg             string `gorm:"column:content"`
	ApprovalContent map[string]interface{}
	Template        TemplateContent
	OrderId         string `gorm:"column:orderId"`
	ApplySign       string `gorm:"column:applySign"`
}

type OwnerOper

type OwnerOper struct {
	ID        int       `gorm:"column:id"`
	Account   string    `gorm:"column:account"`
	OpAccount string    `gorm:"column:operatedAccount"`
	Status    int       `gorm:"column:status"`
	OpAppId   string    `gorm:"column:operatedAppid"`
	RegId     int       `gorm:"column:regId"`
	UpdatedAt time.Time `gorm:"column:updatedAt"`
}

func (OwnerOper) TableName

func (owner OwnerOper) TableName() string

type OwnerReg

type OwnerReg struct {
	ID           int       `gorm:"AUTO_INCREMENT"`
	Name         string    `gorm:"column:name"`
	Pwd          string    `gorm:"column:pwd"`
	Salt         string    `gorm:"column:salt"`
	AppId        string    `gorm:"column:appId"`
	PubKey       string    `gorm:"column:pubKey"`
	Status       int       `gorm:"column:status"`
	CreatedAt    time.Time `gorm:"column:createdAt"`
	UpdatedAt    time.Time `gorm:"column:updatedAt"`
	RefuseReason string    `gorm:"column:refuseReason"`
	Msg          string    `gorm:"column:msg"`
}

func (OwnerReg) TableName

func (ownerReg OwnerReg) TableName() string

type RegDBService

type RegDBService struct {
}

func (*RegDBService) ActiveRecovery

func (*RegDBService) ActiveRecovery(name string, regID int) error

ActiveRecovery 激活股东

func (*RegDBService) AddReg

func (*RegDBService) AddReg(ownerReg *OwnerReg) (int, error)

AddReg 添加恢复股东注册信息

func (*RegDBService) AddUser

func (*RegDBService) AddUser(reg *Registration) error

AddUser add new user account

func (*RegDBService) AppIdExists

func (*RegDBService) AppIdExists(appId string) (bool, error)

AppIdExists check if account existed by appid

func (*RegDBService) CancelRecovery

func (*RegDBService) CancelRecovery(account string) error

CancelRecovery 取消之前的申请

func (*RegDBService) CheckRecovStatus

func (*RegDBService) CheckRecovStatus(appID string) (int, error)

CheckRecovStatus 查看恢复账号审批状态

func (*RegDBService) DuplicateName

func (*RegDBService) DuplicateName(account string) (bool, error)

Duplicate 判断注册用户名是否重复

func (*RegDBService) EditUser

func (*RegDBService) EditUser(reg *Registration) error

EditUser edit a user account

func (*RegDBService) FindUserByAppId

func (*RegDBService) FindUserByAppId(appId string) (*Registration, error)

FindUserByAppId 通过appid查询注册状态

func (*RegDBService) GetRegList

func (*RegDBService) GetRegList() ([]Registration, error)

GetRegList 获取扫码后注册用户列表

func (*RegDBService) HasRecovery

func (*RegDBService) HasRecovery(account string) (int, error)

HasRecovery 是否有进行中的恢复申请

func (*RegDBService) NameExists

func (*RegDBService) NameExists(name string) (bool, error)

NameExists check if account existed by name

func (*RegDBService) OperateStatus

func (*RegDBService) OperateStatus(account string, regID int) (int, error)

OperateStatus 当前股东审批状态

func (*RegDBService) ReSignUp

func (*RegDBService) ReSignUp(appID string) error

ReSignUp 重新注册用户(删除注册表中数据)

func (*RegDBService) RecoveryList

func (*RegDBService) RecoveryList() ([]OwnerReg, error)

RecoveryList 获取待恢复股东列表

func (*RegDBService) RecoveryResult

func (*RegDBService) RecoveryResult(regID int, appID string) ([]OwnerOper, error)

RecoveryResult 获取恢复股东认证结果

func (*RegDBService) RegList

func (*RegDBService) RegList(reg *Registration) ([]Registration, error)

RegList 查询注册列表

func (*RegDBService) RegStatus

func (*RegDBService) RegStatus(regID int) (int, string, error)

RegStatus 审批状态

func (*RegDBService) ResetRecovery

func (*RegDBService) ResetRecovery(account string) error

ResetRecovery 重新注册恢复股东账户(状态为0的删除数据,其余不修改)

func (*RegDBService) Sign

func (*RegDBService) Sign(reg *Registration) error

Sign 登陆

func (*RegDBService) SubRecovery

func (*RegDBService) SubRecovery(appID string, acc string, regID int) error

SubRecovery 提交确认信息 (关系表初始化数据)

func (*RegDBService) UpdateMsg

func (*RegDBService) UpdateMsg(msg string, regID int) error

UpdateMsg update owner message

func (*RegDBService) UpdateRecoveryStatus

func (*RegDBService) UpdateRecoveryStatus(regID int) error

UpdateRecoveryStatus 更新恢复股东申请状态

func (*RegDBService) VerifyRecovery

func (*RegDBService) VerifyRecovery(account string, status int, regID int, voucherStatus int) error

VerifyRecovery 认证股东

type Registration

type Registration struct {
	ID            int       `gorm:"AUTO_INCREMENT"`
	Name          string    `gorm:"column:name"`
	Pwd           string    `gorm:"column:pwd"`
	Salt          string    `gorm:"column:salt"`
	SourceAppId   string    `gorm:"column:sourceAppId"`
	SourceAccount string    `gorm:"column:sourceAccount"`
	AppId         string    `gorm:"column:appId"`
	PubKey        string    `gorm:"column:pubKey"`
	Status        int       `gorm:"column:status"`
	Msg           string    `gorm:"column:msg"`
	CreatedAt     time.Time `gorm:"column:createdAt"`
	UpdatedAt     time.Time `gorm:"column:updatedAt"`
	RefuseReason  string    `gorm:"column:refuseReason"`
	Level         int       `gorm:"column:level"`
}

registration

func (Registration) TableName

func (dep Registration) TableName() string

type Replaced

type Replaced struct {
	Data []Content `json:"data"`
}

Replaced include

type TempList

type TempList struct {
	Id          string
	Name        string
	Hash        string
	Status      int
	ReferAmount string `gorm:"column:referAmount"`
	AmountLimit string `gorm:"column:amountLimit"`
}

type Template

type Template struct {
	ID        string `gorm:"column:id"`
	Hash      string
	Name      string
	CreatorID int `gorm:"column:creatorId"`
	Content   string
	Status    int
	Period    int
	CreatedAt time.Time `gorm:"column:createdAt"`
	UpdatedAt time.Time `gorm:"column:updatedAt"`
}

template

func (Template) TableName

func (template Template) TableName() string

type TemplateChain

type TemplateChain struct {
	Lock           *sync.Mutex
	TemplateChains []Template
}

func (*TemplateChain) DelTemplateChain

func (this *TemplateChain) DelTemplateChain()

删除第一个元素

func (*TemplateChain) GetTemplateChain

func (this *TemplateChain) GetTemplateChain() []Template

func (*TemplateChain) SetTemplateChain

func (this *TemplateChain) SetTemplateChain(tem Template)

type TemplateContent

type TemplateContent struct {
	Name         string          `json:"name"`
	Period       int             `json:"period"`
	ApprovalInfo []ApprovalInfo  `json:"approvalInfo"`
	LimitInfo    []TemplateLimit `json:"limitInfo"`
}

TemplateContent represents the template content struct

type TemplateDBService

type TemplateDBService struct {
}

func (*TemplateDBService) CancelTemplateAdnTxByIDs

func (*TemplateDBService) CancelTemplateAdnTxByIDs(hashs []string, template_statu int) ([]string, error)

CancelTemplateAdnTxByIDs 根据ID批量作废审批流模板

func (*TemplateDBService) CountTxByTempID

func (*TemplateDBService) CountTxByTempID(tempID string) (int, error)

CountTxByTempID 根据审批流统计转账

func (*TemplateDBService) Create

func (*TemplateDBService) Create(tc *TemplateContent, content string, creatorID int) (string, error)

Create create a new template

func (*TemplateDBService) DelayTaskNum

func (*TemplateDBService) DelayTaskNum(approverID int) (task DelayTask)

DelayTaskNum 统计待审批数量

func (*TemplateDBService) DisableTemplate

func (*TemplateDBService) DisableTemplate(tIds, tHashs []string) ([]string, error)

DisableTemplate disable template by given ids

func (*TemplateDBService) FindTemByHashs

func (*TemplateDBService) FindTemByHashs(hash []string) ([]Template, error)

FindTemByHashs 根据hash查询审批

func (*TemplateDBService) FindTemById

func (*TemplateDBService) FindTemById(tem *Template, accountId int) (*TemplateVos, error)

FindTemById 根据id查询审批

func (*TemplateDBService) FindTemlateById

func (*TemplateDBService) FindTemlateById(template *Template) error

FindTemlateById grep template by id

func (*TemplateDBService) FindTemplateByHash

func (*TemplateDBService) FindTemplateByHash(tem *Template) (*Template, bool)

FindTemplateByHash 根据temid查询审批

func (*TemplateDBService) FindTemplateById

func (*TemplateDBService) FindTemplateById(tem *Template) (*Template, error)

FindTemplateById 根据id查询审批

func (*TemplateDBService) FindTemplateByOrderId

func (*TemplateDBService) FindTemplateByOrderId(orderId string) (*Template, bool)

FindTemplateByOrderId 根据orderid查询审批

func (*TemplateDBService) FindTemplateView

func (*TemplateDBService) FindTemplateView(tem *TemplateView) (*TemplateView, bool)

FindTemplateView 根据temid 和 coinid查询审批额度

func (*TemplateDBService) IntermediateStateHashList

func (*TemplateDBService) IntermediateStateHashList() ([]Template, error)

IntermediateStateHashList 获取中间状态的审批流模板列表

func (*TemplateDBService) NameExists

func (*TemplateDBService) NameExists(name string) (bool, error)

NameExists check if the template name exists

func (*TemplateDBService) TempStatistics

func (*TemplateDBService) TempStatistics(account string) (int, int, error)

TempStatistics 审批流统计

func (*TemplateDBService) TemplateList

func (*TemplateDBService) TemplateList(types int, userType int, accountId int) ([]TempList, error)

TemplateList 审批流列表 types :0.全部 1.等待审批

func (*TemplateDBService) TemplateListToUpload

func (*TemplateDBService) TemplateListToUpload() ([]Template, error)

获取待上链的审批流模板

func (*TemplateDBService) TemplateListTransfer

func (*TemplateDBService) TemplateListTransfer(coinId int) ([]TempList, error)

TemplateListTransfer 审批流列表--转账专用

func (*TemplateDBService) TemplistListAvailableByApprover

func (*TemplateDBService) TemplistListAvailableByApprover(approver string) ([]Template, error)

TemplistListAvailable 可用的审批流模板列表

func (*TemplateDBService) UpdateTemplateLimit

func (*TemplateDBService) UpdateTemplateLimit()

UpdateTemplateLimit 通过截止时间更新币种额度

func (*TemplateDBService) UpdateTemplateStatus

func (*TemplateDBService) UpdateTemplateStatus(hash string, status int) error

UpdateTemplateStatus 更新审批流模板状态

type TemplateLimit

type TemplateLimit struct {
	TokenAddress string `json:"tokenAddress"`
	Symbol       string `json:"symbol"`
	FullName     string `json:"name"`
	Decimal      int    `json:"precise"`
	Limit        string `json:"limit"`
}

TemplateLimit represents the transfer limit amount information for every coin of the template

type TemplateOper

type TemplateOper struct {
	ID         string    `gorm:"column:id"`
	TemplateId string    `gorm:"column:templateId"`
	AccountId  int       `gorm:"column:accountId"`
	Status     int       `gorm:"column:status"`
	CreatedAt  time.Time `gorm:"column:createdAt"`
	AppId      string    `gorm:"column:appId"`
	AppName    string    `gorm:"column:appName"`
	Sign       string    `gorm:"column:sign"`
	Reason     string    `gorm:"column:reason"`
}

templateOper

func (TemplateOper) TableName

func (templateOper TemplateOper) TableName() string

type TemplateOperDBService

type TemplateOperDBService struct {
}

func (*TemplateOperDBService) FindTemOperById

func (*TemplateOperDBService) FindTemOperById(TemplateId string) []TemplateOper

FindTemOperById 通过模板id查询所有股东的操作

func (*TemplateOperDBService) TemApprovalInfoByAccId

func (*TemplateOperDBService) TemApprovalInfoByAccId(templateID string, accID int) (*TemplateOper, error)

TemApprovalInfoByAccId 是否重复提交审批模板意见

func (*TemplateOperDBService) VerifyTem

func (*TemplateOperDBService) VerifyTem(template *Template, templateOper *TemplateOper) bool

VerifyTem 审核模板

type TemplateView

type TemplateView struct {
	TemplateId  string `gorm:"column:templateId"`
	CoinId      int    `gorm:"column:coinId"`
	ReferAmount string `gorm:"column:referAmount"`
	AmountLimit string `gorm:"column:amountLimit"`
	Referspan   int
	FrozenTo    time.Time `gorm:"column:frozenTo"`
}

templateView

func (TemplateView) TableName

func (tv TemplateView) TableName() string

type TemplateVos

type TemplateVos struct {
	ID            string
	Hash          string
	Name          string
	CreatorID     int
	Content       string
	Status        int
	Period        int
	CreatedAt     time.Time
	UpdatedAt     time.Time
	ApproveStatus int
}

template

type TokenBalance

type TokenBalance struct {
	CoinName string `gorm:"column:coinName"` // coin name
	CoinId   int    `gorm:"column:coinId"`   // coin id in sql
	Balance  string `gorm:"column:balance"`  // balance of the coin
}

TokenBalance represents the struct of the balance of tokens

type TrRecord

type TrRecord struct {
	ApplyReason string `gorm:"column:applyReason"` // reason to apply this transfer
	Status      int    `gorm:"column:status"`      // status of this record 0-Approval 1-Approved 2-Reject 3-Transfer pending 4-Transfer failed
	// 5.Transfer success 6-Cancel 7-Invalid 8-Approval Expired 9-Transfer Expired 10-Disable User
	// 11-Disable template 12-Insufficient balance 100-Deposit success
	Amount    string    `gorm:"column:amount"`    // transfer amount
	CreatedAt time.Time `gorm:"column:createdAt"` // Order creation time
	Precise   int       `gorm:"column:precise"`   // Coin accuracy
	Type      int       // data type 0-deposit 1-transfer
	Link      string    //  transfer id info on blockchain explorer
	TxID      string    `gorm:"column:txId"` // transfer id on blockchain
}

TrRecord represents the struct of transfer record info

type Transfer

type Transfer struct {
	ID          string
	CoinName    string `gorm:"column:coinName"`
	Amount      string
	Status      int
	TxId        string `gorm:"column:txId"`
	ToAddr      string `gorm:"column:toAddress"`
	FromAddr    string `gorm:"column:fromAddress"`
	Accepted    int
	OrderId     string `gorm:"column:orderId"`
	Tag         string
	CreatedAt   time.Time `gorm:"column:createdAt"`
	UpdatedAt   time.Time `gorm:"column:updatedAt"`
	ApplyReason string    `gorm:"column:applyReason"`
	AmountIndex int       `gorm:"column:amountIndex"`
	Types       int       `gorm:"column:types"`
	Msg         string    `gorm:"column:msg"`
	FromAddress string    `gorm:"column:fromAddress"`
}

transfer

func (Transfer) TableName

func (tx Transfer) TableName() string

type TransferDBService

type TransferDBService struct {
}

func (*TransferDBService) Apply

func (*TransferDBService) Apply(order *TransferOrder, transfers []*Transfer, approvers []*TransferReview, temView *TemplateView) bool

Apply 申请转账

func (*TransferDBService) BatchList

func (*TransferDBService) BatchList(orderIds []string, account string) ([]TransferOrder, error)

func (*TransferDBService) Cancel

func (*TransferDBService) Cancel(order *TransferOrder) bool

Cancel

func (*TransferDBService) CreateWebTransfer

func (*TransferDBService) CreateWebTransfer(transfers *WebTransfers) error

CreateWebTransfer

func (*TransferDBService) DelayTaskNum

func (*TransferDBService) DelayTaskNum(account string) (task DelayTask)

DelayTaskNum 统计待审批数量和最新的待审批

func (*TransferDBService) FindAllApprove

func (*TransferDBService) FindAllApprove(orderIds []string) ([]TransferReview, error)

FindAllApprove 获取所有待审批审批人

func (*TransferDBService) FindAllApproveByOrderId

func (*TransferDBService) FindAllApproveByOrderId(orderId string) ([]*TransferReview, error)

FindAllApproveByOrderId 通过orderid查询所有层所有审批人

func (*TransferDBService) FindApply

func (*TransferDBService) FindApply(orderIds string) (*TransferOrder, error)

FindApply 通过id查找转账订单

func (*TransferDBService) FindApplyList

func (*TransferDBService) FindApplyList(types, applyId int, account string) ([]bachInfo, error)

FindApplyList 获取转账列表 1.全部 2.发起的 3.参与的 4.批量

func (*TransferDBService) FindApplyLog

func (*TransferDBService) FindApplyLog(orderId string) ([]TransferReview, error)

FindApplyLog 查询转账log

func (*TransferDBService) FindApproveByOrderId

func (*TransferDBService) FindApproveByOrderId(tran *TransferOrder) ([]*TransferReview, error)

FindApproveByOrderId 通过orderid查询该层所有审批人 tran.NowLevel:

0 所有  其他第几层

func (*TransferDBService) FindOrderById

func (*TransferDBService) FindOrderById(orderId string) (*TransferOrder, error)

FindOrderById 通过id查找订单

func (*TransferDBService) FindWebTransfer

func (*TransferDBService) FindWebTransfer(transfers *WebTransfers) error

func (*TransferDBService) Findapplybyid

func (*TransferDBService) Findapplybyid(id string) (*OrderDetail, error)

Findapplybyid 转账申请明细

func (*TransferDBService) GetApprovalStatus

func (*TransferDBService) GetApprovalStatus(id, account string) int

GetApprovalStatus 查询审批人的审批状态

func (*TransferDBService) GetBalanceStatus

func (*TransferDBService) GetBalanceStatus() []TransferOrder

GetBalanceStatus 获取应该更新余额的转账

func (*TransferDBService) GetFirstOrder

func (*TransferDBService) GetFirstOrder() *TransferOrder

GetFirstOrder 获取一条不是最终状态的订单

func (*TransferDBService) GetTemHashByOrderId

func (*TransferDBService) GetTemHashByOrderId(id string) (string, error)

GetTemHashByOrderId 获取模版hash

func (*TransferDBService) GetTransferByOrderId

func (*TransferDBService) GetTransferByOrderId(orderId string) []Transfer

GetTransferByOrderId 获取一个订单里的所有转账列表

func (*TransferDBService) RecoverAmount

func (*TransferDBService) RecoverAmount(order *TransferOrder) error

RecoverAmount 恢复额度

func (*TransferDBService) UpdateBalanceStatus

func (*TransferDBService) UpdateBalanceStatus(id string) bool

UpdateBalanceStatus 更新转账余额

func (*TransferDBService) UpdateOrder

func (*TransferDBService) UpdateOrder(orderId string, status int)

UpdateOrder

func (*TransferDBService) UpdateOrderExpire

func (*TransferDBService) UpdateOrderExpire(transfer *Transfer)

UpdateOrderExpire 更新

func (*TransferDBService) UpdateOrderStatus

func (*TransferDBService) UpdateOrderStatus(orderId string, status int)

UpdateOrderStatus 更新订单

func (*TransferDBService) UpdateTimeExpire

func (*TransferDBService) UpdateTimeExpire() error

func (*TransferDBService) UpdateTransfer

func (*TransferDBService) UpdateTransfer(transfer *Transfer) bool

转账更新 timer专用

func (*TransferDBService) UpdateWebTransfer

func (*TransferDBService) UpdateWebTransfer(transfers *WebTransfers) error

func (*TransferDBService) Verify

func (*TransferDBService) Verify(order *TransferOrder, transfer *Transfer, transferReview *TransferReview, approvers []*TransferReview, isOver bool) bool

Verify verify transfer params :

order :  更新订单状态  (可选)
transfer :  更新转账列表的状态	(可选)
transferReview :  更新审批人的操作	(必选)
approvers  :如果当前操作的人是该层的最后一个审批人,且还有下一层,则将下一层的审批人插入数据库 (可选)
isOver :如果当前操作是最终操作,需要把其他没操作的审批人状态更新为不可用 (必选)

func (*TransferDBService) VerifyFailed

func (*TransferDBService) VerifyFailed(order *TransferOrder) bool

VerifyFailed 审批验证签名失败

type TransferOrder

type TransferOrder struct {
	ID            string         `gorm:"column:id"`
	CoinName      string         `gorm:"column:coinName"`
	Hash          string         `gorm:"column:hash"`
	ApplyReason   string         `gorm:"column:applyReason"`
	Deadline      sql.NullString `gorm:"column:deadline"`
	Miner         string         `gorm:"column:miner"`
	Sign          string         `gorm:"column:sign"`
	CreatedAt     time.Time      `gorm:"column:createdAt"`
	UpdatedAt     time.Time      `gorm:"column:updatedAt"`
	Status        int            `gorm:"column:status"`
	Content       string         `gorm:"column:content"`
	ApplyerId     int            `gorm:"column:applyerId"`
	Amount        string         `gorm:"column:amount"`
	NowLevel      int            `gorm:"column:nowLevel"`
	ApproversSign string         `gorm:"column:approversSign"`
}

transferOrder

func (TransferOrder) TableName

func (to TransferOrder) TableName() string

type TransferReview

type TransferReview struct {
	ID          int
	OrderNum    string `gorm:"column:orderNum"`
	Status      int
	Encode      string
	Reason      string
	UpdatedAt   time.Time `gorm:"column:updatedAt"`
	AccountName string    `gorm:"column:accountName"`
	Level       int       `gorm:"column:level"`
}

transferReview

func (TransferReview) TableName

func (tf TransferReview) TableName() string

type TransferSend

type TransferSend struct {
	TransferId     string `gorm:"column:transferId"`
	CoinName       string `gorm:"column:coinName"`
	TransferMsg    string `gorm:"column:transferMsg"`
	ApplyAccount   string `gorm:"column:applyAccount"`
	ApplyerId      int    `gorm:"column:applyerId"`
	ApplyPublickey string `gorm:"column:applyPublickey"`
	ApplySign      string `gorm:"column:applySign"`
	ApproversSign  string `gorm:"column:approversSign"`
	Miner          string `gorm:"column:miner"`
	Amount         string `gorm:"column:amount"`
	ToAddress      string `gorm:"column:toAddress"`
	AmountIndex    int    `gorm:"column:amountIndex"`
	AddressMsg     string `gorm:"column:addressMsg"`
	Types          int    `gorm:"column:types"` //  1.外部转账 2。内部转账
	TokenAddress   string `gorm:"column:tokenAddress"`
	Deadline       string `gorm:"column:deadline"`
	Status         int    `gorm:"column:status"`
	OrderId        string `gorm:"column:orderId"`
	Currency       string `gorm:"column:currency"` //属于哪个主链币
	TemInfo        string `gorm:"column:temInfo"`
}

type TxApply

type TxApply struct {
	Amount       string `json:"amount"`
	CoinName     string `json:"coinName"`
	Info         string `json:"info"`
	Miner        string `json:"miner"`
	Destination  string `json:"destination"`
	Timestamp    int64  `json:"timestamp"`
	TemplateHash string `json:"templateHash"`
}

TxApply represents the struct of transfer apply content

type TxInfos

type TxInfos struct {
	Txid     string `gorm:"column:txId"`
	Confirm  int    `gorm:"column:confirm"`
	Token    string `gorm:"column:token"`
	Type     int    `gorm:"column:type"`
	Height   int    `gorm:"column:height"`
	Fee      string `gorm:"column:fee"`
	TxObj    string `gorm:"column:tx_obj"`
	ExtValid int    `gorm:"column:ext_valid"`

	CreateAt   time.Time `gorm:"column:created_at"`
	UpdatedAt  time.Time `gorm:"column:updated_at"`
	DeleteddAt time.Time `gorm:"column:deletedd_at"`
}

func (TxInfos) TableName

func (txInfos TxInfos) TableName() string

type Txinfos

type Txinfos struct {
	Address   string `gorm:"column:address"`
	AddressId int    `gorm:"column:addressId"`
	CoinId    int    `gorm:"column:coinId"`
	CoinName  string `gorm:"column:coinName"`
}

type TxinfosService

type TxinfosService struct {
}

func (*TxinfosService) FindCoin

func (*TxinfosService) FindCoin(coinName string, tokenAddress string) (*Coin, int)

FindCoin 查询币种

0.没有记录 1.查询失败 2.有结果

func (*TxinfosService) FindDeposit

func (*TxinfosService) FindDeposit() []DepositEntity

FindDeposit 充值列表

func (*TxinfosService) FindTokenAddress

func (*TxinfosService) FindTokenAddress(token string) []Txinfos

FindTokenAddress 添加币种专用, 更新代币余额

func (*TxinfosService) FindTxinfos

func (*TxinfosService) FindTxinfos() []TxInfos

FindTxinfos

func (*TxinfosService) GetBalanceList

func (*TxinfosService) GetBalanceList() []BalanceEntity

GetBalanceList 应该获取的余额列表

func (*TxinfosService) SaveDeposit

func (*TxinfosService) SaveDeposit(deposit *Deposit)

SaveDeposit 充值

func (*TxinfosService) SumBalance

func (*TxinfosService) SumBalance() error

func (*TxinfosService) UpadateConfigs

func (*TxinfosService) UpadateConfigs(key string, value string) error

UpadateConfigs 更新

func (*TxinfosService) UpdateBalance

func (*TxinfosService) UpdateBalance(capital *Capital)

UpdateBalance 更新余额

func (*TxinfosService) UpdateBalances

func (*TxinfosService) UpdateBalances(coinName string, address string, balance string)

UpdateBalance 更新余额

func (*TxinfosService) UpdateDeposit

func (*TxinfosService) UpdateDeposit(deposit *Deposit)

UpdateDeposit 充值更新

func (*TxinfosService) UpdateDeposits

func (*TxinfosService) UpdateDeposits(coin *Coin)

UpdateDeposits 更新充值 --添加代币时专用

func (*TxinfosService) UpdateTokenBalance

func (*TxinfosService) UpdateTokenBalance(maps map[string]string, token string)

UpdateTokenBalance 更新代笔余额

type WebTransfers

type WebTransfers struct {
	ID          int
	TransferId  string `gorm:"column:transferId"`
	Msg         string `gorm:"column:msg"`
	CreatedTime int64  `gorm:"column:createdTime"`
}

func (WebTransfers) TableName

func (webTransfers WebTransfers) TableName() string

Jump to

Keyboard shortcuts

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