package company

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

type CompanyLog struct {
	Id              int       `orm:"column(id);pk"`
	CompanyId       int       `description:"客户id"`
	CompanyName     string    `description:"客户名称"`
	CreditCode      string    `description:"统一社会信用码"`
	CompanyCode     string    `description:"客户编码"`
	Sort            int       `description:"优先级"`
	IsFeeCustomer   int       `description:"是否付费用户"`
	Country         string    `description:"国家编码"`
	ProvinceId      int       `description:"省id"`
	CityId          int       `description:"市id"`
	Address         string    `description:"详细地址"`
	Ctype           int       `orm:"column(type)" description:"客户标签,1：付费客户，2：试用客户，3：流失客户，4：潜在客户" `
	Enabled         int       `description:"用户状态"`
	CreatedTime     time.Time `description:"创建时间"`
	LastUpdatedTime time.Time `description:"最后修改时间"`
	Seller          string    `description:"销售员"`
	SellsId         int       `description:"销售员ID"`
	CompanyBelong   string    `description:"客户所属，ficc：ficc客户，public_offering：公募客户，partner：合作伙伴"`
	StartDate       string    `description:"合同开始日期"`
	EndDate         string    `description:"合同结束日期"`
	LoseReason      string    `description:"流失原因"`
	LastType        int       `description:"原客户标签"`
	FirstStartDate  string    `description:"首次设置为试用客户开始时间"`
	FirstEndDate    string    `description:"首次设置为试用客户结束时间"`
	DateType        int       `description:"日期类型"`
	AdminId         int       `description:"操作人id"`
	LogType         string    `description:"日志类型"`
	LogCreateTime   time.Time `description:"日志创建时间"`
	Province        string    `description:"省"`
	City            string    `description:"市"`
}

//新增客户产品
func AddCompanyLog(item *CompanyLog) (err error) {
	o := orm.NewOrm()
	_, err = o.Insert(item)
	return
}
