...
|
...
|
@@ -425,7 +425,7 @@ func getAuditFlowLog(chanceid int64) ([]protocol.ChanceFlowLog, error) { |
|
|
flowLogs = make([]protocol.ChanceFlowLog, 0)
|
|
|
err error
|
|
|
)
|
|
|
const datasql string = `SELECT a.chance_id,a.content,a.create_at,c.nick_name
|
|
|
const datasql string = `SELECT a.chance_id,a.content,a.create_at,c.nick_name,a.code
|
|
|
FROM audit_flow_log AS a
|
|
|
LEFT JOIN user_company AS b ON a.approve_user_id=b.id
|
|
|
LEFT JOIN user AS c ON b.user_id = c.id
|
...
|
...
|
@@ -525,3 +525,50 @@ func GetPermissionInAuditPage(userid int64, companyid int64) serverabc.OptionOpp |
|
|
}
|
|
|
return option
|
|
|
}
|
|
|
|
|
|
type ChanceReviseLogInfo struct {
|
|
|
UserName string `json:"user_name"`
|
|
|
UserComapnyId int64 `json:"user_company_id"`
|
|
|
CreateTime string `json:"create_time"`
|
|
|
models.ChanceReviseLogData
|
|
|
}
|
|
|
|
|
|
//GetChanceReviseLog 获取对机会的操作记录,补充机会的详情
|
|
|
func GetChanceReviseLog(flowLogId int64, chanceId int64, companyId int64) (*ChanceReviseLogInfo, error) {
|
|
|
var (
|
|
|
reviseLog *models.ChanceReviseLog
|
|
|
reviseLogData *models.ChanceReviseLogData
|
|
|
usercompanyData *models.UserCompany
|
|
|
chanceData *models.Chance
|
|
|
err error
|
|
|
)
|
|
|
chanceData, err = models.GetChanceById(chanceId)
|
|
|
if err != nil {
|
|
|
log.Error("获取机会数据chance失败:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if chanceData.CompanyId != companyId {
|
|
|
log.Error("机会的公司不匹配")
|
|
|
}
|
|
|
reviseLog, reviseLogData, err = models.GetChanceReviseLogData(flowLogId)
|
|
|
if err != nil {
|
|
|
log.Error("获取chance_revise_log失败,err:%s", err)
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if reviseLog.ChanceId != chanceId {
|
|
|
log.Error("日志与机会不匹配")
|
|
|
return nil, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
rspData := &ChanceReviseLogInfo{
|
|
|
UserComapnyId: reviseLog.UserCompanyId,
|
|
|
CreateTime: reviseLog.CreateAt.Format("2006-01-02 15:04:05"),
|
|
|
ChanceReviseLogData: *reviseLogData,
|
|
|
}
|
|
|
usercompanyData, err = models.GetUserCompanyById(reviseLog.UserCompanyId)
|
|
|
if err != nil {
|
|
|
log.Error("获取用户数据user_company失败;%s", err)
|
|
|
} else {
|
|
|
rspData.UserName = usercompanyData.NickName
|
|
|
}
|
|
|
return rspData, nil
|
|
|
} |
...
|
...
|
|