Browse Source

更新

master
huangjiajun 1 year ago
parent
commit
f2d98e6f8c
6 changed files with 34 additions and 10 deletions
  1. +5
    -1
      app/db/db_playlet_sale_order.go
  2. +16
    -0
      app/hdl/hdl_to_doing.go
  3. +1
    -0
      app/router/router.go
  4. +4
    -4
      app/task/svc/svc_playlet_adv_order.go
  5. +4
    -1
      app/task/svc/svc_playlet_order_settle.go
  6. +4
    -4
      app/task/svc/svc_playlet_video_order.go

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

@@ -90,7 +90,11 @@ func (playletSaleOrderDb *PlayletSaleOrderDb) GetPlayletVideoOrderList(args map[
if args["is_to_settle"] == "1" {
sess = sess.And("settle_time=?", 0)
}
sess.Limit(size, offet).OrderBy(sort).Find(&data)
if args["is_commission"] == "1" {
sess = sess.And("commission>?", 0)
}
err := sess.Limit(size, offet).OrderBy(sort).Find(&data)
fmt.Println(err)
fmt.Println(sess.LastSQL())
return data
}


+ 16
- 0
app/hdl/hdl_to_doing.go View File

@@ -0,0 +1,16 @@
package hdl

import (
"applet/app/task/svc"
"github.com/gin-gonic/gin"
)

func Order(c *gin.Context) {
arg := map[string]interface{}{
"start": "2023-07-08",
"end": "2023-07-09",
"page_size": 100,
"page_index": 1,
}
svc.GetAdvOrder("0", arg)
}

+ 1
- 0
app/router/router.go View File

@@ -62,6 +62,7 @@ func routeInternal(r *gin.RouterGroup) {
}
}
func routeZhimeng(r *gin.RouterGroup) {
r.GET("/test", hdl.Order)
r.GET("/authorizationCode", hdl.GetAuthorizationCode)
r.GET("/token", hdl.GetToken)
r.POST("/rToken", hdl.RefreshToken)


+ 4
- 4
app/task/svc/svc_playlet_adv_order.go View File

@@ -57,7 +57,7 @@ func PlayletAdvOrder() {
"page_size": pageSize,
"page_index": pageNo,
}
count := getAdvOrder(uid, arg)
count := GetAdvOrder(uid, arg)
if count == 0 {
goto ChkArg
}
@@ -126,7 +126,7 @@ func PlayletAdvOrderYesterday(hours int, runtimeStr string) {
"page_size": pageSize,
"page_index": pageNo,
}
count := getAdvOrder(uid, arg)
count := GetAdvOrder(uid, arg)
if count == 0 {
break
}
@@ -193,7 +193,7 @@ func PlayletAdvOrderMonth() {
"page_size": pageSize,
"page_index": pageNo,
}
count := getAdvOrder(uid, arg)
count := GetAdvOrder(uid, arg)
if count == 0 {
break
}
@@ -215,7 +215,7 @@ func PlayletAdvOrderMonth() {
建议在次日12:00后拉取后更新,可以将channel,source_id,created_time联合作为唯一索引,
如果遇到数据更新不及时,请联系客服。
*/
func getAdvOrder(uids string, arg map[string]interface{}) int {
func GetAdvOrder(uids string, arg map[string]interface{}) int {
list := make([]map[string]string, 0)
token := GetTpdarenToken(uids)
paging, err := tpdaren.AdStatisticFindPaging(token, arg)


+ 4
- 1
app/task/svc/svc_playlet_order_settle.go View File

@@ -20,6 +20,7 @@ func PlayletOrderSettle() {
"status": "订单结算",
"sort": "id desc",
"is_to_settle": "1",
"is_commission": "1",
"to_settle_time": time.Unix(month["start"], 0).Format("2006-01-02 15:04:05"),
"p": "1",
"size": "100",
@@ -30,12 +31,14 @@ func PlayletOrderSettle() {
if len(order) == 0 {
return
}
fmt.Println(utils.SerializeStr(order))

for _, v := range order {
// 加锁 防止并发提取
mutexKey := fmt.Sprintf("playlet_order_settle:%s", v.CustomOid)
mutexKey := fmt.Sprintf("playlet_order_settle1:%s", v.CustomOid)
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 1800, "NX")
if err != nil {
fmt.Println(err)
continue
}
if withdrawAvailable != "OK" {


+ 4
- 4
app/task/svc/svc_playlet_video_order.go View File

@@ -53,7 +53,7 @@ func PlayletVideoOrder() {
"page_size": pageSize,
"page_index": pageNo,
}
count := getVideoOrder(uid, arg)
count := GetVideoOrder(uid, arg)
if count == 0 {
goto ChkArg
}
@@ -113,7 +113,7 @@ func PlayletVideoOrderYesterDay() {
"page_index": pageNo,
"status": 2,
}
count := getVideoOrder(uid, arg)
count := GetVideoOrder(uid, arg)
if count == 0 {
break
}
@@ -181,7 +181,7 @@ func PlayletVideoOrderMonth() {
"page_size": pageSize,
"page_index": pageNo,
}
count := getVideoOrder(uid, arg)
count := GetVideoOrder(uid, arg)
if count == 0 {
break
}
@@ -201,7 +201,7 @@ func PlayletVideoOrderMonth() {
注意 在选择status为2退款时,start,end的筛选字段将是退款时间,时间范围最大为30天
建议 所有订单:实时订单,延迟最多1分钟内。退款订单:建议每日凌晨1点后拉取一次昨日退款订单。
*/
func getVideoOrder(uids string, arg map[string]interface{}) int {
func GetVideoOrder(uids string, arg map[string]interface{}) int {
list := make([]map[string]string, 0)
token := GetTpdarenToken(uids)
paging, err := tpdaren.OrderFindPaging(token, arg)


Loading…
Cancel
Save