|
@@ -23,7 +23,7 @@ func CreateEnterprise(ctx context.Context, newEnterprise gorm_model.Enterprise)
|
|
return &newEnterprise.EnterpriseID, nil
|
|
return &newEnterprise.EnterpriseID, nil
|
|
}
|
|
}
|
|
|
|
|
|
-//用户ID查找
|
|
|
|
|
|
+// 用户ID查找
|
|
func GetEnterpriseByUID(ctx context.Context, userID int64) (*gorm_model.Enterprise, error) {
|
|
func GetEnterpriseByUID(ctx context.Context, userID int64) (*gorm_model.Enterprise, error) {
|
|
db := GetReadDB(ctx)
|
|
db := GetReadDB(ctx)
|
|
enterprise := gorm_model.Enterprise{}
|
|
enterprise := gorm_model.Enterprise{}
|
|
@@ -215,3 +215,15 @@ func UpdateEnterprise(ctx context.Context, EnterpriseID string, BusinessName str
|
|
}
|
|
}
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// CreateEnterpriseSubAccount ToDo
|
|
|
|
+// CreateEnterpriseSubAccount 创建商家子账号
|
|
|
|
+func CreateEnterpriseSubAccount(ctx context.Context, EnterpriseID string, BusinessName string) error {
|
|
|
|
+ db := GetReadDB(ctx)
|
|
|
|
+ err := db.Model(gorm_model.Enterprise{}).Where("enterprise_id=?", EnterpriseID).Update("business_name", BusinessName).Error
|
|
|
|
+ if err != nil {
|
|
|
|
+ fmt.Println("Update Enterprise Failed!")
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+}
|