1
This commit is contained in:
parent
c88220b1ad
commit
c593ef7a75
@ -127,3 +127,64 @@ func AddGameLog(accountId string, logType string, subType string,
|
||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||
})
|
||||
}
|
||||
|
||||
func UserAddDiamond(accountId string, diamondNum int32, netId int32, tokenId string, reason int32) bool {
|
||||
var oldDiamond 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() {
|
||||
oldDiamond = q5.ToFloat64(ds.GetByName("diamond"))
|
||||
AddGameLog(accountId, jccommon.GAME_LOG_TYPE_BACKTASK_USER_ADD_DIAMOND_START,
|
||||
q5.ToString(reason),
|
||||
q5.ToString(netId), tokenId, q5.ToString(oldDiamond), q5.ToString(diamondNum))
|
||||
}
|
||||
})
|
||||
}
|
||||
result := false
|
||||
f5.GetGoStyleDb().Update(
|
||||
constant.GAME_DB,
|
||||
"t_user",
|
||||
[][]string {
|
||||
{"account_id", accountId},
|
||||
},
|
||||
[][]string {
|
||||
{"!diamond", func () string {
|
||||
return fmt.Sprintf("diamond + %d", diamondNum)
|
||||
}()},
|
||||
},
|
||||
func (err error, lastInsertId int64, rowsAffected int64) {
|
||||
result = err == nil
|
||||
if err != nil {
|
||||
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() {
|
||||
newDiamond := q5.ToFloat64(ds.GetByName("diamond"))
|
||||
AddGameLog(accountId, jccommon.GAME_LOG_TYPE_BACKTASK_USER_ADD_DIAMOND_END,
|
||||
q5.ToString(reason),
|
||||
q5.ToString(netId), tokenId, q5.ToString(oldDiamond), q5.ToString(newDiamond))
|
||||
}
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
@ -96,6 +96,8 @@ const (
|
||||
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"
|
||||
GAME_LOG_TYPE_BACKTASK_USER_ADD_DIAMOND_START = "backtask.user_add_diamond.begin"
|
||||
GAME_LOG_TYPE_BACKTASK_USER_ADD_DIAMOND_END = "backtask.user_add_diamond.end"
|
||||
)
|
||||
|
||||
const (
|
||||
|
Loading…
x
Reference in New Issue
Block a user