@@ -0,0 +1,13 @@ | |||||
package model | |||||
type HcCardCate struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr index INT(11)"` | |||||
AccountType string `json:"account_type" xorm:"default '' comment('账号类型') VARCHAR(100)"` | |||||
GId int `json:"g_id" xorm:"default 0 comment('商品id') index index(g_id_2) INT(11)"` | |||||
GoodsLogo string `json:"goods_logo" xorm:"VARCHAR(255)"` | |||||
GName string `json:"g_name" xorm:"index(g_id_2) index VARCHAR(255)"` | |||||
UpdateTime int `json:"update_time" xorm:"default 0 INT(11)"` | |||||
Type string `json:"type" xorm:"default '' comment('直充 卡券') index(g_id_2) index VARCHAR(255)"` | |||||
Xuzhi string `json:"xuzhi" xorm:"LONGTEXT"` | |||||
IsDelete int `json:"is_delete" xorm:"default 0 INT(11)"` | |||||
} |
@@ -0,0 +1,16 @@ | |||||
package model | |||||
type HcCardList struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr index INT(11)"` | |||||
GId int `json:"g_id" xorm:"default 0 index index(g_id_2) INT(11)"` | |||||
Title string `json:"title" xorm:"default '' VARCHAR(255)"` | |||||
OfficialPrice float64 `json:"official_price" xorm:"default 0.00 comment('官方价') DOUBLE(30,2)"` | |||||
PlatPrice float64 `json:"plat_price" xorm:"default 0.00 DOUBLE(30,2)"` | |||||
Times string `json:"times" xorm:"default '' VARCHAR(100)"` | |||||
SpecId int `json:"spec_id" xorm:"default 0 index(g_id_2) index INT(11)"` | |||||
SpecImg string `json:"spec_img" xorm:"default '' VARCHAR(255)"` | |||||
UpdateTime int `json:"update_time" xorm:"default 0 INT(11)"` | |||||
LId int `json:"l_id" xorm:"default 0 INT(11)"` | |||||
Type string `json:"type" xorm:"default '' VARCHAR(255)"` | |||||
IsDelete int `json:"is_delete" xorm:"default 0 INT(11)"` | |||||
} |
@@ -0,0 +1,32 @@ | |||||
package model | |||||
type HcCardorder struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Orderid string `json:"orderId" xorm:"default '' VARCHAR(255)"` | |||||
CreateTime int `json:"create_time" xorm:"default 0 INT(11)"` | |||||
Uid int `json:"uid" xorm:"default 0 comment('站长id') INT(11)"` | |||||
Zuid int `json:"zuid" xorm:"default 0 comment('站长平台的用户') INT(11)"` | |||||
Statut string `json:"statut" xorm:"default '' comment('状态') VARCHAR(100)"` | |||||
Account string `json:"account" xorm:"default '' comment('充值账号') VARCHAR(100)"` | |||||
BuyNum int `json:"buy_num" xorm:"default 0 comment('购买数量') INT(11)"` | |||||
GId int `json:"g_id" xorm:"default 0 comment('商品id') INT(11)"` | |||||
SpecId int `json:"spec_id" xorm:"default 0 comment('套餐id') INT(11)"` | |||||
Type string `json:"type" xorm:"default '' comment('类型') VARCHAR(100)"` | |||||
Payment float64 `json:"payment" xorm:"default 0.00 DOUBLE(11,2)"` | |||||
Msg string `json:"msg" xorm:"default '' VARCHAR(100)"` | |||||
PayTime int `json:"pay_time" xorm:"default 0 INT(11)"` | |||||
LId int `json:"l_id" xorm:"default 0 INT(11)"` | |||||
SysOrderid string `json:"sys_orderId" xorm:"default '' VARCHAR(255)"` | |||||
Status string `json:"status" xorm:"default '' VARCHAR(255)"` | |||||
IsToreturn int `json:"is_toreturn" xorm:"default 0 INT(11)"` | |||||
CardMsg string `json:"card_msg" xorm:"TEXT"` | |||||
IsFh int `json:"is_fh" xorm:"default 0 INT(11)"` | |||||
Oid string `json:"oid" xorm:"default '' VARCHAR(255)"` | |||||
RechargeStatus int `json:"recharge_status" xorm:"default 0 comment('0无 1充值中 2充值成功 3充值失败') INT(11)"` | |||||
NextUpdateTime int `json:"next_update_time" xorm:"default 0 INT(11)"` | |||||
UpdateTime int `json:"update_time" xorm:"default 0 INT(11)"` | |||||
CreateMsg string `json:"create_msg" xorm:"TEXT"` | |||||
ShowMsg string `json:"show_msg" xorm:"TEXT"` | |||||
Amount float64 `json:"amount" xorm:"default 0.00 DOUBLE(11,2)"` | |||||
Idcard string `json:"idcard" xorm:"default '' VARCHAR(255)"` | |||||
} |
@@ -128,6 +128,7 @@ func initTasks() { | |||||
jobs[taskMd.ZhimengCronLifeOrderSettle] = taskLifeOrderSettle // | jobs[taskMd.ZhimengCronLifeOrderSettle] = taskLifeOrderSettle // | ||||
jobs[taskMd.ZhimengCronElmOrder] = taskElmOrder // | jobs[taskMd.ZhimengCronElmOrder] = taskElmOrder // | ||||
jobs[taskMd.ZhimengCronMeituanLocalOrder] = taskMeituanLocalOrder // | |||||
jobs[taskMd.ZhimengCronDidiOrder] = taskDidiOrder // | jobs[taskMd.ZhimengCronDidiOrder] = taskDidiOrder // | ||||
jobs[taskMd.ZhimengCronT3Order] = taskT3Order // | jobs[taskMd.ZhimengCronT3Order] = taskT3Order // | ||||
jobs[taskMd.ZhimengCronOilAddEs] = taskOilAddEs //加油站点加入es | jobs[taskMd.ZhimengCronOilAddEs] = taskOilAddEs //加油站点加入es | ||||
@@ -136,5 +137,7 @@ func initTasks() { | |||||
jobs[taskMd.ZhimengCronHwRechargeOrder] = taskHwRechargeOrder //加油订单 | jobs[taskMd.ZhimengCronHwRechargeOrder] = taskHwRechargeOrder //加油订单 | ||||
jobs[taskMd.ZhimengCronMovieOrder] = taskMovieOrder //加油订单 | jobs[taskMd.ZhimengCronMovieOrder] = taskMovieOrder //加油订单 | ||||
jobs[taskMd.ZhimengCronKfcOrder] = taskKfcOrder //加油订单 | jobs[taskMd.ZhimengCronKfcOrder] = taskKfcOrder //加油订单 | ||||
jobs[taskMd.ZhimengCronHcRechargeGoods] = taskHcRechargeGoods //加油订单 | |||||
jobs[taskMd.ZhimengCronHcTicketGoods] = taskHcTicketGoods //加油订单 | |||||
} | } |
@@ -43,6 +43,7 @@ const ( | |||||
ZhimengCronHwTourismOrder = "zhimeng_cron_hw_tourism_order" | ZhimengCronHwTourismOrder = "zhimeng_cron_hw_tourism_order" | ||||
ZhimengCronKuaishouOrder = "zhimeng_cron_kuaishou_order" | ZhimengCronKuaishouOrder = "zhimeng_cron_kuaishou_order" | ||||
ZhimengCronMeituanOrder = "zhimeng_cron_meituan_order" | ZhimengCronMeituanOrder = "zhimeng_cron_meituan_order" | ||||
ZhimengCronMeituanLocalOrder = "zhimeng_cron_meituan_local_order" | |||||
ZhimengCronMeituanStoreOrder = "zhimeng_cron_meituan_store_order" | ZhimengCronMeituanStoreOrder = "zhimeng_cron_meituan_store_order" | ||||
ZhimengCronElmOrder = "zhimeng_cron_elm_order" | ZhimengCronElmOrder = "zhimeng_cron_elm_order" | ||||
ZhimengCronT3Order = "zhimeng_cron_t3_order" | ZhimengCronT3Order = "zhimeng_cron_t3_order" | ||||
@@ -60,4 +61,6 @@ const ( | |||||
ZhimengCronMovieOrder = "zhimeng_cron_movie_order" | ZhimengCronMovieOrder = "zhimeng_cron_movie_order" | ||||
ZhimengCronKfcOrder = "zhimeng_cron_kfc_order" | ZhimengCronKfcOrder = "zhimeng_cron_kfc_order" | ||||
ZhimengCronHwRechargeOrder = "zhimeng_cron_hw_recharge_order" | ZhimengCronHwRechargeOrder = "zhimeng_cron_hw_recharge_order" | ||||
ZhimengCronHcRechargeGoods = "zhimeng_cron_hc_recharge_goods" | |||||
ZhimengCronHcTicketGoods = "zhimeng_cron_hc_ticket_goods" | |||||
) | ) |
@@ -0,0 +1,168 @@ | |||||
package svc | |||||
import ( | |||||
"applet/app/db" | |||||
"applet/app/db/model" | |||||
"applet/app/utils" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/hc_card" | |||||
"time" | |||||
) | |||||
func HcRechargeGoods() { | |||||
param := map[string]string{} | |||||
list := hc_card.HcRechargeList(param) | |||||
for _, v := range list { | |||||
if v.Xuzhi == "" { | |||||
param1 := map[string]string{ | |||||
"g_id": utils.IntToStr(v.GId), | |||||
} | |||||
detail := hc_card.HcRechargeDetail(param1) | |||||
v.Xuzhi = detail.Xuzhi | |||||
} | |||||
tmp := model.HcCardCate{ | |||||
AccountType: v.AccountType, | |||||
GId: v.GId, | |||||
GoodsLogo: v.GoodsLogo, | |||||
GName: v.GName, | |||||
UpdateTime: int(time.Now().Unix()), | |||||
Type: "直充", | |||||
Xuzhi: v.Xuzhi, | |||||
IsDelete: 0, | |||||
} | |||||
var data model.HcCardCate | |||||
db.ZhimengDb.Where("g_id=? and type=?", tmp.GId, tmp.Type).Get(&data) | |||||
id := 0 | |||||
if data.Id > 0 { | |||||
id = data.Id | |||||
data.UpdateTime = int(time.Now().Unix()) | |||||
data.Xuzhi = v.Xuzhi | |||||
data.GName = v.GName | |||||
data.GoodsLogo = v.GoodsLogo | |||||
data.GId = v.GId | |||||
data.AccountType = v.AccountType | |||||
data.IsDelete = 0 | |||||
db.ZhimengDb.Where("id=?", data.Id).Update(&data) | |||||
} else { | |||||
db.ZhimengDb.InsertOne(&tmp) | |||||
id = tmp.Id | |||||
} | |||||
ids := []int{-1} | |||||
for _, v1 := range v.Spec { | |||||
specTmp := model.HcCardList{ | |||||
GId: v.GId, | |||||
Title: v1.Title, | |||||
OfficialPrice: utils.StrToFloat64(v1.OfficialPrice), | |||||
PlatPrice: utils.StrToFloat64(v1.PlatPrice), | |||||
Times: v1.Times, | |||||
SpecId: v1.SpecId, | |||||
SpecImg: v1.SpecImg, | |||||
UpdateTime: int(time.Now().Unix()), | |||||
LId: id, | |||||
Type: "直充", | |||||
IsDelete: 0, | |||||
} | |||||
var specData model.HcCardList | |||||
db.ZhimengDb.Where("l_id=? and spec_id=?", id, v1.SpecId).Get(&specData) | |||||
if specData.Id > 0 { | |||||
specData.UpdateTime = int(time.Now().Unix()) | |||||
specData.GId = v.GId | |||||
specData.Title = v1.Title | |||||
specData.OfficialPrice = utils.StrToFloat64(v1.OfficialPrice) | |||||
specData.PlatPrice = utils.StrToFloat64(v1.PlatPrice) | |||||
specData.Times = v1.Times | |||||
specData.SpecId = v1.SpecId | |||||
specData.SpecImg = v1.SpecImg | |||||
specData.IsDelete = 0 | |||||
db.ZhimengDb.Where("id=?", data.Id).Update(&specData) | |||||
} else { | |||||
db.ZhimengDb.InsertOne(&specTmp) | |||||
} | |||||
ids = append(ids, v1.SpecId) | |||||
} | |||||
if len(ids) > 0 { | |||||
db.ZhimengDb.NotIn("spec_id", ids).And("l_id=?", id).Cols("is_delete").Update(&model.HcCardList{IsDelete: 1}) | |||||
} | |||||
} | |||||
if len(list) > 0 { | |||||
db.ZhimengDb.Where("type=? and update_time<?", "直充", time.Now().Unix()-86400).Cols("is_delete").Update(&model.HcCardCate{IsDelete: 1}) | |||||
} | |||||
return | |||||
} | |||||
func HcTicketGoods() { | |||||
param := map[string]string{} | |||||
list := hc_card.HcTicketList(param) | |||||
for _, v := range list { | |||||
if v.Xuzhi == "" { | |||||
param1 := map[string]string{ | |||||
"g_id": utils.IntToStr(v.GId), | |||||
} | |||||
detail := hc_card.HcTicketDetail(param1) | |||||
v.Xuzhi = detail.Xuzhi | |||||
} | |||||
tmp := model.HcCardCate{ | |||||
GId: v.GId, | |||||
GoodsLogo: v.GoodsLogo, | |||||
GName: v.GName, | |||||
UpdateTime: int(time.Now().Unix()), | |||||
Type: "卡券", | |||||
Xuzhi: v.Xuzhi, | |||||
IsDelete: 0, | |||||
} | |||||
var data model.HcCardCate | |||||
db.ZhimengDb.Where("g_id=? and type=?", tmp.GId, tmp.Type).Get(&data) | |||||
id := 0 | |||||
if data.Id > 0 { | |||||
id = data.Id | |||||
data.UpdateTime = int(time.Now().Unix()) | |||||
data.Xuzhi = v.Xuzhi | |||||
data.GName = v.GName | |||||
data.GoodsLogo = v.GoodsLogo | |||||
data.GId = v.GId | |||||
data.IsDelete = 0 | |||||
db.ZhimengDb.Where("id=?", data.Id).Update(&data) | |||||
} else { | |||||
db.ZhimengDb.InsertOne(&tmp) | |||||
id = tmp.Id | |||||
} | |||||
ids := []int{-1} | |||||
for _, v1 := range v.Spec { | |||||
specTmp := model.HcCardList{ | |||||
GId: v.GId, | |||||
Title: v1.Title, | |||||
OfficialPrice: utils.StrToFloat64(v1.OfficialPrice), | |||||
PlatPrice: utils.StrToFloat64(v1.PlatPrice), | |||||
SpecId: v1.SpecId, | |||||
SpecImg: v1.SpecImg, | |||||
UpdateTime: int(time.Now().Unix()), | |||||
LId: id, | |||||
Type: "卡券", | |||||
IsDelete: 0, | |||||
} | |||||
var specData model.HcCardList | |||||
db.ZhimengDb.Where("l_id=? and spec_id=?", id, v1.SpecId).Get(&specData) | |||||
if specData.Id > 0 { | |||||
specData.UpdateTime = int(time.Now().Unix()) | |||||
specData.GId = v.GId | |||||
specData.Title = v1.Title | |||||
specData.OfficialPrice = utils.StrToFloat64(v1.OfficialPrice) | |||||
specData.PlatPrice = utils.StrToFloat64(v1.PlatPrice) | |||||
specData.SpecId = v1.SpecId | |||||
specData.SpecImg = v1.SpecImg | |||||
specData.IsDelete = 0 | |||||
db.ZhimengDb.Where("id=?", data.Id).Update(&specData) | |||||
} else { | |||||
db.ZhimengDb.InsertOne(&specTmp) | |||||
} | |||||
ids = append(ids, v1.SpecId) | |||||
} | |||||
if len(ids) > 0 { | |||||
db.ZhimengDb.NotIn("spec_id", ids).And("l_id=?", id).Cols("is_delete").Update(&model.HcCardList{IsDelete: 1}) | |||||
} | |||||
} | |||||
if len(list) > 0 { | |||||
db.ZhimengDb.Where("type=? and update_time<?", "卡券", time.Now().Unix()-86400).Cols("is_delete").Update(&model.HcCardCate{IsDelete: 1}) | |||||
} | |||||
return | |||||
} |
@@ -0,0 +1,91 @@ | |||||
package svc | |||||
import ( | |||||
offical "applet/app/db/official" | |||||
"applet/app/utils" | |||||
"fmt" | |||||
"strings" | |||||
"time" | |||||
) | |||||
func MeituanLocalOrder() { | |||||
pvdTimeKey := "meituan_local_time" | |||||
// 获得最后时间 | |||||
latest := offical.SysCfgByKey(pvdTimeKey) | |||||
if latest == nil { | |||||
offical.DbsSysCfgInserts(pvdTimeKey, time.Now().String()) | |||||
latest = offical.SysCfgByKey(pvdTimeKey) | |||||
} | |||||
// 所有时间都是在操作秒数 | |||||
now := time.Now().Unix() | |||||
strs := strings.Split(latest.V, ":") | |||||
timeStr := latest.V | |||||
if len(strs) == 3 { | |||||
timeStr = strs[0] + ":" + strs[1] + ":00" | |||||
} | |||||
fmt.Println(timeStr) | |||||
past := utils.TimeParseStd(timeStr).Unix() | |||||
// 如果上次记录超过30天或者 过去时间大于当前时间戳, 把时间设置为此前20分钟 | |||||
if past < now-180*86400 || past > now { | |||||
past = now | |||||
} | |||||
var ( | |||||
beginTime int64 = 0 | |||||
endTime int64 = 0 | |||||
pageNo int = 1 | |||||
pageSize int = 50 | |||||
nextPositionIndex string = "" | |||||
) | |||||
//怕时间不是走最新的 | |||||
leave := now - past | |||||
if leave > 500 { | |||||
leave = 0 | |||||
} | |||||
past = past + leave | |||||
beginTime = past - 300 | |||||
endTime = past | |||||
if endTime > now { | |||||
endTime = now | |||||
} | |||||
for { | |||||
count := 0 | |||||
var positionIndex = "" | |||||
if pageNo == 1 { | |||||
nextPositionIndex = "" | |||||
} | |||||
count, positionIndex = OrdersMeituanGet(nextPositionIndex, pageSize, beginTime, endTime, "update", 2) | |||||
if count == 0 { | |||||
nextPositionIndex = "" | |||||
goto ChkArg | |||||
} | |||||
// 判断是否分页已经全部取完了 | |||||
if count <= pageSize { | |||||
nextPositionIndex = positionIndex | |||||
pageNo++ | |||||
fmt.Println("========下一页========" + utils.IntToStr(pageNo)) | |||||
count = 0 | |||||
continue | |||||
} | |||||
ChkArg: | |||||
nextPositionIndex = "" | |||||
// 查询完后重置时间, 最后查询时间 | |||||
if endTime < now { | |||||
pageNo = 1 | |||||
offical.DbsSysCfgUpdate(pvdTimeKey, utils.TimeToStr(endTime)) | |||||
beginTime = endTime | |||||
endTime = endTime + 300 | |||||
if endTime > now { | |||||
endTime = now | |||||
} | |||||
count = 0 | |||||
continue | |||||
} | |||||
count = 0 | |||||
break | |||||
} | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package task | |||||
import ( | |||||
"applet/app/task/svc" | |||||
"math/rand" | |||||
"time" | |||||
) | |||||
func taskHcRechargeGoods() { | |||||
for { | |||||
if len(ch) > workerNum { | |||||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||||
} else { | |||||
goto START | |||||
} | |||||
} | |||||
START: | |||||
ch <- 1 | |||||
svc.HcRechargeGoods() | |||||
<-ch | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package task | |||||
import ( | |||||
"applet/app/task/svc" | |||||
"math/rand" | |||||
"time" | |||||
) | |||||
func taskHcTicketGoods() { | |||||
for { | |||||
if len(ch) > workerNum { | |||||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||||
} else { | |||||
goto START | |||||
} | |||||
} | |||||
START: | |||||
ch <- 1 | |||||
svc.HcTicketGoods() | |||||
<-ch | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package task | |||||
import ( | |||||
"applet/app/task/svc" | |||||
"math/rand" | |||||
"time" | |||||
) | |||||
func taskMeituanLocalOrder() { | |||||
for { | |||||
if len(ch) > workerNum { | |||||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||||
} else { | |||||
goto START | |||||
} | |||||
} | |||||
START: | |||||
ch <- 1 | |||||
svc.MeituanLocalOrder() | |||||
<-ch | |||||
} |
@@ -4,7 +4,7 @@ go 1.19 | |||||
require ( | 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_es.git v1.0.1-0.20230707081910-52e70aa52998 | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20250311032855-92b94363b2d1 | |||||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20250313085525-11c4483541e5 | |||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 | github.com/360EntSecGroup-Skylar/excelize v1.4.1 | ||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | ||||
github.com/boombuler/barcode v1.0.1 | github.com/boombuler/barcode v1.0.1 | ||||