|
|
@@ -0,0 +1,55 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"strings" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewAliyunSmsNoticeDb(engine *xorm.Engine) dao.AliyunSmsNoticeDao { |
|
|
|
return &AliyunSmsNoticeDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type AliyunSmsNoticeDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (j AliyunSmsNoticeDb) GetAliyunSmsNotice(id string) (m *model.AliyunSmsNotice, err error) { |
|
|
|
m = new(model.AliyunSmsNotice) |
|
|
|
has, err := j.Db.Where("id=?", id).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (j AliyunSmsNoticeDb) FindAliyunSmsNotice(page, limit, types string) (*[]model.AliyunSmsNotice, error) { |
|
|
|
var m []model.AliyunSmsNotice |
|
|
|
sess := j.Db.Where("1=1") |
|
|
|
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) |
|
|
|
if types != "" { |
|
|
|
sess.In("type", strings.Split(types, ",")) |
|
|
|
} |
|
|
|
if err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).Find(&m); err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
func (j AliyunSmsNoticeDb) FindAliyunSmsNoticeAndTotal(page, limit, types string) (*[]model.AliyunSmsNotice, int64, error) { |
|
|
|
var m []model.AliyunSmsNotice |
|
|
|
sess := j.Db.Where("1=1") |
|
|
|
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) |
|
|
|
if types != "" { |
|
|
|
sess.In("type", strings.Split(types, ",")) |
|
|
|
} |
|
|
|
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).Desc("id").FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, count, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &m, count, nil |
|
|
|
} |