normalizade steps getting!!!!!!!
This commit is contained in:
parent
772df884b7
commit
9db181dfdf
2
go.mod
2
go.mod
@ -10,7 +10,7 @@ require (
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/twmb/franz-go v1.17.1
|
||||
go.uber.org/zap v1.27.0
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926124254-355001566829
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926135458-58615f64a3dd
|
||||
penahub.gitlab.yandexcloud.net/devops/linters/golang.git v0.0.0-20240829220549-d35409b619a3
|
||||
)
|
||||
|
||||
|
2
go.sum
2
go.sum
@ -145,5 +145,7 @@ penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926081605-f7d
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926081605-f7dda8704dbf/go.mod h1:uOuosXduBzd2WbLH6TDZO7ME7ZextulA662oZ6OsoB0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926124254-355001566829 h1:GZ6cDgC799ds9hVEQXDa4A+ENVyfJDOmPBPydetdZXU=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926124254-355001566829/go.mod h1:uOuosXduBzd2WbLH6TDZO7ME7ZextulA662oZ6OsoB0=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926135458-58615f64a3dd h1:VMU3RF1HyxQ+1xRVhj9zY4YHRkKe/m3p/zJBjExemQc=
|
||||
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240926135458-58615f64a3dd/go.mod h1:uOuosXduBzd2WbLH6TDZO7ME7ZextulA662oZ6OsoB0=
|
||||
penahub.gitlab.yandexcloud.net/devops/linters/golang.git v0.0.0-20240829220549-d35409b619a3 h1:sf6e2mp582L3i/FMDd2q6QuWm1njRXzYpIX0SipsvM4=
|
||||
penahub.gitlab.yandexcloud.net/devops/linters/golang.git v0.0.0-20240829220549-d35409b619a3/go.mod h1:i7M72RIpkSjcQtHID6KKj9RT/EYZ1rxS6tIPKWa/BSY=
|
||||
|
@ -120,21 +120,12 @@ func (b *Bitrix) CreateWebHook(req models.WebHookRequest, domain string) (*model
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bitrix) GetListSteps(entityID model.TypeStepsEntityID, accessToken string, domain string) (*models.StepsResponse, error) {
|
||||
func (b *Bitrix) GetListSteps(accessToken string, domain string) (*models.StepsResponse, error) {
|
||||
for {
|
||||
if b.rateLimiter.Check() {
|
||||
uri := fmt.Sprintf("https://%s/rest/crm.status.list", domain)
|
||||
agent := b.fiberClient.Post(uri)
|
||||
agent.Set("Authorization", "Bearer "+accessToken)
|
||||
requestBody := map[string]interface{}{
|
||||
"filter": map[string]interface{}{
|
||||
"ENTITY_ID": entityID,
|
||||
},
|
||||
"order": map[string]string{
|
||||
"SORT": "ASC",
|
||||
},
|
||||
}
|
||||
agent.JSON(requestBody)
|
||||
|
||||
statusCode, resBody, errs := agent.Bytes()
|
||||
if len(errs) > 0 {
|
||||
|
@ -2,10 +2,8 @@ package bitrixClient
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"go.uber.org/zap"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/models"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/workers/limiter"
|
||||
"testing"
|
||||
"time"
|
||||
@ -41,81 +39,81 @@ func TestGetListFields(t *testing.T) {
|
||||
// fmt.Println(result)
|
||||
//}
|
||||
//
|
||||
fieldAnswer := make(map[string]string)
|
||||
fieldAnswer["UF_CRM_1727099993"] = "field1"
|
||||
fieldAnswer["UF_CRM_1727099994"] = "field2"
|
||||
fieldAnswer["UF_CRM_1727099994"] = "field3"
|
||||
fieldAnswer["UF_CRM_1726835607006"] = "field4"
|
||||
|
||||
createContactReq := models.CreateContactReq{
|
||||
Fields: models.ContactFields{
|
||||
Name: "Контакт фром апи",
|
||||
SecondName: "SecondName",
|
||||
LastName: "LastName",
|
||||
Opened: "Y",
|
||||
LeadID: 1,
|
||||
UtmSource: "UtmSource",
|
||||
UtmMedium: "UtmMedium",
|
||||
UtmCampaign: "UtmCampaign",
|
||||
UtmContent: "UtmContent",
|
||||
UtmTerm: "UtmTerm",
|
||||
},
|
||||
}
|
||||
|
||||
reqMap := models.FormattingToMap(&createContactReq, fieldAnswer)
|
||||
|
||||
contactResult, err := b.CreateContact(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
createCompanyReq := models.CompanyReq{
|
||||
Fields: models.CompanyFields{
|
||||
Title: "TEST FORMATTER",
|
||||
Opened: "Y",
|
||||
LeadID: 1,
|
||||
UtmSource: "UtmSource",
|
||||
UtmMedium: "UtmMedium",
|
||||
UtmCampaign: "UtmCampaign",
|
||||
UtmContent: "UtmContent",
|
||||
UtmTerm: "UtmTerm",
|
||||
ContactID: contactResult,
|
||||
},
|
||||
}
|
||||
|
||||
reqMap = models.FormattingToMap(&createCompanyReq, fieldAnswer)
|
||||
companyResult, err := b.CreateCompany(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
createDealReq := models.CreatingDealReq{
|
||||
Fields: models.CreateDealFields{
|
||||
Title: "ТЕСТ ОТ ГОУ АПИ 10/10",
|
||||
TypeID: "SALE",
|
||||
StageID: "NEW",
|
||||
CompanyID: companyResult,
|
||||
ContactIDs: []int32{contactResult},
|
||||
Opened: "Y",
|
||||
AssignedByID: 1,
|
||||
CategoryID: 1,
|
||||
SourceID: "CALL",
|
||||
UtmSource: "UtmSource",
|
||||
UtmMedium: "UtmMedium",
|
||||
UtmCampaign: "UtmCampaign",
|
||||
UtmContent: "UtmContent",
|
||||
UtmTerm: "UtmTerm",
|
||||
},
|
||||
}
|
||||
|
||||
reqMap = models.FormattingToMap(&createDealReq, fieldAnswer)
|
||||
result, err := b.CreatingDeal(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
//fieldAnswer := make(map[string]string)
|
||||
//fieldAnswer["UF_CRM_1727099993"] = "field1"
|
||||
//fieldAnswer["UF_CRM_1727099994"] = "field2"
|
||||
//fieldAnswer["UF_CRM_1727099994"] = "field3"
|
||||
//fieldAnswer["UF_CRM_1726835607006"] = "field4"
|
||||
//
|
||||
//createContactReq := models.CreateContactReq{
|
||||
// Fields: models.ContactFields{
|
||||
// Name: "Контакт фром апи",
|
||||
// SecondName: "SecondName",
|
||||
// LastName: "LastName",
|
||||
// Opened: "Y",
|
||||
// LeadID: 1,
|
||||
// UtmSource: "UtmSource",
|
||||
// UtmMedium: "UtmMedium",
|
||||
// UtmCampaign: "UtmCampaign",
|
||||
// UtmContent: "UtmContent",
|
||||
// UtmTerm: "UtmTerm",
|
||||
// },
|
||||
//}
|
||||
//
|
||||
//reqMap := models.FormattingToMap(&createContactReq, fieldAnswer)
|
||||
//
|
||||
//contactResult, err := b.CreateContact(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
//if err != nil {
|
||||
// fmt.Println(err)
|
||||
//}
|
||||
//
|
||||
//createCompanyReq := models.CompanyReq{
|
||||
// Fields: models.CompanyFields{
|
||||
// Title: "TEST FORMATTER",
|
||||
// Opened: "Y",
|
||||
// LeadID: 1,
|
||||
// UtmSource: "UtmSource",
|
||||
// UtmMedium: "UtmMedium",
|
||||
// UtmCampaign: "UtmCampaign",
|
||||
// UtmContent: "UtmContent",
|
||||
// UtmTerm: "UtmTerm",
|
||||
// ContactID: contactResult,
|
||||
// },
|
||||
//}
|
||||
//
|
||||
//reqMap = models.FormattingToMap(&createCompanyReq, fieldAnswer)
|
||||
//companyResult, err := b.CreateCompany(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
//if err != nil {
|
||||
// fmt.Println(err)
|
||||
//}
|
||||
//
|
||||
//createDealReq := models.CreatingDealReq{
|
||||
// Fields: models.CreateDealFields{
|
||||
// Title: "ТЕСТ ОТ ГОУ АПИ 10/10",
|
||||
// TypeID: "SALE",
|
||||
// StageID: "NEW",
|
||||
// CompanyID: companyResult,
|
||||
// ContactIDs: []int32{contactResult},
|
||||
// Opened: "Y",
|
||||
// AssignedByID: 1,
|
||||
// CategoryID: 1,
|
||||
// SourceID: "CALL",
|
||||
// UtmSource: "UtmSource",
|
||||
// UtmMedium: "UtmMedium",
|
||||
// UtmCampaign: "UtmCampaign",
|
||||
// UtmContent: "UtmContent",
|
||||
// UtmTerm: "UtmTerm",
|
||||
// },
|
||||
//}
|
||||
//
|
||||
//reqMap = models.FormattingToMap(&createDealReq, fieldAnswer)
|
||||
//result, err := b.CreatingDeal(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||
//if err != nil {
|
||||
// fmt.Println(err)
|
||||
//}
|
||||
//
|
||||
//for _, tipe := range model.CategoryArr {
|
||||
// result, err := b.GetListPipelines(tipe, "734ff5660000071b00717f9200000001000007e5dc2d31e224105aa808dcb596e057b0", "b24-ld76ub.bitrix24.ru")
|
||||
// result, err := b.GetListPipelines(tipe, "0d7af5660000071b00717f9200000001000007f22d556448dc46077a5fd2eaf9b024ed", "b24-ld76ub.bitrix24.ru")
|
||||
// if err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
@ -134,13 +132,16 @@ func TestGetListFields(t *testing.T) {
|
||||
// fmt.Println(string(r))
|
||||
// fmt.Println(tipe)
|
||||
//}
|
||||
|
||||
//result, err := b.GetListSteps(model.DealStageStepsEntityID, "734ff5660000071b00717f9200000001000007e5dc2d31e224105aa808dcb596e057b0", "b24-ld76ub.bitrix24.ru")
|
||||
//if err != nil {
|
||||
// fmt.Println(err)
|
||||
//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 {
|
||||
result, err := b.GetListSteps("0d7af5660000071b00717f9200000001000007f22d556448dc46077a5fd2eaf9b024ed", "b24-ld76ub.bitrix24.ru")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
for _, i := range result.Result {
|
||||
fmt.Println(i.Name, i.CategoryID)
|
||||
}
|
||||
//}
|
||||
//
|
||||
r, _ := json.Marshal(result)
|
||||
fmt.Println(string(r))
|
||||
//"CATEGORY_ID":"1"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user