You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
package partner
|
|
|
|
import (
|
|
"github.com/jinzhu/gorm"
|
|
"recook/internal/model/user"
|
|
)
|
|
|
|
type createPartnerParam struct {
|
|
Mobile string `json:"mobile" validate:"len=11"`
|
|
Type uint `json:"type" validate:"oneof=0 1"`
|
|
Name string `gorm:"column:name" json:"name"` // 供应商名称
|
|
BusinessLicenseNum string `gorm:"column:business_license_num" json:"businessLicenseNum"` // 营业执照号
|
|
BusinessLicenseAddress string `gorm:"column:business_license_address" json:"businessLicenseAddress"` // 营业执照号详细地址
|
|
IdNum string `gorm:"column:id_num" json:"idNum"` // 法人身份证号码
|
|
BankName string `gorm:"column:bank_name" json:"bankName"`
|
|
BankNo string `gorm:"column:bank_no" json:"bankNo"`
|
|
}
|
|
|
|
var genderHeadImgMap = map[int]string{
|
|
1: "/default/male.png",
|
|
2: "/default/female.png",
|
|
}
|
|
|
|
func insertTopLevelUser(userId uint, tx *gorm.DB) error {
|
|
rootNode := user.Tree{
|
|
UserID: userId,
|
|
RootID: 0,
|
|
Depth: 0,
|
|
}
|
|
myNode := user.Tree{
|
|
UserID: userId,
|
|
RootID: userId,
|
|
Depth: 0,
|
|
}
|
|
|
|
err := tx.Create(&rootNode).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = tx.Create(&myNode).Error
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|