now bitrix is strange need test tomorrow

This commit is contained in:
Pavel 2024-10-22 23:59:45 +03:00
parent b0fdafa3b4
commit f4b739015e
2 changed files with 36 additions and 37 deletions

@ -647,7 +647,7 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, msg models.K
newFields = append(newFields, model.BitrixField{ newFields = append(newFields, model.BitrixField{
BitrixID: fmt.Sprintf("%d", createdID), BitrixID: fmt.Sprintf("%d", createdID),
EntityID: entity, EntityID: entity,
FieldName: field.FieldName, FieldName: "UF_CRM_" + strings.ToUpper(field.FieldName),
EditFromLabel: field.EditFormLabel, EditFromLabel: field.EditFormLabel,
FieldType: field.UserTypeID, FieldType: field.UserTypeID,
}) })
@ -667,7 +667,7 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, msg models.K
newFields = append(newFields, model.BitrixField{ newFields = append(newFields, model.BitrixField{
BitrixID: fmt.Sprintf("%d", createdID), BitrixID: fmt.Sprintf("%d", createdID),
EntityID: model.FieldTypeContact, EntityID: model.FieldTypeContact,
FieldName: contactField.FieldName, FieldName: "UF_CRM_" + strings.ToUpper(contactField.FieldName),
EditFromLabel: contactField.EditFormLabel, EditFromLabel: contactField.EditFormLabel,
FieldType: contactField.UserTypeID, FieldType: contactField.UserTypeID,
}) })

@ -47,11 +47,9 @@ func TestGetListFields(t *testing.T) {
// fmt.Println(result) // fmt.Println(result)
//} //}
// //
//fieldAnswer := make(map[string]string) fieldAnswer := make(map[string]string)
//fieldAnswer["UF_CRM_1727099993"] = "field1" fieldAnswer["UF_CRM_CSC0TEL6PVUM0J68N5RG"] = "field1"
//fieldAnswer["UF_CRM_1727099994"] = "field2"
//fieldAnswer["UF_CRM_1727099994"] = "field3"
//fieldAnswer["UF_CRM_1726835607006"] = "field4"
// //
//createContactReq := models.CreateContactReq{ //createContactReq := models.CreateContactReq{
// Fields: models.ContactFields{ // Fields: models.ContactFields{
@ -95,30 +93,31 @@ func TestGetListFields(t *testing.T) {
// fmt.Println(err) // fmt.Println(err)
//} //}
// //
//createDealReq := models.CreatingDealReq{ createDealReq := models.CreatingDealReq{
// Fields: models.CreateDealFields{ Fields: models.CreateDealFields{
// Title: "ТЕСТ ОТ ГОУ АПИ 10/10", Title: "ТЕСТ ОТ ГОУ АПИ 10/10",
// TypeID: "SALE", TypeID: "SALE",
// StageID: "NEW", StageID: "NEW",
// CompanyID: companyResult, CompanyID: 369,
// ContactIDs: []int32{contactResult}, ContactIDs: []int32{211},
// Opened: "Y", Opened: "Y",
// AssignedByID: 1, AssignedByID: 1,
// CategoryID: 1, CategoryID: 1,
// SourceID: "CALL", SourceID: "CALL",
// UtmSource: "UtmSource", UtmSource: "UtmSource",
// UtmMedium: "UtmMedium", UtmMedium: "UtmMedium",
// UtmCampaign: "UtmCampaign", UtmCampaign: "UtmCampaign",
// UtmContent: "UtmContent", UtmContent: "UtmContent",
// UtmTerm: "UtmTerm", UtmTerm: "UtmTerm",
// }, },
//} }
// //
//reqMap = models.FormattingToMap(&createDealReq, fieldAnswer) reqMap := models.FormattingToMap(&createDealReq, fieldAnswer)
//result, err := b.CreatingDeal(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru") result, err := b.CreatingDeal(reqMap, "59161867007232200072541200000001000007a3be721d08cbf9f847b807c4eb79a73f", "b24-s5jg6c.bitrix24.ru")
//if err != nil { if err != nil {
// fmt.Println(err) fmt.Println(err)
//} }
fmt.Println(result)
// //
//for _, tipe := range model.CategoryArr { //for _, tipe := range model.CategoryArr {
// result, err := b.GetListPipelines(tipe, "9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru") // result, err := b.GetListPipelines(tipe, "9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru")
@ -142,13 +141,13 @@ func TestGetListFields(t *testing.T) {
//} //}
//arr2 := []model.TypeStepsEntityID{model.StatusStepsEntityID, model.DealTypeStepsEntityID, model.DealStageStepsEntityID, model.SourceStepsEntityID, model.ContactTypeStepsEntityID, model.CompanyTypeStepsEntityID, model.EmployeesStepsEntityID, model.IndustryStepsEntityID, model.SmartInvoiceStageStepsEntityID, model.QuoteStatusStepsEntityID, model.HonorificStepsEntityID, model.CallListStepsEntityID, model.SmartDocumentStageStepsEntityID} //arr2 := []model.TypeStepsEntityID{model.StatusStepsEntityID, model.DealTypeStepsEntityID, model.DealStageStepsEntityID, model.SourceStepsEntityID, model.ContactTypeStepsEntityID, model.CompanyTypeStepsEntityID, model.EmployeesStepsEntityID, model.IndustryStepsEntityID, model.SmartInvoiceStageStepsEntityID, model.QuoteStatusStepsEntityID, model.HonorificStepsEntityID, model.CallListStepsEntityID, model.SmartDocumentStageStepsEntityID}
//for _, stepType := range arr2 { //for _, stepType := range arr2 {
result, err := b.GetListSteps("9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru") //result, err := b.GetListSteps("9d5bf9660000071b00717f9200000001000007b8da5b64a2142c5a0abcfb3e65f89b0c", "b24-ld76ub.bitrix24.ru")
if err != nil { //if err != nil {
fmt.Println(err) // fmt.Println(err)
} //}
for _, i := range result.Result { //for _, i := range result.Result {
fmt.Println(i.ID) // fmt.Println(i.ID)
} //}
//} //}
// //
//"CATEGORY_ID":"1" //"CATEGORY_ID":"1"