| | |
| | | |
| | | // checkTimeFormat |
| | | // 检查时间格式 |
| | | func checkTimeFormat(t string) (time.Time, error) { |
| | | if t == "" { |
| | | t = "1900-01-01T00:00:00+08:00" |
| | | } |
| | | |
| | | func checkTimeFormat(t string) (*time.Time, error) { |
| | | location, err := time.LoadLocation("Asia/Shanghai") |
| | | if err != nil { |
| | | return time.Time{}, err |
| | | return nil, err |
| | | } |
| | | |
| | | tt, err := time.Parse("2006-01-02T15:04:05.000Z", t) |
| | | if err == nil { |
| | | return tt.In(location), nil |
| | | ret := tt.In(location) |
| | | return &ret, nil |
| | | } |
| | | |
| | | tt, err = time.Parse("2006-01-02T15:04:05-07:00", t) |
| | | if err == nil { |
| | | return tt.In(location), nil |
| | | ret := tt.In(location) |
| | | return &ret, nil |
| | | } |
| | | |
| | | return time.Time{}, err |
| | | return nil, err |
| | | } |
| | | |
| | | // List |
| | |
| | | type ( |
| | | Business struct { |
| | | Representative string `json:"representative" gorm:"column:representative;type:varchar(255);comment:法人代表"` |
| | | RegistrationTime time.Time `json:"registration_time" gorm:"column:registration_time;type:datetime;default:1970-01-01 08:00:00;comment:注册时间"` |
| | | RegistrationTime *time.Time `json:"registration_time" gorm:"column:registration_time;type:datetime;default:1970-01-01 08:00:00;comment:注册时间"` |
| | | RegisteredCapitalId int `json:"registered_capital_id" gorm:"column:registered_capital_id;type:int(11);comment:注册资金"` |
| | | RegisteredCapital RegisteredCapital |
| | | IndustryId int `json:"industry_id" gorm:"column:industry_id;type:int(11);comment:所属行业"` |
| | |
| | | ServiceMemberId int `json:"service_member_id" gorm:"column:service_member_id;type:int(11);comment:服务负责人ID"` |
| | | DetailAddress string `json:"detail_address" gorm:"column:detail_address;type:varchar(255);comment:详细地址"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:备注"` |
| | | NextVisitTime time.Time `json:"next_visit_time" gorm:"column:next_visit_time;type:datetime;comment:下次回访时间"` |
| | | LatestServiceTime time.Time `json:"latest_service_time" gorm:"column:latest_service_time;type:datetime;comment:最晚服务时间"` |
| | | NextVisitTime *time.Time `json:"next_visit_time" gorm:"column:next_visit_time;type:datetime;comment:下次回访时间"` |
| | | LatestServiceTime *time.Time `json:"latest_service_time" gorm:"column:latest_service_time;type:datetime;comment:最晚服务时间"` |
| | | FollowRecord []FollowRecord `json:"follow_record" gorm:"foreignKey:ClientId"` |
| | | Address |
| | | Business |
| | |
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:负责人ID"` |
| | | IsFirst bool `json:"is_first" gorm:"column:is_first;type:tinyint(1);comment:是否首要联系人"` |
| | | Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255);comment:微信"` |
| | | Birthday time.Time `json:"birthday" gorm:"column:birthday;type:datetime;comment:生日"` |
| | | Birthday *time.Time `json:"birthday" gorm:"column:birthday;type:datetime;comment:生日"` |
| | | Email string `json:"email" gorm:"column:email;type:varchar(255);comment:邮箱"` |
| | | Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:备注"` |
| | | Address |
| | |
| | | SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:销售机会id"` |
| | | SalesLeadsId int `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:销售线索id"` |
| | | ContactInformationId int `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:联系方式id"` |
| | | FollowTime time.Time `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"` |
| | | NextFollowTime time.Time `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"` |
| | | FollowTime *time.Time `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:跟进时间"` |
| | | NextFollowTime *time.Time `json:"next_follow_time" gorm:"column:next_follow_time;type:datetime;comment:下次跟进时间"` |
| | | Purpose string `json:"purpose" gorm:"column:purpose;type:varchar(255);comment:跟进目的"` |
| | | Content string `json:"content" gorm:"column:content;type:MEDIUMTEXT;comment:跟进内容"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Client Client `json:"client" gorm:"foreignKey:ClientId"` |
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | StartTime time.Time `json:"start_time" gorm:"column:start_time;type:datetime;comment:开始时间"` |
| | | EndTime time.Time `json:"end_time" gorm:"column:end_time;type:datetime;comment:结束时间"` |
| | | StartTime *time.Time `json:"start_time" gorm:"column:start_time;type:datetime;comment:开始时间"` |
| | | EndTime *time.Time `json:"end_time" gorm:"column:end_time;type:datetime;comment:结束时间"` |
| | | Money float64 `json:"money" gorm:"column:money;type:decimal(10,2);comment:总金额"` |
| | | gorm.Model `json:"-"` |
| | | } |
| | |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | |
| | | } |
| | | ) |
| | | |
| | |
| | | SubOrder SubOrder `json:"subOrder" gorm:"foreignKey:SubOrderId"` |
| | | SalesDetailsId int `json:"salesDetailsId" gorm:"column:sales_details_id;type:int;comment:销售明细id"` |
| | | SalesDetails SalesDetails `json:"salesDetails" gorm:"foreignKey:SalesDetailsId"` |
| | | StartTime time.Time `json:"startTime" gorm:"column:start_time;type:datetime;comment:开始时间"` |
| | | EndTime time.Time `json:"endTime" gorm:"column:end_time;type:datetime;comment:结束时间"` |
| | | StartTime *time.Time `json:"startTime" gorm:"column:start_time;type:datetime;comment:开始时间"` |
| | | EndTime *time.Time `json:"endTime" gorm:"column:end_time;type:datetime;comment:结束时间"` |
| | | Content string `json:"content" gorm:"column:content;type:varchar(255);comment:计划内容"` |
| | | File string `json:"file" gorm:"column:file;type:varchar(255);comment:附件"` |
| | | gorm.Model `json:"-"` |
| | |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:报价单号"` |
| | | QuotationStatusId int `json:"quotation_status_id" gorm:"column:quotation_status_id;type:int;comment:报价单状态id"` |
| | | ValidityDate time.Time `json:"validity_date" gorm:"column:validity_date;type:datetime;comment:有效期"` |
| | | ValidityDate *time.Time `json:"validity_date" gorm:"column:validity_date;type:datetime;comment:有效期"` |
| | | ContactId int `json:"contact_id" gorm:"column:contact_id;type:int;comment:联系人id"` |
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int;comment:销售机会id"` |
| | |
| | | Budget float64 `json:"budget" gorm:"column:budget;type:decimal(10,2);comment:预算"` |
| | | ProjectedAmount float64 `json:"projected_amount" gorm:"column:projected_amount;type:decimal(10,2);comment:预计金额"` |
| | | Currency int `json:"currency" gorm:"column:currency;type:int(11);comment:币种"` |
| | | ExpectedTime time.Time `json:"expected_time" gorm:"column:expected_time;type:datetime;comment:预计成交时间"` |
| | | ExpectedTime *time.Time `json:"expected_time" gorm:"column:expected_time;type:datetime;comment:预计成交时间"` |
| | | StatusId int `json:"status_id" gorm:"column:status_id;type:int(11);comment:状态ID"` |
| | | PainPoints string `json:"pain_points" gorm:"column:pain_points;type:text;comment:痛点"` |
| | | WhetherEstablished string `json:"whether_established" gorm:"column:whether_established;type:text;comment:是否成立"` |
| | |
| | | ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"` |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退款单号"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | RefundDate time.Time `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:退款日期"` |
| | | RefundDate *time.Time `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:退款日期"` |
| | | RefundMethod string `json:"refundMethod" gorm:"column:refund_method;type:varchar(255);comment:退款方式"` |
| | | AccountId int `json:"accountId" gorm:"column:account_id;type:int;comment:账户"` |
| | | IsInvoice int `json:"isInvoice" gorm:"column:is_invoice;type:int;comment:是否开票"` |
| | |
| | | OrderBy string |
| | | PageNum int |
| | | PageSize int |
| | | |
| | | } |
| | | ) |
| | | |
| | |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"` |
| | | Repository string `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | ReturnDate time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"` |
| | | ReturnDate *time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"` |
| | | SalesReturnStatus int `json:"salesReturnStatus" gorm:"column:sales_return_status;type:int;comment:退货状态"` |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"` |
| | | Products []Product `json:"products" gorm:"many2many:salesReturn_product;"` |
| | |
| | | ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:客户ID"`
|
| | | Client *Client `json:"client" gorm:"foreignKey:ClientId"`
|
| | | MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:员工ID"`
|
| | | LatestDate time.Time `json:"latest_date" gorm:"column:latest_date;type:datetime;comment:最晚服务时间"`
|
| | | LatestDate *time.Time `json:"latest_date" gorm:"column:latest_date;type:datetime;comment:最晚服务时间"` |
| | | Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:备注"`
|
| | | File string `json:"file" gorm:"column:file;type:varchar(255);comment:文件"`
|
| | | gorm.Model `json:"-"`
|