huangjiajun преди 5 месеца
родител
ревизия
a1ce4fc787
променени са 4 файла, в които са добавени 175 реда и са изтрити 1 реда
  1. +0
    -1
      app/hdl/zhimeng_platform/hdl_guide_order_list.go
  2. +64
    -0
      app/hdl/zhimeng_platform/hdl_life_order_list.go
  3. +4
    -0
      app/hdl/zhimeng_platform/hdl_new_order_list.go
  4. +107
    -0
      app/svc/platform/svc_life_order_list.go

+ 0
- 1
app/hdl/zhimeng_platform/hdl_guide_order_list.go Целия файл

@@ -19,7 +19,6 @@ func GuideOrderList(c *gin.Context) {
"csjp_live": "穿山甲抖音直播商品",
"kuaishou": "快手",
"kuaishou_live": "快手直播商品",
"meituan": "美团",
}

data, total := platform.GuideOrderList(c, args)


+ 64
- 0
app/hdl/zhimeng_platform/hdl_life_order_list.go Целия файл

@@ -0,0 +1,64 @@
package zhimeng_platform

import (
"applet/app/e"
"applet/app/svc/platform"
"applet/app/utils"
"github.com/gin-gonic/gin"
)

func LifeOrderList(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
platformMap := map[string]string{
"meituan": "美团",
}

data, total := platform.LifeOrderList(c, args)
var sourceList []map[string]string

for k, v := range platformMap {
tmp := map[string]string{
"name": v, "value": k,
}
sourceList = append(sourceList, tmp)
}
statusList := []map[string]string{
{"name": "订单付款", "value": "订单付款"},
{"name": "订单成功", "value": "订单成功"},
{"name": "订单结算", "value": "订单结算"},
{"name": "订单退款", "value": "订单退款"},
}
settleStatusList := []map[string]string{
{"name": "未结算", "value": "未结算"},
{"name": "已结算", "value": "已结算"},
}
var res = map[string]interface{}{
"list": data,
"total": total,
"source_list": sourceList,
"status_list": statusList,
"settle_status_list": settleStatusList,
}
e.OutSuc(c, res, nil)
return
}
func LifeOrderOutput(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
name, data := platform.LifeOrderOutput(c, args)
file := utils.Output(c, name, data)
filename := name + ".xlsx"
r := map[string]string{
"file": file,
"filename": filename,
}
e.OutSuc(c, r, nil)
return
}

+ 4
- 0
app/hdl/zhimeng_platform/hdl_new_order_list.go Целия файл

@@ -15,6 +15,8 @@ func NewOrderList(c *gin.Context) {
break
case "guide":
GuideOrderList(c)
case "life":
LifeOrderList(c)
}

}
@@ -29,5 +31,7 @@ func NewOrderOutput(c *gin.Context) {
break
case "guide":
GuideOrderOutput(c)
case "life":
LifeOrderOutput(c)
}
}

+ 107
- 0
app/svc/platform/svc_life_order_list.go Целия файл

@@ -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
}

Зареждане…
Отказ
Запис