• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang utils.Time函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/c-darwin/dcoin-go/packages/utils.Time函数的典型用法代码示例。如果您正苦于以下问题:Golang Time函数的具体用法?Golang Time怎么用?Golang Time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Time函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: 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


示例2: MoneyBackRequest

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

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

	orderId := int64(utils.StrToFloat64(c.Parameters["order_id"]))
	order, err := c.OneRow("SELECT * FROM orders WHERE id  =  ?", orderId).String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	TemplateStr, err := makeTemplate("money_back_request", "moneyBackRequest", &moneyBackRequestPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		ShowSignData: c.ShowSignData,
		SignData:     "",
		UserId:       c.SessUserId,
		OrderId:      orderId,
		Order:        order,
		CountSignArr: c.CountSignArr,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:29,代码来源:money_back_request.go


示例3: 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


示例4: 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


示例5: 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


示例6: CleanExit

func CleanExit() {
	Clean()
	if utils.DB != nil && utils.DB.DB != nil {
		utils.DB.ExecSql(`INSERT INTO stop_daemons(stop_time) VALUES (?)`, utils.Time())
	} else {
		os.Exit(0)
	}
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:8,代码来源:connection.go


示例7: CfCatalog

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

	var err error
	log.Debug("CfCatalog")

	categoryId := utils.Int64ToStr(int64(utils.StrToFloat64(c.Parameters["category_id"])))
	log.Debug("categoryId", categoryId)
	var curCategory string
	addSql := ""
	if categoryId != "0" {
		addSql = `AND category_id = ` + categoryId
		curCategory = c.Lang["cf_category_"+categoryId]
	}

	cfUrl := ""

	projects := make(map[string]map[string]string)
	cfProjects, err := c.GetAll(`
			SELECT cf_projects.id, lang_id, blurb_img, country, city, currency_id, end_time, amount
			FROM cf_projects
			LEFT JOIN cf_projects_data ON  cf_projects_data.project_id = cf_projects.id
			WHERE del_block_id = 0 AND
						 end_time > ? AND
						 lang_id = ?
						`+addSql+`
			ORDER BY funders DESC
			LIMIT 100
			`, 100, utils.Time(), c.LangInt)
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	for _, data := range cfProjects {
		CfProjectData, err := c.GetCfProjectData(utils.StrToInt64(data["id"]), utils.StrToInt64(data["end_time"]), c.LangInt, utils.StrToFloat64(data["amount"]), cfUrl)
		if err != nil {
			return "", utils.ErrInfo(err)
		}
		for k, v := range CfProjectData {
			data[k] = v
		}
		projects[data["id"]] = data
	}

	cfCategory := utils.MakeCfCategories(c.Lang)

	TemplateStr, err := makeTemplate("cf_catalog", "cfCatalog", &cfCatalogPage{
		Lang:         c.Lang,
		CfCategory:   cfCategory,
		CurrencyList: c.CurrencyList,
		CurCategory:  curCategory,
		Projects:     projects,
		UserId:       c.SessUserId,
		CategoryId:   categoryId,
		CfUrl:        cfUrl})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:58,代码来源:cf_catalog.go


示例8: EWithdraw

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

	if c.SessUserId == 0 {
		return "", errors.New(c.Lang["sign_up_please"])
	}

	c.r.ParseForm()
	currencyId := utils.StrToInt64(c.r.FormValue("currency_id"))
	if !utils.CheckInputData(c.r.FormValue("amount"), "amount") {
		return "", fmt.Errorf("incorrect amount")
	}
	method := c.r.FormValue("method")
	if !utils.CheckInputData(method, "method") {
		return "", fmt.Errorf("incorrect method")
	}
	account := c.r.FormValue("account")
	if !utils.CheckInputData(account, "account") {
		return "", fmt.Errorf("incorrect account")
	}
	amount := utils.StrToFloat64(c.r.FormValue("amount"))

	curTime := utils.Time()

	// нужно проверить, есть ли нужная сумма на счету юзера
	userAmount := utils.EUserAmountAndProfit(c.SessUserId, currencyId)
	if userAmount < amount {
		return "", fmt.Errorf("%s (%f<%f)", c.Lang["not_enough_money"], userAmount, amount)
	}
	if method != "Dcoin" && currencyId < 1000 {
		return "", fmt.Errorf("incorrect method")
	}

	err := userLock(c.SessUserId)
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	err = c.ExecSql(`UPDATE e_wallets SET amount = ?, last_update = ? WHERE user_id = ? AND currency_id = ?`, userAmount-amount, curTime, c.SessUserId, currencyId)
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	var commission float64
	if method == "Dcoin" {
		commission = utils.StrToFloat64(c.EConfig["dc_commission"])
	} else if method == "Perfect-money" {
		commission = utils.StrToFloat64(c.EConfig["pm_commission"])
	}
	wdAmount := utils.ClearNull(utils.Float64ToStr(amount*(1-commission/100)), 2)

	err = c.ExecSql(`INSERT INTO e_withdraw (open_time, user_id, currency_id, account, amount, wd_amount, method) VALUES (?, ?, ?, ?, ?, ?, ?)`, curTime, c.SessUserId, currencyId, account, amount, wdAmount, method)
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	userUnlock(c.SessUserId)

	return utils.JsonAnswer(c.Lang["request_is_created"], "success").String(), nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:56,代码来源:e_withdraw.go


示例9: EGateIk

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

	c.r.ParseForm()
	fmt.Println(c.r.Form)
	var ikNames []string
	for name, _ := range c.r.Form {
		if name[:2] == "ik" && name != "ik_sign" {
			ikNames = append(ikNames, name)
		}
	}
	sort.Strings(ikNames)
	fmt.Println(ikNames)

	var ikValues []string
	for _, names := range ikNames {
		ikValues = append(ikValues, c.r.FormValue(names))
	}
	ikValues = append(ikValues, c.EConfig["ik_s_key"])
	fmt.Println(ikValues)
	sign := strings.Join(ikValues, ":")
	fmt.Println(sign)
	sign = base64.StdEncoding.EncodeToString(utils.HexToBin(utils.Md5(sign)))
	fmt.Println(sign)
	if sign != c.r.FormValue("ik_sign") {
		return "", errors.New("Incorrect signature")
	}
	currencyId := int64(0)

	if c.r.FormValue("ik_cur") == "USD" {
		currencyId = 1001
	}
	if currencyId == 0 {
		return "", errors.New("Incorrect currencyId")
	}

	amount := utils.StrToFloat64(c.r.FormValue("ik_am"))
	pmId := utils.StrToInt64(c.r.FormValue("ik_inv_id"))
	// проверим, не зачисляли ли мы уже это платеж
	existsId, err := c.Single(`SELECT id FROM e_adding_funds_ik WHERE id = ?`, pmId).Int64()
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	if existsId != 0 {
		return "", errors.New("Incorrect ik_inv_id")
	}
	paymentInfo := c.r.FormValue("ik_desc")

	txTime := utils.Time()
	err = EPayment(paymentInfo, currencyId, txTime, amount, pmId, "ik", c.ECommission)
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	return ``, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:55,代码来源:e_gate_ik.go


示例10: ChangeHost

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

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

	if !c.PoolAdmin || c.SessRestricted != 0 {
		return "", utils.ErrInfo(errors.New("access denied"))
	}

	data, err := c.OneRow("SELECT http_host, tcp_host, host_status FROM " + c.MyPrefix + "my_table").String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	data2, err := c.OneRow("SELECT http_host, tcp_host, e_host FROM miners_data WHERE user_id = ?", c.SessUserId).String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	if len(data["http_host"]) == 0 {
		data["http_host"] = data2["http_host"]
	}
	if len(data["tcp_host"]) == 0 {
		data["tcp_host"] = data2["tcp_host"]
	}
	if len(data["e_host"]) == 0 {
		data["e_host"] = data2["e_host"]
	}
	if data["e_host"] == "" {
		data["e_host"] = "0"
	}

	statusArray := map[string]string{"my_pending": c.Lang["local_pending"], "approved": c.Lang["status_approved"]}
	data["host_status"] = statusArray[data["host_status"]]

	limitsText := strings.Replace(c.Lang["change_host_limits_text"], "[limit]", utils.Int64ToStr(c.Variables.Int64["limit_change_host"]), -1)
	limitsText = strings.Replace(limitsText, "[period]", c.Periods[c.Variables.Int64["limit_change_host_period"]], -1)

	TemplateStr, err := makeTemplate("change_host", "changeHost", &changeHostPage{
		Alert:        c.Alert,
		UserId:       c.SessUserId,
		CountSignArr: c.CountSignArr,
		Data:         data,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		LimitsText:   limitsText,
		ShowSignData: c.ShowSignData,
		Community:    c.Community,
		SignData:     "",
		Lang:         c.Lang})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:55,代码来源:change_host.go


示例11: NewCfProject

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

	var err error

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

	cfCategory := utils.MakeCfCategories(c.Lang)

	latitude := "39.94887"
	longitude := "-75.15005"
	city := "Pennsylvania, USA"
	endTime := utils.Time() + 3600*24*7 + 3600

	var countDaysArr []int
	for i := 7; i < 90; i++ {
		countDaysArr = append(countDaysArr, i)
	}

	TemplateStr, err := makeTemplate("new_cf_project", "newCfProject", &NewCfProjectPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		Latitude:     latitude,
		Longitude:    longitude,
		EndTime:      endTime,
		City:         city,
		CfCategory:   cfCategory,
		CountDaysArr: countDaysArr,
		CurrencyList: c.CurrencyList})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:41,代码来源:new_cf_project.go


示例12: MyCfProjects

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

	var err error

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

	projectsLang := make(map[string]map[string]string)
	projects := make(map[string]map[string]string)
	cfProjects, err := c.GetAll(`
			SELECT id, category_id, project_currency_name, country, city, currency_id, end_time, amount
			FROM cf_projects
			WHERE user_id = ? AND del_block_id = 0
			`, -1, c.SessUserId)
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	for _, data := range cfProjects {
		CfProjectData, err := c.GetCfProjectData(utils.StrToInt64(data["id"]), utils.StrToInt64(data["end_time"]), c.LangInt, utils.StrToFloat64(data["amount"]), "")
		if err != nil {
			return "", utils.ErrInfo(err)
		}
		for k, v := range CfProjectData {
			data[k] = v
		}
		projects[data["id"]] = data
		lang, err := c.GetMap(`SELECT id, lang_id FROM cf_projects_data WHERE project_id = ?`, "id", "lang_id", data["id"])
		projectsLang[data["id"]] = lang
	}

	cfLng, err := c.GetAllCfLng()

	TemplateStr, err := makeTemplate("my_cf_projects", "myCfProjects", &MyCfProjectsPage{
		Alert:        c.Alert,
		Lang:         c.Lang,
		CountSignArr: c.CountSignArr,
		ShowSignData: c.ShowSignData,
		UserId:       c.SessUserId,
		TimeNow:      timeNow,
		TxType:       txType,
		TxTypeId:     txTypeId,
		CfLng:        cfLng,
		CurrencyList: c.CurrencyList,
		Projects:     projects,
		ProjectsLang: projectsLang})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:51,代码来源:my_cf_projects.go


示例13: UnbanNodes

func UnbanNodes(chBreaker chan bool, chAnswer chan string) {
	defer func() {
		if r := recover(); r != nil {
			log.Error("daemon Recovered", r)
			panic(r)
		}
	}()

	GoroutineName := "UnbanNodes"
	d := new(daemon)
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}
	d.goRoutineName = GoroutineName
	d.chAnswer = chAnswer
	d.chBreaker = chBreaker
	d.sleepTime = 3600
	if !d.CheckInstall(chBreaker, chAnswer, GoroutineName) {
		return
	}
	d.DCDB = DbConnect(chBreaker, chAnswer, GoroutineName)
	if d.DCDB == nil {
		return
	}

BEGIN:
	for {
		log.Info(GoroutineName)
		MonitorDaemonCh <- []string{GoroutineName, utils.Int64ToStr(utils.Time())}

		// проверим, не нужно ли нам выйти из цикла
		if CheckDaemonsRestart(chBreaker, chAnswer, GoroutineName) {
			break BEGIN
		}

		err = d.ExecSql("DELETE FROM nodes_ban")
		if err != nil {
			if d.dPrintSleep(err, d.sleepTime) {
				break BEGIN
			}
			continue BEGIN
		}

		if d.dSleep(d.sleepTime) {
			break BEGIN
		}
	}
	log.Debug("break BEGIN %v", GoroutineName)
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:50,代码来源:unban_nodes.go


示例14: EDataBaseDump

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

	if !c.NodeAdmin || c.SessRestricted != 0 {
		return "", utils.ErrInfo(errors.New("Permission denied"))
	}

	allTables, err := c.GetAllTables()
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	c.r.ParseForm()

	mainMap := make(map[string][]map[string]string)

	for _, table := range allTables {
		re := regexp.MustCompile("^e_")
		match := re.FindStringSubmatch(table)
		if len(match) > 0 {
			data, err := c.GetAll(`SELECT * FROM `+table, -1)
			if err != nil {
				return "", utils.ErrInfo(err)
			}
			for k, arr := range data {
				for name, value := range arr {
					if ok, _ := regexp.MatchString("(tx_hash)", name); ok {
						data[k][name] = string(utils.BinToHex([]byte(value)))
					}
				}
			}
			mainMap[table] = data
		}
	}

	jsonData, _ := json.Marshal(mainMap)
	log.Debug(string(jsonData))

	c.w.Header().Set("Content-Type", "text/plain")
	c.w.Header().Set("Content-Length", utils.IntToStr(len(jsonData)))
	t := time.Unix(utils.Time(), 0)
	c.w.Header().Set("Content-Disposition", `attachment; filename="dcoin_e_backup-`+t.Format(c.TimeFormat)+`.txt`)
	if _, err := c.w.Write(jsonData); err != nil {
		return "", utils.ErrInfo(errors.New("unable to write text"))
	}

	return "", nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:46,代码来源:e_database_dump.go


示例15: AddCfProjectData

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

	var err error

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

	projectId := int64(utils.StrToFloat64(c.Parameters["projectId"]))
	id := int64(utils.StrToFloat64(c.Parameters["id"]))
	cfData := make(map[string]string)
	if id > 0 {
		log.Debug("id:", id)
		cfData, err = c.OneRow("SELECT * FROM cf_projects_data WHERE id = ?", id).String()
		if err != nil {
			return "", utils.ErrInfo(err)
		}
		projectId = utils.StrToInt64(cfData["project_id"])
	}

	cfCurrencyName, err := c.Single("SELECT project_currency_name FROM cf_projects WHERE id  =  ?", projectId).String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	CfLng, err := c.GetAllCfLng()
	log.Debug("CfData", cfData)
	TemplateStr, err := makeTemplate("add_cf_project_data", "addCfProjectData", &AddCfProjectDataPage{
		Alert:          c.Alert,
		Lang:           c.Lang,
		CountSignArr:   c.CountSignArr,
		ShowSignData:   c.ShowSignData,
		UserId:         c.SessUserId,
		TimeNow:        timeNow,
		TxType:         txType,
		TxTypeId:       txTypeId,
		ProjectId:      projectId,
		Id:             id,
		CfData:         cfData,
		CfCurrencyName: cfCurrencyName,
		CfLng:          CfLng})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:46,代码来源:add_cf_project_data.go


示例16: EPayment

func EPayment(paymentInfo string, currencyId, txTime int64, amount float64, paymentId int64, paymentSystem string, eCommission float64) error {

	var userId int64
	r, _ := regexp.Compile(`(?i)token\-([0-9]+)`)
	t_ := r.FindStringSubmatch(paymentInfo)
	token := ""
	if len(t_) > 0 {
		token = t_[1]
	} else {
		userId = utils.StrToInt64(paymentInfo)
	}
	var buyCurrencyId int64
	if len(token) > 0 {
		err := utils.DB.ExecSql(`UPDATE e_tokens SET status = 'paid' WHERE id = ?`, token)
		if err != nil {
			return utils.ErrInfo(err)
		}
		data, err := utils.DB.OneRow(`SELECT user_id, buy_currency_id FROM e_tokens WHERE id = ?`, token).Int64()
		if err != nil {
			return utils.ErrInfo(err)
		}
		userId = data["user_id"]

		buyCurrencyId = data["buy_currency_id"]
	}
	err := utils.DB.ExecSql(`INSERT INTO e_adding_funds_`+paymentSystem+` (id, user_id, currency_id, time, amount) VALUES (?, ?, ?, ?, ?)`, paymentId, userId, currencyId, txTime, amount)
	if err != nil {
		return utils.ErrInfo(err)
	}
	if userId > 0 {
		err = utils.UpdEWallet(userId, currencyId, utils.Time(), amount, false)
		if err != nil {
			return utils.ErrInfo(err)
		}

		// автоматом создаем ордер, если это запрос через кошель Dcoin
		if len(token) > 0 {
			err = NewForexOrder(userId, amount, 1, currencyId, buyCurrencyId, "buy", eCommission)
			if err != nil {
				return utils.ErrInfo(err)
			}
		}
	}
	return nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:45,代码来源:e_gate_pm.go


示例17: main

func main() {

	runtime.LockOSThread()

	var width uint = 800
	var height uint = 600
	var thrustWindow *window.Window
	if runtime.GOOS == "darwin" {
		height = 578
	}
	if utils.Desktop() && (winVer() >= 6 || winVer() == 0) {
		thrust.Start()
		thrustWindow = thrust.NewWindow(thrust.WindowOptions{
			RootUrl:  "http://localhost:8989/loader.html",
			HasFrame: true,
			Title:    "Dcoin",
			Size:     commands.SizeHW{Width: width, Height: height},
		})

		thrust.NewEventHandler("*", func(cr commands.CommandResponse) {
			//fmt.Println(fmt.Sprintf("======Event(%s %d) - Signaled by Command (%s)", cr.TargetID, cr.Type))
			if cr.TargetID > 1 && cr.Type == "closed" {
				if utils.DB != nil && utils.DB.DB != nil {
					utils.DB.ExecSql(`INSERT INTO stop_daemons(stop_time) VALUES (?)`, utils.Time())
				} else {
					thrust.Exit()
					os.Exit(0)
				}
			}
		})
		thrustWindow.Show()
		thrustWindow.Focus()
		go func() {
			http.HandleFunc("/static/img/main_loader.gif", main_loader)
			http.HandleFunc("/loader.html", main_loader_html)
			http.ListenAndServe(":8989", nil)
		}()
	}
	tray()

	go dcoin.Start("", thrustWindow)

	enterLoop()

}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:45,代码来源:dcoinnotmobile.go


示例18: EGatePayeer

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

	c.r.ParseForm()

	fmt.Println(c.r.Form)

	if utils.IPwoPort(c.r.RemoteAddr) != "37.59.221.23" {
		return "", errors.New("Incorrect RemoteAddr " + utils.IPwoPort(c.r.RemoteAddr))
	}

	if len(c.r.FormValue("m_operation_id")) > 0 && len(c.r.FormValue("m_sign")) > 0 {
		sign := strings.ToUpper(string(utils.Sha256(c.r.FormValue("m_operation_id") + ":" + c.r.FormValue("m_operation_ps") + ":" + c.r.FormValue("m_operation_date") + ":" + c.r.FormValue("m_operation_pay_date") + ":" + c.r.FormValue("m_shop") + ":" + c.r.FormValue("m_orderid") + ":" + c.r.FormValue("m_amount") + ":" + c.r.FormValue("m_curr") + ":" + base64.StdEncoding.EncodeToString([]byte(c.r.FormValue("m_desc"))) + ":" + c.r.FormValue("m_status") + ":" + c.EConfig["payeer_s_key"])))
		if c.r.FormValue("m_sign") == sign && c.r.FormValue("m_status") == "success" {

			txTime := utils.Time()

			currencyId := int64(0)

			if c.r.FormValue("m_curr") == "USD" {
				currencyId = 1001
			}
			if currencyId == 0 {
				return c.r.FormValue("m_orderid") + "|success", nil
			}

			amount := utils.StrToFloat64(c.r.FormValue("m_amount"))
			pmId := utils.StrToInt64(c.r.FormValue("m_operation_id"))
			// проверим, не зачисляли ли мы уже это платеж
			existsId, err := c.Single(`SELECT id FROM e_adding_funds_payeer WHERE id = ?`, pmId).Int64()
			if err != nil {
				return c.r.FormValue("m_orderid") + "|success", nil
			}
			if existsId != 0 {
				return c.r.FormValue("m_orderid") + "|success", nil
			}
			paymentInfo := c.r.FormValue("m_desc")

			EPayment(paymentInfo, currencyId, txTime, amount, pmId, "payeer", c.ECommission)
			return c.r.FormValue("m_orderid") + "|success", nil
		}
	}
	return c.r.FormValue("m_orderid") + "|error", nil

}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:44,代码来源:e_gate_payeer.go


示例19: ChangeGeolocation

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

	var err error

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

	myGeolocationStr, err := c.Single(`SELECT geolocation FROM ` + c.MyPrefix + `my_table`).String()
	if len(myGeolocationStr) == 0 {
		myGeolocationStr = "39.94887, -75.15005"
	}
	x := strings.Split(myGeolocationStr, ", ")
	myGeolocation := make(map[string]string)
	myGeolocation["lat"] = x[0]
	myGeolocation["lon"] = x[1]

	myCountry, err := c.Single("SELECT country FROM miners_data WHERE user_id = ?", c.SessUserId).Int()
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	limitsText := strings.Replace(c.Lang["geolocation_limits_text"], "[limit]", utils.Int64ToStr(c.Variables.Int64["limit_change_geolocation"]), -1)
	limitsText = strings.Replace(limitsText, "[period]", c.Periods[c.Variables.Int64["limit_change_geolocation_period"]], -1)

	TemplateStr, err := makeTemplate("change_geolocation", "changeGeolocation", &changeGeolocationPage{
		Alert:         c.Alert,
		Lang:          c.Lang,
		TxTypeId:      txTypeId,
		TimeNow:       timeNow,
		UserId:        c.SessUserId,
		CountSignArr:  c.CountSignArr,
		ShowSignData:  c.ShowSignData,
		SignData:      "",
		LimitsText:    limitsText,
		MyCountry:     myCountry,
		Countries:     consts.Countries,
		MyGeolocation: myGeolocation})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:43,代码来源:change_geolocation.go


示例20: RestoringAccess

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

	var err error

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

	adminUserId, err := c.GetAdminUserId()

	data, err := c.OneRow("SELECT change_key, change_key_time, change_key_close FROM users WHERE user_id  =  ?", c.SessUserId).String()
	if err != nil {
		return "", utils.ErrInfo(err)
	}

	// разрешил ли уже юзер менять свой ключ админу
	changeKeyStatus := data["change_key"]

	requests := ""
	if len(data["change_key_status"]) > 0 && len(data["change_key_close"]) > 0 {
		t := time.Unix(utils.StrToInt64(data["change_key_time"]), 0)
		requests = t.Format(c.TimeFormat)
	}

	TemplateStr, err := makeTemplate("restoring_access", "restoringAccess", &restoringAccessPage{
		Alert:           c.Alert,
		Lang:            c.Lang,
		ShowSignData:    c.ShowSignData,
		SignData:        "",
		UserId:          c.SessUserId,
		CountSignArr:    c.CountSignArr,
		TimeNow:         timeNow,
		TxType:          txType,
		TxTypeId:        txTypeId,
		AdminUserId:     adminUserId,
		ChangeKeyStatus: changeKeyStatus,
		Requests:        requests})
	if err != nil {
		return "", utils.ErrInfo(err)
	}
	return TemplateStr, nil
}
开发者ID:dzyk,项目名称:dcoin-go,代码行数:42,代码来源:restoring_access.go



注:本文中的github.com/c-darwin/dcoin-go/packages/utils.Time函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang utils.TypeInt函数代码示例发布时间:2022-05-24
下一篇:
Golang utils.StrToInt64函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap