|
|
package models
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
type MonkeyTask struct {
|
|
|
Id int `json:"id" gorm:"column:id;type:int(11);primary_key;not null;autoIncrement;comment:主键"`
|
|
|
Project string `json:"project" gorm:"column:project;type:varchar(255);not null;comment:项目名"`
|
|
|
Product string `json:"product" gorm:"column:product;type:varchar(255);not null;comment:产品名"`
|
|
|
PackageName string `json:"package_name" gorm:"column:package_name;type:varchar(255);not null;comment:应用包名"`
|
|
|
PackageURL string `json:"package_url" gorm:"column:package_url;type:varchar(255);not null;comment:应用包下载链接"`
|
|
|
Branch string `json:"branch" gorm:"column:branch"`
|
|
|
Version string `json:"version" gorm:"column:version"`
|
|
|
LaunchActivity string `json:"launch_activity" gorm:"column:launch_activity;type:varchar(255);comment:启动Activity页"`
|
|
|
Devices string `json:"devices" gorm:"column:devices;type:varchar(255);comment:存放设备udid"`
|
|
|
RunTime int `json:"run_time" gorm:"column:run_time;type:int(11);not null;comment:运行时间(秒)"`
|
|
|
RunPids string `json:"run_pids" gorm:"column:run_pids;type:varchar(255);comment:数组形式存放运行进程pid"`
|
|
|
Platform string `json:"platform" gorm:"column:platform;type:varchar(255);comment:平台adr/ios"`
|
|
|
CoveredAcitvities int `json:"covered_activities" gorm:"-"`
|
|
|
CrashCount int `json:"crash_count" gorm:"column:crash_count;type:int(11);not null;comment:崩溃次数"`
|
|
|
Creator string `json:"creator" gorm:"column:creator;type:varchar(255);comment:创建人"`
|
|
|
Referer string `json:"referer" gorm:"column:referer;type:varchar(255);not null;comment:调用方"`
|
|
|
Status string `json:"status" gorm:"column:status;type:varchar(255);not null;comment:运行状态"`
|
|
|
Remark string `json:"remark" gorm:"column:remark;type:varchar(255);not null;comment:备注"`
|
|
|
CreateTime int `json:"create_time" gorm:"column:create_time;type:int(11);not null;autoCreateTime;comment:创建时间"`
|
|
|
UpdateTime int `json:"update_time" gorm:"column:update_time;type:int(11);not null;autoUpdateTime;comment:更新时间"`
|
|
|
IsDel int `json:"is_del" gorm:"column:is_del;type:int(1);not null;comment:是否已删除"`
|
|
|
}
|
|
|
|
|
|
func (m *MonkeyTask) TableName() string {
|
|
|
return "monkey_task"
|
|
|
}
|
|
|
|
|
|
func (t *MonkeyTask) Check() error {
|
|
|
if t.Project == "" {
|
|
|
return errors.New("task.Project为空")
|
|
|
}
|
|
|
if t.Product == "" {
|
|
|
return errors.New("task.Product为空")
|
|
|
}
|
|
|
if t.PackageName == "" {
|
|
|
return errors.New("task.PackageName为空")
|
|
|
}
|
|
|
if t.Branch == "" {
|
|
|
return errors.New("task.Branch为空")
|
|
|
}
|
|
|
if t.Version == "" {
|
|
|
return errors.New("task.Version为空")
|
|
|
}
|
|
|
if t.Platform == "" {
|
|
|
return errors.New("task.Platform为空")
|
|
|
}
|
|
|
if t.LaunchActivity == "" && t.Platform == "adr" {
|
|
|
return errors.New("task.LaunchActivity为空,platform=adr时需要传入LaunchActivity参数")
|
|
|
}
|
|
|
if t.PackageURL == "" {
|
|
|
return errors.New("task.PackageURL为空")
|
|
|
}
|
|
|
return nil
|
|
|
}
|