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/lib/pq v1.10.9
|
||||||
github.com/twmb/franz-go v1.17.1
|
github.com/twmb/franz-go v1.17.1
|
||||||
go.uber.org/zap v1.27.0
|
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
|
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-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 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-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 h1:sf6e2mp582L3i/FMDd2q6QuWm1njRXzYpIX0SipsvM4=
|
||||||
penahub.gitlab.yandexcloud.net/devops/linters/golang.git v0.0.0-20240829220549-d35409b619a3/go.mod h1:i7M72RIpkSjcQtHID6KKj9RT/EYZ1rxS6tIPKWa/BSY=
|
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 {
|
for {
|
||||||
if b.rateLimiter.Check() {
|
if b.rateLimiter.Check() {
|
||||||
uri := fmt.Sprintf("https://%s/rest/crm.status.list", domain)
|
uri := fmt.Sprintf("https://%s/rest/crm.status.list", domain)
|
||||||
agent := b.fiberClient.Post(uri)
|
agent := b.fiberClient.Post(uri)
|
||||||
agent.Set("Authorization", "Bearer "+accessToken)
|
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()
|
statusCode, resBody, errs := agent.Bytes()
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
|
@ -2,10 +2,8 @@ package bitrixClient
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/models"
|
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/workers/limiter"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/bitrix/internal/workers/limiter"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -41,81 +39,81 @@ 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_1727099993"] = "field1"
|
||||||
fieldAnswer["UF_CRM_1727099994"] = "field2"
|
//fieldAnswer["UF_CRM_1727099994"] = "field2"
|
||||||
fieldAnswer["UF_CRM_1727099994"] = "field3"
|
//fieldAnswer["UF_CRM_1727099994"] = "field3"
|
||||||
fieldAnswer["UF_CRM_1726835607006"] = "field4"
|
//fieldAnswer["UF_CRM_1726835607006"] = "field4"
|
||||||
|
//
|
||||||
createContactReq := models.CreateContactReq{
|
//createContactReq := models.CreateContactReq{
|
||||||
Fields: models.ContactFields{
|
// Fields: models.ContactFields{
|
||||||
Name: "Контакт фром апи",
|
// Name: "Контакт фром апи",
|
||||||
SecondName: "SecondName",
|
// SecondName: "SecondName",
|
||||||
LastName: "LastName",
|
// LastName: "LastName",
|
||||||
Opened: "Y",
|
// Opened: "Y",
|
||||||
LeadID: 1,
|
// LeadID: 1,
|
||||||
UtmSource: "UtmSource",
|
// UtmSource: "UtmSource",
|
||||||
UtmMedium: "UtmMedium",
|
// UtmMedium: "UtmMedium",
|
||||||
UtmCampaign: "UtmCampaign",
|
// UtmCampaign: "UtmCampaign",
|
||||||
UtmContent: "UtmContent",
|
// UtmContent: "UtmContent",
|
||||||
UtmTerm: "UtmTerm",
|
// UtmTerm: "UtmTerm",
|
||||||
},
|
// },
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
reqMap := models.FormattingToMap(&createContactReq, fieldAnswer)
|
//reqMap := models.FormattingToMap(&createContactReq, fieldAnswer)
|
||||||
|
//
|
||||||
contactResult, err := b.CreateContact(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
//contactResult, err := b.CreateContact(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
fmt.Println(err)
|
// fmt.Println(err)
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
createCompanyReq := models.CompanyReq{
|
//createCompanyReq := models.CompanyReq{
|
||||||
Fields: models.CompanyFields{
|
// Fields: models.CompanyFields{
|
||||||
Title: "TEST FORMATTER",
|
// Title: "TEST FORMATTER",
|
||||||
Opened: "Y",
|
// Opened: "Y",
|
||||||
LeadID: 1,
|
// LeadID: 1,
|
||||||
UtmSource: "UtmSource",
|
// UtmSource: "UtmSource",
|
||||||
UtmMedium: "UtmMedium",
|
// UtmMedium: "UtmMedium",
|
||||||
UtmCampaign: "UtmCampaign",
|
// UtmCampaign: "UtmCampaign",
|
||||||
UtmContent: "UtmContent",
|
// UtmContent: "UtmContent",
|
||||||
UtmTerm: "UtmTerm",
|
// UtmTerm: "UtmTerm",
|
||||||
ContactID: contactResult,
|
// ContactID: contactResult,
|
||||||
},
|
// },
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
reqMap = models.FormattingToMap(&createCompanyReq, fieldAnswer)
|
//reqMap = models.FormattingToMap(&createCompanyReq, fieldAnswer)
|
||||||
companyResult, err := b.CreateCompany(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
//companyResult, err := b.CreateCompany(reqMap, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
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: companyResult,
|
||||||
ContactIDs: []int32{contactResult},
|
// ContactIDs: []int32{contactResult},
|
||||||
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, "ad5df5660000071b00717f920000000100000783b6e19c671e64c3655e5c7aff197e14", "b24-ld76ub.bitrix24.ru")
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
fmt.Println(err)
|
// fmt.Println(err)
|
||||||
}
|
//}
|
||||||
//
|
//
|
||||||
//for _, tipe := range model.CategoryArr {
|
//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 {
|
// if err != nil {
|
||||||
// fmt.Println(err)
|
// fmt.Println(err)
|
||||||
// }
|
// }
|
||||||
@ -134,13 +132,16 @@ func TestGetListFields(t *testing.T) {
|
|||||||
// fmt.Println(string(r))
|
// fmt.Println(string(r))
|
||||||
// fmt.Println(tipe)
|
// fmt.Println(tipe)
|
||||||
//}
|
//}
|
||||||
|
//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}
|
||||||
//result, err := b.GetListSteps(model.DealStageStepsEntityID, "734ff5660000071b00717f9200000001000007e5dc2d31e224105aa808dcb596e057b0", "b24-ld76ub.bitrix24.ru")
|
//for _, stepType := range arr2 {
|
||||||
//if err != nil {
|
result, err := b.GetListSteps("0d7af5660000071b00717f9200000001000007f22d556448dc46077a5fd2eaf9b024ed", "b24-ld76ub.bitrix24.ru")
|
||||||
// fmt.Println(err)
|
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"
|
//"CATEGORY_ID":"1"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user