huangjiajun há 1 ano
ascendente
cometimento
db3fed0713
25 ficheiros alterados com 1073 adições e 77 eliminações
  1. +109
    -0
      app/db/db_hw_order.go
  2. +11
    -1
      app/db/db_master_amount.go
  3. +30
    -0
      app/db/model/hw_order.go
  4. +1
    -0
      app/db/model/master_amount.go
  5. +27
    -0
      app/db/official/db_master_list_cfg.go
  6. +15
    -0
      app/db/official/db_user_app_list.go
  7. +9
    -0
      app/db/official/model/master_list_cfg.go
  8. +33
    -0
      app/db/official/model/user_app_list.go
  9. +10
    -0
      app/hdl/zhimeng_internal/hdl_hw_order.go
  10. +80
    -2
      app/hdl/zhimeng_platform/hdl_order_list.go
  11. +1
    -0
      app/router/router.go
  12. +15
    -0
      app/svc/platform/svc_app_list.go
  13. +91
    -0
      app/svc/platform/svc_hw_order_list.go
  14. +6
    -50
      app/svc/platform/svc_order_list.go
  15. +51
    -13
      app/svc/platform/svc_withdrawal.go
  16. +35
    -0
      app/svc/svc_hw_order.go
  17. +17
    -3
      app/task/init.go
  18. +15
    -0
      app/task/md/cron_key.go
  19. +184
    -0
      app/task/svc/svc_hw_order.go
  20. +111
    -0
      app/task/svc/svc_hw_order_settle.go
  21. +5
    -5
      app/task/svc/svc_master_month_settle.go
  22. +2
    -2
      app/task/svc/svc_playlet_order_settle.go
  23. +191
    -0
      app/task/task_hw_order.go
  24. +22
    -0
      app/task/task_hw_order_settle.go
  25. +2
    -1
      go.mod

+ 109
- 0
app/db/db_hw_order.go Ver ficheiro

@@ -0,0 +1,109 @@
package db

import (
"applet/app/db/model"
"applet/app/utils"
"fmt"
)

func GetHwOrderByOne(oid, mid, types string) *model.HwOrder {
var data model.HwOrder
get, err := ZhimengDb.Where("uid=? and oid=? and type=?", mid, oid, types).Get(&data)
if get == false || err != nil {
fmt.Println(err)
return nil
}
return &data
}
func GetHwOrderList(args map[string]string) []model.HwOrder {
/***
p 页数
size 个数
start_time 开始时间
end_time 结束时间
ord_type 订单类型
video_type 视频类型
status 订单状态
settle_status 结算状态
oid 订单号
sort 排序
is_to_settle 智盟结算
to_settle_time 结算上月时间
*/
var data = make([]model.HwOrder, 0)
size := utils.StrToInt(args["size"])
offet := (utils.StrToInt(args["p"]) - 1) * size
sess := ZhimengDb.Where("1=1")
if args["start_time"] != "" {
sess = sess.And("update_time>=?", args["start_time"])
}
if args["end_time"] != "" {
sess = sess.And("update_time<=?", args["end_time"])
}
if args["type"] != "" {
sess = sess.And("type=?", args["type"])
}
if args["uid"] != "" {
sess = sess.And("uid=?", args["uid"])
}
if args["status"] != "" {
sess = sess.And("status=?", args["status"])
}
if args["to_settle_time"] != "" {
sess = sess.And("create_time<?", args["to_settle_time"])
}
sort := "update_time desc,id desc"
if args["sort"] != "" {
sort = args["sort"]
}
if args["is_to_settle"] == "1" {
sess = sess.And("settle_time=?", 0)
}
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
}
func GetHwOrderListTotal(args map[string]string) ([]model.HwOrder, int64) {
var data = make([]model.HwOrder, 0)
size := utils.StrToInt(args["size"])
offet := (utils.StrToInt(args["p"]) - 1) * size
sess := ZhimengDb.Where("1=1")
if args["start_time"] != "" {
sess = sess.And("create_time>=?", args["start_time"])
}
if args["end_time"] != "" {
sess = sess.And("create_time<=?", args["end_time"])
}
if args["type"] != "" {
sess = sess.And("type=?", args["type"])
}
if args["settle_type"] == "0" {
sess = sess.And("settle_time=?", 0)
}
if args["settle_type"] == "1" {
sess = sess.And("settle_time>?", 0)
}
if args["uid"] != "" {
sess = sess.And("uid=?", args["uid"])
}
if args["zuid"] != "" {
sess = sess.And("zuid=?", args["zuid"])
}
if args["status"] != "" {
sess = sess.And("status=?", args["status"])
}

sort := "create_time desc,id desc"
if args["sort"] != "" {
sort = args["sort"]
}

total, err := sess.Limit(size, offet).OrderBy(sort).FindAndCount(&data)
fmt.Println(err)
fmt.Println(sess.LastSQL())
return data, total
}

+ 11
- 1
app/db/db_master_amount.go Ver ficheiro

