|
|
@@ -0,0 +1,107 @@ |
|
|
|
package platform |
|
|
|
|
|
|
|
import ( |
|
|
|
"applet/app/db" |
|
|
|
"applet/app/utils" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
func LifeOrderList(c *gin.Context, args map[string]string) ([]map[string]string, int64) { |
|
|
|
masterId, _ := c.Get("master_id") |
|
|
|
args["uid"] = utils.AnyToString(masterId) |
|
|
|
list, total := db.GetLifeOrderListTotal(args) |
|
|
|
var data = make([]map[string]string, 0) |
|
|
|
platformMap := map[string]string{ |
|
|
|
"tikTok_life": "抖音本地生活", |
|
|
|
"csjp": "穿山甲抖音", |
|
|
|
"csjp_live": "穿山甲抖音直播商品", |
|
|
|
"kuaishou": "快手", |
|
|
|
"kuaishou_live": "快手直播商品", |
|
|
|
"meituan": "美团", |
|
|
|
} |
|
|
|
if len(list) > 0 { |
|
|
|
for _, v := range list { |
|
|
|
settleStatus := "未结算" |
|
|
|
settleTime := "-" |
|
|
|
if v.SettleTime > 0 { |
|
|
|
settleStatus = "已结算" |
|
|
|
settleTime = time.Unix(int64(v.SettleTime), 0).Format("2006-01-02 15:04:05") |
|
|
|
} |
|
|
|
platformSettleTime := "-" |
|
|
|
if v.SettleTime > 0 { |
|
|
|
platformSettleTime = time.Unix(int64(v.PlatformSettleTime), 0).Format("2006-01-02 15:04:05") |
|
|
|
} |
|
|
|
var tmp = map[string]string{ |
|
|
|
"oid": v.PvdOid, |
|
|
|
"uid": utils.IntToStr(v.StationUid), |
|
|
|
"title": v.Title, |
|
|
|
"platform_fee": "0", |
|
|
|
"commission_bili": "", |
|
|
|
"source": platformMap[v.Pvd], |
|
|
|
"amount": v.Payment, |
|
|
|
"commission": v.Commission, |
|
|
|
"platform_settle_time": platformSettleTime, |
|
|
|
"real_commission": v.RealCommission, |
|
|
|
"status": v.Status, |
|
|
|
"settle_status": settleStatus, |
|
|
|
"create_time": time.Unix(int64(v.CreateTime), 0).Format("2006-01-02 15:04:05"), |
|
|
|
"settle_time": settleTime, |
|
|
|
} |
|
|
|
data = append(data, tmp) |
|
|
|
} |
|
|
|
} |
|
|
|
return data, total |
|
|
|
} |
|
|
|
|
|
|
|
func LifeOrderOutput(c *gin.Context, args map[string]string) (string, map[string]string) { |
|
|
|
masterId, _ := c.Get("master_id") |
|
|
|
args["mid"] = utils.AnyToString(masterId) |
|
|
|
args["size"] = "3000" |
|
|
|
if args["ids"] != "" { |
|
|
|
args["size"] = "0" |
|
|
|
} |
|
|
|
name := "订单_" + args["p"] |
|
|
|
//写入数据 |
|
|
|
data := map[string]string{ |
|
|
|
"A1": "订单号", |
|
|
|
"B1": "会员ID", |
|
|
|
"C1": "标题", |
|
|
|
"D1": "来源", |
|
|
|
"E1": "结算时间", |
|
|
|
"F1": "订单状态", |
|
|
|
"G1": "金额", |
|
|
|
"H1": "预估佣金", |
|
|
|
"I1": "实际佣金", |
|
|
|
} |
|
|
|
platformMap := map[string]string{ |
|
|
|
"tikTok_life": "抖音本地生活", |
|
|
|
"csjp": "穿山甲抖音", |
|
|
|
"csjp_live": "穿山甲抖音直播商品", |
|
|
|
"kuaishou": "快手", |
|
|
|
"kuaishou_live": "快手直播商品", |
|
|
|
"meituan": "美团", |
|
|
|
} |
|
|
|
|
|
|
|
list, _ := db.GetGuideOrderListTotal(args) |
|
|
|
if len(list) > 0 { |
|
|
|
for k, v := range list { |
|
|
|
settleTime := "-" |
|
|
|
if v.SettleTime > 0 { |
|
|
|
settleTime = time.Unix(int64(v.SettleTime), 0).Format("2006-01-02 15:04:05") |
|
|
|
} |
|
|
|
i := utils.IntToStr(k + 2) |
|
|
|
data["A"+i] = v.PvdOid |
|
|
|
data["B"+i] = utils.IntToStr(v.StationUid) |
|
|
|
data["C"+i] = v.Title |
|
|
|
data["D"+i] = platformMap[v.Pvd] |
|
|
|
data["E"+i] = settleTime |
|
|
|
data["F"+i] = v.Status |
|
|
|
data["G"+i] = v.Payment |
|
|
|
data["H"+i] = v.Commission |
|
|
|
data["I"+i] = v.RealCommission |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return name, data |
|
|
|
} |