作者 tangxvhui

修复数据更新错误

... ... @@ -41,7 +41,6 @@ func (sms *LogSms) SummaryEvaluationMessage(phone string, name string) {
}
type LogSmsRepository interface {
Insert(param *LogSms) error
Save(param *LogSms) error
Find(queryOptions map[string]interface{}) (int, []*LogSms, error)
}
... ...
package repository
import (
"time"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
... ... @@ -16,24 +18,6 @@ func NewLogSmsRepository(transactionContext *pgTransaction.TransactionContext) *
var _ domain.LogSmsRepository = (*LogSmsRepository)(nil)
func (repo *LogSmsRepository) Insert(param *domain.LogSms) error {
m := models.LogSms{
Id: param.Id,
Phone: param.Phone,
TemplateId: param.TemplateId,
Template: param.Template,
Value: param.Value,
CreatedAt: param.CreatedAt,
Result: param.Result,
}
tx := repo.transactionContext.PgTx
_, err := tx.Model(&m).Insert()
if err != nil {
return err
}
return nil
}
func (repo *LogSmsRepository) Save(param *domain.LogSms) error {
m := models.LogSms{
Id: param.Id,
... ... @@ -43,6 +27,10 @@ func (repo *LogSmsRepository) Save(param *domain.LogSms) error {
Value: param.Value,
CreatedAt: param.CreatedAt,
Result: param.Result,
Status: string(param.Status),
From: param.From,
Index: param.Index,
ExecuteAt: time.Time{},
}
tx := repo.transactionContext.PgTx
_, err := tx.Model(&m).Insert()
... ...