@@ -25,12 +25,22 @@ func (masterAmountDb *MasterAmountDb) GetMasterAmount(id, types string) *model.M
}
return &data
}
func (masterAmountDb *MasterAmountDb) GetMasterAmountByExtendUid(id, extendUid, types string) *model.MasterAmount {
var data model.MasterAmount
get, err := masterAmountDb.Db.Where("uid=? and type=? and extend_uid=?", id, types, extendUid).Get(&data)
if get == false || err != nil {
data = model.MasterAmount{Uid: id, ExtendUid: extendUid, Type: types, UpdateTime: time.Now()}
masterAmountDb.Db.InsertOne(&data)
}
return &data
}
func (masterAmountDb *MasterAmountDb) GetMasterAmountList(args map[string]string) *[]model.MasterAmount {
var data = make([]model.MasterAmount, 0)
size := utils.StrToInt(args["size"])
offet := (utils.StrToInt(args["p"]) - 1) * size
sess := masterAmountDb.Db.Where("last_month_amount>0")
sess.Limit(size, offet).OrderBy("id desc").Find(&data)
err := sess.Limit(size, offet).OrderBy("id desc").Find(&data)
fmt.Println(err)
return &data
}
func (masterAmountDb *MasterAmountDb) GetMasterAmountByListId(id string) *model.MasterAmount {


+ 30
- 0
app/db/model/hw_order.go Ver ficheiro

@@ -0,0 +1,30 @@
package model

type HwOrder struct {
Id int `json:"id" xorm:"not null pk autoincr index INT(11)"`
Oid string `json:"oid" xorm:"default '' comment('订单编号') VARCHAR(255)"`
Info string `json:"info" xorm:"default '' comment('商品标题') VARCHAR(100)"`
Commission float64 `json:"commission" xorm:"default 0.00 comment('佣金') DOUBLE(30,2)"`
Type string `json:"type" xorm:"default '' comment('平台') VARCHAR(100)"`
TakePhoneNumber string `json:"take_phone_number" xorm:"default '' comment('手机号') VARCHAR(100)"`
RestaurantAddress string `json:"restaurant_address" xorm:"default '' comment('地址') VARCHAR(100)"`
Uid int `json:"uid" xorm:"default 0 comment('站长id') index INT(11)"`
Payment float64 `json:"payment" xorm:"default 0.00 comment('付款金额') DOUBLE(11,2)"`
Status string `json:"status" xorm:"default '' comment('状态描述') VARCHAR(10)"`
CreateTime int `json:"create_time" xorm:"default 0 comment('订单创建时间') INT(11)"`
Fanli int `json:"fanli" xorm:"default 0 comment('是否已返利') INT(1)"`
Data string `json:"data" xorm:"comment('附加内容') LONGTEXT"`
TakeMealCode string `json:"take_meal_code" xorm:"comment('取餐口令') LONGTEXT"`
SettleTime int `json:"settle_time" xorm:"default 0 comment('返利时间') INT(11)"`
UpdateTime int `json:"update_time" xorm:"default 0 comment('订单最后更新时间') INT(11)"`
Zuid string `json:"zuid" xorm:"default '0' comment('站长平台的用户id') VARCHAR(100)"`
Extra string `json:"extra" xorm:"default '' comment('自定义参数') VARCHAR(100)"`
Code string `json:"code" xorm:"default '' comment('取餐口令') VARCHAR(100)"`
UserId string `json:"user_id" xorm:"default '' comment('自定义参数') VARCHAR(100)"`
LmJsTime int `json:"lm_js_time" xorm:"default 0 comment('结算时间') INT(11)"`
PlatformTypes string `json:"platform_types" xorm:"default '' VARCHAR(50)"`
IsShare int `json:"is_share" xorm:"default 0 INT(11)"`
RefundTime int `json:"refund_time" xorm:"default 0 comment('订单退款成功时间') INT(11)"`
OutMealTime int `json:"out_meal_time" xorm:"default 0 comment('订单出餐成功时间') INT(11)"`
ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"`
}

+ 1
- 0
app/db/model/master_amount.go Ver ficheiro

@@ -13,4 +13,5 @@ type MasterAmount struct {
LastMonthAmount string `json:"last_month_amount" xorm:"DECIMAL(20,2)"`
MonthAmount string `json:"month_amount" xorm:"DECIMAL(20,2)"`
ChangeTime time.Time `json:"change_time" xorm:"comment('标记本月是否把预估结算佣金转换') DATETIME"`
ExtendUid string `json:"extend_uid" xorm:"VARCHAR(255)"`
}

+ 27
- 0
app/db/official/db_master_list_cfg.go Ver ficheiro

@@ -0,0 +1,27 @@
package offical

import (
"applet/app/db"
"applet/app/db/model"
)

func MasterListCfgGetOneData(uid, key string) string {
var cfgList model.MasterListCfg
has, err := db.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList)
if err != nil {
return ""
}
if has == false {
cfgList = model.MasterListCfg{Uid: uid, K: key}
db.Db.InsertOne(&cfgList)
}
return cfgList.V
}
func MasterListCfgGetKeyAll(key string) *[]model.MasterListCfg {
var cfgList []model.MasterListCfg
err := db.Db.Where("`k`=? ", key).Find(&cfgList)
if err != nil {
return nil
}
return &cfgList
}

+ 15
- 0
app/db/official/db_user_app_list.go Ver ficheiro

@@ -0,0 +1,15 @@
package offical

import (
"applet/app/db"
"applet/app/db/official/model"
)

func GetUserAppList(uid string) *model.UserAppList {
var data model.UserAppList
get, err := db.Db.Where("uuid=?", uid).Get(&data)
if get == false || err != nil {
return nil
}
return &data
}

+ 9
- 0
app/db/official/model/master_list_cfg.go Ver ficheiro

@@ -0,0 +1,9 @@
package model

