浏览代码

更新vendor

lijian 6 年之前
父节点
当前提交
ae7c3751ce

+ 1 - 3
services/knowoapi/controllers/parsebody.go

@@ -1,13 +1,11 @@
 package controllers
 
 import (
-	"knowoapi/schema"
-
 	"github.com/kataras/iris"
 )
 
 // parseBody 转化请求body
-func parseBody(ctx iris.Context, body schema.BodyTemplate) error {
+func parseBody(ctx iris.Context, body model.BodyTemplate) error {
 	err := ctx.ReadJSON(body)
 	if err != nil {
 		return err

+ 0 - 1
services/knowoapi/controllers/token.go

@@ -2,7 +2,6 @@ package controllers
 
 import (
 	"sparrow/pkg/models"
-	"sparrow/services/knowoapi/model"
 	"time"
 
 	"github.com/kataras/iris"

+ 0 - 1
services/knowoapi/controllers/user.go

@@ -2,7 +2,6 @@ package controllers
 
 import (
 	"sparrow/pkg/models"
-	"sparrow/services/knowoapi/model"
 	"sparrow/services/knowoapi/services"
 
 	"github.com/kataras/iris"

+ 1 - 1
vendor/knowoapi/schema/bodytemplate.go → services/knowoapi/model/bodytemplate.go

@@ -1,4 +1,4 @@
-package schema
+package model
 
 // BodyTemplate 接口
 type BodyTemplate interface {

+ 0 - 31
vendor/knowoapi/schema/agent.go

@@ -1,31 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-// Agent 代理商表
-type Agent struct {
-	gorm.Model
-	AgentCode       string `gorm:"not null;primary_key"`  // 代理商编号
-	AgentName       string `gorm:"not null;size:50;"`     // 代理商名称
-	ParentAgentCode string `gorm:"not nulll;default:'0'"` //父级代理商编号
-	Operator        string //操作人
-	AgentUserName   string `gorm:"not null;unique;size:25"`     //代理商用户名
-	AgentPassWord   string `gorm:"not null;size:25;default:''"` //代理商密码
-	Adress          string `gorm:"size:100"`                    //地址
-	Contact         string `gorm:"size:10"`                     // 联系人
-	Phone           string // 联系电话
-}
-
-// Validate 验证
-func (a *Agent) Validate() error {
-	if a.AgentName == "" ||
-		a.AgentUserName == "" ||
-		a.AgentPassWord == "" {
-		return errors.New("参数不能为空[AgentName,AgentUserName,AgentPassword]")
-	}
-	return nil
-}

+ 0 - 24
vendor/knowoapi/schema/circuitry.go

@@ -1,24 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-// Circuitry 站点系统图 表
-type Circuitry struct {
-	gorm.Model
-	CircuitryCode  string `gorm:"not null;primary_key"` //系统图编号
-	SubstationCode string `gorm:"not null;index;"`      //所属站点编号
-	ChartData      string `gorm:"type:LONGTEXT"`        //系统图表XML结构
-	Operator       string //操作人
-}
-
-// Validate 验证
-func (a *Circuitry) Validate() error {
-	if a.SubstationCode == "" {
-		return errors.New("参数不能为空")
-	}
-	return nil
-}

+ 0 - 32
vendor/knowoapi/schema/company.go

@@ -1,32 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-// Company 公司表
-type Company struct {
-	gorm.Model
-	CompanyCode   string `gorm:"primary_key;unique_index"` //公司编号
-	CompanyName   string `gorm:"size:50;not null"`         //公司名称
-	GeographyCode string `gorm:"not null;size;20"`         //省市区代码
-	Address       string `gorm:"size:200;index:addr"`      //公司地址
-	Contact       string `gorm:"size:10"`                  //联系人
-	Phone         string `gorm:"size:20"`                  //联系人电话
-	LocationX     string `gorm:"size:10"`                  //经度
-	LocationY     string `gorm:"size:10"`                  //纬度
-	AgentCode     string //代理商编号
-	Operator      string `gorm:"-"`        //操作人
-	CompanyIntro  string `gorm:"size:255"` //备注
-}
-
-// Validate 验证
-func (a *Company) Validate() error {
-	if a.CompanyName == "" ||
-		a.GeographyCode == "" {
-		return errors.New("公司名或地区码不能为空")
-	}
-	return nil
-}

+ 0 - 13
vendor/knowoapi/schema/const.go

@@ -1,13 +0,0 @@
-package schema
-
-const (
-	_            int = iota
-	SUPER_ADMIN      = 0
-	NORMAL_ADMIN     = 1
-
-	AGENT_ADMIN = 20
-	AGENT_USER  = 21
-
-	COMPANY_ADMIN = 10
-	COMPANY_USER  = 11
-)

+ 0 - 43
vendor/knowoapi/schema/device.go

@@ -1,43 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-// Device 设备表
-type Device struct {
-	gorm.Model
-	DeviceCode    string `gorm:"not null;"`                  //设备code
-	CollectorID   int    `gorm:"not null;"`                  //采集点
-	StationCode   string `gorm:"not null;"`                  //归属配电室的ID
-	DeviceName    string `gorm:"not null;"`                  //设备名称
-	Status        int    `gorm:"size:10;not null;default:0"` //状态 0 无效 1有效
-	DeviceIntro   string `gorm:"size:255;"`                  //设备备注
-	CompanyCode   string `gorm:"not null;"`                  // 公司id
-	CabinetCode   string //柜体编号
-	SwitcherType  string //开关型号
-	Circuitry     string //线路图
-	PowerLevel    int    //电压等级
-	CurrentRating string //额定电流
-	LineSize      string //导线规格
-	LineLength    string //导线长度
-	Capkva        string //变压器容量
-	Capmaterial   string //导线材质
-	Capradius     string //导线直径
-	Caplength     string //导线长度
-	DeviceType    string //设备类型
-	Password      string `gorm:"not null;" json:"-"` //控制密码
-}
-
-// Validate 验证
-func (a *Device) Validate() error {
-	if a.DeviceCode == "" ||
-		a.DeviceName == "" ||
-		a.CompanyCode == "" ||
-		a.StationCode == "" {
-		return errors.New("参数不能为空")
-	}
-	return nil
-}

+ 0 - 47
vendor/knowoapi/schema/json.go

@@ -1,47 +0,0 @@
-package schema
-
-import (
-	"bytes"
-	"database/sql/driver"
-	"errors"
-)
-
-type JSON []byte
-
-func (j JSON) Value() (driver.Value, error) {
-	if j.IsNull() {
-		return nil, nil
-	}
-	return string(j), nil
-}
-func (j *JSON) Scan(value interface{}) error {
-	if value == nil {
-		*j = nil
-		return nil
-	}
-	s, ok := value.([]byte)
-	if !ok {
-		return errors.New("Invalid Scan Source")
-	}
-	*j = append((*j)[0:0], s...)
-	return nil
-}
-func (m JSON) MarshalJSON() ([]byte, error) {
-	if m == nil {
-		return []byte("null"), nil
-	}
-	return m, nil
-}
-func (m *JSON) UnmarshalJSON(data []byte) error {
-	if m == nil {
-		return errors.New("null point exception")
-	}
-	*m = append((*m)[0:0], data...)
-	return nil
-}
-func (j JSON) IsNull() bool {
-	return len(j) == 0 || string(j) == "null"
-}
-func (j JSON) Equals(j1 JSON) bool {
-	return bytes.Equal([]byte(j), []byte(j1))
-}

+ 0 - 42
vendor/knowoapi/schema/substation.go

@@ -1,42 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-var SubstationTableName = "substations"
-
-// Substation 变电站表
-type Substation struct {
-	gorm.Model
-	StationCode       string `gorm:"primary_key;not null;"` //站点编号
-	StationName       string `gorm:"not null;size:50;"`     // 站点名称
-	CompanyCode       string `gorm:"not null;"`             //关联公司ID
-	CircutryCode      string `gorm:"index"`                 //关联的线路图编号
-	Operator          string // 操作人
-	StationIntro      string `gorm:"size:255"` //备注
-	LocationX         string //经度
-	LocationY         string //纬度
-	StationProperties JSON   `sql:"TYPE:json"` //站点自定义属性
-	PrincipalCode     string `gorm:"index"`    //负责人编号
-	StationImage      string //站点图片
-}
-
-// SubstationQuery 查询结果
-type SubstationQuery struct {
-	Substation
-	PrincipalName  string
-	PrincipalPhone string
-}
-
-// Validate 验证
-func (a *Substation) Validate() error {
-	if a.StationName == "" ||
-		a.CompanyCode == "" ||
-		a.PrincipalCode == "" {
-		return errors.New("参数不能为空")
-	}
-	return nil
-}

+ 0 - 57
vendor/knowoapi/schema/user.go

@@ -1,57 +0,0 @@
-package schema
-
-import (
-	"errors"
-
-	"github.com/jinzhu/gorm"
-)
-
-// UserTableName 用户表名
-var UserTableName = "users"
-
-// User 用户表
-type User struct {
-	gorm.Model
-	RecordID  string //记录ID
-	UserCode  string `gorm:"size:20;unique;not null;unique_index"` //用户编号
-	UserName  string `gorm:"size:25;not null"`                     //用户名称
-	PassWord  string `gorm:"size:32;not null"`                     //密码
-	Phone     string `gorm:"size:11;"`                             //手机号
-	UserType  int    `gorm:"size:10;not null;default:0"`           //用户角色类型(0超级管理员,1普通管理员、10公司管理员\11公司普通用户 20代理商管理员,21代理商普通用户)
-	RoleCode  int    `gorm:"size:10;not null;default:0"`           //用户权限类型
-	TypCode   string `gorm:"size:50;not null;"`                    //编号 所属公司编号
-	Operator  string `gorm:"-"`                                    //操作人ID
-	UserIntro string `gorm:"size:255;"`                            //备注
-}
-
-// Validate ``
-func (u *User) Validate() error {
-	if u.UserCode == "" ||
-		u.UserName == "" ||
-		u.TypCode == "" {
-		return errors.New("参数不能为空")
-	}
-	return nil
-}
-
-// LoginRequest 用户登录请求
-type LoginRequest struct {
-	UserName string //用户名
-	PassWord string //密码
-	Platform string //平板 ANDROID IOS PC
-	Version  string //版本号
-}
-
-// Validate 实现验证
-func (a *LoginRequest) Validate() error {
-	if a.UserName == "" || a.PassWord == "" {
-		return errors.New("用户名或密码不能为空")
-	}
-	return nil
-}
-
-// LoginResponse 登录成功返回
-type LoginResponse struct {
-	User  `json:"user"`
-	Token string `json:"token"` //登陆令牌
-}

+ 0 - 6
vendor/vendor.json

@@ -685,12 +685,6 @@
 			"revision": "b1670413ba6a7532e46c12ff23d0914c270d2768",
 			"revisionTime": "2018-09-01T16:27:21Z"
 		},
-		{
-			"checksumSHA1": "dSuFw78Ptf3aASKzI9c4dkikJnY=",
-			"path": "knowoapi/schema",
-			"revision": "c8bc2adfc52832a43e9b18da1ab21276e9b476ec",
-			"revisionTime": "2018-09-28T02:09:59Z"
-		},
 		{
 			"checksumSHA1": "tlQInNkqcoSbRydjohND/xm8Ycc=",
 			"path": "labix.org/v2/mgo",