You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

package manage
import "recook/internal/v2/lib/db"
const (
RecookThirdPartyJingtongStatusNone = 0
RecookThirdPartyJingtongStatusSuc = 1
RecookThirdPartyJingtongStatusFail = 2
)
type RecookThirdPartyModel struct {
db.BaseModel
Id uint `gorm:"column:id;primary_key" json:"id"`
GoodsId uint `json:"goodsId"`
Status int `json:"status"`
}
// TableName sets the insert table name for this struct type
func (r *RecookThirdPartyModel) TableName() string {
return "recook_third_party_jingtong"
}
func (r *RecookThirdPartyModel) GetLimit(limit int) (result []RecookThirdPartyModel) {
r.GetDb().Model(&RecookThirdPartyModel{}).Limit(limit).Find(&result, "status = ?", RecookThirdPartyJingtongStatusNone)
return
}
func (r *RecookThirdPartyModel) UpdateSucByIds(ids []uint) (result []RecookThirdPartyModel) {
r.GetDb().Model(&RecookThirdPartyModel{}).Where("id in (?)", ids).Update("status", RecookThirdPartyJingtongStatusSuc)
return
}
func (r *RecookThirdPartyModel) UpdateFailByIds(ids []uint) (result []RecookThirdPartyModel) {
r.GetDb().Model(&RecookThirdPartyModel{}).Where("id in (?)", ids).Update("status", RecookThirdPartyJingtongStatusFail)
return
}