added todo for lead
This commit is contained in:
parent
b6d4ab132f
commit
9f99282f71
@ -164,6 +164,8 @@ func (wc *DealsWorker) startFetching(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("DEALID", id)
|
||||
|
||||
err = wc.bitrixRepo.BitrixRepo.SaveDealBitrixStatus(ctx, bitrix.SaveDealBitrixDeps{
|
||||
DealID: id,
|
||||
AnswerID: result.AnswerID,
|
||||
@ -177,6 +179,7 @@ func (wc *DealsWorker) startFetching(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// todo ОБДУМАТЬ ЛИДЫ ПОЧЕМУ ЛИД ПРЕВРАЩАЕТСЯ В СДЕЛКУ
|
||||
func (wc *DealsWorker) constructField(ctx context.Context, request interface{}, allAnswers []model.ResultAnswer, result model.BitrixUsersTrueResults, performerIDInt int) (map[string]map[string]interface{}, error) {
|
||||
// id поля - ответ по типу поля
|
||||
entityFieldsMap := make(map[model.FieldsType]map[string]string)
|
||||
@ -192,6 +195,9 @@ func (wc *DealsWorker) constructField(ctx context.Context, request interface{},
|
||||
entityRules[model.FieldTypeCompany] = result.FieldsRule.Company.QuestionID
|
||||
entityRules[model.FieldTypeContact] = result.FieldsRule.Contact.QuestionID
|
||||
|
||||
fmt.Println("result.FieldsRule.Deal.QuestionID", result.FieldsRule.Deal.QuestionID)
|
||||
fmt.Println("result.FieldsRule.Lead.QuestionID", result.FieldsRule.Lead.QuestionID)
|
||||
|
||||
for entityType, rule := range entityRules {
|
||||
for _, data := range allAnswers {
|
||||
if fieldID, ok := rule[int(data.QuestionID)]; ok {
|
||||
@ -365,10 +371,12 @@ func (wc *DealsWorker) constructField(ctx context.Context, request interface{},
|
||||
var reqMap map[string]map[string]interface{}
|
||||
|
||||
if result.LeadFlag {
|
||||
fmt.Println("leadFields", leadFields)
|
||||
leadReq.Fields.CompanyID = companyID
|
||||
leadReq.Fields.ContactIDs = append(leadReq.Fields.ContactIDs, contactID)
|
||||
reqMap = models.FormattingToMap(&leadReq, leadFields)
|
||||
} else {
|
||||
fmt.Println("dealFields", dealFields)
|
||||
dealReq.Fields.CompanyID = companyID
|
||||
dealReq.Fields.ContactIDs = append(dealReq.Fields.ContactIDs, contactID)
|
||||
reqMap = models.FormattingToMap(&dealReq, dealFields)
|
||||
|
Loading…
Reference in New Issue
Block a user