package db import ( "applet/app/db/model" "errors" "xorm.io/xorm" ) // GetCloudBundleByVersion is 根据版本 获取打包记录 func GetCloudBundleByVersion(Db *xorm.Engine, appverison string, os int) (*model.CloudBundle, error) { m := new(model.CloudBundle) has, err := Db.Where("version = ? and os = ?", appverison, os).Get(m) if err != nil { return nil, err } if !has { return nil, errors.New("not Found") } return m, nil } // GetCloudBundleByVersionPlatform is 根据版本\os 获取打包记录 func GetCloudBundleByVersionPlatform(Db *xorm.Engine, appverison string, platform string) (*model.CloudBundle, error) { m := new(model.CloudBundle) var tag int if platform == "ios" { tag = 2 } else { tag = 1 } has, err := Db.Where("version = ? and os=?", appverison, tag).Get(m) if err != nil { return nil, err } if !has { return nil, errors.New("not Found") } return m, nil }