diff --git a/model/model_test.go b/model/model_test.go index ad0bc15..9ceb821 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -164,6 +164,26 @@ func InitDBProd() { //&UserAttendance{}, //&UserAttendanceRecord{}, + &Store{}, + &GameCard{}, + &GameCardGoods{}, + &GameCardGoodsStock{}, + &User{}, + &Order{}, + &OrderCard{}, + + &OperationLog{}, + &CooperativeBusiness{}, + &CooperativeMemberDeduct{}, + &CooperativeAssistantMemberDeduct{}, + + &CooperativeMemberPromotion{}, + &CooperativeMemberPromotionStore{}, + &CooperativeMemberPromotionDay{}, + &CooperativeMemberPromotionStoreDay{}, + &InviteMemberReport{}, + &CooperativeDeductSettle{}, + &XcxRole{}, ) if err := DBProd.DB().Ping(); err != nil { @@ -1165,3 +1185,33 @@ func TestAddCooperativeMemberPromotion(t *testing.T) { DB = DBDev AddCooperativeMemberPromotion(4, 20, 68608411, 2) } + +func TestUpdateCooperativeBusiness(t *testing.T) { + //InitTestDB() + //DB = DBDev + InitDBProd() + DB = DBProd + + //var list []GameCardGoods + //err := DB.Table("game_card").Find(&list).Error + //if err != nil { + // fmt.Println("err:", err) + //} + //storeMap := GetAllStoreMap() + chendu := []uint32{15, 17, 20, 21} + chongqin := []uint32{12, 16} + diwei := []uint32{13, 14, 18, 19, 23, 24, 25} + DB.Table("user").Where("store_id in (?)", chendu).Updates(map[string]interface{}{ + "cooperative_business_id": 2, + "cooperative_name": "成都合作商", + }) + DB.Table("user").Where("store_id in (?)", chongqin).Updates(map[string]interface{}{ + "cooperative_business_id": 3, + "cooperative_name": "重庆合作商", + }) + DB.Table("user").Where("store_id in (?)", diwei).Updates(map[string]interface{}{ + "cooperative_business_id": 1, + "cooperative_name": "迪为合作商", + }) + +} diff --git a/model/user.go b/model/user.go index c69910a..fc7957a 100644 --- a/model/user.go +++ b/model/user.go @@ -277,18 +277,18 @@ const ( // gen:qs type OperationLog struct { Model - Uid uint32 `json:"uid" gorm:"index"` // 店员id - Description string `json:"description"` // 描述 - OperationType string `json:"operation_type" gorm:"index"` // 操作类型 - CorrelationId uint32 `json:"correlation_id" gorm:"index"` // 关联id - CorrelationName string `json:"correlation_name" gorm:"index"` // 关联name - StoreId uint32 `json:"store_id" gorm:"index"` // 门店id - StoreName string `json:"store_name"` // 门店名称 - CooperativeName string `json:"cooperative_name"` // 合作商名称 - CooperativeBusinessId uint32 `json:"cooperative_business_id"` // 合作商id - SerialNumber string `json:"serial_number" gorm:"index"` // 卡编号 - Detail string `json:"detail"` // 详情 - Remark string `json:"remark"` // 备注 + Uid uint32 `json:"uid" gorm:"index"` // 店员id + Description string `json:"description"` // 描述 + OperationType string `json:"operation_type" gorm:"index"` // 操作类型 + CorrelationId uint32 `json:"correlation_id" gorm:"index"` // 关联id + CorrelationName string `json:"correlation_name" gorm:"index"` // 关联name + StoreId uint32 `json:"store_id" gorm:"index"` // 门店id + StoreName string `json:"store_name"` // 门店名称 + CooperativeName string `json:"cooperative_name"` // 合作商名称 + CooperativeBusinessId uint32 `json:"cooperative_business_id" gorm:"index"` // 合作商id + SerialNumber string `json:"serial_number" gorm:"index"` // 卡编号 + Detail string `json:"detail"` // 详情 + Remark string `json:"remark"` // 备注 } func (m *UserOpenMemberRecord) OrderRefund(outTradeNo string) error {