Browse Source

test

master
huangjiajun 1 year ago
parent
commit
b3d594c402
5 changed files with 53 additions and 25 deletions
  1. +13
    -3
      app/db/db_master_list_cfg.go
  2. +2
    -1
      app/db/db_playlet_sale_order.go
  3. +8
    -7
      app/task/md/playlet_order.go
  4. +15
    -7
      app/task/svc/svc_playlet_adv_order.go
  5. +15
    -7
      app/task/svc/svc_playlet_video_order.go

+ 13
- 3
app/db/db_master_list_cfg.go View File

@@ -45,16 +45,26 @@ func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOneNoDataNoErr(key strin

func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOne(uid, key string) (*model.MasterListCfg, error) {
var cfgList model.MasterListCfg
if has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList); err != nil || has == false {
has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
if err != nil {
return nil, logx.Error(err)
}
if has == false {
cfgList = model.MasterListCfg{Uid: uid, K: key}
masterListCfgDb.Db.InsertOne(&cfgList)
}
return &cfgList, nil
}
func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOneData(uid, key string) string {
var cfgList model.MasterListCfg
if has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList); err != nil || has == false {
has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
if err != nil {
return ""
}
if has == false {
cfgList = model.MasterListCfg{Uid: uid, K: key}
masterListCfgDb.Db.InsertOne(&cfgList)
}
return cfgList.V
}

@@ -70,7 +80,7 @@ func (masterListCfgDb *MasterListCfgDb) MasterListCfgInsert(uid, key, val, memo

func (masterListCfgDb *MasterListCfgDb) MasterListCfgUpdate(uid, key, val string) bool {
cfg := model.MasterListCfg{K: key, V: val}
_, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Cols("val").Update(&cfg)
_, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Cols("v").Update(&cfg)
if err != nil {
logx.Error(err)
return false


+ 2
- 1
app/db/db_playlet_sale_order.go View File

@@ -76,8 +76,9 @@ func (playletSaleOrderDb *PlayletSaleOrderDb) GetPlayletVideoOrderList(args map[
sess = sess.And("update_time>=?", args["start_time"])
}
if args["end_time"] != "" {
sess = sess.And("update_time>=?", args["end_time"])
sess = sess.And("update_time<=?", args["end_time"])
}

if args["to_settle_time"] != "" {
sess = sess.And("create_time<?", args["to_settle_time"])
}


+ 8
- 7
app/task/md/playlet_order.go View File

@@ -1,20 +1,21 @@
package md

type PlayletVideoOrder struct {
Appid int `json:"appid"`
Channel string `json:"channel"`
Appid string `json:"appid"`
OrderId string `json:"order_id"`
PayDate string `json:"pay_date"`
SettleType string `json:"settle_type"`
Price int `json:"price"`
Title string `json:"title"`
Status int `json:"status"`
PayDate string `json:"pay_date"`
RefundDate string `json:"refund_date"`
SourceId string `json:"source_id"`
Status int `json:"status"`
Title string `json:"title"`
SourceType string `json:"source_type"`
SettleType string `json:"settle_type"`
MemberId string `json:"member_id"`
Channel string `json:"channel"`
}
type PlayletAdvOrder struct {
Appid int `json:"appid"`
Appid string `json:"appid"`
Channel string `json:"channel"`
CreatedTime string `json:"created_time"`
Price int `json:"price"`


+ 15
- 7
app/task/svc/svc_playlet_adv_order.go View File

@@ -198,6 +198,12 @@ func PlayletAdvOrderMonth() {
return
}

/***
注意 广告点击pv,uv每小时统计一次,结算金额将于次日,投流平台更新数据后更新
建议 所有统计数据:每小时在整点拉取当日统计,在次日凌晨1点后拉取一次昨日所有统计数据。金额数据,
建议在次日12:00后拉取后更新,可以将channel,source_id,created_time联合作为唯一索引,
如果遇到数据更新不及时,请联系客服。
*/
func getAdvOrder(uids string, arg map[string]interface{}) int {
list := make([]map[string]string, 0)
token := GetTpdarenToken(uids)
@@ -215,19 +221,21 @@ func getAdvOrder(uids string, arg map[string]interface{}) int {
dataList := make([]md.PlayletAdvOrder, 0)
json.Unmarshal([]byte(data), &dataList)

sysCfgDb := db.MasterListCfgDb{}
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
playletKuaishouBili := sysCfgDb.MasterListCfgGetOneData(uids, "adv_kuaishou_bili")
playletDouyinBili := sysCfgDb.MasterListCfgGetOneData(uids, "adv_douyin_bili")
playletChannelBili := sysCfgDb.MasterListCfgGetOneData(uids, "adv_channel_bili")
playletKuaishouBili := sysCfgDb.SysCfgGetOneData("adv_kuaishou_bili")
playletDouyinBili := sysCfgDb.SysCfgGetOneData("adv_douyin_bili")
playletChannelBili := sysCfgDb.SysCfgGetOneData("adv_channel_bili")
var biliMap = map[string]string{
"kuaishou": playletKuaishouBili,
"douyin": playletDouyinBili,
"channel": playletChannelBili,
}
zyPlayletKuaishouBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_adv_kuaishou_bili")
zyPlayletDouyinBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_adv_douyin_bili")
zyPlayletChannelBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_adv_channel_bili")
masterListCfgDb := db.MasterListCfgDb{}
masterListCfgDb.Set()
zyPlayletKuaishouBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_adv_kuaishou_bili")
zyPlayletDouyinBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_adv_douyin_bili")
zyPlayletChannelBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_adv_channel_bili")
var zyBiliMap = map[string]string{
"kuaishou": zyPlayletKuaishouBili,
"douyin": zyPlayletDouyinBili,


+ 15
- 7
app/task/svc/svc_playlet_video_order.go View File

@@ -111,6 +111,7 @@ func PlayletVideoOrderYesterDay() {
"end": time.Unix(endTime, 0).Format("2006-01-02 15:04:05"),
"page_size": pageSize,
"page_index": pageNo,
"status": 2,
}
count := getVideoOrder(uid, arg)
if count == 0 {
@@ -189,6 +190,11 @@ func PlayletVideoOrderMonth() {
syscfgDb.MasterListCfgUpdate(uid, key, time.Unix(endTime, 0).Format("2006-01-02 15:04:05"))
return
}

/***
注意 在选择status为2退款时,start,end的筛选字段将是退款时间,时间范围最大为30天
建议 所有订单:实时订单,延迟最多1分钟内。退款订单:建议每日凌晨1点后拉取一次昨日退款订单。
*/
func getVideoOrder(uids string, arg map[string]interface{}) int {
list := make([]map[string]string, 0)
token := GetTpdarenToken(uids)
@@ -206,19 +212,21 @@ func getVideoOrder(uids string, arg map[string]interface{}) int {
dataList := make([]md.PlayletVideoOrder, 0)
json.Unmarshal([]byte(data), &dataList)

sysCfgDb := db.MasterListCfgDb{}
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
playletKuaishouBili := sysCfgDb.MasterListCfgGetOneData(uids, "playlet_kuaishou_bili")
playletDouyinBili := sysCfgDb.MasterListCfgGetOneData(uids, "playlet_douyin_bili")
playletChannelBili := sysCfgDb.MasterListCfgGetOneData(uids, "playlet_channel_bili")
playletKuaishouBili := sysCfgDb.SysCfgGetOneData("playlet_kuaishou_bili")
playletDouyinBili := sysCfgDb.SysCfgGetOneData("playlet_douyin_bili")
playletChannelBili := sysCfgDb.SysCfgGetOneData("playlet_channel_bili")
var biliMap = map[string]string{
"kuaishou": playletKuaishouBili,
"douyin": playletDouyinBili,
"channel": playletChannelBili,
}
zyPlayletKuaishouBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_kuaishou_bili")
zyPlayletDouyinBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_douyin_bili")
zyPlayletChannelBili := sysCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_channel_bili")
masterListCfgDb := db.MasterListCfgDb{}
masterListCfgDb.Set()
zyPlayletKuaishouBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_kuaishou_bili")
zyPlayletDouyinBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_douyin_bili")
zyPlayletChannelBili := masterListCfgDb.MasterListCfgGetOneData(uids, "zy_playlet_channel_bili")
var zyBiliMap = map[string]string{
"kuaishou": zyPlayletKuaishouBili,
"douyin": zyPlayletDouyinBili,


Loading…
Cancel
Save