@@ -90,7 +90,11 @@ func (playletSaleOrderDb *PlayletSaleOrderDb) GetPlayletVideoOrderList(args map[ | |||||
if args["is_to_settle"] == "1" { | if args["is_to_settle"] == "1" { | ||||
sess = sess.And("settle_time=?", 0) | 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()) | fmt.Println(sess.LastSQL()) | ||||
return data | return data | ||||
} | } | ||||
@@ -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) | |||||
} |
@@ -62,6 +62,7 @@ func routeInternal(r *gin.RouterGroup) { | |||||
} | } | ||||
} | } | ||||
func routeZhimeng(r *gin.RouterGroup) { | func routeZhimeng(r *gin.RouterGroup) { | ||||
r.GET("/test", hdl.Order) | |||||
r.GET("/authorizationCode", hdl.GetAuthorizationCode) | r.GET("/authorizationCode", hdl.GetAuthorizationCode) | ||||
r.GET("/token", hdl.GetToken) | r.GET("/token", hdl.GetToken) | ||||
r.POST("/rToken", hdl.RefreshToken) | r.POST("/rToken", hdl.RefreshToken) | ||||
@@ -57,7 +57,7 @@ func PlayletAdvOrder() { | |||||
"page_size": pageSize, | "page_size": pageSize, | ||||
"page_index": pageNo, | "page_index": pageNo, | ||||
} | } | ||||
count := getAdvOrder(uid, arg) | |||||
count := GetAdvOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
goto ChkArg | goto ChkArg | ||||
} | } | ||||
@@ -126,7 +126,7 @@ func PlayletAdvOrderYesterday(hours int, runtimeStr string) { | |||||
"page_size": pageSize, | "page_size": pageSize, | ||||
"page_index": pageNo, | "page_index": pageNo, | ||||
} | } | ||||
count := getAdvOrder(uid, arg) | |||||
count := GetAdvOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
break | break | ||||
} | } | ||||
@@ -193,7 +193,7 @@ func PlayletAdvOrderMonth() { | |||||
"page_size": pageSize, | "page_size": pageSize, | ||||
"page_index": pageNo, | "page_index": pageNo, | ||||
} | } | ||||
count := getAdvOrder(uid, arg) | |||||
count := GetAdvOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
break | break | ||||
} | } | ||||
@@ -215,7 +215,7 @@ func PlayletAdvOrderMonth() { | |||||
建议在次日12:00后拉取后更新,可以将channel,source_id,created_time联合作为唯一索引, | 建议在次日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) | list := make([]map[string]string, 0) | ||||
token := GetTpdarenToken(uids) | token := GetTpdarenToken(uids) | ||||
paging, err := tpdaren.AdStatisticFindPaging(token, arg) | paging, err := tpdaren.AdStatisticFindPaging(token, arg) | ||||
@@ -20,6 +20,7 @@ func PlayletOrderSettle() { | |||||
"status": "订单结算", | "status": "订单结算", | ||||
"sort": "id desc", | "sort": "id desc", | ||||
"is_to_settle": "1", | "is_to_settle": "1", | ||||
"is_commission": "1", | |||||
"to_settle_time": time.Unix(month["start"], 0).Format("2006-01-02 15:04:05"), | "to_settle_time": time.Unix(month["start"], 0).Format("2006-01-02 15:04:05"), | ||||
"p": "1", | "p": "1", | ||||
"size": "100", | "size": "100", | ||||
@@ -30,12 +31,14 @@ func PlayletOrderSettle() { | |||||
if len(order) == 0 { | if len(order) == 0 { | ||||
return | return | ||||
} | } | ||||
fmt.Println(utils.SerializeStr(order)) | |||||
for _, v := range 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") | withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 1800, "NX") | ||||
if err != nil { | if err != nil { | ||||
fmt.Println(err) | |||||
continue | continue | ||||
} | } | ||||
if withdrawAvailable != "OK" { | if withdrawAvailable != "OK" { | ||||
@@ -53,7 +53,7 @@ func PlayletVideoOrder() { | |||||
"page_size": pageSize, | "page_size": pageSize, | ||||
"page_index": pageNo, | "page_index": pageNo, | ||||
} | } | ||||
count := getVideoOrder(uid, arg) | |||||
count := GetVideoOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
goto ChkArg | goto ChkArg | ||||
} | } | ||||
@@ -113,7 +113,7 @@ func PlayletVideoOrderYesterDay() { | |||||
"page_index": pageNo, | "page_index": pageNo, | ||||
"status": 2, | "status": 2, | ||||
} | } | ||||
count := getVideoOrder(uid, arg) | |||||
count := GetVideoOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
break | break | ||||
} | } | ||||
@@ -181,7 +181,7 @@ func PlayletVideoOrderMonth() { | |||||
"page_size": pageSize, | "page_size": pageSize, | ||||
"page_index": pageNo, | "page_index": pageNo, | ||||
} | } | ||||
count := getVideoOrder(uid, arg) | |||||
count := GetVideoOrder(uid, arg) | |||||
if count == 0 { | if count == 0 { | ||||
break | break | ||||
} | } | ||||
@@ -201,7 +201,7 @@ func PlayletVideoOrderMonth() { | |||||
注意 在选择status为2退款时,start,end的筛选字段将是退款时间,时间范围最大为30天 | 注意 在选择status为2退款时,start,end的筛选字段将是退款时间,时间范围最大为30天 | ||||
建议 所有订单:实时订单,延迟最多1分钟内。退款订单:建议每日凌晨1点后拉取一次昨日退款订单。 | 建议 所有订单:实时订单,延迟最多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) | list := make([]map[string]string, 0) | ||||
token := GetTpdarenToken(uids) | token := GetTpdarenToken(uids) | ||||
paging, err := tpdaren.OrderFindPaging(token, arg) | paging, err := tpdaren.OrderFindPaging(token, arg) | ||||