1
This commit is contained in:
parent
872fba5414
commit
3a3297a186
@ -1,9 +1,11 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"q5"
|
||||||
"f5"
|
"f5"
|
||||||
"main/constant"
|
"main/constant"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"jccommon"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetAccountIdByAddress(accountAddress string) string {
|
func GetAccountIdByAddress(accountAddress string) string {
|
||||||
@ -45,6 +47,26 @@ func AccountIdExistsAndIgnoreError(accountId string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UserAddGold(accountId string, goldNum int32, netId int32, tokenId string, reason int32) bool {
|
func UserAddGold(accountId string, goldNum int32, netId int32, tokenId string, reason int32) bool {
|
||||||
|
var oldGold float64
|
||||||
|
{
|
||||||
|
f5.GetGoStyleDb().OrmSelectOne(
|
||||||
|
constant.GAME_DB,
|
||||||
|
"t_user",
|
||||||
|
[][]string {
|
||||||
|
{"account_id", accountId},
|
||||||
|
},
|
||||||
|
func (err error, ds *f5.DataSet) {
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ds.Next() {
|
||||||
|
oldGold = q5.ToFloat64(ds.GetByName("gold"))
|
||||||
|
AddGameLog(accountId, jccommon.GAME_LOG_TYPE_BACKTASK_USER_ADD_GOLD_START,
|
||||||
|
q5.ToString(reason),
|
||||||
|
q5.ToString(netId), tokenId, q5.ToString(oldGold), q5.ToString(goldNum))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
result := false
|
result := false
|
||||||
f5.GetGoStyleDb().Update(
|
f5.GetGoStyleDb().Update(
|
||||||
constant.GAME_DB,
|
constant.GAME_DB,
|
||||||
@ -63,5 +85,45 @@ func UserAddGold(accountId string, goldNum int32, netId int32, tokenId string, r
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
{
|
||||||
|
f5.GetGoStyleDb().OrmSelectOne(
|
||||||
|
constant.GAME_DB,
|
||||||
|
"t_user",
|
||||||
|
[][]string {
|
||||||
|
{"account_id", accountId},
|
||||||
|
},
|
||||||
|
func (err error, ds *f5.DataSet) {
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ds.Next() {
|
||||||
|
newGold := q5.ToFloat64(ds.GetByName("gold"))
|
||||||
|
AddGameLog(accountId, jccommon.GAME_LOG_TYPE_BACKTASK_USER_ADD_GOLD_END,
|
||||||
|
q5.ToString(reason),
|
||||||
|
q5.ToString(netId), tokenId, q5.ToString(oldGold), q5.ToString(newGold))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AddGameLog(accountId string, logType string, subType string,
|
||||||
|
param1 string, param2 string, param3 string, param4 string) {
|
||||||
|
nowTime := f5.GetApp().GetRealSeconds()
|
||||||
|
f5.GetGoStyleDb().Insert(
|
||||||
|
constant.GAME_DB,
|
||||||
|
"t_game_log",
|
||||||
|
[][]string {
|
||||||
|
{"account_id", accountId},
|
||||||
|
{"type", logType},
|
||||||
|
{"subtype", subType},
|
||||||
|
{"param1", param1},
|
||||||
|
{"param2", param2},
|
||||||
|
{"param3", param3},
|
||||||
|
{"param4", param4},
|
||||||
|
{"createtime", q5.ToString(nowTime)},
|
||||||
|
{"modifytime", q5.ToString(nowTime)},
|
||||||
|
},
|
||||||
|
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -88,6 +88,11 @@ const (
|
|||||||
BC_POLY_POLY_METAKASK = 13
|
BC_POLY_POLY_METAKASK = 13
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
GAME_LOG_TYPE_BACKTASK_USER_ADD_GOLD_START = "backtask.user_add_gold.begin"
|
||||||
|
GAME_LOG_TYPE_BACKTASK_USER_ADD_GOLD_END = "backtask.user_add_gold.end"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BC_CURRENCY_NAME_ETHEREUM = "Ethereum"
|
BC_CURRENCY_NAME_ETHEREUM = "Ethereum"
|
||||||
BC_CURRENCY_NAME_USDC = "USDC"
|
BC_CURRENCY_NAME_USDC = "USDC"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user