Commit 506f7794 by mushishixian

完成客户和供应商的新增和修改同步

parent 11021d01
package main
import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/configs"
"scm_server/internal/common"
"scm_server/internal/logic"
"scm_server/internal/model"
"scm_server/internal/service"
"time"
)
type RecvPro struct {
}
type CustomerQueueMessage struct {
Type string
Data struct {
FID string
FNUMBER string
CFNAME string
}
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message CustomerQueueMessage
err error
customer model.Customer
operateType string
syncLog model.SyncLog
)
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
goto ERR
}
//转换成customer数据
customer.ErpId = message.Data.FID
customer.ErpClientCode = message.Data.FNUMBER
customer.Name = message.Data.CFNAME
//判断操作类型
switch message.Type {
case "save":
//先去查询是否存在,不存在才去插入,已经存在即是修改
if logic.CheckCustomerExist(customer.ErpId) {
operateType = "update"
if err = logic.UpdateCustomer(customer); err != nil {
goto ERR
}
} else {
operateType = "insert"
if err = logic.InsertCustomer(customer); err != nil {
goto ERR
}
}
case "delete":
operateType = "delete"
if logic.CheckCustomerExist(customer.ErpId) {
//如果存在,才进行删除
if err = logic.DeleteCustomer(customer.ErpId); err != nil {
goto ERR
}
} else {
err = errors.New("试图删除不存在的客户")
goto ERR
}
default:
err = errors.New("同步客户出现不存在的操作类型")
goto ERR
}
//操作成功后还要去请求后端接口同步数据
if err = SyncCustomerData(operateType, customer); err != nil {
goto ERR
}
fmt.Println("同步成功")
return nil
ERR:
//不存在的erp_id不去操作对应的数据库
if customer.ErpId != "" {
logSyncErrorToCustomer(customer.ErpId, err.Error())
}
//还要存到一个统一错误表
syncLog = model.SyncLog{
AddTime: time.Now().Unix(),
SyncTime: time.Now().Unix(),
QueueMessage: string(dataByte),
UniqueId: customer.ErpId, //有可能为
SyncError: err.Error(),
SyncName: "customer",
}
logic.InsertSyncLog(syncLog)
//发送钉钉错误消息
msg, _ := json.Marshal(syncLog)
service.SendMessage(common.ErrorSendPhone, string(msg))
//保存日志
log.Error("%s", string(msg))
return nil
}
func (t *RecvPro) FailAction(dataByte []byte) error {
fmt.Println("任务处理失败了,发送钉钉消息通知主人")
return nil
}
//同步数据
func SyncCustomerData(operate string, customer model.Customer) (err error) {
var (
resp *req.Resp
url string
respData common.Response
)
param := req.Param{
"erp_client_sn": customer.ErpClientCode,
"customer_name": customer.Name,
"erp_customer_id": customer.ErpId,
"admin_name": "admin@ichunt.com",
"admin_id": 1000,
}
//更新和插入接口不同
if operate == "update" {
url = configs.BasicApiUrl + "/basic/api/ApiUpdateCustomerInfo"
} else if operate == "insert" {
url = configs.BasicApiUrl + "/basic/api/ApiInsertCustomerInfo"
} else {
url = configs.BasicApiUrl + "/basic/api/ApiDeleteCustomerInfo"
}
req.Debug = false
if operate == "update" || operate == "insert" {
resp, err = req.Post(url, param)
if err != nil {
return
}
if err = resp.ToJSON(&respData); err != nil {
return
}
if respData.Errcode != 101100 {
return errors.New(respData.Errmsg)
}
//都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil {
return
}
} else {
//删除
}
return
}
func logSyncErrorToCustomer(erpId, syncError string) {
var err error
//请求失败的话,将原因存起来
if err = logic.WriteCustomerSyncError(erpId, syncError); err != nil {
//数据库错误,发送警告
service.SendMessage(common.ErrorSendPhone, err.Error())
}
}
func main() {
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_customer",
"store_customer",
"store",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}, t, 3)
}
package main
import (
"encoding/json"
"fmt"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
)
func main() {
message := make(map[string]interface{})
message = map[string]interface{}{
"type": "save",
"data": map[string]string{
"FID": "Z8eVSzSLRXKa7ET9WHFzYagYZf011=",
"FNUMBER": "WT0050333",
"CFNAME": "深圳市鼎驰达电子有限公司",
},
}
data,err := json.Marshal(message)
if err!=nil {
fmt.Println(err)
}
body := string(data)
queueExchange := rabbitmq.QueueExchange{
"store_customer",
"store_customer",
"store",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}
rabbitmq.Send(queueExchange, body)
}
package main
import (
"fmt"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"time"
)
type RecvPro struct {
}
func (t *RecvPro) Consumer(dataByte []byte) error {
//time.Sleep(500*time.Microsecond)
//return errors.New("顶顶顶顶")
fmt.Println(string(dataByte))
time.Sleep(1 * time.Second)
//return errors.New("顶顶顶顶")
return nil
}
func (t *RecvPro) FailAction(dataByte []byte) error {
fmt.Println(string(dataByte))
fmt.Println("任务处理失败了,我要进入db日志库了")
fmt.Println("任务处理失败了,发送钉钉消息通知主人")
return nil
}
func main() {
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_customer",
"store_customer",
"store",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}, t, 3)
}
package main
import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/configs"
"scm_server/internal/common"
"scm_server/internal/logic"
"scm_server/internal/model"
"scm_server/internal/service"
"time"
)
type RecvPro struct {
}
type SupplierQueueMessage struct {
Type string
Data struct {
FID string
FNUMBER string
CFNAME string
}
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message SupplierQueueMessage
err error
supplier model.Supplier
operateType string
syncLog model.SyncLog
)
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
goto ERR
}
//转换成supplier数据
supplier.ErpId = message.Data.FID
supplier.ErpSupplierCode = message.Data.FNUMBER
supplier.Name = message.Data.CFNAME
//判断操作类型
switch message.Type {
case "save":
//先去查询是否存在,不存在才去插入,已经存在即是修改
if logic.CheckSupplierExist(supplier.ErpId) {
operateType = "update"
if err = logic.UpdateSupplier(supplier); err != nil {
goto ERR
}
} else {
operateType = "insert"
if err = logic.InsertSupplier(supplier); err != nil {
goto ERR
}
}
case "delete":
operateType = "delete"
if logic.CheckSupplierExist(supplier.ErpId) {
//如果存在,才进行删除
if err = logic.DeleteSupplier(supplier.ErpId); err != nil {
goto ERR
}
} else {
err = errors.New("试图删除不存在的供应商")
goto ERR
}
default:
err = errors.New("同步供应商出现不存在的操作类型")
goto ERR
}
//操作成功后还要去请求后端接口同步数据
if err = SyncSupplierData(operateType, supplier); err != nil {
goto ERR
}
fmt.Println("同步成功")
return nil
ERR:
//不存在的erp_id不去操作对应的数据库
if supplier.ErpId != "" {
logSyncErrorToSupplier(supplier.ErpId, err.Error())
}
//还要存到一个统一错误表
syncLog = model.SyncLog{
AddTime: time.Now().Unix(),
SyncTime: time.Now().Unix(),
QueueMessage: string(dataByte),
UniqueId: supplier.ErpId, //有可能为
SyncError: err.Error(),
SyncName: "supplier",
}
logic.InsertSyncLog(syncLog)
//发送钉钉错误消息
msg, _ := json.Marshal(syncLog)
service.SendMessage(common.ErrorSendPhone, string(msg))
//保存日志
log.Error("%s", string(msg))
return nil
}
func (t *RecvPro) FailAction(dataByte []byte) error {
fmt.Println("任务处理失败了,发送钉钉消息通知主人")
return nil
}
//同步数据
func SyncSupplierData(operate string, supplier model.Supplier) (err error) {
var (
resp *req.Resp
url string
respData common.Response
)
param := req.Param{
"erp_supplier_sn": supplier.ErpSupplierCode,
"supplier_name": supplier.Name,
"erp_supplier_id": supplier.ErpId,
"admin_name": "admin@ichunt.com",
"admin_id": 1000,
}
//更新和插入接口不同
if operate == "update" {
url = configs.BasicApiUrl + "/basic/api/ApiUpdateSupplierInfo"
} else if operate == "insert" {
url = configs.BasicApiUrl + "/basic/api/ApiInsertSupplierInfo"
} else {
url = configs.BasicApiUrl + "/basic/api/ApiDeleteSupplierInfo"
}
req.Debug = false
if operate == "update" || operate == "insert" {
resp, err = req.Post(url, param)
if err != nil {
return
}
if err = resp.ToJSON(&respData); err != nil {
return
}
if respData.Errcode != 101100 {
return errors.New(respData.Errmsg)
}
//都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncSupplierSuccess(supplier.ErpId); err != nil {
return
}
} else {
//删除
}
return
}
func logSyncErrorToSupplier(erpId, syncError string) {
var err error
//请求失败的话,将原因存起来
if err = logic.WriteSupplierSyncError(erpId, syncError); err != nil {
//数据库错误,发送警告
service.SendMessage(common.ErrorSendPhone, err.Error())
}
}
func main() {
body := fmt.Sprintf("{\"order_id\":%d}", "测试队列")
queueExchange := rabbitmq.QueueExchange{
"store_customer",
"store_customer",
t := &RecvPro{}
rabbitmq.Recv(rabbitmq.QueueExchange{
"store_supplier",
"store_supplier",
"store",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}
rabbitmq.Send(queueExchange, body)
}, t, 3)
}
package main
import (
"encoding/json"
"fmt"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
)
func main() {
message := make(map[string]interface{})
message = map[string]interface{}{
"type": "save",
"data": map[string]string{
"FID": "Z8eVSzSLRXKa7ET9WHFzYagYZf0171=",
"FNUMBER": "WT0050333",
"CFNAME": "深圳市鼎驰达电子有限公司",
},
}
data,err := json.Marshal(message)
if err!=nil {
fmt.Println(err)
}
body := string(data)
queueExchange := rabbitmq.QueueExchange{
"store_supplier",
"store_supplier",
"store",
"direct",
"amqp://huntadmin:jy2y2900@192.168.1.237:5672/",
}
rabbitmq.Send(queueExchange, body)
}
......@@ -2,7 +2,10 @@ package customer
import (
"fmt"
"github.com/imroc/req"
"github.com/tealeg/xlsx"
"scm_server/configs"
"scm_server/internal/common"
"scm_server/internal/logic"
"scm_server/internal/model"
)
......@@ -15,21 +18,75 @@ func Import() {
err error
customer model.Customer
)
excelFileName = "./cmd/source/data/customer.xls"
excelFileName = "./cmd/source/data/customer.xlsx"
xlFile, err = xlsx.OpenFile(excelFileName)
if err != nil {
fmt.Printf("open failed: %s\n", err)
}
//循环遍历数据
for _, sheet := range xlFile.Sheets {
for key, row := range sheet.Rows {
if key > 0 {
if key == 0 {
continue
}
customer.ErpId = row.Cells[0].String()
customer.ErpClientCode = row.Cells[1].String()
customer.Name = row.Cells[2].String()
//存在的记录跳过
if logic.CheckCustomerExist(customer.ErpId) {
continue
}
if err = logic.InsertCustomer(customer); err != nil {
fmt.Println(err)
break
}
//插入成功后还要去请求后端接口同步数据
SyncCustomerData(customer)
}
}
}
//同步数据
func SyncCustomerData(customer model.Customer) bool {
var (
resp *req.Resp
url string
respData common.Response
err error
)
param := req.Param{
"erp_client_sn": customer.ErpClientCode,
"customer_name": customer.Name,
"erp_customer_id": customer.ErpId,
"admin_name": "admin@ichunt.com",
"admin_id": 1000,
}
url = configs.BasicApiUrl + "/basic/api/ApiInsertCustomerInfo"
req.Debug = true
resp, err = req.Post(url, param)
if err != nil {
logSyncErrorToDataBase(customer.ErpId, err.Error())
return false
}
if err = resp.ToJSON(&respData); err != nil {
logSyncErrorToDataBase(customer.ErpId, err.Error())
return false
}
if respData.Errcode != 101100 {
logSyncErrorToDataBase(customer.ErpId, respData.Errmsg)
return false
}
//都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncCustomerSuccess(customer.ErpId); err != nil {
fmt.Println(err)
}
}
func logSyncErrorToDataBase(erpId, syncError string) {
var err error
//请求失败的话,将原因存起来
if err = logic.WriteCustomerSyncError(erpId, syncError); err != nil {
//写数据失败,记录到日志
fmt.Println(err)
}
}
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -22,15 +22,19 @@ func Import() {
}
for _, sheet := range xlFile.Sheets {
for key, row := range sheet.Rows {
if key > 0 {
if key == 0 {
continue
}
goods.ErpGoodsId = row.Cells[0].String()
goods.GoodsName = row.Cells[1].String()
goods.BrandName = row.Cells[2].String()
goods.GoodsCnName = row.Cells[3].String()
if logic.CheckGoodsExist(goods.ErpGoodsId) {
continue
}
if err = logic.InsertGoods(goods); err != nil {
fmt.Println(err)
}
}
}
}
}
package main
import (
"scm_server/cmd/source/goods"
)
func main() {
//supplier.Import()
goods.Import()
//forever := make(chan bool)
//go supplier.Import()
//<-forever
//customer.Import()
//goods.Import()
}
......@@ -2,7 +2,10 @@ package supplier
import (
"fmt"
"github.com/imroc/req"
"github.com/tealeg/xlsx"
"scm_server/configs"
"scm_server/internal/common"
"scm_server/internal/logic"
"scm_server/internal/model"
)
......@@ -27,12 +30,64 @@ func Import() {
supplier.ErpSupplierCode = row.Cells[1].String()
supplier.Name = row.Cells[2].String()
//先去查询是否存在,不存在才去插入
if !logic.CheckSupplierExist(supplier.ErpId) {
if logic.CheckSupplierExist(supplier.ErpId) {
continue
}
if err = logic.InsertSupplier(supplier); err != nil {
fmt.Println(err)
continue
}
//插入成功后还要去请求后端接口同步数据
if !SyncSupplierData(supplier) {
continue
}
}
}
}
}
//同步数据
func SyncSupplierData(supplier model.Supplier) bool {
var (
resp *req.Resp
url string
respData common.Response
err error
)
param := req.Param{
"erp_supplier_sn": supplier.ErpSupplierCode,
"supplier_name": supplier.Name,
"erp_supplier_id": supplier.ErpId,
"admin_name": "admin@ichunt.com",
"admin_id": 1000,
}
url = configs.BasicApiUrl + "/basic/api/ApiInsertSupplierInfo"
req.Debug = true
resp, err = req.Post(url, param)
if err != nil {
logSyncErrorToDataBase(supplier.ErpId, err.Error())
return false
}
if err = resp.ToJSON(&respData); err != nil {
logSyncErrorToDataBase(supplier.ErpId, err.Error())
return false
}
if respData.Errcode != 101100 {
logSyncErrorToDataBase(supplier.ErpId, respData.Errmsg)
return false
}
//都没问题,代表后端那边已经成功修改,修改同步表的状态
if err = logic.SyncSupplierSuccess(supplier.ErpId); err != nil {
fmt.Println(err)
}
return true
}
func logSyncErrorToDataBase(erpId, syncError string) {
var err error
//请求失败的话,将原因存起来
if err = logic.WriteSupplierSyncError(erpId, syncError); err != nil {
//写数据失败,记录到日志
fmt.Println(err)
}
}
......@@ -5,6 +5,7 @@ go 1.13
require (
github.com/go-kratos/kratos v0.4.2
github.com/ichunt2019/go-rabbitmq v1.0.1
github.com/imroc/req v0.3.0
github.com/jmoiron/sqlx v1.2.0
github.com/pkg/errors v0.9.1
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71
......
......@@ -104,6 +104,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ichunt2019/go-rabbitmq v1.0.1 h1:qHhpGm9v7jnhSBo3f3viX+BSky9yugp9lCSV03eYsF4=
github.com/ichunt2019/go-rabbitmq v1.0.1/go.mod h1:TQsZ1XWULyvm4UwpYHwNPtOXYbuVvLLI0GM7g/BRy68=
github.com/imroc/req v0.3.0 h1:3EioagmlSG+z+KySToa+Ylo3pTFZs+jh3Brl7ngU12U=
github.com/imroc/req v0.3.0/go.mod h1:F+NZ+2EFSo6EFXdeIbpfE9hcC233id70kf0byW97Caw=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
......
package common
const ErrorSendPhone = 18825159814
package common
type Response struct {
Errcode int
Errmsg string
Data interface{}
}
......@@ -10,6 +10,14 @@ const CheckCustomerExistSql = "SELECT customer_id FROM lie_customer WHERE erp_id
const InsertCustomerSql = "Insert INTO `lie_customer` (`erp_client_code`,`name`,`erp_id`,`add_time`,`sync_status`) VALUES (?,?,?,?,?)"
const UpdateCustomerSql = "UPDATE `lie_customer` SET `erp_client_code` = ? , `name` = ? , `update_time` = ? WHERE `erp_id` = ?"
const DeleteCustomerSql = "DELETE FROM `lie_customer` WHERE `erp_id` = ?"
const WriteCustomerSyncErrorSql = "UPDATE `lie_customer` SET sync_error = ? WHERE erp_id = ?"
const SyncCustomerSuccessSql = "UPDATE `lie_customer` SET sync_status = 1 , sync_time = ? WHERE erp_id = ?"
//检查用户是否存在
func CheckCustomerExist(erpId string) (exist bool) {
var customerId int
......@@ -25,3 +33,30 @@ func InsertCustomer(customer model.Customer) (err error) {
}
return nil
}
//更新供应商
func UpdateCustomer(customer model.Customer) (err error) {
_, err = dao.GetDb().Exec(UpdateCustomerSql, customer.ErpClientCode, customer.Name, time.Now().Unix(), customer.ErpId)
if err != nil {
return
}
return nil
}
//删除供应商
func DeleteCustomer(erpId string) (err error) {
_, err = dao.GetDb().Exec(DeleteCustomerSql, erpId)
return
}
//写入同步失败的原因
func WriteCustomerSyncError(erpId, syncError string) (err error) {
_, err = dao.GetDb().Exec(WriteCustomerSyncErrorSql, syncError, erpId)
return
}
//修改成功的同步状态
func SyncCustomerSuccess(erpId string) (err error) {
_, err = dao.GetDb().Exec(SyncCustomerSuccessSql, time.Now().Unix(), erpId)
return
}
......@@ -10,6 +10,8 @@ const CheckGoodsExistSql = "SELECT goods_id FROM lie_goods WHERE erp_goods_id =
const InsertGoodsSql = "INSERT INTO `lie_goods` (`goods_name`,`goods_cn_name`,`brand_name`,`erp_goods_id`,`add_time`,`sync_status`) VALUES (?,?,?,?,?,?)"
const WriteSyncErrorSql = "UPDATE `lie_goods` SET sync_error = ? WHERE goods_id = ?"
//检查物料是否存在
func CheckGoodsExist(erpId string) (exist bool) {
var customerId int
......@@ -21,8 +23,11 @@ func CheckGoodsExist(erpId string) (exist bool) {
func InsertGoods(goods model.Goods) (err error) {
_, err = dao.GetDb().Exec(InsertGoodsSql, goods.GoodsName, goods.GoodsCnName,
goods.BrandName, goods.ErpGoodsId, time.Now().Unix(), 0)
if err != nil {
return
}
return nil
}
//写入同步失败的原因
func WriteSyncError(goodsId int, syncError string) (err error) {
_, err = dao.GetDb().Exec(WriteSyncErrorSql, syncError, goodsId)
return
}
......@@ -10,6 +10,14 @@ const CheckSupplierExistSql = "SELECT supplier_id FROM lie_supplier WHERE erp_id
const InsertSupplierSql = "Insert INTO `lie_supplier` (`erp_supplier_code`,`name`,`erp_id`,`add_time`,`sync_status`) VALUES (?,?,?,?,?)"
const UpdateSupplierSql = "UPDATE `lie_supplier` SET `erp_supplier_code` = ? , `name` = ? , `update_time` = ? WHERE `erp_id` = ?"
const DeleteSupplierSql = "DELETE FROM `lie_supplier` WHERE `erp_id` = ?"
const WriteSupplierSyncErrorSql = "UPDATE `lie_supplier` SET sync_time = ? , sync_status = ? , sync_error = ? WHERE erp_id = ?"
const SyncSupplierSuccessSql = "UPDATE `lie_supplier` SET sync_status = 1 , sync_time = ? WHERE erp_id = ?"
//检查供应商是否存在
func CheckSupplierExist(erpId string) (exist bool) {
var supplierId int = 0
......@@ -25,3 +33,30 @@ func InsertSupplier(supplier model.Supplier) (err error) {
}
return nil
}
//更新供应商
func UpdateSupplier(supplier model.Supplier) (err error) {
_, err = dao.GetDb().Exec(UpdateSupplierSql, supplier.ErpSupplierCode, supplier.Name, time.Now().Unix(), supplier.ErpId)
if err != nil {
return
}
return nil
}
//删除供应商
func DeleteSupplier(erpId string) (err error) {
_, err = dao.GetDb().Exec(DeleteSupplierSql, erpId)
return
}
//写入同步失败的原因
func WriteSupplierSyncError(erpId, syncError string) (err error) {
_, err = dao.GetDb().Exec(WriteSupplierSyncErrorSql, time.Now().Unix(), 0, syncError, erpId)
return
}
//修改成功的同步状态
func SyncSupplierSuccess(erpId string) (err error) {
_, err = dao.GetDb().Exec(SyncSupplierSuccessSql, time.Now().Unix(), erpId)
return
}
package logic
import (
"scm_server/internal/dao"
"scm_server/internal/model"
)
const InsertSyncLogSql = "INSERT INTO `lie_sync_log` (`sync_name`,`sync_time`,`sync_error`,`unique_id`,`queue_message`,`add_time`) VALUES (?,?,?,?,?,?)"
//插入错误日志
func InsertSyncLog(syncLog model.SyncLog) (err error) {
_, err = dao.GetDb().Exec(InsertSyncLogSql, syncLog.SyncName, syncLog.SyncTime, syncLog.SyncError, syncLog.UniqueId, syncLog.QueueMessage, syncLog.AddTime)
if err != nil {
return
}
return nil
}
package model
type SyncLog struct {
SyncName string
SyncTime int64
SyncError string
UniqueId string
QueueMessage string
AddTime int64
}
......@@ -12,7 +12,7 @@ import (
const APIMD5STR string = "fh6y5t4rr351d2c3bryi"
const APIDOMAIN string = "http://api.ichunt.com/msg/sendMessageByAuto"
const ADMINTEL int64 = 17600091664
const ADMINTEL int64 = 18825159814
func AdminErr(err error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment