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