...
|
...
|
@@ -578,7 +578,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
|
}
|
|
|
auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover}
|
|
|
|
|
|
go CheckChanceUpdate(header, chance, request)
|
|
|
CheckChanceDifferent(header, chance, request)
|
|
|
|
|
|
orm := orm.NewOrm()
|
|
|
orm.Begin()
|
...
|
...
|
@@ -712,9 +712,8 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
|
}
|
|
|
|
|
|
//检查机会更新
|
|
|
func CheckChanceUpdate(header *protocol.RequestHeader, chance *models.Chance, request *protocol.ChanceUpdateRequest) {
|
|
|
func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, request *protocol.ChanceUpdateRequest) {
|
|
|
var (
|
|
|
//chanceData *models.ChanceData
|
|
|
isSaveLog bool = false
|
|
|
chanceReviseLog *models.ChanceReviseLog
|
|
|
message string
|
...
|
...
|
@@ -729,21 +728,18 @@ func CheckChanceUpdate(header *protocol.RequestHeader, chance *models.Chance, re |
|
|
if header.UserId == chance.UserId {
|
|
|
return
|
|
|
}
|
|
|
type ChanceModifyLog struct {
|
|
|
DiffContents interface{} `json:"diffContents"`
|
|
|
Speechs []protocol.Speech `json:"speechs"`
|
|
|
Pictures []protocol.Picture `json:"pictures"`
|
|
|
Videos []protocol.Video `json:"videos"`
|
|
|
var modifyLog = protocol.ChanceReviseLog{}
|
|
|
checkIsSaveLog := func() {
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
}
|
|
|
var modifyLog = ChanceModifyLog{}
|
|
|
|
|
|
diffFormList := func(source string, dis []*protocol.Form) {
|
|
|
type DiffContent struct {
|
|
|
Content string `json:"content"`
|
|
|
}
|
|
|
var (
|
|
|
src []*protocol.Form
|
|
|
mapForm map[string]*protocol.Form = make(map[string]*protocol.Form)
|
|
|
diffStructs = []DiffContent{}
|
|
|
src []*protocol.Form
|
|
|
mapForm map[string]*protocol.Form = make(map[string]*protocol.Form)
|
|
|
reviseContents []protocol.ReviseContent
|
|
|
)
|
|
|
jsonUnmarshal(source, &src)
|
|
|
for i := range src {
|
...
|
...
|
@@ -761,16 +757,13 @@ func CheckChanceUpdate(header *protocol.RequestHeader, chance *models.Chance, re |
|
|
isDiff = true
|
|
|
}
|
|
|
if isDiff {
|
|
|
diffStructs = append(diffStructs, DiffContent{
|
|
|
reviseContents = append(reviseContents, protocol.ReviseContent{
|
|
|
Content: fmt.Sprintf("将“%v”由“%v”改为 “%v“", dis[i].Label, srcValue, dis[i].Value)})
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
checkIsSaveLog()
|
|
|
}
|
|
|
}
|
|
|
modifyLog.DiffContents = diffStructs
|
|
|
modifyLog.DiffContents = reviseContents
|
|
|
}
|
|
|
|
|
|
diffChanceData := func() {
|
|
|
var (
|
|
|
speechs []protocol.Speech
|
...
|
...
|
@@ -782,27 +775,19 @@ func CheckChanceUpdate(header *protocol.RequestHeader, chance *models.Chance, re |
|
|
jsonUnmarshal(chanceData.Images, &pictures)
|
|
|
jsonUnmarshal(chanceData.Videos, &videos)
|
|
|
if !reflect.DeepEqual(request.Videos, videos) || !reflect.DeepEqual(request.Pictures, pictures) {
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
checkIsSaveLog()
|
|
|
modifyLog.Videos = request.Videos
|
|
|
}
|
|
|
if !reflect.DeepEqual(request.Pictures, pictures) {
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
checkIsSaveLog()
|
|
|
modifyLog.Pictures = request.Pictures
|
|
|
}
|
|
|
if !reflect.DeepEqual(request.Speechs, speechs) {
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
checkIsSaveLog()
|
|
|
modifyLog.Speechs = request.Speechs
|
|
|
}
|
|
|
} else {
|
|
|
if !isSaveLog {
|
|
|
isSaveLog = true
|
|
|
}
|
|
|
checkIsSaveLog()
|
|
|
modifyLog.Speechs = request.Speechs
|
|
|
modifyLog.Videos = request.Videos
|
|
|
modifyLog.Speechs = request.Speechs
|
...
|
...
|
@@ -2264,3 +2249,23 @@ func Permission(header *protocol.RequestHeader, request *protocol.PermissionRequ |
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//机会补充详情
|
|
|
func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.ChanceReviseDetailRequest) (rsp *protocol.ChanceReviseDetailResponse, err error) {
|
|
|
var (
|
|
|
detail *models.ChanceReviseLog
|
|
|
provider *protocol.BaseUserInfo
|
|
|
)
|
|
|
if detail, err = models.GetChanceReviseLogById(request.Id); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.ChanceReviseDetailResponse{}
|
|
|
if provider, err = agg.GetUserBaseInfo(detail.UserCompanyId, header.CompanyId); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
json.Unmarshal([]byte(detail.Data), &rsp.ChanceReviseData)
|
|
|
rsp.ChanceReviseData.Provider = provider
|
|
|
return
|
|
|
} |
...
|
...
|
|