utils

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: 23 Imported by: 0

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.

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

This section is empty.

Variables

View Source
var Client *http.Client

Functions

func AddFloat64

func AddFloat64(a, b float64) float64

a+b

func AddFlowToServer

func AddFlowToServer(flowName, appid, flow, sign, flowHash, captainID string) bool

向代理服务器申请创建审批流

func ApplyDisuseFlow

func ApplyDisuseFlow(param string) error

向代理服务器申请作废审批流

func ApplyTx

func ApplyTx(param string) error

向代理服务器发起转账申请

func BusinessFlowStatus

func BusinessFlowStatus(flowHash string) (status int, err error)

获取业务流结构上链状态

func CompareFloat64

func CompareFloat64(a, b float64) int

比较float64

func DefaultConfigDir

func DefaultConfigDir() string

func DivFloat64

func DivFloat64(a, b float64) float64

a/b

func EqualFloat64

func EqualFloat64(a, b float64) bool

if a=b

func GenHashStr

func GenHashStr(msg string) string

生成sha256哈希字符串

func GetJsonMap

func GetJsonMap(filename string) (map[string]string, error)

func GreaterThanFloat64

func GreaterThanFloat64(a, b float64) bool

if a>b

func HttpRequest

func HttpRequest(method, urls string, jsonStr string) (r []byte, err error)

发起https请求

func InitLogger

func InitLogger()

func LessThanFloat64

func LessThanFloat64(a, b float64) bool

if a<b

func MulFloat64

func MulFloat64(a, b float64) float64

a*b

func ReadJsonFile

func ReadJsonFile(ctx *gin.Context) map[string]string

func RegToServer

func RegToServer(regid, msg, applicantID, captainID, applicantAccount string, status int) (err error)

向代理服务器请求注册

func RetError

func RetError(ctx *gin.Context, code int, args ...interface{}) error

func SubFloat64

func SubFloat64(a, b float64) float64

a-b

func UnitConversion

func UnitConversion(amount float64, factor int64, base int64) (float64, error)

单位换算 amount/(10^factor)

func UnitReConversion

func UnitReConversion(amount float64, factor int64, base int64) (float64, error)

单位反换算 amount*(10^factor)

Types

type CoinStatu

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

type FlowOpLogInfo

type FlowOpLogInfo struct {
	ApplyerAccount string
	CaptainId      string
	Option         string
	Opinion        string
	CreateTime     string
}

审批流操作日志详情

type FlowStatus

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

type RPCRsp

type RPCRsp struct {
	RspNo string
}

type ResFlowOpLog

type ResFlowOpLog struct {
	RPCRsp
	HashOperates []FlowOpLogInfo
}

审批流操作日志

func GetFlowOperationLogFromRPC

func GetFlowOperationLogFromRPC(flow_hash string) (ResFlowOpLog, error)

type ResHashStatus

type ResHashStatus struct {
	RspNo        string
	Status       ServerStatus
	ApprovalInfo FlowStatus
}

查询审批流上链状态返回值结构

type ServerStatus

type ServerStatus struct {
	ServerStatus    int64
	Status          int64
	Total           int64
	HashCount       int64
	TokenCount      int64
	Address         string
	ContractAddress string
	BtcAddress      string
	CoinStatus      []CoinStatu
}

type TokenInfo

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

type VoucherStatus

type VoucherStatus struct {
	RPCRsp
	Status       ServerStatus
	ApprovalInfo FlowStatus
	CoinStatus   []CoinStatu
	TokenInfos   []TokenInfo
}

签名机状态

Jump to

Keyboard shortcuts

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