作者 tangxvhui

机会详情添加 自查内容

package models
import (
"encoding/json"
"fmt"
"time"
... ... @@ -101,6 +102,12 @@ type ChanceSelfCheck struct {
Answer string `json::"answer"`
}
func (m *Chance) GetSelfCheckData() []ChanceSelfCheck {
var data []ChanceSelfCheck
json.Unmarshal([]byte(m.SelfChecks), &data)
return data
}
// AddChance insert a new Chance into database and returns
// last inserted Id on success.
func AddChance(m *Chance) (id int64, err error) {
... ...
... ... @@ -421,7 +421,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
log.Warn("获取获取记录失败")
}
returnData.FlowLog = flowlogs
returnData.SelfCheck = getChanceSelfChecks(chanceid)
returnData.SelfCheck = getChanceSelfChecks(chanceInfo)
return returnData, nil
}
... ... @@ -444,8 +444,16 @@ func getAuditFlowLog(chanceid int64) ([]protocol.ChanceFlowLog, error) {
return flowLogs, err
}
func getChanceSelfChecks(chanceId int64) []ChanceSelfCheckData {
func getChanceSelfChecks(chanceInfo *models.Chance) []ChanceSelfCheckData {
selfchecks := []ChanceSelfCheckData{}
mSelfChecks := chanceInfo.GetSelfCheckData()
for _, v := range mSelfChecks {
m := ChanceSelfCheckData{
Title: v.ChickItem,
Result: v.Answer,
}
selfchecks = append(selfchecks, m)
}
return selfchecks
}
... ...