fix auth_token
This commit is contained in:
parent
2bfc236555
commit
83b85c2508
|
@ -41,6 +41,7 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
appVersionCode = ""
|
appVersionCode = ""
|
||||||
browserName = ""
|
browserName = ""
|
||||||
browserVersion = ""
|
browserVersion = ""
|
||||||
|
authToken = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set deviceID
|
// Set deviceID
|
||||||
|
@ -70,6 +71,13 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
appVersionCode = headerData.AppVersionCode
|
appVersionCode = headerData.AppVersionCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auth token
|
||||||
|
if headerData.AuthToken != "" {
|
||||||
|
authToken = headerData.AuthToken
|
||||||
|
} else {
|
||||||
|
authToken = payload.AuthToken
|
||||||
|
}
|
||||||
|
|
||||||
// pretty.Println("- platform", platform)
|
// pretty.Println("- platform", platform)
|
||||||
// pretty.Println("- osName", osName)
|
// pretty.Println("- osName", osName)
|
||||||
// pretty.Println("- osVersion", osVersion)
|
// pretty.Println("- osVersion", osVersion)
|
||||||
|
@ -93,7 +101,7 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
).Values(
|
).Values(
|
||||||
mongodb.NewStringID(), deviceID, payload.IP, platform, appVersion,
|
mongodb.NewStringID(), deviceID, payload.IP, platform, appVersion,
|
||||||
appVersionCode, osName, osVersion, browserName, browserVersion,
|
appVersionCode, osName, osVersion, browserName, browserVersion,
|
||||||
payload.AuthToken, payload.FCMToken, payload.OwnerID, payload.OwnerType,
|
authToken, payload.FCMToken, payload.OwnerID, payload.OwnerType,
|
||||||
payload.FirstSignInAt, now(),
|
payload.FirstSignInAt, now(),
|
||||||
).ToSql()
|
).ToSql()
|
||||||
|
|
||||||
|
@ -114,7 +122,7 @@ func (s Service) Upsert(payload UpsertPayload) {
|
||||||
Set("os_version", osVersion).
|
Set("os_version", osVersion).
|
||||||
Set("browser_name", browserName).
|
Set("browser_name", browserName).
|
||||||
Set("browser_version", browserVersion).
|
Set("browser_version", browserVersion).
|
||||||
Set("auth_token", payload.AuthToken).
|
Set("auth_token", authToken).
|
||||||
Set("fcm_token", payload.FCMToken).
|
Set("fcm_token", payload.FCMToken).
|
||||||
Set("owner_id", payload.OwnerID).
|
Set("owner_id", payload.OwnerID).
|
||||||
Set("owner_type", payload.OwnerType).
|
Set("owner_type", payload.OwnerType).
|
||||||
|
|
|
@ -30,5 +30,6 @@ func getHeaderData(headers http.Header) HeaderData {
|
||||||
AppVersionCode: headers.Get("App-Version-Code"),
|
AppVersionCode: headers.Get("App-Version-Code"),
|
||||||
OSName: headers.Get("Os-Name"),
|
OSName: headers.Get("Os-Name"),
|
||||||
OSVersion: headers.Get("Os-Version"),
|
OSVersion: headers.Get("Os-Version"),
|
||||||
|
AuthToken: headers.Get("Authorization"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue