當前位置: 首頁>>代碼示例>>Golang>>正文


Golang utils.TypeInt函數代碼示例

本文整理匯總了Golang中github.com/c-darwin/dcoin-go/packages/utils.TypeInt函數的典型用法代碼示例。如果您正苦於以下問題:Golang TypeInt函數的具體用法?Golang TypeInt怎麽用?Golang TypeInt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了TypeInt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewPct"
	txTime := "1599278817"
	userId := []byte("2")
	var blockId int64 = 140015
	//data:=`{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"},"72":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"}},"referral":{"first":10,"second":0,"third":0}}`
	data := `{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000435602"},"72":{"miner_pct":"0.0000000760368","user_pct":"0.0000000562834"}},"referral":{"first":30,"second":20,"third":5}}`

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(data))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, data)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}

}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:32,代碼來源:new_pct_front.go

示例2: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeHost"
	txTime := "1399278817"
	userId := []byte("2")
	var blockId int64 = 1415
	host := "http://fdfdfd.ru/"

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(host))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, host)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:30,代碼來源:change_host_front.go

示例3: VotesExchange

func (c *Controller) VotesExchange() (string, error) {

	txType := "VotesExchange"
	txTypeId := utils.TypeInt(txType)
	timeNow := time.Now().Unix()

	eOwner := utils.StrToInt64(c.Parameters["e_owner_id"])
	result := utils.StrToInt64(c.Parameters["result"])

	signData := fmt.Sprintf("%d,%d,%d,%d,%d", txTypeId, timeNow, c.SessUserId, eOwner, result)
	if eOwner == 0 {
		signData = ""
	}
	TemplateStr, err := makeTemplate("votes_exchange", "votesExchange", &VotesExchangePage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		EOwner:       eOwner,
		Result:       result,
		SignData:     signData})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:30,代碼來源:votes_exchange.go

示例4: ChangeCreditor

