diff --git a/app/db/db_playlet_sale_order.go b/app/db/db_playlet_sale_order.go index c59f579..6fa937c 100644 --- a/app/db/db_playlet_sale_order.go +++ b/app/db/db_playlet_sale_order.go @@ -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 } diff --git a/app/hdl/hdl_to_doing.go b/app/hdl/hdl_to_doing.go new file mode 100644 index 0000000..86a74ac --- /dev/null +++ b/app/hdl/hdl_to_doing.go @@ -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) +} diff --git a/app/router/router.go b/app/router/router.go index 9feb1d4..78b9c57 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -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) diff --git a/app/task/svc/svc_playlet_adv_order.go b/app/task/svc/svc_playlet_adv_order.go index 2d4bbd9..3995d42 100644 --- a/app/task/svc/svc_playlet_adv_order.go +++ b/app/task/svc/svc_playlet_adv_order.go @@ -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) diff --git a/app/task/svc/svc_playlet_order_settle.go b/app/task/svc/svc_playlet_order_settle.go index 2330dc5..94316ed 100644 --- a/app/task/svc/svc_playlet_order_settle.go +++ b/app/task/svc/svc_playlet_order_settle.go @@ -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" { diff --git a/app/task/svc/svc_playlet_video_order.go b/app/task/svc/svc_playlet_video_order.go index fb5e21a..ff20724 100644 --- a/app/task/svc/svc_playlet_video_order.go +++ b/app/task/svc/svc_playlet_video_order.go @@ -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)