fix: accept jpush token metadata fields
This commit is contained in:
@@ -1372,6 +1372,9 @@ func createIMUserProductTables(tx *sql.Tx) error {
|
||||
token VARCHAR(512) NOT NULL,
|
||||
app_version VARCHAR(64) NOT NULL DEFAULT '',
|
||||
platform VARCHAR(32) NOT NULL DEFAULT '',
|
||||
sdk_version VARCHAR(64) NOT NULL DEFAULT '',
|
||||
push_env VARCHAR(32) NOT NULL DEFAULT '',
|
||||
notification_permission VARCHAR(32) NOT NULL DEFAULT '',
|
||||
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
|
||||
PRIMARY KEY(id),
|
||||
|
||||
@@ -6281,16 +6281,21 @@ func (a *adapter) TenantDevicePushTokenUpsert(id t.TenantID, token *t.DevicePush
|
||||
token.Token = strings.TrimSpace(token.Token)
|
||||
token.AppVersion = strings.TrimSpace(token.AppVersion)
|
||||
token.Platform = strings.ToLower(strings.TrimSpace(token.Platform))
|
||||
token.SDKVersion = strings.TrimSpace(token.SDKVersion)
|
||||
token.PushEnv = strings.ToLower(strings.TrimSpace(token.PushEnv))
|
||||
token.NotificationPermission = strings.ToLower(strings.TrimSpace(token.NotificationPermission))
|
||||
tokenID, err := nextSnowflakeID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, err = a.db.ExecContext(ctx,
|
||||
`INSERT INTO im_device_push_tokens(id,device_id,user_id,provider,token,app_version,platform,created_at,updated_at)
|
||||
VALUES(?,?,?,?,?,?,?,?,?)
|
||||
`INSERT INTO im_device_push_tokens(id,device_id,user_id,provider,token,app_version,platform,sdk_version,push_env,notification_permission,created_at,updated_at)
|
||||
VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
|
||||
ON DUPLICATE KEY UPDATE device_id=VALUES(device_id),user_id=VALUES(user_id),provider=VALUES(provider),token=VALUES(token),
|
||||
app_version=VALUES(app_version),platform=VALUES(platform),updated_at=VALUES(updated_at)`,
|
||||
tokenID, token.DeviceID, decodeUID(token.UserID), token.Provider, token.Token, token.AppVersion, token.Platform, now, now)
|
||||
app_version=VALUES(app_version),platform=VALUES(platform),sdk_version=VALUES(sdk_version),push_env=VALUES(push_env),
|
||||
notification_permission=VALUES(notification_permission),updated_at=VALUES(updated_at)`,
|
||||
tokenID, token.DeviceID, decodeUID(token.UserID), token.Provider, token.Token, token.AppVersion, token.Platform,
|
||||
token.SDKVersion, token.PushEnv, token.NotificationPermission, now, now)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user