Browse Source

gm, 广告, 渠道排序

master
linquan 2 months ago
parent
commit
b5beb82f0d
  1. 63
      api/v1/game/advertisement.go
  2. 13
      api/v1/game/manage.go
  3. 5
      internal/controller/game_manage.go
  4. 10
      internal/controller/game_pub.go
  5. 4
      internal/dao/internal/advertisement_oceanegine.go
  6. 2
      internal/dao/internal/game_channel_list.go
  7. 115
      internal/dao/internal/login_logout_info_gm.go
  8. 27
      internal/dao/login_logout_info_gm.go
  9. 2
      internal/model/do/advertisement_oceanegine.go
  10. 1
      internal/model/do/game_channel_list.go
  11. 37
      internal/model/do/login_logout_info_gm.go
  12. 2
      internal/model/entity/advertisement_oceanegine.go
  13. 1
      internal/model/entity/game_channel_list.go
  14. 35
      internal/model/entity/login_logout_info_gm.go
  15. 8
      internal/service/middleware.go
  16. 14
      internal/serviceGame/advertisement.go
  17. 73
      internal/serviceGame/internal/advertisement.go
  18. 40
      internal/serviceGame/internal/basicinfo.go
  19. 6
      internal/serviceGame/manage.go

63
api/v1/game/advertisement.go

