diff --git a/src/pages/User.vue b/src/pages/User.vue index 3d044218..9509ad0e 100644 --- a/src/pages/User.vue +++ b/src/pages/User.vue @@ -143,8 +143,8 @@ async function getBindRoleV2 () { bindRole.map(async (role: BTMuli.User.Game.Account) => { const sql = ` INSERT INTO GameAccount (gameBiz, gameUid, isChosen, isOfficial, level, nickname, region, regionName, updated) - Values ('${role.game_biz}', '${role.game_uid}', ${role.is_chosen ? 1 : 0}, ${role.is_official ? 1 : 0}, '${role.level}', '${role.nickname}', '${role.region}', '${role.region_name}', datetime('now', 'localtime') - ON CONFILCT (gameBiz, gameUid) DO UPDATE SET + VALUES ('${role.game_biz}', '${role.game_uid}', ${role.is_chosen ? 1 : 0}, ${role.is_official ? 1 : 0}, '${role.level}', '${role.nickname}', '${role.region}', '${role.region_name}', datetime('now', 'localtime')) + ON CONFLICT (gameBiz, gameUid) DO UPDATE SET isChosen = ${role.is_chosen ? 1 : 0}, isOfficial = ${role.is_official ? 1 : 0}, level = '${role.level}', diff --git a/src/utils/TGSql.ts b/src/utils/TGSql.ts index 98a1fd06..ff70c481 100644 --- a/src/utils/TGSql.ts +++ b/src/utils/TGSql.ts @@ -40,16 +40,16 @@ function initGameAccountTable (): string[] { sqlRes.push(` CREATE TABLE IF NOT EXISTS GameAccount ( - gameBiz TEXT PRIMARY KEY, - gameUid TEXT DEFAULT NULL, - isChosen BOOLEAN DEFAULT 0, - isOfficial BOOLEAN DEFAULT 0, - level INTEGER DEFAULT 0, - nickname TEXT DEFAULT NULL, - region TEXT DEFAULT NULL, - regionName TEXT DEFAULT NULL, - updated TEXT DEFAULT NULL, - PRIMARY KEY (gameBiz, gameUid) + gameBiz TEXT NOT NULL, + gameUid TEXT NOT NULL, + isChosen BOOLEAN DEFAULT 0, + isOfficial BOOLEAN DEFAULT 0, + level INTEGER DEFAULT 0, + nickname TEXT DEFAULT NULL, + region TEXT DEFAULT NULL, + regionName TEXT DEFAULT NULL, + updated TEXT DEFAULT NULL, + PRIMARY KEY (gameBiz, gameUid) ); `); return sqlRes;