type MasterListCfg struct {
K string `json:"k" xorm:"not null VARCHAR(255)"`
V string `json:"v" xorm:"TEXT"`
Memo string `json:"memo" xorm:"VARCHAR(255)"`
Uid string `json:"uid" xorm:"comment('0是官方') VARCHAR(255)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
}

+ 33
- 0
app/db/official/model/user_app_list.go Ver ficheiro

@@ -0,0 +1,33 @@
package model

type UserAppList struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uuid int `json:"uuid" xorm:"not null comment('masterId') INT(10)"`
Uid int `json:"uid" xorm:"not null comment('用户ID') INT(10)"`
AppId int `json:"app_id" xorm:"not null comment('应用ID') INT(10)"`
PlanId string `json:"plan_id" xorm:"not null default '' comment('套餐ID') VARCHAR(100)"`
Expire int `json:"expire" xorm:"not null default 0 comment('过期时间') INT(10)"`
Name string `json:"name" xorm:"not null default '' comment('应用主名称') VARCHAR(32)"`
Icon string `json:"icon" xorm:"not null default '' comment('应用主图标') VARCHAR(250)"`
CreateTime int `json:"create_time" xorm:"not null default 0 comment('初次激活时间') INT(10)"`
RenewTime int `json:"renew_time" xorm:"not null default 0 comment('上次续费时间') INT(10)"`
Domain string `json:"domain" xorm:"not null default '' comment('域名') index VARCHAR(110)"`
DomainAlias string `json:"domain_alias" xorm:"not null default '' comment('域名别名') index VARCHAR(110)"`
Platform string `json:"platform" xorm:"not null default '' comment('平台信息 ios,android,applet') VARCHAR(100)"`
Info string `json:"info" xorm:"comment('平台名称如ios.name.#ddd;') TEXT"`
PayMode int `json:"pay_mode" xorm:"not null default 1 comment('付费模式,0授信,1付款') TINYINT(1)"`
Price float32 `json:"price" xorm:"not null default 0.00 comment('应用价格') FLOAT(10,2)"`
PricePay float32 `json:"price_pay" xorm:"not null default 0.00 comment('实际付款价格') FLOAT(10,2)"`
OfficialPrice float32 `json:"official_price" xorm:"not null default 0.00 comment('应用价格') FLOAT(10,2)"`
OfficialPricePay float32 `json:"official_price_pay" xorm:"not null default 0.00 comment('实际付款价格') FLOAT(10,2)"`
State int `json:"state" xorm:"not null default 0 comment('0未创建,1正常,2停用,3过期') TINYINT(1)"`
DeleteAt int `json:"delete_at" xorm:"not null default 0 TINYINT(1)"`
CustomAndroidCount int `json:"custom_android_count" xorm:"default 0 comment('客户端安卓包名重置次数') INT(11)"`
CustomIosCount int `json:"custom_ios_count" xorm:"default 0 comment('客户端ios包名重置次数') INT(11)"`
StoreAndroidCount int `json:"store_android_count" xorm:"default 0 comment('商家端安卓包名重置次数') INT(11)"`
StoreIosCount int `json:"store_ios_count" xorm:"default 0 comment('商家端ios包名重置次数') INT(11)"`
SmsPlatform string `json:"sms_platform" xorm:"default 'mob' comment('mob ljioe联江') VARCHAR(255)"`
IsClose int `json:"is_close" xorm:"default 0 comment('是否关闭') INT(1)"`
Puid int `json:"puid" xorm:"default 0 comment('') INT(11)"`
StoreRateInfo string `json:"store_rate_info" xorm:"comment('付呗商品进件费率') TEXT"`
}

+ 10
- 0
app/hdl/zhimeng_internal/hdl_hw_order.go Ver ficheiro

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

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

func GetHwOrder(c *gin.Context) {
svc.GetHwOrder(c)
}

+ 80
- 2
app/hdl/zhimeng_platform/hdl_order_list.go Ver ficheiro

@@ -1,13 +1,91 @@
package zhimeng_platform

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

func OrderList(c *gin.Context) {
platform.OrderList(c)
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
platformMaps := []string{
"starbucks", "movie", "mcdonald", "nayuki", "luckin", "pizza", "pagoda", "burger_king", "heytea", "to_kfc", "wallace", "flowerCake", "delivery", "tourism",
}
platformMap := map[string]string{
"starbucks": "星巴克", "movie": "电影", "mcdonald": "麦当劳", "nayuki": "奈雪", "luckin": "瑞幸咖啡", "pizza": "必胜客",
"pagoda": "百果园", "burger_king": "汉堡王", "heytea": "喜茶", "to_kfc": "肯德基", "wallace": "华莱士", "flowerCake": "鲜花", "delivery": "比价寄", "tourism": "出游",
}
var data = make([]map[string]string, 0)
var total int64
if utils.InArr(args["source"], platformMaps) {
data, total = platform.HwOrderList(c, args)
} else {
data, total = platform.OrderList(c, args)
}
sourceList := []map[string]string{
{"name": "短剧", "value": "video"},
{"name": "广告", "value": "adv"},
}

for k, v := range platformMap {
tmp := map[string]string{
"name": v, "value": k,
}
sourceList = append(sourceList, tmp)
}
videoList := []map[string]string{
{"name": "抖音", "value": "douyin"},
{"name": "快手", "value": "kuaishou"},
{"name": "视频号", "value": "channel"},
}
statusList := []map[string]string{
{"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,
"video_ist": videoList,
"status_list": statusList,
"settle_status_list": settleStatusList,
}
e.OutSuc(c, res, nil)
return
}
func OrderOutput(c *gin.Context) {
platform.OrderOutput(c)
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
platformMap := []string{
"starbucks", "movie", "mcdonald", "nayuki", "luckin", "pizza", "pagoda", "burger_king", "heytea", "to_kfc", "wallace", "flowerCake", "delivery", "tourism",
}
var data map[string]string
var name string
if utils.InArr(args["source"], platformMap) {
name, data = platform.HwOrderOutput(c, args)

} else {
name, data = platform.OrderOutput(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
}

+ 1
- 0
app/router/router.go Ver ficheiro

@@ -49,6 +49,7 @@ func routeInternal(r *gin.RouterGroup) {
r.Use(mw.DB) // 以下接口需要用到数据库
{
r.POST("/playlet_order", internalHdl.GetPlayletOrder)
r.POST("/hw_order", internalHdl.GetHwOrder)
r.POST("/playlet_short_link", internalHdl.GetShortLink)
}



+ 15
- 0
app/svc/platform/svc_app_list.go Ver ficheiro

@@ -0,0 +1,15 @@
package platform

import (
offical "applet/app/db/official"
"applet/app/utils"
)

func AppUserListPuid(mid string) string {
appList := offical.GetUserAppList(mid)
uid := "0"
if appList != nil && appList.Puid > 0 {
uid = utils.IntToStr(appList.Puid)
}
return uid
}

+ 91
- 0
app/svc/platform/svc_hw_order_list.go Ver ficheiro

@@ -0,0 +1,91 @@
package platform

import (
"applet/app/db"
"applet/app/utils"
"github.com/gin-gonic/gin"
"time"
)

func HwOrderList(c *gin.Context, args map[string]string) ([]map[string]string, int64) {
masterId, _ := c.Get("master_id")
args["uid"] = utils.AnyToString(masterId)
list, total := db.GetHwOrderListTotal(args)
var data = make([]map[string]string, 0)
platformMap := map[string]string{
"starbucks": "星巴克", "movie": "电影", "mcdonald": "麦当劳", "nayuki": "奈雪", "luckin": "瑞幸咖啡", "pizza": "必胜客",
"pagoda": "百果园", "burger_king": "汉堡王", "heytea": "喜茶", "to_kfc": "肯德基", "wallace": "华莱士", "flowerCake": "鲜花", "delivery": "比价寄", "tourism": "出游",
}
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")
}
var tmp = map[string]string{
"oid": v.Oid,
"uid": v.Zuid,
"title": v.Info,
"platform_fee": "0",
"commission_bili": "",
"source": platformMap[v.Type],
"amount": utils.Float64ToStr(v.Payment),
"commission": utils.Float64ToStr(v.Commission),
"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 HwOrderOutput(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": "佣金",
}
platformMap := map[string]string{
"starbucks": "星巴克", "movie": "电影", "mcdonald": "麦当劳", "nayuki": "奈雪", "luckin": "瑞幸咖啡", "pizza": "必胜客",
"pagoda": "百果园", "burger_king": "汉堡王", "heytea": "喜茶", "to_kfc": "肯德基", "wallace": "华莱士", "flowerCake": "鲜花", "delivery": "比价寄", "tourism": "出游",
}

list, _ := db.GetHwOrderListTotal(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.Oid
data["B"+i] = v.Zuid
data["C"+i] = v.Info
data["D"+i] = platformMap[v.Type]
data["E"+i] = settleTime
data["F"+i] = v.Status
data["G"+i] = utils.Float64ToStr(v.Payment)
data["H"+i] = utils.Float64ToStr(v.Commission)
}
}

return name, data
}

+ 6
- 50
app/svc/platform/svc_order_list.go Ver ficheiro

@@ -2,19 +2,14 @@ package platform

import (
"applet/app/db"
"applet/app/e"
"applet/app/md"
"applet/app/utils"
"github.com/gin-gonic/gin"
"time"
)

func OrderList(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
func OrderList(c *gin.Context, args map[string]string) ([]map[string]string, int64) {

masterId, _ := c.Get("master_id")
playletSaleOrderDb := db.PlayletSaleOrderDb{}
playletSaleOrderDb.Set()
@@ -22,7 +17,6 @@ func OrderList(c *gin.Context) {
args["sort"] = "create_time desc,id desc"
list, total := playletSaleOrderDb.GetPlayletVideoOrderListAndTotal(args)
var data = make([]map[string]string, 0)

if list != nil {
for _, v := range *list {
source := md.OrdTypeMap[v.OrdType] + md.VideoTypeMap[v.VideoType]
@@ -53,41 +47,11 @@ func OrderList(c *gin.Context) {
data = append(data, tmp)
}
}
sourceList := []map[string]string{
{"name": "短剧", "value": "video"},
{"name": "广告", "value": "adv"},
}
videoList := []map[string]string{
{"name": "抖音", "value": "douyin"},
{"name": "快手", "value": "kuaishou"},
{"name": "视频号", "value": "channel"},
}
statusList := []map[string]string{
{"name": "订单付款", "value": "订单付款"},
{"name": "订单结算", "value": "订单结算"},
}
settleStatusList := []map[string]string{
{"name": "未结算", "value": "未结算"},
{"name": "已结算", "value": "已结算"},
}
var res = map[string]interface{}{
"list": data,
"total": total,
"source_list": sourceList,
"video_ist": videoList,
"status_list": statusList,
"settle_status_list": settleStatusList,
}
e.OutSuc(c, res, nil)
return
return data, total
}

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

masterId, _ := c.Get("master_id")
playletSaleOrderDb := db.PlayletSaleOrderDb{}
playletSaleOrderDb.Set()
@@ -127,13 +91,5 @@ func OrderOutput(c *gin.Context) {
data["H"+i] = v.Commission
}
}

file := utils.Output(c, name, data)
filename := name + ".xlsx"
r := map[string]string{
"file": file,
"filename": filename,
}
e.OutSuc(c, r, nil)
return
return name, data
}

+ 51
- 13
app/svc/platform/svc_withdrawal.go Ver ficheiro

@@ -3,6 +3,7 @@ package platform
import (
"applet/app/db"
"applet/app/db/model"
offical "applet/app/db/official"
"applet/app/e"
"applet/app/utils"
"applet/app/utils/cache"
@@ -29,13 +30,23 @@ func WithdrawalIncome(c *gin.Context) {
if amountMap["alipay"] != "" {
isNeedBingAlipay = "0"
}
var res = []map[string]string{
{"name": "账户余额", "value": amountMap["amount"], "type": "amount", "tip": "", "alipay": amountMap["alipay"], "alipay_name": amountMap["alipay_name"], "is_need_bing_alipay": isNeedBingAlipay, "is_show_withdrawal": "1"},
{"name": "上月预估收益", "value": monthAmountMap["last_month_amount"], "type": "last_month_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"},
{"name": "上月预估结算收益", "value": amountMap["last_month_settle_amount"], "type": "last_month_settle_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"},
{"name": "本月预估收益", "value": monthAmountMap["month_amount"], "type": "month_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"},
{"name": "本月预估结算收益", "value": monthAmountMap["month_settle_amount"], "type": "month_settle_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"},
}
var res = make([]map[string]string, 0)
if amountMap["is_show_official_amount"] == "1" {
var tmp = map[string]string{"name": "账户一余额", "value": amountMap["amount"], "type": "amount", "tip": "", "alipay": amountMap["alipay"], "alipay_name": amountMap["alipay_name"], "is_need_bing_alipay": isNeedBingAlipay, "is_show_withdrawal": "1"}
res = append(res, tmp)
if utils.StrToInt(amountMap["puid"]) > 0 {
var tmpAgent = map[string]string{"name": "账户二余额", "value": amountMap["agent_amount"], "type": "agent_amount", "tip": "", "alipay": amountMap["alipay"], "alipay_name": amountMap["alipay_name"], "is_need_bing_alipay": isNeedBingAlipay, "is_show_withdrawal": "1"}
res = append(res, tmpAgent)
}
} else {
var tmpAgent = map[string]string{"name": "账户余额", "value": amountMap["agent_amount"], "type": "agent_amount", "tip": "", "alipay": amountMap["alipay"], "alipay_name": amountMap["alipay_name"], "is_need_bing_alipay": isNeedBingAlipay, "is_show_withdrawal": "1"}
res = append(res, tmpAgent)
}
res = append(res, map[string]string{"name": "上月预估收益", "value": monthAmountMap["last_month_amount"], "type": "last_month_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"})
res = append(res, map[string]string{"name": "上月预估结算收益", "value": amountMap["last_month_settle_amount"], "type": "last_month_settle_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"})
res = append(res, map[string]string{"name": "本月预估收益", "value": monthAmountMap["month_amount"], "type": "month_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"})
res = append(res, map[string]string{"name": "本月预估结算收益", "value": monthAmountMap["month_settle_amount"], "type": "month_settle_amount", "tip": "", "is_need_bing_alipay": "0", "is_show_withdrawal": "0"})

e.OutSuc(c, res, nil)
return
}
@@ -105,6 +116,12 @@ func WithdrawalDoing(c *gin.Context) {
return
}
amountMap := masterAmount(mid, args["type"])
puid := "0"
if args["amount_type"] == "agent_amount" {
amountMap["amount"] = amountMap["agent_amount"]
amountMap["list_id"] = amountMap["agent_list_id"]
puid = amountMap["puid"]
}
leaveAmount := utils.StrToFloat64(amountMap["amount"]) - utils.StrToFloat64(args["amount"])
if leaveAmount < 0 {
e.OutErr(c, 400, e.NewErr(400, "余额不足"))
@@ -112,9 +129,9 @@ func WithdrawalDoing(c *gin.Context) {
}
masterListCfgDb := db.MasterListCfgDb{}
masterListCfgDb.Set()
withdrawalBili := masterListCfgDb.MasterListCfgGetOneData("0", "withdrawal_bili")
invoiceBili := masterListCfgDb.MasterListCfgGetOneData("0", "invoice_bili")
withdrawalDay := masterListCfgDb.MasterListCfgGetOneData("0", "withdrawal_day")
withdrawalBili := masterListCfgDb.MasterListCfgGetOneData(puid, "withdrawal_bili")
invoiceBili := masterListCfgDb.MasterListCfgGetOneData(puid, "invoice_bili")
withdrawalDay := masterListCfgDb.MasterListCfgGetOneData(puid, "withdrawal_day")
if time.Now().Day() != utils.StrToInt(withdrawalDay) && utils.StrToInt(withdrawalDay) > 0 {
e.OutErr(c, 400, e.NewErr(400, "每月"+withdrawalDay+"号提现"))
return
@@ -158,6 +175,7 @@ func WithdrawalDoing(c *gin.Context) {
return
}
defer sess.Close()

//先扣钱
amountData := db.GetMasterAmountByListIdWithSess(sess, amountMap["list_id"])
if amountData == nil {
@@ -188,7 +206,7 @@ func WithdrawalDoing(c *gin.Context) {
Oid: "",
Title: "提现",
FlowType: "withdrawal",
ExtendUid: master.ExtendUid,
ExtendUid: puid,
}
flowInsert := db.MasterAmountFlowInsertWithSess(sess, &tmpFlow)
if flowInsert == false {
@@ -209,7 +227,7 @@ func WithdrawalDoing(c *gin.Context) {
Status: "提现审核",
HasInvoice: utils.StrToInt(args["has_invoice"]),
InvoiceBili: args["invoice_bili"],
ExtendUid: master.ExtendUid,
ExtendUid: puid,
}
insert := db.MasterWithdrawalFlowInsertWithSess(sess, &tmp)
if insert == false {
@@ -351,12 +369,32 @@ func masterAmount(mid, types string) map[string]string {
if masterInfos["id"] == "" {
return res
}

puid := AppUserListPuid(mid)
hwOwnOpen := offical.MasterListCfgGetOneData(puid, "hw_own_open")

masterAmountDb := db.MasterAmountDb{}
masterAmountDb.Set()
masterAmounts := masterAmountDb.GetMasterAmount(masterInfos["id"], types)
masterAmounts := masterAmountDb.GetMasterAmountByExtendUid(masterInfos["id"], "0", types)
if masterAmounts == nil {
return res
}
res["agent_amount"] = "0"
res["is_show_official_amount"] = "1"
res["puid"] = puid
if utils.StrToInt(puid) > 0 && hwOwnOpen == "1" {
agentMasterAmounts := masterAmountDb.GetMasterAmountByExtendUid(masterInfos["id"], puid, types)
if agentMasterAmounts != nil {
if agentMasterAmounts.Amount != "" {
res["agent_amount"] = agentMasterAmounts.Amount
}
res["agent_list_id"] = utils.IntToStr(agentMasterAmounts.Id)
masterAmounts.LastMonthAmount = utils.Float64ToStr(utils.StrToFloat64(masterAmounts.LastMonthAmount) + utils.StrToFloat64(agentMasterAmounts.LastMonthAmount))
}
if utils.StrToFloat64(masterAmounts.Amount) == 0 {
res["is_show_official_amount"] = "0"
}
}
res["amount"] = masterAmounts.Amount
if res["amount"] == "" {
res["amount"] = "0"


+ 35
- 0
app/svc/svc_hw_order.go Ver ficheiro

@@ -0,0 +1,35 @@
package svc

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

func GetHwOrder(c *gin.Context) {
var args map[string]string
if err := c.ShouldBindJSON(&args); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
args["uid"] = c.GetString("mid")
order := db.GetHwOrderList(args)
list := make([]map[string]string, 0)
for _, v := range order {
var tmp = map[string]string{
"oid": v.Oid,
"info": v.Info,
"commission": utils.Float64ToStr(v.Commission),
"status": v.Status,
"type": v.Type,
"zuid": v.Zuid,
"is_share": utils.IntToStr(v.IsShare),
"update_time": utils.IntToStr(v.UpdateTime),
"create_time": utils.IntToStr(v.CreateTime),
}
list = append(list, tmp)
}
e.OutSuc(c, list, nil)
return
}

+ 17
- 3
app/task/init.go Ver ficheiro

@@ -91,8 +91,22 @@ func initTasks() {
jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDay] = taskPlayletAdvOrderYesterday //
jobs[taskMd.ZhimengCronPlayletAdvOrderYesterDayToMoney] = taskPlayletAdvOrderYesterdayToMoney //
jobs[taskMd.ZhimengCronPlayletGoods] = taskPlayletGoods //

jobs[taskMd.ZhimengCronPlayletOrderSettle] = taskPlayletOrderSettle //
jobs[taskMd.ZhimengCronMasterMonthSettle] = taskMasterMonthSettle //
jobs[taskMd.ZhimengCronPlayletOrderSettle] = taskPlayletOrderSettle //
jobs[taskMd.ZhimengCronHwOrderSettle] = taskHwOrderSettle //
jobs[taskMd.ZhimengCronMasterMonthSettle] = taskMasterMonthSettle //
jobs[taskMd.ZhimengCronHwStarbucksOrder] = taskHwStarbucksOrder //
jobs[taskMd.ZhimengCronHwMovieOrder] = taskHwMovieOrder //
jobs[taskMd.ZhimengCronHwMcdonaldOrder] = taskHwMcdonaldOrder //
jobs[taskMd.ZhimengCronHwNayukiOrder] = taskHwNayukiOrder //
jobs[taskMd.ZhimengCronHwLuckinOrder] = taskHwLuckinOrder //
jobs[taskMd.ZhimengCronHwPizzaOrder] = taskHwPizzaOrder //
jobs[taskMd.ZhimengCronHwPagodaOrder] = taskHwPagodaOrder //
jobs[taskMd.ZhimengCronHwBurgerKingOrder] = taskHwBurgerKingOrder //
jobs[taskMd.ZhimengCronHwHeyteaOrder] = taskHwHeyteaOrder //
jobs[taskMd.ZhimengCronHwToKfcOrder] = taskHwToKfcOrder //
jobs[taskMd.ZhimengCronHwWallaceOrder] = taskHwWallaceOrder //
jobs[taskMd.ZhimengCronHwFlowerCakeOrder] = taskHwFlowerCakeOrder //
jobs[taskMd.ZhimengCronHwDeliveryOrder] = taskHwDeliveryOrder //
jobs[taskMd.ZhimengCronHwTourismOrder] = taskHwTourismOrder //

}

+ 15
- 0
app/task/md/cron_key.go Ver ficheiro

@@ -11,5 +11,20 @@ const (
ZhimengCronPlayletGoods = "zhimeng_cron_playlet_goods"

ZhimengCronPlayletOrderSettle = "zhimeng_cron_playlet_order_settle"
ZhimengCronHwOrderSettle = "zhimeng_cron_hw_order_settle"
ZhimengCronMasterMonthSettle = "zhimeng_cron_master_month_settle"
ZhimengCronHwStarbucksOrder = "zhimeng_cron_hw_starbucks_order"
ZhimengCronHwMovieOrder = "zhimeng_cron_hw_movie_order"
ZhimengCronHwMcdonaldOrder = "zhimeng_cron_hw_mcdonald_order"
ZhimengCronHwNayukiOrder = "zhimeng_cron_hw_nayuki_order"
ZhimengCronHwLuckinOrder = "zhimeng_cron_hw_luckin_order"
ZhimengCronHwPizzaOrder = "zhimeng_cron_hw_pizza_order"
ZhimengCronHwPagodaOrder = "zhimeng_cron_hw_pagoda_order"
ZhimengCronHwBurgerKingOrder = "zhimeng_cron_hw_burger_king_order"
ZhimengCronHwHeyteaOrder = "zhimeng_cron_hw_heytea_order"
ZhimengCronHwToKfcOrder = "zhimeng_cron_hw_to_kfc_order"
ZhimengCronHwWallaceOrder = "zhimeng_cron_hw_wallace_order"
ZhimengCronHwFlowerCakeOrder = "zhimeng_cron_hw_flowerCake_order"
ZhimengCronHwDeliveryOrder = "zhimeng_cron_hw_delivery_order"
ZhimengCronHwTourismOrder = "zhimeng_cron_hw_tourism_order"
)

+ 184
- 0
app/task/svc/svc_hw_order.go Ver ficheiro

@@ -0,0 +1,184 @@
package svc

import (
"applet/app/db"
"applet/app/db/model"
offical "applet/app/db/official"
"applet/app/utils"
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/hw"
"encoding/json"
"fmt"
"strings"
"time"
)

func HwLoop(method string) {
all := offical.MasterListCfgGetKeyAll("hw_share_code")
if all == nil {
return
}
for _, v := range *all {
if v.V == "" {
continue
}
data := offical.MasterListCfgGetOneData(v.Uid, "hw_own_open")
if data != "1" && utils.StrToInt(v.Uid) > 0 {
continue
}
p := 1
for true {
count := GetHwOrder(p, method, v.Uid)
if count < 50 {
break
}
p++
}
}

}

func GetHwOrder(p int, method, uid string) int {
hwShareCode := offical.MasterListCfgGetOneData(uid, "hw_share_code")
hwSecret := offical.MasterListCfgGetOneData(uid, "hw_secret")
router := ""
switch method {
case "starbucks":
router = "https://ot.jfshou.cn/sbkplus/queryStarbucksOrder"
break
case "movie":
router = "https://ot.jfshou.cn/ticket/query/order/list"
break
case "mcdonald":
router = "https://ot.jfshou.cn/api/queryMcOrder"
break
case "nayuki":
router = "https://ot.jfshou.cn/api/nayuki/order/queryOrdersByUser"
break
case "luckin":
router = "https://ot.jfshou.cn/privilege-api/luckin/external/queryOrder"
break
case "pizza":
router = "https://ot.jfshou.cn/privilege-api/pizzaHut/external/queryOrder"
break
case "pagoda":
router = "https://ot.jfshou.cn/privilege-api/pagoda/external/queryOrder"
break
case "burger_king":
router = "https://ot.jfshou.cn/privilege-api/burgerKing/external/queryOrder"
break
case "heytea":
router = "https://ot.jfshou.cn/privilege-api/heytea/external/queryOrder"
break
case "to_kfc":
router = "https://ot.jfshou.cn/api/queryOrder"
break
case "wallace":
router = "https://ot.jfshou.cn/privilege-api/wallace/external/queryOrder"
break
case "flowerCake":
router = "https://ot.jfshou.cn/privilege-api/flowercake/external/queryOrder"
break
case "delivery":
router = "https://ot.jfshou.cn/privilege-api/expressDelivery/external/queryOrder"
break
case "tourism":
router = "https://ot.jfshou.cn/privilege-api/tourism/external/queryOrder"
break
}
endTime := time.Now().Unix()
startTime := endTime - 300
params := map[string]string{
"start_time": time.Unix(startTime, 0).Format("2006-01-02 15:04:05"),
"end_time": time.Unix(endTime, 0).Format("2006-01-02 15:04:05"),
"time_type": "1",
"page_number": utils.IntToStr(p),
"page_size": "50",
}
params["share_code"] = hwShareCode
params["timestamp"] = utils.Int64ToStr(time.Now().UnixNano() / 1e6)
order, takeList := hw.HwSendOrder(router, params, hwSecret)
count := 0
if order != "" && order != "[]" {
var list = make([]map[string]interface{}, 0)
json.Unmarshal([]byte(order), &list)
count = len(list)
for _, v := range list {
AddOrder(method, v)
}
}
if takeList != "" && takeList != "[]" {
var list = make([]map[string]interface{}, 0)
json.Unmarshal([]byte(takeList), &list)
for _, v := range list {
AddOrder(method, v)
}
}
return count
}
func AddOrder(method string, order map[string]interface{}) {

statusArr := map[string]string{"FINISHED": "订单成功", "GENERATE_SUCCESS": "订单成功", "WAIT_GENERATE": "订单付款", "WAIT_PAY": "创建订单", "CLOSED": "订单失效", "CANCELED": "订单失效", "FAIL": "订单失效", "CLOSE": "订单失效", "RETURNED": "订单失效", "UNPAID": "创建订单", "PAYED": "订单付款", "DEALING": "订单付款", "SENDING": "订单付款", "ORDER_RECEIVED": "订单付款", "RECEIVED": "订单成功", "RECEIVED_ORDER": "订单付款", "WAITING_RECEIVED": "订单付款", "WAIT_OUT_MEAL": "订单付款", "MAKING": "订单付款", "ARRIVED": "订单成功", "COMPLETE": "订单成功", "REFUNDED": "订单退款", "OUT_MEAL": "订单成功"}
userId := order["extra"]
if strings.Contains(utils.AnyToString(userId), "m") == false {
return
}
isShare := 0
if strings.Contains(utils.AnyToString(userId), "share") {
isShare = 1
userId = strings.ReplaceAll(utils.AnyToString(userId), "share", "")
}
split := strings.Split(utils.AnyToString(userId), "s")
mid := strings.ReplaceAll(split[0], "m", "")
splitSecond := strings.Split(split[1], "p")
puid := splitSecond[1]
uid := splitSecond[0]
if order["modify_time"] == "" {
order["modify_time"] = order["update_time"]
}
if utils.AnyToFloat64(order["total_rebate"]) == 0 {
order["total_rebate"] = order["rebate"]
}
if order["product_detail"] == "" {
order["product_detail"] = order["product_name"]
}
if order["product_detail"] == "" {
order["product_detail"] = utils.AnyToString(order["cinema_name"]) + "-" + utils.AnyToString(order["movie_name"])
}
if order["product_detail"] == "" {
order["product_detail"] = utils.AnyToString(order["delivery_brand_name"]) + "-" + utils.AnyToString(order["delivery_goods_name"])
}
var ord = &model.HwOrder{
Oid: utils.AnyToString(order["order_no"]),
Info: utils.AnyToString(order["product_detail"]),
Commission: utils.AnyToFloat64(order["total_rebate"]),
Type: method,
TakePhoneNumber: utils.AnyToString(order["take_phone_number"]),
RestaurantAddress: utils.AnyToString(order["restaurant_address"]),
Uid: utils.StrToInt(mid),
Payment: utils.AnyToFloat64(order["settle_price"]),
Status: statusArr[utils.AnyToString(order["order_status"])],
CreateTime: int(utils.TimeStdParseUnix(utils.AnyToString(order["order_time"]))),
Data: utils.SerializeStr(order),
UpdateTime: int(utils.TimeStdParseUnix(utils.AnyToString(order["modify_time"]))),
Zuid: uid,
Extra: utils.AnyToString(order["extra"]),
Code: utils.AnyToString(order["code"]),
UserId: utils.AnyToString(order["user_id"]),
IsShare: isShare,
OutMealTime: int(utils.TimeStdParseUnix(utils.AnyToString(order["out_meal_time"]))),
ExtendUid: puid,
}
if order["refund_time"] != "" {
ord.RefundTime = int(utils.TimeStdParseUnix(utils.AnyToString(order["refund_time"])))
}
one := db.GetHwOrderByOne(ord.Oid, utils.IntToStr(ord.Uid), ord.Type)
if one == nil {
insertOne, err := db.ZhimengDb.InsertOne(ord)
fmt.Println(insertOne)
fmt.Println(err)
} else {
ord.SettleTime = one.SettleTime
db.ZhimengDb.Where("id=?", one.Id).AllCols().Update(ord)
}
return
}

+ 111
- 0
app/task/svc/svc_hw_order_settle.go Ver ficheiro

@@ -0,0 +1,111 @@
package svc

import (
"applet/app/db"
"applet/app/db/model"
"applet/app/utils"
"applet/app/utils/cache"
"fmt"
"time"
)

func HwOrderSettle() {
day := time.Now().Day()
if day < 15 {
return
}
month := utils.GetTimeRange("current_month")
fmt.Println(month)
arg := map[string]string{
"status": "订单成功",
"sort": "id desc",
"is_to_settle": "1",
"is_commission": "1",
"to_settle_time": utils.Int64ToStr(month["start"]),
"p": "1",
"size": "100",
}
order := db.GetHwOrderList(arg)
if len(order) == 0 {
return
}
fmt.Println(utils.SerializeStr(order))
platformMap := map[string]string{
"starbucks": "星巴克", "movie": "电影", "mcdonald": "麦当劳", "nayuki": "奈雪", "luckin": "瑞幸咖啡", "pizza": "必胜客",
"pagoda": "百果园", "burger_king": "汉堡王", "heytea": "喜茶", "to_kfc": "肯德基", "wallace": "华莱士", "flowerCake": "鲜花", "delivery": "比价寄", "tourism": "出游",
}
for _, v := range order {
fmt.Println("=================00")
// 加锁 防止并发提取
mutexKey := fmt.Sprintf("hw_order_settle3:%d", v.Id)
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 1800, "NX")
if err != nil {
fmt.Println("=================0")

fmt.Println(err)
continue
}
if withdrawAvailable != "OK" {
fmt.Println("=================1")

continue
}
if v.SettleTime > 0 {
fmt.Println("=================2")

continue
}
//加到上月结算
if v.Uid == 0 {
fmt.Println("=================3")

continue
}
masterDb := db.MasterDb{}
masterDb.Set()
master := masterDb.GetMaster(utils.IntToStr(v.Uid))
if master == nil {
fmt.Println("=================4")

continue
}
masterAmountDb := db.MasterAmountDb{}
masterAmountDb.Set()
amount := masterAmountDb.GetMasterAmountByExtendUid(utils.IntToStr(master.Id), v.ExtendUid, "playlet")
if amount == nil {
fmt.Println("=================5")
continue
}
if v.Commission <= 0 {
v.SettleTime = int(time.Now().Unix())
db.ZhimengDb.Where("id=?", v.Id).Update(&v)
continue
}
oldAmount := amount.LastMonthAmount
amount.LastMonthAmount = utils.Float64ToStr(utils.StrToFloat64(amount.LastMonthAmount) + v.Commission)
update := masterAmountDb.MasterAmountUpdate(amount.Id, amount)
if update == false {
fmt.Println("=================7")

continue
}
var tmp = model.MasterLastMonthAmountFlow{
Uid: utils.IntToStr(master.Id),
Time: time.Now(),
BeforeAmount: oldAmount,
Amount: utils.Float64ToStr(v.Commission),
AfterAmount: amount.LastMonthAmount,
Platform: v.Type,
Oid: v.Oid,
Title: platformMap[v.Type] + "结算",
FlowType: v.Type + "_settle",
ExtendUid: v.ExtendUid,
}
masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{}
masterLastMonthAmountFlowDb.Set()
masterLastMonthAmountFlowDb.MasterLastMonthAmountFlowInsert(&tmp)
v.SettleTime = int(time.Now().Unix())
db.ZhimengDb.Where("id=?", v.Id).Update(&v)
}
return
}

+ 5
- 5
app/task/svc/svc_master_month_settle.go Ver ficheiro

@@ -41,7 +41,7 @@ func MasterMonthSettle() {
}
masterDb := db.MasterDb{}
masterDb.Set()
master := masterDb.GetMasterId(v.Id)
master := masterDb.GetMasterId(utils.StrToInt(v.Uid))
if master == nil {
continue
}
@@ -61,10 +61,10 @@ func MasterMonthSettle() {
AfterAmount: v.Amount,
Platform: "playlet",
Oid: utils.IntToStr(v.Id),
Title: "短剧上月结算佣金到账",
Title: "上月结算佣金到账",
FlowType: "last_month_playlet_settle",
IncomeType: 0,
ExtendUid: master.ExtendUid,
ExtendUid: v.ExtendUid,
}
masterAmountFlowDb := db.MasterAmountFlowDb{}
masterAmountFlowDb.Set()
@@ -78,10 +78,10 @@ func MasterMonthSettle() {
AfterAmount: v.LastMonthAmount,
Platform: "playlet",
Oid: utils.IntToStr(v.Id),
Title: "短剧上月结算佣金转到余额",
Title: "上月结算佣金转到余额",
FlowType: "last_month_playlet_settle",
IncomeType: 1,
ExtendUid: master.ExtendUid,
ExtendUid: v.ExtendUid,
}
masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{}
masterLastMonthAmountFlowDb.Set()


+ 2
- 2
app/task/svc/svc_playlet_order_settle.go Ver ficheiro

@@ -70,7 +70,7 @@ func PlayletOrderSettle() {
}
masterAmountDb := db.MasterAmountDb{}
masterAmountDb.Set()
amount := masterAmountDb.GetMasterAmount(utils.IntToStr(master.Id), "playlet")
amount := masterAmountDb.GetMasterAmountByExtendUid(utils.IntToStr(master.Id), v.ExtendUid, "playlet")
if amount == nil {
fmt.Println("=================5")

@@ -101,7 +101,7 @@ func PlayletOrderSettle() {
Oid: v.Oid,
Title: "短剧订单结算",
FlowType: "playlet_settle",
ExtendUid: master.ExtendUid,
ExtendUid: v.ExtendUid,
}
masterLastMonthAmountFlowDb := db.MasterLastMonthAmountFlowDb{}
masterLastMonthAmountFlowDb.Set()


+ 191
- 0
app/task/task_hw_order.go Ver ficheiro

@@ -0,0 +1,191 @@
package task

import (
"applet/app/task/svc"
"math/rand"
"time"
)

//25结算上个月1-30结算订单
func taskHwStarbucksOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("starbucks")
<-ch
}
func taskHwMovieOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("movie")
<-ch
}
func taskHwMcdonaldOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("mcdonald")
<-ch
}
func taskHwNayukiOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("nayuki")
<-ch
}
func taskHwLuckinOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("luckin")
<-ch
}
func taskHwPizzaOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("pizza")
<-ch
}
func taskHwPagodaOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("pagoda")
<-ch
}
func taskHwBurgerKingOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("burger_king")
<-ch
}
func taskHwHeyteaOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("heytea")
<-ch
}
func taskHwToKfcOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("to_kfc")
<-ch
}
func taskHwWallaceOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("wallace")
<-ch
}
func taskHwFlowerCakeOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("flowerCake")
<-ch
}
func taskHwDeliveryOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("delivery")
<-ch
}
func taskHwTourismOrder() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwLoop("tourism")
<-ch
}

+ 22
- 0
app/task/task_hw_order_settle.go Ver ficheiro

@@ -0,0 +1,22 @@
package task

import (
"applet/app/task/svc"
"math/rand"
"time"
)

//
func taskHwOrderSettle() {
for {
if len(ch) > workerNum {
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
} else {
goto START
}
}
START:
ch <- 1
svc.HwOrderSettle()
<-ch
}

+ 2
- 1
go.mod Ver ficheiro

@@ -4,7 +4,7 @@ go 1.15

require (
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20230707081910-52e70aa52998
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20230805060535-47d3fd8bc8d7
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20230921025810-033e82ffb46e
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/boombuler/barcode v1.0.1
@@ -26,6 +26,7 @@ require (
github.com/sony/sonyflake v1.1.0
github.com/syyongx/php2go v0.9.7
github.com/tidwall/gjson v1.14.1
github.com/xuri/excelize/v2 v2.8.0 // indirect
go.uber.org/zap v1.16.0
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0


Carregando…
Cancelar
Guardar