func (c *Controller) ChangeCreditor() (string, error) {

	txType := "ChangeCreditor"
	txTypeId := utils.TypeInt(txType)
	timeNow := time.Now().Unix()

	creditId := utils.Round(utils.StrToFloat64(c.Parameters["credit_id"]), 0)
	log.Debug("creditId", creditId)

	TemplateStr, err := makeTemplate("change_creditor", "changeCreditor", &changeCreditorPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		SignData:     "",
		CreditId:     creditId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:25,代碼來源:change_creditor.go

示例5: DelCfFunding

func (c *Controller) DelCfFunding() (string, error) {

	var err error

	txType := "DelCfFunding"
	txTypeId := utils.TypeInt(txType)
	timeNow := utils.Time()

	delId := int64(utils.StrToFloat64(c.Parameters["del_id"]))

	TemplateStr, err := makeTemplate("del_cf_funding", "delCfFunding", &DelCfFundingPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		SignData:     fmt.Sprintf(`%d,%d,%d,%d`, txTypeId, timeNow, c.SessUserId, delId),
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		DelId:        delId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:26,代碼來源:del_cf_funding.go

示例6: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeArbitrationDaysRefund"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("91573"))
	// arbitration_days_refund
	txSlice = append(txSlice, []byte("150"))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:35,代碼來源:change_arbitration_days_refund.go

示例7: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewUser"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// public_key
	txSlice = append(txSlice, utils.HexToBin([]byte("30820122300d06092a864886f70d01010105000382010f003082010a0282010100ae7797b5c16358862f083bb26cde86b233ba97c48087df44eaaf88efccfe554bf51df8dc7e99072cbe433933f1b87aa9ef62bd5d49dc40e75fe398426c727b0773ea9e4d88184d64c1aa561b1cdf78abe07ca5d23711c403f58abf30d41f4b96161649a91a95818d9d482e8fa3f91829abce3d80f6fc3708ce23f6841bb4a8bae301b23745fce5134420fec0519a081f162d16e4dd0da2e8869b5b67122a1fb7e9bcdb8b2512d1edabdb271bee190563b36a66f5498f50d2fc7202ad2f43b90f860428d5ecd67973900d9997475d4e1a1e4c56b44411cc4b5e9c660fe23fdcd5ab956a834fa05a4ecac9d815143d84993c9424d86379b6f76e3be9aeaaff48fb0203010001)")))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))
	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:34,代碼來源:new_user.go

示例8: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "Abuses"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// message
	txSlice = append(txSlice, []byte(`{"1":"fdfdsfdd", "2":"fsdfkj43 43 34"}`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:35,代碼來源:abuses.go

示例9: DelCfProject

func (c *Controller) DelCfProject() (string, error) {

	var err error

	txType := "DelCfProject"
	txTypeId := utils.TypeInt(txType)
	timeNow := utils.Time()

	delId := int64(utils.StrToFloat64(c.Parameters["del_id"]))
	projectCurrencyName, err := c.Single("SELECT project_currency_name FROM cf_projects WHERE id =  ?", delId).String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	TemplateStr, err := makeTemplate("del_cf_project", "delCfProject", &DelCfProjectPage{
		Alert:               c.Alert,
		Lang:                c.Lang,
		CountSignArr:        c.CountSignArr,
		ShowSignData:        c.ShowSignData,
		SignData:            fmt.Sprintf(`%d,%d,%d,%d`, txTypeId, timeNow, c.SessUserId, delId),
		UserId:              c.SessUserId,
		TimeNow:             timeNow,
		TxType:              txType,
		TxTypeId:            txTypeId,
		DelId:               delId,
		ProjectCurrencyName: projectCurrencyName})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:31,代碼來源:del_cf_project.go

示例10: MiningPromisedAmount

func (c *Controller) MiningPromisedAmount() (string, error) {

	txType := "Mining"
	txTypeId := utils.TypeInt(txType)
	timeNow := time.Now().Unix()
	amount := utils.StrToMoney(c.Parameters["amount"])
	amount = math.Floor(amount*100) / 100
	promisedAmountId := int64(utils.StrToFloat64(c.Parameters["promised_amount_id"]))
	log.Debug("c.Parameters[promised_amount_id]):", c.Parameters["promised_amount_id"])
	log.Debug("promisedAmountId:", promisedAmountId)
	TemplateStr, err := makeTemplate("mining_promised_amount", "miningPromisedAmount", &miningPromisedAmountPage{
		Alert:            c.Alert,
		Lang:             c.Lang,
		CountSignArr:     c.CountSignArr,
		ShowSignData:     c.ShowSignData,
		UserId:           c.SessUserId,
		TimeNow:          timeNow,
		TxType:           txType,
		TxTypeId:         txTypeId,
		SignData:         fmt.Sprintf("%v,%v,%v,%v,%v", txTypeId, timeNow, c.SessUserId, promisedAmountId, amount),
		Amount:           amount,
		PromisedAmountId: promisedAmountId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:27,代碼來源:mining_promised_amount.go

示例11: ChangeMoneyBackTime

func (c *Controller) ChangeMoneyBackTime() (string, error) {

	txType := "ChangeMoneyBackTime"
	txTypeId := utils.TypeInt(txType)
	timeNow := utils.Time()

	orderId := int64(utils.StrToFloat64(c.Parameters["order_id"]))
	days := int64(utils.StrToFloat64(c.Parameters["days"]))

	TemplateStr, err := makeTemplate("change_money_back_time", "changeMoneyBackTime", &changeMoneyBackTimePage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		ShowSignData: c.ShowSignData,
		SignData:     "",
		UserId:       c.SessUserId,
		OrderId:      orderId,
		Days:         days,
		CountSignArr: c.CountSignArr,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:26,代碼來源:change_money_back_time.go

示例12: ChangePromisedAmount

func (c *Controller) ChangePromisedAmount() (string, error) {

	txType := "ChangePromisedAmount"
	txTypeId := utils.TypeInt(txType)
	timeNow := time.Now().Unix()
	promisedAmountId := int64(utils.StrToFloat64(c.Parameters["promised_amount_id"]))
	amount := c.Parameters["amount"]

	TemplateStr, err := makeTemplate("change_promised_amount", "changePromisedAmount", &changePromisedAmountPage{
		Alert:            c.Alert,
		Lang:             c.Lang,
		CountSignArr:     c.CountSignArr,
		ShowSignData:     c.ShowSignData,
		UserId:           c.SessUserId,
		TimeNow:          timeNow,
		TxType:           txType,
		TxTypeId:         txTypeId,
		SignData:         fmt.Sprintf("%v,%v,%v,%v,%v", txTypeId, timeNow, c.SessUserId, promisedAmountId, amount),
		PromisedAmountId: promisedAmountId,
		Amount:           amount})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:25,代碼來源:change_promised_amount.go

示例13: main

func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewMaxOtherCurrencies"
	txTime := "1427383713"
	userId := []byte("2")
	var blockId int64 = 128008

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("1111111111"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, []byte("1"))
	// json data
	txSlice = append(txSlice, []byte(`{"1":"1000", "72":500}`))
	// sign
	txSlice = append(txSlice, []byte("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"))

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err := tests_utils.MakeTest(txSlice, blockData, txType, "work_and_rollback")
	if err != nil {
		fmt.Println(err)
	}

}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:35,代碼來源:new_max_other_currencies.go

示例14: Abuse

func (c *Controller) Abuse() (string, error) {

	var err error

	txType := "Abuses"
	txTypeId := utils.TypeInt(txType)
	timeNow := utils.Time()

	var countAbusesArr []int
	for i := 0; i < 20; i++ {
		countAbusesArr = append(countAbusesArr, i)
	}

	TemplateStr, err := makeTemplate("abuse", "abuse", &AbusePage{
		Alert:          c.Alert,
		Lang:           c.Lang,
		CountAbusesArr: countAbusesArr,
		ShowSignData:   c.ShowSignData,
		SignData:       "",
		UserId:         c.SessUserId,
		CountSignArr:   c.CountSignArr,
		TimeNow:        timeNow,
		TxType:         txType,
		TxTypeId:       txTypeId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:29,代碼來源:abuse.go

示例15: RepaymentCredit

func (c *Controller) RepaymentCredit() (string, error) {

	txType := "RepaymentCredit"
	txTypeId := utils.TypeInt(txType)
	timeNow := time.Now().Unix()

	creditId := utils.Round(utils.StrToFloat64(c.Parameters["credit_id"]), 0)

	TemplateStr, err := makeTemplate("repayment_credit", "repaymentCredit", &repaymentCreditPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		SignData:     "",
		CreditId:     creditId,
		CurrencyList: c.CurrencyList})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:25,代碼來源:repayment_credit.go


注:本文中的github.com/c-darwin/dcoin-go/packages/utils.TypeInt函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。