@ -50,6 +50,7 @@ type DeepADRes struct {
type ATHAReq struct {
g.Meta `path:"/attributionHA" tags:"ad" method:"get" summary:"广告投放"`
Platform string `p:"platform"`
Idfa string `p:"idfa"`
Idfv string `p:"idfv"`
AndroidId string `p:"android_id"`
PackageName string `p:"package_name"`
@ -88,6 +89,7 @@ type CSHAReq struct {
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
Idfa string `p:"idfa"`
}
type CSHARes struct {
@ -100,6 +102,7 @@ type AdvertiseHAReq struct {
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
Idfa string `p:"idfa"`
PackageName string `p:"package_name"`
}
@ -109,11 +112,13 @@ type AdvertiseHARes struct {
}
type AdvertiseHA1Req struct {
g.Meta `path:"/advertiseHA1" tags:"ad" method:"get" summary:"广告投放"`
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
PackageName string `p:"package_name"`
g.Meta `path:"/advertiseHA1" tags:"ad" method:"get" summary:"广告投放"`
Os string `p:"os"`
Idfa string `p:"idfa"`
TIMESTAMP string `p:"TIMESTAMP"`
Callback string `p:"callback"`
Androidid string `p:"androidid"`
Oaid string `p:"oaid"`
}
type AdvertiseHA1Res struct {
@ -122,11 +127,13 @@ type AdvertiseHA1Res struct {
}
type AdvertiseHA2Req struct {
g.Meta `path:"/advertiseHA2" tags:"ad" method:"get" summary:"广告投放"`
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
PackageName string `p:"package_name"`
g.Meta `path:"/advertiseHA2" tags:"ad" method:"get" summary:"广告投放"`
Os string `p:"os"`
Idfa string `p:"idfa"`
TIMESTAMP string `p:"TIMESTAMP"`
Callback string `p:"callback"`
Androidid string `p:"androidid"`
Oaid string `p:"oaid"`
}
type AdvertiseHA2Res struct {
@ -135,11 +142,13 @@ type AdvertiseHA2Res struct {
}
type AdvertiseHA3Req struct {
g.Meta `path:"/advertiseHA3" tags:"ad" method:"get" summary:"广告投放"`
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
PackageName string `p:"package_name"`
g.Meta `path:"/advertiseHA3" tags:"ad" method:"get" summary:"广告投放"`
Os string `p:"os"`
Idfa string `p:"idfa"`
TIMESTAMP string `p:"TIMESTAMP"`
Callback string `p:"callback"`
Androidid string `p:"androidid"`
Oaid string `p:"oaid"`
}
type AdvertiseHA3Res struct {
@ -148,11 +157,13 @@ type AdvertiseHA3Res struct {
}
type AdvertiseHA4Req struct {
g.Meta `path:"/advertiseHA4" tags:"ad" method:"get" summary:"广告投放"`
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
PackageName string `p:"package_name"`
g.Meta `path:"/advertiseHA4" tags:"ad" method:"get" summary:"广告投放"`
Os string `p:"os"`
Idfa string `p:"idfa"`
TIMESTAMP string `p:"TIMESTAMP"`
Callback string `p:"callback"`
Androidid string `p:"androidid"`
Oaid string `p:"oaid"`
}
type AdvertiseHA4Res struct {
@ -161,11 +172,13 @@ type AdvertiseHA4Res struct {
}
type AdvertiseHA5Req struct {
g.Meta `path:"/advertiseHA5" tags:"ad" method:"get" summary:"广告投放"`
EventType string `p:"event_type"`
Platform string `p:"platform"`
Id string `p:"id"`
PackageName string `p:"package_name"`
g.Meta `path:"/advertiseHA5" tags:"ad" method:"get" summary:"广告投放"`
Os string `p:"os"`
Idfa string `p:"idfa"`
TIMESTAMP string `p:"TIMESTAMP"`
Callback string `p:"callback"`
Androidid string `p:"androidid"`
Oaid string `p:"oaid"`
}
type AdvertiseHA5Res struct {

13
api/v1/game/manage.go

@ -2,6 +2,7 @@ package game
import (
"github.com/gogf/gf/v2/frame/g"
"tyj_admin/api/v1/common"
"tyj_admin/internal/model/entity"
)
@ -434,3 +435,15 @@ type DelAllowChannelReq struct {
type DelAllowChannelRes struct {
g.Meta `mime:"application/json"`
}
type GetOperLogReq struct {
g.Meta `path:"/log/getOperLog" tags:"log接口" method:"get" summary:"操作日志"`
Label string `p:"label"`
common.PageReq
}
type GetOperLogRes struct {
g.Meta `mime:"application/json"`
List []entity.SysOperLog `json:"list"`
common.ListRes
}

5
internal/controller/game_manage.go

@ -61,3 +61,8 @@ func (c *manageController) GetShopItemList(ctx context.Context, req *game.GetSho
res, err = serviceGame.GameManage().GetShopItemList(ctx, req)
return res, err
}
func (c *manageController) GetOperLog(ctx context.Context, req *game.GetOperLogReq) (res *game.GetOperLogRes, err error) {
res, err = serviceGame.GameManage().GetOperLog(ctx, req)
return res, err
}

10
internal/controller/game_pub.go

@ -244,25 +244,35 @@ func (c *pubController) AdvertiseHugeAmount(ctx context.Context, req *game.Adver
func (c *pubController) AdvertiseHugeAmount1(ctx context.Context, req *game.AdvertiseHA1Req) (res *game.AdvertiseHA1Res, err error) {
log.Print("AdvertiseHugeAmount1", gjson.MustEncodeString(req))
res = new(game.AdvertiseHA1Res)
err = serviceGame.Advertisement().AdvertiseHugeAmount1(ctx, req.Androidid, req.Idfa, req.Os, req.Callback, req.TIMESTAMP)
return
}
func (c *pubController) AdvertiseHugeAmount2(ctx context.Context, req *game.AdvertiseHA2Req) (res *game.AdvertiseHA2Res, err error) {
log.Print("AdvertiseHugeAmount2", gjson.MustEncodeString(req))
res = new(game.AdvertiseHA2Res)
err = serviceGame.Advertisement().AdvertiseHugeAmount1(ctx, req.Androidid, req.Idfa, req.Os, req.Callback, req.TIMESTAMP)
return
}
func (c *pubController) AdvertiseHugeAmount3(ctx context.Context, req *game.AdvertiseHA3Req) (res *game.AdvertiseHA3Res, err error) {
log.Print("AdvertiseHugeAmount3", gjson.MustEncodeString(req))
res = new(game.AdvertiseHA3Res)
err = serviceGame.Advertisement().AdvertiseHugeAmount1(ctx, req.Androidid, req.Idfa, req.Os, req.Callback, req.TIMESTAMP)
return
}
func (c *pubController) AdvertiseHugeAmount4(ctx context.Context, req *game.AdvertiseHA4Req) (res *game.AdvertiseHA4Res, err error) {
log.Print("AdvertiseHugeAmount4", gjson.MustEncodeString(req))
res = new(game.AdvertiseHA4Res)
err = serviceGame.Advertisement().AdvertiseHugeAmount1(ctx, req.Androidid, req.Idfa, req.Os, req.Callback, req.TIMESTAMP)
return
}
func (c *pubController) AdvertiseHugeAmount5(ctx context.Context, req *game.AdvertiseHA5Req) (res *game.AdvertiseHA5Res, err error) {
log.Print("AdvertiseHugeAmount5", gjson.MustEncodeString(req))
res = new(game.AdvertiseHA5Res)
err = serviceGame.Advertisement().AdvertiseHugeAmount1(ctx, req.Androidid, req.Idfa, req.Os, req.Callback, req.TIMESTAMP)
return
}

4
internal/dao/internal/advertisement_oceanegine.go

@ -27,6 +27,8 @@ type AdvertisementOceanegineColumns struct {
CallbackUrl string //
LastTouchTime string //
CDate string //
Idfa string //
Os string // 安卓:0 IOS:1 其他:3
}
// advertisementOceanegineColumns holds the columns for table advertisement_oceanegine.
@ -38,6 +40,8 @@ var advertisementOceanegineColumns = AdvertisementOceanegineColumns{
CallbackUrl: "callback_url",
LastTouchTime: "last_touch_time",
CDate: "c_date",
Idfa: "idfa",
Os: "os",
}
// NewAdvertisementOceanegineDao creates and returns a new DAO object for table data access.

2
internal/dao/internal/game_channel_list.go

@ -23,6 +23,7 @@ type GameChannelListColumns struct {
Id string //
Value string // 渠道号
Label string // 渠道名称
Sort string // 排序
}
// gameChannelListColumns holds the columns for table game_channel_list.
@ -30,6 +31,7 @@ var gameChannelListColumns = GameChannelListColumns{
Id: "id",
Value: "value",
Label: "label",
Sort: "sort",
}
// NewGameChannelListDao creates and returns a new DAO object for table data access.

115
internal/dao/internal/login_logout_info_gm.go

@ -0,0 +1,115 @@
// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================
package internal
import (
"context"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
// LoginLogoutInfoGmDao is the data access object for table login_logout_info_gm.
type LoginLogoutInfoGmDao struct {
table string // table is the underlying table name of the DAO.
group string // group is the database configuration group name of current DAO.
columns LoginLogoutInfoGmColumns // columns contains all the column names of Table for convenient usage.
}
// LoginLogoutInfoGmColumns defines and stores column names for table login_logout_info_gm.
type LoginLogoutInfoGmColumns struct {
Id string //
Uid string //
State string // 1: 登录,2: 登出
CDate string //
GameTime string // 游戏时间
Scale string // 规模
VillagerNum string // 村民数量
Prosperity string // 繁荣值
Copper string // 铜币
GoldIngot string // 桃花石
BaseFood string // 基础食物
Day string // 游戏天数
Server string // 区服
VouchersNum string //
RechargeTotal string //
StoreSum string //
StoneAmount string //
Item7307 string //
Item7315 string //
Item7316 string //
Item7319 string //
Item7312 string //
}
// loginLogoutInfoGmColumns holds the columns for table login_logout_info_gm.
var loginLogoutInfoGmColumns = LoginLogoutInfoGmColumns{
Id: "id",
Uid: "uid",
State: "state",
CDate: "c_date",
GameTime: "game_time",
Scale: "scale",
VillagerNum: "villager_num",
Prosperity: "prosperity",
Copper: "copper",
GoldIngot: "goldIngot",
BaseFood: "base_food",
Day: "day",
Server: "server",
VouchersNum: "vouchersNum",
RechargeTotal: "rechargeTotal",
StoreSum: "storeSum",
StoneAmount: "stoneAmount",
Item7307: "item7307",
Item7315: "item7315",
Item7316: "item7316",
Item7319: "item7319",
Item7312: "item7312",
}
// NewLoginLogoutInfoGmDao creates and returns a new DAO object for table data access.
func NewLoginLogoutInfoGmDao() *LoginLogoutInfoGmDao {
return &LoginLogoutInfoGmDao{
group: "default",
table: "login_logout_info_gm",
columns: loginLogoutInfoGmColumns,
}
}
// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *LoginLogoutInfoGmDao) DB() gdb.DB {
return g.DB(dao.group)
}
// Table returns the table name of current dao.
func (dao *LoginLogoutInfoGmDao) Table() string {
return dao.table
}
// Columns returns all column names of current dao.
func (dao *LoginLogoutInfoGmDao) Columns() LoginLogoutInfoGmColumns {
return dao.columns
}
// Group returns the configuration group name of database of current dao.
func (dao *LoginLogoutInfoGmDao) Group() string {
return dao.group
}
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *LoginLogoutInfoGmDao) Ctx(ctx context.Context) *gdb.Model {
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
}
// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *LoginLogoutInfoGmDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
return dao.Ctx(ctx).Transaction(ctx, f)
}

27
internal/dao/login_logout_info_gm.go

@ -0,0 +1,27 @@
// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================
package dao
import (
"tyj_admin/internal/dao/internal"
)
// internalLoginLogoutInfoGmDao is internal type for wrapping internal DAO implements.
type internalLoginLogoutInfoGmDao = *internal.LoginLogoutInfoGmDao
// loginLogoutInfoGmDao is the data access object for table login_logout_info_gm.
// You can define custom methods on it to extend its functionality as you wish.
type loginLogoutInfoGmDao struct {
internalLoginLogoutInfoGmDao
}
var (
// LoginLogoutInfoGm is globally public accessible object for table login_logout_info_gm operations.
LoginLogoutInfoGm = loginLogoutInfoGmDao{
internal.NewLoginLogoutInfoGmDao(),
}
)
// Fill with you ideas below.

2
internal/model/do/advertisement_oceanegine.go

@ -19,4 +19,6 @@ type AdvertisementOceanegine struct {
CallbackUrl interface{} //
LastTouchTime interface{} //
CDate *gtime.Time //
Idfa interface{} //
Os interface{} // 安卓:0 IOS:1 其他:3
}

1
internal/model/do/game_channel_list.go

@ -14,4 +14,5 @@ type GameChannelList struct {
Id interface{} //
Value interface{} // 渠道号
Label interface{} // 渠道名称
Sort interface{} // 排序
}

37
internal/model/do/login_logout_info_gm.go

@ -0,0 +1,37 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// LoginLogoutInfoGm is the golang structure of table login_logout_info_gm for DAO operations like Where/Data.
type LoginLogoutInfoGm struct {
g.Meta `orm:"table:login_logout_info_gm, do:true"`
Id interface{} //
Uid interface{} //
State interface{} // 1: 登录,2: 登出
CDate *gtime.Time //
GameTime interface{} // 游戏时间
Scale interface{} // 规模
VillagerNum interface{} // 村民数量
Prosperity interface{} // 繁荣值
Copper interface{} // 铜币
GoldIngot interface{} // 桃花石
BaseFood interface{} // 基础食物
Day interface{} // 游戏天数
Server interface{} // 区服
VouchersNum interface{} //
RechargeTotal interface{} //
StoreSum interface{} //
StoneAmount interface{} //
Item7307 interface{} //
Item7315 interface{} //
Item7316 interface{} //
Item7319 interface{} //
Item7312 interface{} //
}

2
internal/model/entity/advertisement_oceanegine.go

@ -17,4 +17,6 @@ type AdvertisementOceanegine struct {
CallbackUrl string `json:"callbackUrl" description:""`
LastTouchTime int64 `json:"lastTouchTime" description:""`
CDate *gtime.Time `json:"cDate" description:""`
Idfa string `json:"idfa" description:""`
Os int `json:"os" description:"安卓:0 IOS:1 其他:3"`
}

1
internal/model/entity/game_channel_list.go

@ -9,4 +9,5 @@ type GameChannelList struct {
Id int64 `json:"id" description:""`
Value string `json:"value" description:"渠道号"`
Label string `json:"label" description:"渠道名称"`
Sort int `json:"sort" description:"排序"`
}

35
internal/model/entity/login_logout_info_gm.go

@ -0,0 +1,35 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// LoginLogoutInfoGm is the golang structure for table login_logout_info_gm.
type LoginLogoutInfoGm struct {
Id int64 `json:"id" description:""`
Uid int64 `json:"uid" description:""`
State int `json:"state" description:"1: 登录,2: 登出"`
CDate *gtime.Time `json:"cDate" description:""`
GameTime int `json:"gameTime" description:"游戏时间"`
Scale int `json:"scale" description:"规模"`
VillagerNum int `json:"villagerNum" description:"村民数量"`
Prosperity int `json:"prosperity" description:"繁荣值"`
Copper int `json:"copper" description:"铜币"`
GoldIngot int `json:"goldIngot" description:"桃花石"`
BaseFood int `json:"baseFood" description:"基础食物"`
Day int `json:"day" description:"游戏天数"`
Server int `json:"server" description:"区服"`
VouchersNum int `json:"vouchersNum" description:""`
RechargeTotal int `json:"rechargeTotal" description:""`
StoreSum int `json:"storeSum" description:""`
StoneAmount int `json:"stoneAmount" description:""`
Item7307 int `json:"item7307" description:""`
Item7315 int `json:"item7315" description:""`
Item7316 int `json:"item7316" description:""`
Item7319 int `json:"item7319" description:""`
Item7312 int `json:"item7312" description:""`
}

8
internal/service/middleware.go

@ -9,6 +9,7 @@ package service
import (
"fmt"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/text/gstr"
@ -160,6 +161,11 @@ func (s *middlewareImpl) OperLog(r *ghttp.Request) {
userName = user.UserName
}
resp := r.GetHandlerResponse()
if len(gjson.MustEncodeString(resp)) > 2000 {
resp = ""
}
dao.SysOperLog.Ctx(ctx).Insert(g.Map{
dao.SysOperLog.Columns().Title: "game.v1",
dao.SysOperLog.Columns().BusinessType: 0,
@ -171,7 +177,7 @@ func (s *middlewareImpl) OperLog(r *ghttp.Request) {
dao.SysOperLog.Columns().OperIp: r.GetClientIp(),
dao.SysOperLog.Columns().OperLocation: r.RemoteAddr,
dao.SysOperLog.Columns().OperParam: r.URL.RawQuery,
dao.SysOperLog.Columns().JsonResult: r.GetHandlerResponse(),
dao.SysOperLog.Columns().JsonResult: resp,
dao.SysOperLog.Columns().OperTime: time.Now().Local().Format(consts.TIME_FORMAT),
})

14
internal/serviceGame/advertisement.go

@ -3,6 +3,8 @@ package serviceGame
import (
"context"
"tyj_admin/api/v1/game"
"tyj_admin/internal/dao"
"tyj_admin/internal/model/do"
"tyj_admin/internal/serviceGame/internal"
)
@ -12,6 +14,7 @@ type IAdvertisement interface {
AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.ATHARes, err error)
ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSHARes, err error)
AdvertiseHugeAmount(ctx context.Context, req *game.AdvertiseHAReq) (res *game.AdvertiseHARes, err error)
AdvertiseHugeAmount1(ctx context.Context, androidId, idfa, os, callBack, timestamp string) (err error)
}
type advertisementImpl struct {
@ -52,3 +55,14 @@ func (g *advertisementImpl) ConversionHugeAmount(ctx context.Context, req *game.
res, err = internal.ConversionHugeAmount(ctx, req)
return
}
func (g *advertisementImpl) AdvertiseHugeAmount1(ctx context.Context, androidId, idfa, os, callBack, timestamp string) (err error) {
_, err = dao.AdvertisementOceanegine.Ctx(ctx).Insert(do.AdvertisementOceanegine{
AdvAndroidId: androidId,
Idfa: idfa,
Os: os,
CallbackParam: callBack,
LastTouchTime: timestamp,
})
return
}

73
internal/serviceGame/internal/advertisement.go

@ -114,9 +114,21 @@ func AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.AT
"package_name": req.PackageName,
"customer_active_time": fmt.Sprint(time.Now().UnixMilli()), // 毫秒时间戳,客户激活归因时间点
}
var adData []entity.AdvertisementOceanegine
model := dao.AdvertisementOceanegine.Ctx(ctx).Order("last_touch_time desc")
if req.Platform == "android" {
_ = model.Where("adv_android_id=?", req.AndroidId).Scan(&adData)
if len(adData) == 0 {
log.Printf("AttributionHugeAmount: adData is nil %s", gjson.MustEncodeString(req))
return
}
data["android_id"] = req.AndroidId
} else if req.Platform == "ios" {
_ = model.Where("idfa=?", req.Idfa).Scan(&adData)
if len(adData) == 0 {
log.Printf("AttributionHugeAmount: adData is nil %s", gjson.MustEncodeString(req))
return
}
data["idfv"] = req.Idfv
}
url := "https://analytics.oceanengine.com/sdk/app/attribution"
@ -130,13 +142,18 @@ func AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.AT
return
}
if json.Get("code").Int() == 0 {
if json != nil && json.Get("code").Int() == 0 {
callbackUrl := json.Get("callback_url").String()
callbackParam := json.Get("callback_param").String()
lastTouchTime := json.Get("last_touch_time").Int64()
model := dao.AdvertisementOceanegine.Ctx(ctx)
_, _ = model.Insert(do.AdvertisementOceanegine{AdvAndroidId: req.AndroidId, AdvIdfv: req.Idfv, CallbackUrl: callbackUrl, CallbackParam: callbackParam, LastTouchTime: lastTouchTime})
advertiseData := do.AdvertisementOceanegine{AdvAndroidId: req.AndroidId, Idfa: req.Idfa, AdvIdfv: req.Idfv,
CallbackUrl: callbackUrl, CallbackParam: callbackParam, LastTouchTime: lastTouchTime * 1000}
if req.Platform == "android" {
advertiseData.Os = 0
} else if req.Platform == "ios" {
advertiseData.Os = 1
}
_, _ = dao.AdvertisementOceanegine.Ctx(ctx).Insert(data)
} else {
return nil, gerror.New("获取失败")
}
@ -146,16 +163,24 @@ func AttributionHugeAmount(ctx context.Context, req *game.ATHAReq) (res *game.AT
func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSHARes, err error) {
log.Printf("ConversionHugeAmount: %s", gjson.MustEncodeString(req))
adData := []entity.AdvertisementOceanegine{}
var adData []entity.AdvertisementOceanegine
device := map[string]interface{}{
"platform": req.Platform,
}
model := dao.AdvertisementOceanegine.Ctx(ctx).Order("last_touch_time desc")
if req.Platform == "android" {
_ = model.Where("adv_android_id=?", req.Id).Scan(&adData)
if len(adData) == 0 {
log.Printf("ConversionHugeAmount: adData is nil %s", gjson.MustEncodeString(req))
return
}
device["android_id"] = req.Id
} else if req.Platform == "ios" {
_ = model.Where("adv_idfv=?", req.Id).Scan(&adData)
_ = model.Where("idfa=?", req.Idfa).Scan(&adData)
if len(adData) == 0 {
log.Printf("ConversionHugeAmount: adData is nil %s", gjson.MustEncodeString(req))
return
}
device["idfv"] = req.Id
}
ad := map[string]interface{}{
@ -178,30 +203,32 @@ func ConversionHugeAmount(ctx context.Context, req *game.CSHAReq) (res *game.CSH
func AdvertiseHugeAmount(ctx context.Context, req *game.AdvertiseHAReq) (res *game.AdvertiseHARes, err error) {
req.Platform = strings.ToLower(req.Platform)
log.Printf("AdvertiseHugeAmount: %s", gjson.MustEncodeString(req))
if req.EventType == "active" {
req1 := game.ATHAReq{
Platform: req.Platform,
PackageName: req.PackageName,
}
if req.Platform == "android" {
req1.AndroidId = req.Id
} else if req.Platform == "ios" {
req1.Idfv = req.Id
} else {
return
}
_, err = AttributionHugeAmount(ctx, &req1)
if err != nil {
return
}
if req.Platform == "android" {
return
}
req2 := game.CSHAReq{
Platform: req.Platform,
Id: req.Id,
Idfa: req.Idfa,
EventType: req.EventType,
}
req2.Id = req.Id
_, err = ConversionHugeAmount(ctx, &req2)
req1 := game.ATHAReq{
Platform: req.Platform,
PackageName: req.PackageName,
}
if req.Platform == "android" {
req1.AndroidId = req.Id
} else if req.Platform == "ios" {
req1.Idfv = req.Id
} else {
return
}
_, err = AttributionHugeAmount(ctx, &req1)
if err != nil {
return
}
return
}

40
internal/serviceGame/internal/basicinfo.go

@ -712,7 +712,7 @@ func GetItemLog(ctx context.Context, req *game.GetItemLogReq) (res *game.GetItem
model = model.Where("item_id=? ", req.ItemId)
}
res.Total, err = model.Count()
err = model.Page(req.PageNum, req.PageSize).Scan(&res.Logs)
err = model.Page(req.PageNum, req.PageSize).Order("c_time desc").Scan(&res.Logs)
if err != nil {
return
}
@ -895,6 +895,31 @@ func LoginOut(ctx context.Context, req *game.LoginOutReq) (res *game.LoginOutRes
Item7312: req.Item7312,
Item7319: req.Item7319,
})
if req.StoneAmount > 50000 || req.VouchersNum > 400 || req.Item7307 > 1000 || req.Item7315 > 50 ||
req.Item7316 > 1000 || req.Item7319 > 1000 || req.Item7312 > 50 || (req.RechargeTotal == 0 && req.VouchersNum > 10) {
_, err = dao.LoginLogoutInfoGm.Ctx(ctx).Insert(&do.LoginLogoutInfoGm{
Uid: req.Uid,
State: req.State,
Day: req.Day,
GameTime: req.GameTime,
Scale: req.Scale,
VillagerNum: req.VillagerNum,
Copper: req.Copper,
GoldIngot: req.GoldIngot,
BaseFood: req.BaseFood,
Prosperity: req.Prosperity,
Server: req.Server,
VouchersNum: req.VouchersNum,
RechargeTotal: req.RechargeTotal,
StoreSum: req.StoreSum,
StoneAmount: req.StoneAmount,
Item7307: req.Item7307,
Item7315: req.Item7315,
Item7316: req.Item7316,
Item7312: req.Item7312,
Item7319: req.Item7319,
})
}
}
if gtime.Timestamp()-online[req.Server] > 2 {
online[req.Server] = gtime.Timestamp()
@ -1110,3 +1135,16 @@ func GameUserDel(ctx context.Context, req *game.UserDelReq) (res *game.UserDelRe
})
return
}
func GetOperLog(ctx context.Context, req *game.GetOperLogReq) (res *game.GetOperLogRes, err error) {
res = new(game.GetOperLogRes)
err = g.Try(ctx, func(ctx context.Context) {
if req.Label == "" {
req.Label = "/api/v1/game/mange/setclientgm"
}
model := dao.SysOperLog.Ctx(ctx).Where("oper_url=?", req.Label)
res.Total, err = model.Count()
err = model.Page(req.PageNum, req.PageSize).Order("oper_time desc").Scan(&res.List)
})
return
}

6
internal/serviceGame/manage.go

@ -33,6 +33,7 @@ type IGameManage interface {
RegisterCount(ctx context.Context, req *game.RegisterCountReq) (res *game.RegisterCountRes, err error)
GetShopItemLog(ctx context.Context, req *game.GetShopItemLogReq) (res *game.GetShopItemLogRes, err error)
GetShopItemList(ctx context.Context, req *game.GetShopItemListReq) (res *game.GetShopItemListRes, err error)
GetOperLog(ctx context.Context, req *game.GetOperLogReq) (res *game.GetOperLogRes, err error)
}
type gameManageImpl struct {
@ -352,3 +353,8 @@ func (ga *gameManageImpl) GetShopItemList(ctx context.Context, req *game.GetShop
res, err = internal.GetShopItemList(ctx, req)
return
}
func (ga *gameManageImpl) GetOperLog(ctx context.Context, req *game.GetOperLogReq) (res *game.GetOperLogRes, err error) {
res, err = internal.GetOperLog(ctx, req)
return
}

Loading…
Cancel
Save