Browse Source

修复图片列表查询

kobe6258 7 months ago
parent
commit
0e6b8c1283
2 changed files with 11 additions and 1 deletions
  1. 2 1
      controllers/analyst.go
  2. 9 0
      models/financial_analyst.go

+ 2 - 1
controllers/analyst.go

@@ -118,6 +118,7 @@ func (this *AnalystController) GetAnalystByName(AnalystName string) {
 		this.ServeJSON()
 	}()
 	analyst, err := models.GetAnalystByName(AnalystName)
+
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败,Err:" + err.Error()
@@ -126,7 +127,7 @@ func (this *AnalystController) GetAnalystByName(AnalystName string) {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
-	br.Data = analyst
+	br.Data = analyst.ToView()
 }
 
 // List

+ 9 - 0
models/financial_analyst.go

@@ -45,6 +45,15 @@ func GetAnalystByName(name string) (analyst CrmFinancialAnalyst, err error) {
 	return
 }
 
+func (a *CrmFinancialAnalyst) ToView() *AnalystView {
+	return &AnalystView{
+		Id:           a.Id,
+		Name:         a.Name,
+		HeadImgURL:   a.HeadImgUrl,
+		Introduction: a.Introduction,
+		CreatedTime:  a.CreatedTime.Format(time.DateTime),
+	}
+}
 func GetAnalystCount() (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(*) AS count FROM crm_financial_analysts`