feat:完善产品详情
This commit is contained in:
@ -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()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user