|
@@ -1,6 +1,7 @@
|
|
|
package service
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"io"
|
|
"io"
|
|
|
"mtp20_assisted/core"
|
|
"mtp20_assisted/core"
|
|
@@ -34,6 +35,7 @@ func InitTimer() (err error) {
|
|
|
// for range time.Tick(1) {
|
|
// for range time.Tick(1) {
|
|
|
if loc, err := time.LoadLocation("Local"); err == nil {
|
|
if loc, err := time.LoadLocation("Local"); err == nil {
|
|
|
targetTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), hour, min, sec, 0, loc)
|
|
targetTime := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), hour, min, sec, 0, loc)
|
|
|
|
|
+ fmt.Println(targetTime)
|
|
|
|
|
|
|
|
// 计算时间差,等待执行时间
|
|
// 计算时间差,等待执行时间
|
|
|
// dur := time.Until(targetTime)
|
|
// dur := time.Until(targetTime)
|
|
@@ -43,7 +45,7 @@ func InitTimer() (err error) {
|
|
|
// }
|
|
// }
|
|
|
// time.Sleep(dur)
|
|
// time.Sleep(dur)
|
|
|
|
|
|
|
|
- if time.Now().Before(targetTime) {
|
|
|
|
|
|
|
+ if time.Now().After(targetTime) {
|
|
|
// 执行函数
|
|
// 执行函数
|
|
|
global.M2A_LOG.Info("WMS结算单导入:启动-ImportWMSReckon")
|
|
global.M2A_LOG.Info("WMS结算单导入:启动-ImportWMSReckon")
|
|
|
ImportWMSReckon()
|
|
ImportWMSReckon()
|
|
@@ -122,6 +124,9 @@ func ImportWMSReckon() {
|
|
|
key, _ := hex.DecodeString(utils.AESSecretKey)
|
|
key, _ := hex.DecodeString(utils.AESSecretKey)
|
|
|
var userKeyEncrypted []byte
|
|
var userKeyEncrypted []byte
|
|
|
if userKeyEncrypted, err = utils.AESEncrypt([]byte(userKey), key); err != nil || userKeyEncrypted == nil {
|
|
if userKeyEncrypted, err = utils.AESEncrypt([]byte(userKey), key); err != nil || userKeyEncrypted == nil {
|
|
|
|
|
+ if err == nil {
|
|
|
|
|
+ err = errors.New("DataNoFound")
|
|
|
|
|
+ }
|
|
|
global.M2A_LOG.Error("加密会员统一信用代码失败,", zap.String("UserKey", userKey), zap.String("err", err.Error()))
|
|
global.M2A_LOG.Error("加密会员统一信用代码失败,", zap.String("UserKey", userKey), zap.String("err", err.Error()))
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
@@ -130,6 +135,9 @@ func ImportWMSReckon() {
|
|
|
}
|
|
}
|
|
|
has := false
|
|
has := false
|
|
|
if has, err = global.M2A_DB.Get(&userinfo); err != nil || !has {
|
|
if has, err = global.M2A_DB.Get(&userinfo); err != nil || !has {
|
|
|
|
|
+ if err == nil {
|
|
|
|
|
+ err = errors.New("DataNoFound")
|
|
|
|
|
+ }
|
|
|
global.M2A_LOG.Error("用户唯一标识在数据库中无对应记录或读取数据库失败,", zap.String("UserKey", string(userKeyEncrypted)), zap.String("err", err.Error()))
|
|
global.M2A_LOG.Error("用户唯一标识在数据库中无对应记录或读取数据库失败,", zap.String("UserKey", string(userKeyEncrypted)), zap.String("err", err.Error()))
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
@@ -172,6 +180,9 @@ func ImportWMSReckon() {
|
|
|
// 获取资金账户ID
|
|
// 获取资金账户ID
|
|
|
taaccounts := make([]model.Taaccount, 0)
|
|
taaccounts := make([]model.Taaccount, 0)
|
|
|
if err := global.M2A_DB.Where("USERID = ?", userinfo.USERID).Find(&taaccounts); err != nil || len(taaccounts) == 0 {
|
|
if err := global.M2A_DB.Where("USERID = ?", userinfo.USERID).Find(&taaccounts); err != nil || len(taaccounts) == 0 {
|
|
|
|
|
+ if err == nil {
|
|
|
|
|
+ err = errors.New("DataNoFound")
|
|
|
|
|
+ }
|
|
|
global.M2A_LOG.Error("获取资金账户失败,", zap.String("UserKey", userKey), zap.String("err", err.Error()))
|
|
global.M2A_LOG.Error("获取资金账户失败,", zap.String("UserKey", userKey), zap.String("err", err.Error()))
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|