package service

import (
	"fmt"
	"time"

	"Xcx_New/models"
	"Xcx_New/utils"
)

func CreateDBErrorRecord(orgID int64, decsFormat string, v ...interface{}) {
	if orgID < 0 {
		orgID = 0
	}
	now := time.Now()
	record := models.DBErrorRecord{
		OrgID:      orgID,
		ErrDesc:    fmt.Sprintf(decsFormat, v...),
		Status:     1,
		CreateTime: now.Unix(),
		ModifyTime: now.Unix(),
	}
	insertErr := writeDb.Save(&record).Error
	if insertErr != nil {
		utils.ErrorLog("插入数据库执行错误记录失败:%v", insertErr)
	}
}
