huangjiajun пре 10 часа
родитељ
комит
7ef2c42532
6 измењених фајлова са 166 додато и 0 уклоњено
  1. +9
    -0
      src/dao/aliyun_sms_notice_dao.go
  2. +9
    -0
      src/dao/aliyun_sms_record_dao.go
  3. +55
    -0
      src/implement/aliyun_sms_notice_implement.go
  4. +54
    -0
      src/implement/aliyun_sms_record_implement.go
  5. +16
    -0
      src/model/aliyun_sms_notice.go
  6. +23
    -0
      src/model/aliyun_sms_record.go

+ 9
- 0
src/dao/aliyun_sms_notice_dao.go Прегледај датотеку

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type AliyunSmsNoticeDao interface {
GetAliyunSmsNotice(id string) (m *model.AliyunSmsNotice, err error)
FindAliyunSmsNotice(page, limit, types string) (*[]model.AliyunSmsNotice, error)
FindAliyunSmsNoticeAndTotal(page, limit, types string) (*[]model.AliyunSmsNotice, int64, error)
}

+ 9
- 0
src/dao/aliyun_sms_record_dao.go Прегледај датотеку

@@ -0,0 +1,9 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type AliyunSmsRecordDao interface {
GetAliyunSmsRecord(id string) (m *model.AliyunSmsRecord, err error)
FindAliyunSmsRecord(page, limit, title string) (*[]model.AliyunSmsRecord, error)
FindAliyunSmsRecordAndTotal(page, limit, title string) (*[]model.AliyunSmsRecord, int64, error)
}

+ 55
- 0
src/implement/aliyun_sms_notice_implement.go Прегледај датотеку

@@ -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
}

+ 54
- 0
src/implement/aliyun_sms_record_implement.go Прегледај датотеку

@@ -0,0 +1,54 @@
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"
"xorm.io/xorm"
)

func NewAliyunSmsRecordDb(engine *xorm.Engine) dao.AliyunSmsRecordDao {
return &AliyunSmsRecordDb{Db: engine}
}

type AliyunSmsRecordDb struct {
Db *xorm.Engine
}

func (j AliyunSmsRecordDb) GetAliyunSmsRecord(id string) (m *model.AliyunSmsRecord, err error) {
m = new(model.AliyunSmsRecord)
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 AliyunSmsRecordDb) FindAliyunSmsRecord(page, limit, title string) (*[]model.AliyunSmsRecord, error) {
var m []model.AliyunSmsRecord
sess := j.Db.Where("1=1")
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
if title != "" {
sess.And("title like ?", "%"+title+"%")
}
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 AliyunSmsRecordDb) FindAliyunSmsRecordAndTotal(page, limit, title string) (*[]model.AliyunSmsRecord, int64, error) {
var m []model.AliyunSmsRecord
sess := j.Db.Where("1=1")
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit)
if title != "" {
sess.And("title like ?", "%"+title+"%")
}
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
}

+ 16
- 0
src/model/aliyun_sms_notice.go Прегледај датотеку

@@ -0,0 +1,16 @@
package model

import (
"time"
)

type AliyunSmsNotice struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Title string `json:"title" xorm:"VARCHAR(255)"`
Content string `json:"content" xorm:"VARCHAR(255)"`
Skip string `json:"skip" xorm:"TEXT"`
CreateAt time.Time `json:"create_at" xorm:"DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"`
Day int `json:"day" xorm:"comment('部分通知需要时间') INT(11)"`
Type string `json:"type" xorm:"VARCHAR(255)"`
}

+ 23
- 0
src/model/aliyun_sms_record.go Прегледај датотеку

@@ -0,0 +1,23 @@
package model

import (
"time"
)

type AliyunSmsRecord struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Platform string `json:"platform" xorm:"VARCHAR(255)"`
Target string `json:"target" xorm:"VARCHAR(255)"`
UserId string `json:"user_id" xorm:"TEXT"`
Phone string `json:"phone" xorm:"TEXT"`
Level int `json:"level" xorm:"default 0 INT(11)"`
Title string `json:"title" xorm:"VARCHAR(255)"`
Content string `json:"content" xorm:"VARCHAR(255)"`
Skip string `json:"skip" xorm:"TEXT"`
SendType int `json:"send_type" xorm:"default 0 INT(1)"`
State int `json:"state" xorm:"default 0 INT(1)"`
SendStartTime time.Time `json:"send_start_time" xorm:"DATETIME"`
SendEndTime time.Time `json:"send_end_time" xorm:"DATETIME"`
CreateAt time.Time `json:"create_at" xorm:"DATETIME"`
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"`
}

Loading…
Откажи
Сачувај