parent
							
								
									ea5e451b30
								
							
						
					
					
						commit
						b5c2ab5330
					
				|  | @ -1,8 +1,11 @@ | |||
| # 3.1.0 Dev | ||||
| # 3.1.0 | ||||
| 
 | ||||
| * !!!暂未完成,会有很多错误,不建议升级!!! | ||||
| * 重构CK与UID管理逻辑 | ||||
| * 底层对星铁查询进行支持 | ||||
|     * 支持多UID绑定,可绑定多个UID并进行切换 | ||||
|     * 支持原神与星铁UID共存,可针对查询命令分配对应UID | ||||
|     * 新增`#删除uid1`命令,可对`#uid`列表内的绑定UID进行删除 | ||||
|     * 使用sqlite进行ck与uid存储 | ||||
| * 底层对星铁查询进行支持 **@cvs** | ||||
| 
 | ||||
| # 3.0.2 | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| { | ||||
|   "name": "miao-yunzai", | ||||
|   "version": "3.0.2", | ||||
|   "version": "3.1.0", | ||||
|   "author": "Yoimiya-Kokomi, Le-niao", | ||||
|   "description": "QQ group Bot", | ||||
|   "main": "app.js", | ||||
|  |  | |||
|  | @ -18,7 +18,6 @@ export default class BaseModel extends Model { | |||
| 
 | ||||
|   static initDB (model, columns) { | ||||
|     let name = model.name | ||||
|     console.log('Model Name', name) | ||||
|     name = name.replace(/DB$/, 's') | ||||
|     model.init(columns, { sequelize, tableName: name }) | ||||
|     model.COLUMNS = columns | ||||
|  |  | |||
|  | @ -262,9 +262,12 @@ export default class NoteUser extends BaseModel { | |||
|     if (this.uidMap[gameKey][uid] && this.uidMap[gameKey][uid].type !== 'ck') { | ||||
|       lodash.remove(this.uidList[gameKey], (u) => u + '' === uid + '') | ||||
|       delete this.uidMap[gameKey][uid] | ||||
|       if (this.mainUid[gameKey] === uid) { | ||||
|         this.mainUid[gameKey] = '' | ||||
|       } | ||||
|     } | ||||
|     await this.save() | ||||
|     if (this.mainUid[gameKey] === uid) { | ||||
|     if (this.mainUid[gameKey] === '') { | ||||
|       this.setMainUid(this.uidList[gameKey][0], game) | ||||
|       await this.save() | ||||
|     } | ||||
|  |  | |||
|  | @ -176,27 +176,25 @@ export default class User extends base { | |||
|   async showUid () { | ||||
|     let user = await this.user() | ||||
|     let msg = [] | ||||
|     lodash.forEach({ gs: '原神', sr: '星穹铁道' }, (gameName, game) => { | ||||
|     let typeMap = { ck: 'CK Uid', reg: '绑定uid' } | ||||
|     lodash.forEach({ gs: '原神 (#uid)', sr: '星穹铁道 (*uid)' }, (gameName, game) => { | ||||
|       let uidList = user.getUidList(game) | ||||
|       let currUid = user.getUid(game) | ||||
|       msg.push(`【${gameName}】`) | ||||
|       if (uidList.length === 0) { | ||||
|         msg.push(`暂无,通过${game === 'gs' ? '#' : '*'}绑定123456789来绑定UID`) | ||||
|         return true | ||||
|       } | ||||
|       msg.push(`【${gameName}】`) | ||||
|       lodash.forEach(uidList, (ds, idx) => { | ||||
|         let tmp = `${++idx}: ${ds.uid} (${ds.type})` | ||||
|         let tmp = `${++idx}: ${ds.uid} (${typeMap[ds.type]})` | ||||
|         if (currUid * 1 === ds.uid * 1) { | ||||
|           tmp += ' ☑' | ||||
|         } | ||||
|         msg.push(tmp) | ||||
|       }) | ||||
|     }) | ||||
|     if (msg.length > 0) { | ||||
|       msg.unshift('通过【#uid+序号】来切换uid') | ||||
|     msg.unshift('通过【#uid+序号】来切换uid,【#删除uid+序号】删除uid') | ||||
|     await this.e.reply(msg.join('\n')) | ||||
|     } else { | ||||
|       await this.e.reply('尚未绑定UID,发送CK或通过【#绑定123456789】命令来绑定UID') | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   /** 切换uid */ | ||||
|  | @ -266,10 +264,14 @@ export default class User extends base { | |||
|   /** 加载V3ck */ | ||||
|   async loadOldDataV3 (data) { | ||||
|     let dir = './data/MysCookie/' | ||||
|     Data.createDir('./data/MysCookieBak') | ||||
|     Data.createDir('./temp/MysCookieBak') | ||||
|     let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml')) | ||||
|     const readFile = promisify(fs.readFile) | ||||
|     let promises = [] | ||||
|     if (files.length === 0) { | ||||
|       fs.rmdirSync('./data/MysCookie/') | ||||
|       return | ||||
|     } | ||||
|     files.forEach((v) => promises.push(readFile(`${dir}${v}`, 'utf8'))) | ||||
|     const res = await Promise.all(promises) | ||||
|     let ret = {} | ||||
|  | @ -332,7 +334,7 @@ export default class User extends base { | |||
|       } | ||||
|       await user.save() | ||||
|       if (fs.existsSync(`./data/MysCookie/${qq}.yaml`)) { | ||||
|         fs.rename(`./data/MysCookie/${qq}.yaml`, `./data/MysCookieBak/${qq}.yaml`, (err) => { | ||||
|         fs.rename(`./data/MysCookie/${qq}.yaml`, `./temp/MysCookieBak/${qq}.yaml`, (err) => { | ||||
|           if (err) console.log(err) | ||||
|         }) | ||||
|       } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue