From 460e591f215fe64d6a097ff4b1ee836d181298ac Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期五, 11 八月 2023 16:12:38 +0800 Subject: [PATCH] fix --- model/salesReturn.go | 19 +-- model/business.go | 8 - model/plan.go | 5 model/saleChance.go | 3 model/jsonTime.go | 52 ++++++++++ model/quotation.go | 29 ++--- model/contact.go | 27 ++-- api/v1/quotation.go | 7 model/masterOrder.go | 17 +- model/followRecord.go | 37 +++--- model/serviceFeeManage.go | 14 +- model/salesRefund.go | 21 ++-- model/client.go | 4 api/v1/followRecord.go | 25 +++- 14 files changed, 162 insertions(+), 106 deletions(-) diff --git a/api/v1/followRecord.go b/api/v1/followRecord.go index fef5098..0960dcf 100644 --- a/api/v1/followRecord.go +++ b/api/v1/followRecord.go @@ -6,6 +6,7 @@ "aps_crm/model/response" "aps_crm/pkg/contextx" "aps_crm/pkg/ecode" + "errors" "github.com/gin-gonic/gin" "time" ) @@ -172,25 +173,37 @@ // checkTimeFormat // 妫�鏌ユ椂闂存牸寮� -func checkTimeFormat(t string) (*time.Time, error) { +func checkTimeFormat(t string) (*model.CustomTime, error) { + if t == "" { + return nil, nil + } + location, err := time.LoadLocation("Asia/Shanghai") if err != nil { return nil, err } - tt, err := time.Parse("2006-01-02T15:04:05.000Z", t) + tt, err := time.Parse("2006-01-02", t) if err == nil { ret := tt.In(location) - return &ret, nil + tmp := model.CustomTime(ret) + return &tmp, nil } - tt, err = time.Parse("2006-01-02T15:04:05-07:00", t) + tt, err = time.Parse("2006-01-02 15:04:05", t) if err == nil { ret := tt.In(location) - return &ret, nil + tmp := model.CustomTime(ret) + return &tmp, nil } - return nil, err + //tt, err = time.Parse("2006-01-02T15:04:05-07:00", t) + //if err == nil { + // ret := tt.In(location) + // return &ret, nil + //} + + return nil, errors.New("invalid time format") } // List diff --git a/api/v1/quotation.go b/api/v1/quotation.go index 3a8dd0e..b436336 100644 --- a/api/v1/quotation.go +++ b/api/v1/quotation.go @@ -98,7 +98,6 @@ ctx.Ok() } - // checkQuotationParams func checkQuotationParams(quotation request.Quotation) (int, model.Quotation) { var errCode int @@ -129,6 +128,8 @@ errCode = ecode.InvalidParams return errCode, quotationModel } + + // 灏嗘椂闂村瓧绗﹁浆鎹负鏃堕棿绫诲瀷 quotationModel.ValidityDate = t quotationModel.ClientId = quotation.ClientId @@ -166,7 +167,7 @@ } ctx.OkWithDetailed(response.QuotationResponse{ - List: quotations, + List: quotations, Count: int(total), }) -} \ No newline at end of file +} diff --git a/model/business.go b/model/business.go index c26f7ee..fe1625f 100644 --- a/model/business.go +++ b/model/business.go @@ -1,12 +1,10 @@ package model -import "time" - type ( Business struct { - Representative string `json:"representative" gorm:"column:representative;type:varchar(255);comment:娉曚汉浠h〃"` - 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:娉ㄥ唽璧勯噾"` + Representative string `json:"representative" gorm:"column:representative;type:varchar(255);comment:娉曚汉浠h〃"` + RegistrationTime *CustomTime `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:鎵�灞炶涓�"` Industry Industry diff --git a/model/client.go b/model/client.go index 2dfb6e6..f7470f6 100644 --- a/model/client.go +++ b/model/client.go @@ -26,8 +26,8 @@ ServiceMemberId int `json:"service_member_id" gorm:"column:service_member_id;type:int(11);comment:鏈嶅姟璐熻矗浜篒D"` 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 *CustomTime `json:"next_visit_time" gorm:"column:next_visit_time;type:datetime;comment:涓嬫鍥炶鏃堕棿"` + LatestServiceTime *CustomTime `json:"latest_service_time" gorm:"column:latest_service_time;type:datetime;comment:鏈�鏅氭湇鍔℃椂闂�"` FollowRecord []FollowRecord `json:"follow_record" gorm:"foreignKey:ClientId"` Address Business diff --git a/model/contact.go b/model/contact.go index 7907378..a955791 100644 --- a/model/contact.go +++ b/model/contact.go @@ -3,24 +3,23 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( Contact struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鑱旂郴浜哄鍚�"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鑱旂郴浜虹紪鍙�"` - ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` - Client Client `json:"-" gorm:"foreignKey:ClientId"` - Position string `json:"position" gorm:"column:position;type:varchar(255);comment:鑱屼綅"` - Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璐熻矗浜篒D"` - 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:鐢熸棩"` - Email string `json:"email" gorm:"column:email;type:varchar(255);comment:閭"` - Desc string `json:"desc" gorm:"column:desc;type:varchar(255);comment:澶囨敞"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Name string `json:"name" gorm:"column:name;type:varchar(255);comment:鑱旂郴浜哄鍚�"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:鑱旂郴浜虹紪鍙�"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` + Client Client `json:"-" gorm:"foreignKey:ClientId"` + Position string `json:"position" gorm:"column:position;type:varchar(255);comment:鑱屼綅"` + Phone string `json:"phone" gorm:"column:phone;type:varchar(255);comment:鐢佃瘽"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璐熻矗浜篒D"` + 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 *CustomTime `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 gorm.Model `json:"-"` } diff --git a/model/followRecord.go b/model/followRecord.go index 291eca4..b12a6da 100644 --- a/model/followRecord.go +++ b/model/followRecord.go @@ -3,29 +3,28 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( FollowRecord struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"` - ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"` - Member User `json:"member" gorm:"foreignKey:MemberId"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"` - ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"` - Topic string `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"` - Record string `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"` - SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"` - SalesLeadsId int `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"` - 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:涓嬫璺熻繘鏃堕棿"` - 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"` - Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛id"` + ClientStatusId int `json:"client_status_id" gorm:"column:client_status_id;type:int(11);comment:瀹㈡埛鐘舵�乮d"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:璺熻繘浜篿d"` + Member User `json:"member" gorm:"foreignKey:MemberId"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:璺熻繘缂栧彿"` + ContactId int `json:"contact_id" gorm:"column:contact_id;type:int(11);comment:鑱旂郴浜篿d"` + Topic string `json:"topic" gorm:"column:topic;type:varchar(255);comment:璺熻繘涓婚"` + Record string `json:"record" gorm:"column:record;type:MEDIUMTEXT;comment:璺熻繘璁板綍"` + SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int(11);comment:閿�鍞満浼歩d"` + SalesLeadsId int `json:"sales_leads_id" gorm:"column:sales_leads_id;type:int(11);comment:閿�鍞嚎绱d"` + ContactInformationId int `json:"contact_information_id" gorm:"column:contact_information_id;type:int(11);comment:鑱旂郴鏂瑰紡id"` + FollowTime *CustomTime `json:"follow_time" gorm:"column:follow_time;type:datetime;comment:璺熻繘鏃堕棿"` + NextFollowTime *CustomTime `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"` + Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` gorm.Model `json:"-"` } diff --git a/model/jsonTime.go b/model/jsonTime.go new file mode 100644 index 0000000..64bf399 --- /dev/null +++ b/model/jsonTime.go @@ -0,0 +1,52 @@ +package model + +import ( + "database/sql/driver" + "encoding/json" + "fmt" + "time" +) + +type CustomTime time.Time + +const ctLayout = "2006-01-02 15:04:05" // 鎯宠鐨勬椂闂存牸寮� + +func (ct *CustomTime) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(*ct).Format(ctLayout)) +} + +func (ct *CustomTime) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + + t, err := time.Parse(ctLayout, s) + if err != nil { + return err + } + + *ct = CustomTime(t) + return nil +} + +// Scan 灏嗘暟鎹簱鍊兼壂鎻忓埌Go涓殑CustomTime +func (ct *CustomTime) Scan(value interface{}) error { + if value == nil { + *ct = CustomTime(time.Time{}) + return nil + } + if t, ok := value.(time.Time); ok { + *ct = CustomTime(t) + return nil + } + return fmt.Errorf("can't scan %T into CustomTime", value) +} + +// Value 灏咰ustomTime鐨勫�艰浆鎹负鏁版嵁搴撳�� +func (ct CustomTime) Value() (driver.Value, error) { + if time.Time(ct).IsZero() { + return nil, nil + } + return time.Time(ct), nil +} diff --git a/model/masterOrder.go b/model/masterOrder.go index 090803f..56550f8 100644 --- a/model/masterOrder.go +++ b/model/masterOrder.go @@ -3,20 +3,19 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( // MasterOrder 閿�鍞�诲崟 MasterOrder struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞�诲崟鍙�"` - 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:璐熻矗浜篿d"` - 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:鎬婚噾棰�"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + Number string `json:"number" gorm:"column:number;type:varchar(255);comment:閿�鍞�诲崟鍙�"` + 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:璐熻矗浜篿d"` + StartTime *CustomTime `json:"start_time" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` + EndTime *CustomTime `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:"-"` } diff --git a/model/plan.go b/model/plan.go index 96f5e22..6441c30 100644 --- a/model/plan.go +++ b/model/plan.go @@ -3,7 +3,6 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( @@ -16,8 +15,8 @@ SubOrder SubOrder `json:"subOrder" gorm:"foreignKey:SubOrderId"` SalesDetailsId int `json:"salesDetailsId" gorm:"column:sales_details_id;type:int;comment:閿�鍞槑缁唅d"` 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 *CustomTime `json:"startTime" gorm:"column:start_time;type:datetime;comment:寮�濮嬫椂闂�"` + EndTime *CustomTime `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:"-"` diff --git a/model/quotation.go b/model/quotation.go index 34262bc..b97befb 100644 --- a/model/quotation.go +++ b/model/quotation.go @@ -3,26 +3,25 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( // Quotation 鎶ヤ环鍗� Quotation struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - 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:鎶ヤ环鍗曠姸鎬乮d"` - 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:鑱旂郴浜篿d"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` - SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` - Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:鎶ヤ环鏉′欢"` - File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"` - Client Client `json:"client" gorm:"foreignKey:ClientId"` - Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` - SaleChance SaleChance `json:"sale_chance" gorm:"foreignKey:SaleChanceId"` - Products []Product `json:"products" gorm:"many2many:quotation_product"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + 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:鎶ヤ环鍗曠姸鎬乮d"` + ValidityDate *CustomTime `json:"validity_date" gorm:"column:validity_date;type:datetime;comment:鏈夋晥鏈�"` + ContactId int `json:"contact_id" gorm:"column:contact_id;type:int;comment:鑱旂郴浜篿d"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"` + SaleChanceId int `json:"sale_chance_id" gorm:"column:sale_chance_id;type:int;comment:閿�鍞満浼歩d"` + Conditions string `json:"conditions" gorm:"column:conditions;type:text;comment:鎶ヤ环鏉′欢"` + File string `json:"file" gorm:"column:file;type:varchar(255);comment:闄勪欢"` + Client Client `json:"client" gorm:"foreignKey:ClientId"` + Contact Contact `json:"contact" gorm:"foreignKey:ContactId"` + SaleChance SaleChance `json:"sale_chance" gorm:"foreignKey:SaleChanceId"` + Products []Product `json:"products" gorm:"many2many:quotation_product"` gorm.Model `json:"-"` } diff --git a/model/saleChance.go b/model/saleChance.go index f695f9d..3667873 100644 --- a/model/saleChance.go +++ b/model/saleChance.go @@ -3,7 +3,6 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( @@ -23,7 +22,7 @@ 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 *CustomTime `json:"expected_time" gorm:"column:expected_time;type:datetime;comment:棰勮鎴愪氦鏃堕棿"` StatusId int `json:"status_id" gorm:"column:status_id;type:int(11);comment:鐘舵�両D"` PainPoints string `json:"pain_points" gorm:"column:pain_points;type:text;comment:鐥涚偣"` WhetherEstablished string `json:"whether_established" gorm:"column:whether_established;type:text;comment:鏄惁鎴愮珛"` diff --git a/model/salesRefund.go b/model/salesRefund.go index ef4dc92..cbdf41b 100644 --- a/model/salesRefund.go +++ b/model/salesRefund.go @@ -3,21 +3,20 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( SalesRefund struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - 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:璐熻矗浜篿d"` - 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:鏄惁寮�绁�"` - Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"` - Products []Product `json:"products" gorm:"many2many:salesRefund_product;"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + 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:璐熻矗浜篿d"` + RefundDate *CustomTime `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:鏄惁寮�绁�"` + Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"` + Products []Product `json:"products" gorm:"many2many:salesRefund_product;"` gorm.Model `json:"-"` } diff --git a/model/salesReturn.go b/model/salesReturn.go index aec6c31..646ca70 100644 --- a/model/salesReturn.go +++ b/model/salesReturn.go @@ -3,20 +3,19 @@ import ( "aps_crm/pkg/mysqlx" "gorm.io/gorm" - "time" ) type ( SalesReturn struct { - Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` - ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` - 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:璐熻矗浜篿d"` - 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;"` + Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` + ClientId int `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"` + 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:璐熻矗浜篿d"` + ReturnDate *CustomTime `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;"` } SalesReturnSearch struct { diff --git a/model/serviceFeeManage.go b/model/serviceFeeManage.go index 4ef85e8..39f7e9a 100644 --- a/model/serviceFeeManage.go +++ b/model/serviceFeeManage.go @@ -9,13 +9,13 @@ type ( ServiceFeeManage struct { - Id int `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"` - 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:鏈�鏅氭湇鍔℃椂闂�"` - Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:澶囨敞"` - File string `json:"file" gorm:"column:file;type:varchar(255);comment:鏂囦欢"` + Id int `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"` + 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 *CustomTime `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:"-"` } -- Gitblit v1.8.0