面包店
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

db_cloud_bundle.go 916 B

9 个月前
12345678910111213141516171819202122232425262728293031323334353637383940
  1. package db
  2. import (
  3. "applet/app/db/model"
  4. "errors"
  5. "xorm.io/xorm"
  6. )
  7. // GetCloudBundleByVersion is 根据版本 获取打包记录
  8. func GetCloudBundleByVersion(Db *xorm.Engine, appverison string, os int) (*model.CloudBundle, error) {
  9. m := new(model.CloudBundle)
  10. has, err := Db.Where("version = ? and os = ?", appverison, os).Get(m)
  11. if err != nil {
  12. return nil, err
  13. }
  14. if !has {
  15. return nil, errors.New("not Found")
  16. }
  17. return m, nil
  18. }
  19. // GetCloudBundleByVersionPlatform is 根据版本\os 获取打包记录
  20. func GetCloudBundleByVersionPlatform(Db *xorm.Engine, appverison string, platform string) (*model.CloudBundle, error) {
  21. m := new(model.CloudBundle)
  22. var tag int
  23. if platform == "ios" {
  24. tag = 2
  25. } else {
  26. tag = 1
  27. }
  28. has, err := Db.Where("version = ? and os=?", appverison, tag).Get(m)
  29. if err != nil {
  30. return nil, err
  31. }
  32. if !has {
  33. return nil, errors.New("not Found")
  34. }
  35. return m, nil
  36. }