This commit is contained in:
yangduo 2024-12-13 16:43:24 +08:00
parent 6d1de87c5f
commit 4c017a9963
7 changed files with 25 additions and 23 deletions

View File

@ -148,15 +148,15 @@ func (this *ActivityApi) RollDice(c *gin.Context) {
bageffect, taskupdate, bufeffect := service.Award.HandleAwards(user, rspObj.GetOrCreateAward())
if bageffect {
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "bag")
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BAG)
}
if bufeffect {
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "buff")
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BUFF)
}
if fullgrid {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "fullgrid")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_FULL_GRID)
}
itemtype := constant.ITEM_TYPE_SPEC_DICE
@ -165,7 +165,7 @@ func (this *ActivityApi) RollDice(c *gin.Context) {
}
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.TASK_COND_BACK_USE, int32(itemtype), 1, nil) || taskupdate {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
rspObj.GetOrCreateSideEffect().GetOrCreateUser().FromModel(user)
@ -221,15 +221,15 @@ func (this *ActivityApi) Claim(c *gin.Context) {
bageffect, taskupdate, bufeffect := service.Award.HandleAwards(user, rspObj.GetOrCreateAward())
if bageffect {
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "bag")
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BAG)
}
if bufeffect {
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "buff")
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BUFF)
}
if taskupdate {
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
rspObj.GetOrCreateSideEffect().GetOrCreateUser().FromModel(user)

View File

@ -80,10 +80,10 @@ func (this *BagApi) UseItem(c *gin.Context) {
}
service.Buff.Add(s.GetAccountId(), itemMeta.GetBuffList())
bagItem.DecItemNum(1, int32(nowTime))
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "buff")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "bag")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BUFF)
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_BAG)
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.TASK_COND_BACK_USE, itemMeta.GetItemType(), reqJson.ItemNum, nil) {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
c.JSON(200, rspObj)
}

View File

@ -149,7 +149,7 @@ func (this *MissionApi) ClaimTaskAward(c *gin.Context) {
if taskMeta.GetRewardType() == constant.TASK_AWARD_SCORE {
user.AddScore(taskMeta.GetReward())
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.TASK_COND_BACK_GAIN, constant.ITEM_TYPE_SCORE, taskMeta.GetReward(), &tasks) {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
rspObj.GetOrCreateAward().AddItem(constant.VIRTUAL_ITEM_SCORE, taskMeta.GetReward())
}

View File

@ -98,7 +98,7 @@ func (this *ShopApi) Buy(c *gin.Context) {
rspObj.SideEffect.User.FromModel(user)
rspObj.SideEffect.User.HourlyEarnings = service.Chip.GetHourEarning(user.AccountId)
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.TASK_COND_BACK_BUY, itemMeta.GetItemType(), 1, nil) {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
user.UpdateUserFields()

View File

@ -80,7 +80,7 @@ func (this *UserApi) Login(c *gin.Context) {
if earning > 0 {
user.AddScore(earning)
if service.Task.UpdateTaskProgress(s.GetAccountId(), constant.TASK_COND_BACK_GAIN, constant.ITEM_TYPE_SCORE, earning, nil) {
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, "task")
q5.AppendSlice(&rspObj.BaseVo.GetOrCreateSideEffect().Effects, constant.SIDE_EFFECT_Task)
}
}
}

View File

@ -43,6 +43,8 @@ const (
const (
SIDE_EFFECT_BUFF = "buff"
SIDE_EFFECT_BAG = "bag"
SIDE_EFFECT_Task = "task"
SIDE_EFFECT_FULL_GRID = "fullgrid"
)
const (

View File

@ -6,16 +6,16 @@ import (
)
type Log struct {
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
AccountId string `gorm:"column:account_id"`
Type string `gorm:"column:type"`
SubType string `gorm:"column:sub_type"`
Param1 string `gorm:"column:param1"`
Param2 string `gorm:"column:param2"`
Param3 string `gorm:"column:param3"`
Param4 string `gorm:"column:param4"`
CreateTime int32 `gorm:"column:createtime;<-:create"`
ModifyTime int32 `gorm:"column:modifytime"`
Idx int64 `gorm:"column:idx;AUTO_INCREMENT;primaryKey"`
AccountId string `gorm:"column:account_id"`
Type string `gorm:"column:type;comment:item id"`
SubType string `gorm:"column:sub_type;comment:变化来源"`
Param1 string `gorm:"column:param1;comment:变化量"`
Param2 string `gorm:"column:param2;comment:变化后"`
Param3 string `gorm:"column:param3"`
Param4 string `gorm:"column:param4"`
CreateTime int32 `gorm:"column:createtime;<-:create"`
ModifyTime int32 `gorm:"column:modifytime"`
}
func (this *Log) TableName() string {