commented utms methods
This commit is contained in:
parent
b898091905
commit
6bd772ee23
36
model/amo.go
36
model/amo.go
@ -141,7 +141,7 @@ type Rule struct {
|
|||||||
/* - айдишник этапа*/
|
/* - айдишник этапа*/
|
||||||
Stepid int32 `json:"StepID"`
|
Stepid int32 `json:"StepID"`
|
||||||
/* - список UTM для этого опроса*/
|
/* - список UTM для этого опроса*/
|
||||||
Utms []int32 `json:"UTMs"`
|
//Utms []int32 `json:"UTMs"`
|
||||||
/* - правила заполнения полей сущностей в амо*/
|
/* - правила заполнения полей сущностей в амо*/
|
||||||
Fieldsrule Fieldsrule `json:"FieldsRule"`
|
Fieldsrule Fieldsrule `json:"FieldsRule"`
|
||||||
/* - флаг мягкого удаления*/
|
/* - флаг мягкого удаления*/
|
||||||
@ -197,22 +197,22 @@ const (
|
|||||||
TypeContactAddress ContactQuizConfig = "address"
|
TypeContactAddress ContactQuizConfig = "address"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UTM struct {
|
//type UTM struct {
|
||||||
/* - айдишник в нашей системе Primary Key*/
|
// /* - айдишник в нашей системе Primary Key*/
|
||||||
ID int64 `json:"ID"`
|
// ID int64 `json:"ID"`
|
||||||
/* - айдишник кастомного поля в амо*/
|
// /* - айдишник кастомного поля в амо*/
|
||||||
Amofieldid int32 `json:"AmoFieldID"`
|
// Amofieldid int32 `json:"AmoFieldID"`
|
||||||
/* - айдишник квиза*/
|
// /* - айдишник квиза*/
|
||||||
Quizid int32 `json:"QuizID"`
|
// Quizid int32 `json:"QuizID"`
|
||||||
/* - связь с аккаунтом в интеграции амо id амо*/
|
// /* - связь с аккаунтом в интеграции амо id амо*/
|
||||||
Accountid int32 `json:"AccountID"`
|
// Accountid int32 `json:"AccountID"`
|
||||||
/* - название тега в амо*/
|
// /* - название тега в амо*/
|
||||||
Name string `json:"Name"`
|
// Name string `json:"Name"`
|
||||||
/* - флаг мягкого удаления*/
|
// /* - флаг мягкого удаления*/
|
||||||
Deleted bool `json:"Deleted"`
|
// Deleted bool `json:"Deleted"`
|
||||||
/* - таймштамп создания тега в нашей системе*/
|
// /* - таймштамп создания тега в нашей системе*/
|
||||||
Createdat int64 `json:"CreatedAt"`
|
// Createdat int64 `json:"CreatedAt"`
|
||||||
}
|
//}
|
||||||
|
|
||||||
type FieldType string
|
type FieldType string
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ type AmoUsersTrueResults struct {
|
|||||||
Session string
|
Session string
|
||||||
AccessToken string
|
AccessToken string
|
||||||
AmoAccountID int32
|
AmoAccountID int32
|
||||||
UTMs []int32
|
UTMs UTMSavingMap
|
||||||
FieldsRule Fieldsrule
|
FieldsRule Fieldsrule
|
||||||
PerformerID int32
|
PerformerID int32
|
||||||
StepID int32
|
StepID int32
|
||||||
|
@ -13,14 +13,14 @@ type PaginationReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RulesReq struct {
|
type RulesReq struct {
|
||||||
PerformerID int32 // айдишник ответственного за сделку
|
PerformerID int32 // айдишник ответственного за сделку
|
||||||
PipelineID int32 // айдишник воронки
|
PipelineID int32 // айдишник воронки
|
||||||
StepID int32 // айдишник этапа
|
StepID int32 // айдишник этапа
|
||||||
Utms []int32 // список UTM для этого опроса
|
//Utms []int32 // список UTM для этого опроса
|
||||||
Fieldsrule Fieldsrule // правила заполнения полей сущностей в амо
|
Fieldsrule Fieldsrule // правила заполнения полей сущностей в амо
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaveUserListUTMReq struct {
|
//type SaveUserListUTMReq struct {
|
||||||
/* - список utm для сохранения. сохранять только те, которых в этом аккаунте ещё нет*/
|
// /* - список utm для сохранения. сохранять только те, которых в этом аккаунте ещё нет*/
|
||||||
Utms []UTM `json:"utms"`
|
// Utms []UTM `json:"utms"`
|
||||||
}
|
//}
|
||||||
|
@ -24,12 +24,12 @@ type GetCurrentAccountResp struct {
|
|||||||
Createdat int64 `json:"CreatedAt"`
|
Createdat int64 `json:"CreatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetListUserUTMResp struct {
|
//type GetListUserUTMResp struct {
|
||||||
/* - общее количество юзеров, которые у нас закешированы для этого пользователя*/
|
// /* - общее количество юзеров, которые у нас закешированы для этого пользователя*/
|
||||||
Count int64 `json:"count"`
|
// Count int64 `json:"count"`
|
||||||
/* - список юзеров, которые были закешированы нашим сервисом*/
|
// /* - список юзеров, которые были закешированы нашим сервисом*/
|
||||||
Items []UTM `json:"items"`
|
// Items []UTM `json:"items"`
|
||||||
}
|
//}
|
||||||
|
|
||||||
type ListSavedIDUTMResp struct {
|
type ListSavedIDUTMResp struct {
|
||||||
/* - список айдишников сохранённых меток*/
|
/* - список айдишников сохранённых меток*/
|
||||||
|
@ -899,110 +899,109 @@ func (r *AmoRepository) DeletingUserUtm(ctx context.Context, request *model.List
|
|||||||
}
|
}
|
||||||
|
|
||||||
// todo нужно ли тут ограничивать индексом что то
|
// todo нужно ли тут ограничивать индексом что то
|
||||||
func (r *AmoRepository) SavingUserUtm(ctx context.Context, utms []model.UTM, accountID string) (*model.ListSavedIDUTMResp, error) {
|
//func (r *AmoRepository) SavingUserUtm(ctx context.Context, utms []model.UTM, accountID string) (*model.ListSavedIDUTMResp, error) {
|
||||||
//column2, err := json.Marshal(utms)
|
// column2, err := json.Marshal(utms)
|
||||||
//if err != nil {
|
// if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
//}
|
// }
|
||||||
//rows, err := r.queries.SaveUTMs(ctx, sqlcgen.SaveUTMsParams{
|
// rows, err := r.queries.SaveUTMs(ctx, sqlcgen.SaveUTMsParams{
|
||||||
// Accountid: accountID,
|
// Accountid: accountID,
|
||||||
// Column2: column2,
|
// Column2: column2,
|
||||||
//})
|
// })
|
||||||
//
|
//
|
||||||
//var ids []int64
|
// var ids []int64
|
||||||
//
|
//
|
||||||
//for _, row := range rows {
|
// for _, row := range rows {
|
||||||
// ids = append(ids, row.ID)
|
// ids = append(ids, row.ID)
|
||||||
//}
|
// }
|
||||||
//
|
//
|
||||||
//return &model.ListSavedIDUTMResp{
|
// return &model.ListSavedIDUTMResp{
|
||||||
// Ids: ids,
|
// Ids: ids,
|
||||||
//}, nil
|
// }, nil
|
||||||
|
//
|
||||||
return nil, nil
|
// return nil, nil
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func (r *AmoRepository) GettingUserUtm(ctx context.Context, request *model.PaginationReq, accountID string, quizID int) (*model.GetListUserUTMResp, error) {
|
//func (r *AmoRepository) GettingUserUtm(ctx context.Context, request *model.PaginationReq, accountID string, quizID int) (*model.GetListUserUTMResp, error) {
|
||||||
//rows, err := r.queries.GetUTMsWithPagination(ctx, sqlcgen.GetUTMsWithPaginationParams{
|
// rows, err := r.queries.GetUTMsWithPagination(ctx, sqlcgen.GetUTMsWithPaginationParams{
|
||||||
// Accountid: accountID,
|
// Accountid: accountID,
|
||||||
// Column2: request.Page,
|
// Column2: request.Page,
|
||||||
// Limit: request.Size,
|
// Limit: request.Size,
|
||||||
// Quizid: int32(quizID),
|
// Quizid: int32(quizID),
|
||||||
//})
|
// })
|
||||||
//
|
//
|
||||||
//if err != nil {
|
// if err != nil {
|
||||||
// return nil, err
|
// return nil, err
|
||||||
//}
|
// }
|
||||||
//
|
//
|
||||||
//var count int64
|
// var count int64
|
||||||
//var utmS []model.UTM
|
// var utmS []model.UTM
|
||||||
//
|
//
|
||||||
//for _, row := range rows {
|
// for _, row := range rows {
|
||||||
// count = row.TotalCount
|
// count = row.TotalCount
|
||||||
// utm := model.UTM{
|
// utm := model.UTM{
|
||||||
// ID: row.ID,
|
// ID: row.ID,
|
||||||
// Amofieldid: row.Amofieldid,
|
// Amofieldid: row.Amofieldid,
|
||||||
// Quizid: row.Quizid,
|
// Quizid: row.Quizid,
|
||||||
// Accountid: row.Accountid,
|
// Accountid: row.Accountid,
|
||||||
// Name: row.Name,
|
// Name: row.Name,
|
||||||
// Deleted: row.Deleted,
|
// Deleted: row.Deleted,
|
||||||
// Createdat: row.Createdat.Time.Unix(),
|
// Createdat: row.Createdat.Time.Unix(),
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// utmS = append(utmS, utm)
|
// utmS = append(utmS, utm)
|
||||||
//}
|
// }
|
||||||
//
|
//
|
||||||
//return &model.GetListUserUTMResp{
|
// return &model.GetListUserUTMResp{
|
||||||
// Count: count,
|
// Count: count,
|
||||||
// Items: utmS,
|
// Items: utmS,
|
||||||
//}, nil
|
// }, nil
|
||||||
return nil, nil
|
//}
|
||||||
}
|
//
|
||||||
|
//func (r *AmoRepository) GetUtmsByID(ctx context.Context, ids []int32) ([]model.UTM, error) {
|
||||||
func (r *AmoRepository) GetUtmsByID(ctx context.Context, ids []int32) ([]model.UTM, error) {
|
// rows, err := r.queries.GetUtmsByID(ctx, ids)
|
||||||
//rows, err := r.queries.GetUtmsByID(ctx, ids)
|
// if err != nil {
|
||||||
//if err != nil {
|
// return nil, err
|
||||||
// return nil, err
|
// }
|
||||||
//}
|
//
|
||||||
//
|
// var utmS []model.UTM
|
||||||
//var utmS []model.UTM
|
// for _, row := range rows {
|
||||||
//for _, row := range rows {
|
// utm := model.UTM{
|
||||||
// utm := model.UTM{
|
// ID: row.ID,
|
||||||
// ID: row.ID,
|
// Amofieldid: row.Amofieldid,
|
||||||
// Amofieldid: row.Amofieldid,
|
// Quizid: row.Quizid,
|
||||||
// Quizid: row.Quizid,
|
// Accountid: row.Accountid,
|
||||||
// Accountid: row.Accountid,
|
// Name: row.Name,
|
||||||
// Name: row.Name,
|
// }
|
||||||
// }
|
//
|
||||||
//
|
// utmS = append(utmS, utm)
|
||||||
// utmS = append(utmS, utm)
|
// }
|
||||||
//}
|
//
|
||||||
|
// return utmS, nil
|
||||||
return nil, nil
|
//}
|
||||||
}
|
//
|
||||||
|
//func (r *AmoRepository) UpdateUTMs(ctx context.Context, utms []model.UTM) error {
|
||||||
func (r *AmoRepository) UpdateUTMs(ctx context.Context, utms []model.UTM) error {
|
// dollar1, err := json.Marshal(utms)
|
||||||
//dollar1, err := json.Marshal(utms)
|
// if err != nil {
|
||||||
//if err != nil {
|
// return err
|
||||||
// return err
|
// }
|
||||||
//}
|
// err = r.queries.UpdateUtms(ctx, dollar1)
|
||||||
//err = r.queries.UpdateUtms(ctx, dollar1)
|
//
|
||||||
//
|
// if err != nil {
|
||||||
//if err != nil {
|
// return err
|
||||||
// return err
|
// }
|
||||||
//}
|
//
|
||||||
|
// return nil
|
||||||
return nil
|
//}
|
||||||
}
|
//
|
||||||
|
//func (r *AmoRepository) UpdateUtmsFields(ctx context.Context, ids []int32) error {
|
||||||
func (r *AmoRepository) UpdateUtmsFields(ctx context.Context, ids []int32) error {
|
// err := r.queries.UpdateUtmsFields(ctx, ids)
|
||||||
//err := r.queries.UpdateUtmsFields(ctx, ids)
|
// if err != nil {
|
||||||
//if err != nil {
|
// return err
|
||||||
// return err
|
// }
|
||||||
//}
|
//
|
||||||
|
// return nil
|
||||||
return nil
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
func (r *AmoRepository) GettingAmoUsersTrueResults(ctx context.Context) ([]model.AmoUsersTrueResults, error) {
|
func (r *AmoRepository) GettingAmoUsersTrueResults(ctx context.Context) ([]model.AmoUsersTrueResults, error) {
|
||||||
rows, err := r.queries.GettingAmoUsersTrueResults(ctx)
|
rows, err := r.queries.GettingAmoUsersTrueResults(ctx)
|
||||||
@ -1018,16 +1017,23 @@ func (r *AmoRepository) GettingAmoUsersTrueResults(ctx context.Context) ([]model
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var utm model.UTMSavingMap
|
||||||
|
err = json.Unmarshal(row.Utm, &utm)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
result := model.AmoUsersTrueResults{
|
result := model.AmoUsersTrueResults{
|
||||||
QuizID: row.QuizID,
|
QuizID: row.QuizID,
|
||||||
AnswerID: row.ID,
|
AnswerID: row.ID,
|
||||||
Result: row.Result.Bool,
|
Result: row.Result.Bool,
|
||||||
QuestionID: row.QuestionID,
|
QuestionID: row.QuestionID,
|
||||||
Content: row.Content.String,
|
Content: row.Content.String,
|
||||||
Session: row.Session.String,
|
Session: row.Session.String,
|
||||||
AccessToken: row.Accesstoken,
|
AccessToken: row.Accesstoken,
|
||||||
AmoAccountID: row.Accountid,
|
AmoAccountID: row.Accountid,
|
||||||
//UTMs: row.Utms,
|
UTMs: utm,
|
||||||
FieldsRule: fieldsRule,
|
FieldsRule: fieldsRule,
|
||||||
PerformerID: row.Performerid,
|
PerformerID: row.Performerid,
|
||||||
StepID: row.Stepid,
|
StepID: row.Stepid,
|
||||||
|
Loading…
Reference in New Issue
Block a user