diff --git a/src/dao/cloud_bundle_dao.go b/src/dao/cloud_bundle_dao.go new file mode 100644 index 0000000..21b6de6 --- /dev/null +++ b/src/dao/cloud_bundle_dao.go @@ -0,0 +1,11 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + +type CloudBundleDao interface { + FindCloudBundleAndTotal(page, limit string) (*[]model.CloudBundle, int64, error) + GetCloudBundle(id string) (m *model.CloudBundle, err error) + GetCloudBundleLast(os string) (m *model.CloudBundle, err error) +} diff --git a/src/implement/cloud_bundle_implement.go b/src/implement/cloud_bundle_implement.go new file mode 100644 index 0000000..a63b36e --- /dev/null +++ b/src/implement/cloud_bundle_implement.go @@ -0,0 +1,50 @@ +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 NewCloudBundleDb(engine *xorm.Engine) dao.CloudBundleDao { + return &CloudBundleDb{Db: engine} +} + +type CloudBundleDb struct { + Db *xorm.Engine +} + +func (c CloudBundleDb) FindCloudBundleAndTotal(page, limit string) (*[]model.CloudBundle, int64, error) { + var m []model.CloudBundle + sess := c.Db.Where("1=1") + start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) + count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m) + if err != nil { + return nil, count, zhios_order_relate_logx.Error(err) + } + return &m, count, nil +} +func (c CloudBundleDb) GetCloudBundle(id string) (m *model.CloudBundle, err error) { + m = new(model.CloudBundle) + has, err := c.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 (c CloudBundleDb) GetCloudBundleLast(os string) (m *model.CloudBundle, err error) { + m = new(model.CloudBundle) + has, err := c.Db.Where("os=? and ep=0", os).Desc("id").Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} diff --git a/src/model/cloud_bundle.go b/src/model/cloud_bundle.go new file mode 100644 index 0000000..ba78c89 --- /dev/null +++ b/src/model/cloud_bundle.go @@ -0,0 +1,25 @@ +package model + +type CloudBundle struct { + Id int `json:"id" xorm:"not null pk autoincr INT(10)"` + Os int `json:"os" xorm:"not null default 1 comment('系统类型:1.Android; 2.IOS 3.微信小程序 4.支付宝小程序') TINYINT(1)"` + Version string `json:"version" xorm:"not null default '' comment('版本号') VARCHAR(255)"` + Modules string `json:"modules" xorm:"not null comment('包含的模块') TEXT"` + ApplyAt int `json:"apply_at" xorm:"comment('申请时间') INT(11)"` + FinishAt int `json:"finish_at" xorm:"comment('完成时间') INT(11)"` + State int `json:"state" xorm:"not null default 1 comment('状态:正在排队0,正在同步代码1,正在更新配置2,正在混淆3,正在打包4,正在上传5,打包成功999,异常-1, 998已重签') SMALLINT(5)"` + Memo string `json:"memo" xorm:"comment('备注') TEXT"` + ErrorMsg string `json:"error_msg" xorm:"comment('错误信息') TEXT"` + Src string `json:"src" xorm:"comment('包源地址') VARCHAR(255)"` + BuildId string `json:"build_id" xorm:"comment('build版本ID') VARCHAR(255)"` + BuildNumber string `json:"build_number" xorm:"default '' VARCHAR(255)"` + TemplateDuringAudit string `json:"template_during_audit" xorm:"not null default '' VARCHAR(255)"` + ResignSrc string `json:"resign_src" xorm:"comment('已重签的apk包') VARCHAR(255)"` + Ep int `json:"ep" xorm:"not null default 0 comment('0:c端 1:b端') TINYINT(1)"` + Bit string `json:"bit" xorm:"comment('位数') VARCHAR(255)"` + AppletId int `json:"applet_id" xorm:"default 0 comment('小程序记录id') INT(11)"` + IsCombine string `json:"is_combine" xorm:"default '0' VARCHAR(255)"` + NewBit string `json:"new_bit" xorm:"VARCHAR(255)"` + IsAuditing int `json:"is_auditing" xorm:"default 0 INT(1)"` + AlipayAppletAppId string `json:"alipay_applet_app_id" xorm:"not null default '' comment('支付宝小程序appid') CHAR(50)"` +}