fix tg example
This commit is contained in:
parent
7b482b17bc
commit
f2a74857b7
@ -18,7 +18,7 @@ func RegisterSystem() {
|
|||||||
AccountURL: AppConfig.BaseURL,
|
AccountURL: AppConfig.BaseURL,
|
||||||
Integrations: &retailcrm.Integrations{
|
Integrations: &retailcrm.Integrations{
|
||||||
MgTransport: &retailcrm.MgTransport{
|
MgTransport: &retailcrm.MgTransport{
|
||||||
WebhookURL: AppConfig.BaseURL + "/api/v1/webhook",
|
WebhookURL: AppConfig.BaseURL + "/api/v1/mg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -39,10 +39,11 @@ func Listen() {
|
|||||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-quit
|
<-quit
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
log.Println("shutting down, please wait...")
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
if err := srv.Shutdown(ctx); err != nil {
|
if err := srv.Shutdown(ctx); err != nil {
|
||||||
log.Fatal("shutting down:", err)
|
log.Fatal("shutdown error:", err)
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
@ -65,7 +66,7 @@ func MGWebhookHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
whMsg := wh.MessageWebhookData()
|
whMsg := wh.MessageWebhookData()
|
||||||
if strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
|
if !strings.HasPrefix(whMsg.ExternalChatID, ChatIDPrefix) {
|
||||||
c.AbortWithStatusJSON(http.StatusUnprocessableEntity,
|
c.AbortWithStatusJSON(http.StatusUnprocessableEntity,
|
||||||
v1.NewTransportErrorResponse(v1.MessageErrorGeneral, "unexpected chat ID"))
|
v1.NewTransportErrorResponse(v1.MessageErrorGeneral, "unexpected chat ID"))
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user