gitee.com/h79/goutils@v1.22.10/common/app/app.go (about)

     1  package app
     2  
     3  // Info 应用app信息
     4  type Info struct {
     5  	AppId    string `form:"appId" binding:"-" json:"appId" yaml:"appId" xml:"appId"`
     6  	Source   string `form:"source" binding:"-" json:"source" yaml:"source" xml:"source"` //来自己client ,`如果 server,表示具体服务名
     7  	Terminal string `form:"terminal" binding:"-" json:"terminal" yaml:"terminal" xml:"terminal"`
     8  	Version  string `form:"version" binding:"-" json:"version" yaml:"version" xml:"version"` //应用程序版本
     9  	Channel  string `form:"channel" binding:"-" json:"channel" yaml:"channel" xml:"channel"` //渠道(小米、华为、360、VIVO、OPPO、APPLE)
    10  	ExtInfo  string `form:"extInfo" binding:"-" json:"extInfo" yaml:"extInfo" xml:"extInfo"` //base64 json
    11  }
    12  
    13  func (i Info) HasValid() bool {
    14  	return len(i.AppId) > 0 && len(i.Source) > 0 && len(i.Terminal) > 0 && len(i.Version) > 0
    15  }
    16  
    17  func (i Info) HasExtInfo() bool {
    18  	return len(i.ExtInfo) > 0
    19  }
    20  
    21  // System 用户系统
    22  type System struct {
    23  	DeviceId string `form:"deviceId" binding:"-" json:"deviceId" yaml:"deviceId"`
    24  	SysVer   string `form:"sysVersion" binding:"-" json:"sysVersion" yaml:"sysVer"`
    25  	Model    string `form:"model" binding:"-" json:"model" yaml:"model"`
    26  	Wifi     string `form:"wifi" binding:"-" json:"wifi" yaml:"wifi"`
    27  }
    28  
    29  func (i System) HasValid() bool {
    30  	return len(i.DeviceId) > 0 && len(i.SysVer) > 0
    31  }