feat:完善产品详情
This commit is contained in:
@ -10,7 +10,14 @@ type UserAgent struct {
|
||||
*model.UserAgent
|
||||
}
|
||||
|
||||
func (m *UserAgent) Agent(uid uint64) (*UserSettledInfo, error) {
|
||||
type (
|
||||
UserAgentInfo struct {
|
||||
UserAgentID uint64 `json:"-"`
|
||||
*model.ManageAgent
|
||||
}
|
||||
)
|
||||
|
||||
func (m *UserAgent) Settled(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
@ -22,6 +29,19 @@ func (m *UserAgent) Agent(uid uint64) (*UserSettledInfo, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
// Agent 经纪人信息
|
||||
func (m *UserAgent) Agent(uid uint64) (*UserAgentInfo, error) {
|
||||
out := new(UserAgentInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id AS user_agent_id", "c.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.agent_id = c.id", model.NewManageAgent().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserAgent() *UserAgent {
|
||||
return &UserAgent{model.NewUserAgent()}
|
||||
}
|
||||
|
@ -10,13 +10,19 @@ type UserCompany struct {
|
||||
*model.UserCompany
|
||||
}
|
||||
|
||||
type UserSettledInfo struct {
|
||||
ID uint64 `json:"id"`
|
||||
*model.Examine
|
||||
}
|
||||
type (
|
||||
UserSettledInfo struct {
|
||||
ID uint64 `json:"id"`
|
||||
*model.Examine
|
||||
}
|
||||
UserCompanyInfo struct {
|
||||
*model.ManageCompany
|
||||
UserCompanyID uint64 `json-"`
|
||||
}
|
||||
)
|
||||
|
||||
// Company 公司信息
|
||||
func (m *UserCompany) Company(uid uint64) (*UserSettledInfo, error) {
|
||||
// Settled 入驻信息
|
||||
func (m *UserCompany) Settled(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
@ -28,6 +34,19 @@ func (m *UserCompany) Company(uid uint64) (*UserSettledInfo, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
// Company 公司信息
|
||||
func (m *UserCompany) Company(uid uint64) (*UserCompanyInfo, error) {
|
||||
out := new(UserCompanyInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id AS user_company_id", "c.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.company_id = c.id", model.NewManageCompany().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserCompany() *UserCompany {
|
||||
return &UserCompany{model.NewUserCompany()}
|
||||
}
|
||||
|
@ -10,7 +10,15 @@ type UserExpert struct {
|
||||
*model.UserExpert
|
||||
}
|
||||
|
||||
func (m *UserExpert) Expert(uid uint64) (*UserSettledInfo, error) {
|
||||
type (
|
||||
// UserExpertInfo 专家信息
|
||||
UserExpertInfo struct {
|
||||
UserExpertID uint64 `json:"-"`
|
||||
*model.ManageExpert
|
||||
}
|
||||
)
|
||||
|
||||
func (m *UserExpert) Settled(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
@ -22,6 +30,19 @@ func (m *UserExpert) Expert(uid uint64) (*UserSettledInfo, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
// Expert 专家信息
|
||||
func (m *UserExpert) Expert(uid uint64) (*UserExpertInfo, error) {
|
||||
out := new(UserExpertInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id AS user_expert_id", "c.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.expert_id = c.id", model.NewManageExpert().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserExpert() *UserExpert {
|
||||
return &UserExpert{model.NewUserExpert()}
|
||||
}
|
||||
|
@ -10,7 +10,14 @@ type UserLaboratory struct {
|
||||
*model.UserLaboratory
|
||||
}
|
||||
|
||||
func (m *UserLaboratory) Laboratory(uid uint64) (*UserSettledInfo, error) {
|
||||
type (
|
||||
UserLaboratoryInfo struct {
|
||||
UserLaboratoryID uint64 `json:"-"`
|
||||
*model.ManageLaboratory
|
||||
}
|
||||
)
|
||||
|
||||
func (m *UserLaboratory) Settled(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
@ -22,6 +29,18 @@ func (m *UserLaboratory) Laboratory(uid uint64) (*UserSettledInfo, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (m *UserLaboratory) Laboratory(uid uint64) (*UserLaboratoryInfo, error) {
|
||||
out := new(UserLaboratoryInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id AS user_laboratory_id", "c.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.laboratory_id = c.id", model.NewManageLaboratory().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserLaboratory() *UserLaboratory {
|
||||
return &UserLaboratory{model.NewUserLaboratory()}
|
||||
}
|
||||
|
@ -10,7 +10,14 @@ type UserResearch struct {
|
||||
*model.UserResearch
|
||||
}
|
||||
|
||||
func (m *UserResearch) Research(uid uint64) (*UserSettledInfo, error) {
|
||||
type (
|
||||
UserResearchInfo struct {
|
||||
UserResearchID uint64 `json:"-"`
|
||||
*model.ManageResearch
|
||||
}
|
||||
)
|
||||
|
||||
func (m *UserResearch) Settled(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
@ -22,6 +29,18 @@ func (m *UserResearch) Research(uid uint64) (*UserSettledInfo, error) {
|
||||
return out, err
|
||||
}
|
||||
|
||||
func (m *UserResearch) Research(uid uint64) (*UserResearchInfo, error) {
|
||||
out := new(UserResearchInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id AS user_research_id", "c.*").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.research_id = c.id", model.NewManageResearch().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserResearch() *UserResearch {
|
||||
return &UserResearch{model.NewUserResearch()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user