101 lines
4.3 KiB
Go
101 lines
4.3 KiB
Go
|
package repository
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"finclip-app-manager/domain/entity"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
//const APPTEMPINFO_DB_NAME = "appTempInfo"
|
||
|
//
|
||
|
//var (
|
||
|
// AppTempDefSequence = 1
|
||
|
// appTempNotFoundErr = errors.New("NOT FOUND")
|
||
|
//)
|
||
|
//
|
||
|
//type CustomDataInfo struct {
|
||
|
// DetailDescription string `bson:"detail_description" json:"detailDescription"` //小程序详细描述
|
||
|
// SourceFile []CustomDataSourceFile `bson:"source_file" json:"sourceFile"`
|
||
|
// VersionDescription string `bson:"version_description" json:"versionDescription"` //小程序编译包版本描述
|
||
|
// Developer string `bson:"developer" json:"developer"` //开发者
|
||
|
//}
|
||
|
//
|
||
|
//type CustomDataSourceFile struct {
|
||
|
// FileMd5 string `bson:"file_md5" json:"fileMd5"`
|
||
|
// Name string `bson:"name" json:"name"`
|
||
|
// SourceFileUrl string `bson:"source_file_url" json:"sourceFileUrl"`
|
||
|
// UploadDate int64 `bson:"upload_date" json:"uploadDate"`
|
||
|
// Url string `bson:"url" json:"url"`
|
||
|
// EncryptedUrl string `bson:"encrypted_url" json:"encryptedUrl"`
|
||
|
// EncryptedFileMd5 string `bson:"encrypted_file_md5" json:"encryptedFileMd5"`
|
||
|
// EncryptedFileSha256 string `bson:"encrypted_file_sha256" json:"encryptedFileSha256"`
|
||
|
// BasicPackVer string `bson:"basic_pack_ver" json:"basicPackVer"`
|
||
|
// Packages []Package `bson:"packages"`
|
||
|
// EncryptPackages []Package `bson:"encrypt_packages"`
|
||
|
//}
|
||
|
//
|
||
|
//type Package struct {
|
||
|
// Root string `json:"root" bson:"root"`
|
||
|
// Name string `json:"name" bson:"name"`
|
||
|
// Pages []string `json:"pages" bson:"pages"`
|
||
|
// Independent bool `json:"independent" bson:"independent"`
|
||
|
// Filename string `json:"filename" bson:"filename"`
|
||
|
// FileUrl string `json:"fileUrl" bson:"file_url"`
|
||
|
// FileMd5 string `json:"fileMd5" bson:"file_md5"`
|
||
|
//}
|
||
|
//
|
||
|
//type AppTempInfo struct {
|
||
|
// AppID string `json:"appId" bson:"app_id"` //id
|
||
|
// Name string `json:"name" bson:"name"` //名字
|
||
|
// Sequence int `json:"sequence" bson:"sequence"` //版本号
|
||
|
// AppClass string `json:"appClass" bson:"app_class"` //用途
|
||
|
// AppType string `json:"appType" bson:"app_type"` //应用类型--mop使用为了和应用市场区分开
|
||
|
// Status Status `json:"status" bson:"status"` //状态
|
||
|
// DeveloperID string `json:"developerId" bson:"developer_id"` //开发者id
|
||
|
// GroupID string `json:"groupId" bson:"group_id"` //组id
|
||
|
// Created int64 `json:"created" bson:"created"`
|
||
|
// CreatedBy string `json:"createdBy" bson:"created_by"`
|
||
|
// CustomData CustomDataInfo `json:"customData" bson:"custom_data"` //预留
|
||
|
// Version string `json:"version" bson:"version"` //应用版本
|
||
|
// CoreDescription string `json:"coreDescription" bson:"core_description"` //核心描述
|
||
|
// Logo string `json:"logo" bson:"logo"` //图标
|
||
|
//}
|
||
|
|
||
|
type IAppTempInfoRepo interface {
|
||
|
Insert(ctx context.Context, info *entity.AppTempInfo) error
|
||
|
UpdateInfo(ctx context.Context, info *entity.AppTempInfo) error
|
||
|
GetInfoByAppId(ctx context.Context, appId string) (*entity.AppTempInfo, error)
|
||
|
GetInfoByAppIdAndSeq(ctx context.Context, appId string, seq int) (*entity.AppTempInfo, error)
|
||
|
NotFound(err error) bool
|
||
|
}
|
||
|
|
||
|
func NewDefaultInfo(appId string, projectType int) *entity.AppTempInfo {
|
||
|
now := time.Now().UnixNano() / 1e6
|
||
|
return &entity.AppTempInfo{
|
||
|
AppID: appId,
|
||
|
Name: "",
|
||
|
Sequence: entity.AppTempDefSequence,
|
||
|
AppClass: "Others",
|
||
|
AppType: "Applet",
|
||
|
Status: entity.Status{
|
||
|
Value: "Published",
|
||
|
Reason: "ide测试",
|
||
|
LastUpdated: now,
|
||
|
ModifiedBy: "ide测试",
|
||
|
},
|
||
|
DeveloperID: "",
|
||
|
GroupID: "",
|
||
|
Created: now,
|
||
|
CreatedBy: "",
|
||
|
CustomData: entity.CustomDataInfo{
|
||
|
DetailDescription: "ide测试小程序",
|
||
|
VersionDescription: "ide测试小程序",
|
||
|
SourceFile: make([]entity.CustomDataSourceFile, 0),
|
||
|
},
|
||
|
Version: "1.0.0",
|
||
|
CoreDescription: "ide测试小程序",
|
||
|
Logo: "",
|
||
|
ProjectType: projectType,
|
||
|
}
|
||
|
}
|