对星铁命令进行标准化处理,便于后续兼容
This commit is contained in:
		
							parent
							
								
									195b39212a
								
							
						
					
					
						commit
						097bcb6649
					
				| 
						 | 
				
			
			@ -354,16 +354,17 @@ class PluginsLoader {
 | 
			
		|||
      for (let val of e.message) {
 | 
			
		||||
        switch (val.type) {
 | 
			
		||||
          case 'text':
 | 
			
		||||
            /** 中文#转为英文 */
 | 
			
		||||
            val.text = val.text.replace(/#|井/g, '#').trim()
 | 
			
		||||
            if(/星铁|崩坏星穹铁道|铁道|星轨|星穹铁道|\/common\//.test(val.text)){
 | 
			
		||||
            let msg = (val.text || '').replace(/^\s*[#井#]+\s*/, '#').replace(/^\s*[\\*※]+\s*/, '*').trim()
 | 
			
		||||
 | 
			
		||||
            // 判断是否是星铁命令,若是星铁命令则标准化处理
 | 
			
		||||
            // e.isSr = true,且命令标准化为 #星铁 开头
 | 
			
		||||
            let srReg = /^#?(\*|星铁|星轨|穹轨|星穹|崩铁|星穹铁道|崩坏星穹铁道|铁道)+/
 | 
			
		||||
            if (srReg.test(msg)) {
 | 
			
		||||
              console.log('sr test true')
 | 
			
		||||
              e.isSr = true
 | 
			
		||||
              msg = msg.replace(srReg, '#星铁')
 | 
			
		||||
            }
 | 
			
		||||
            if (e.msg) {
 | 
			
		||||
              e.msg += val.text
 | 
			
		||||
            } else {
 | 
			
		||||
              e.msg = val.text.trim()
 | 
			
		||||
            }
 | 
			
		||||
            e.msg = (e.msg || '') + msg
 | 
			
		||||
            break
 | 
			
		||||
          case 'image':
 | 
			
		||||
            if (!e.img) {
 | 
			
		||||
| 
						 | 
				
			
			@ -692,7 +693,7 @@ class PluginsLoader {
 | 
			
		|||
    if (e.group_id) {
 | 
			
		||||
      /** 白名单群 */
 | 
			
		||||
      if (Array.isArray(other.whiteGroup) && other.whiteGroup.length > 0) {
 | 
			
		||||
        return other.whiteGroup.includes(Number(e.group_id));
 | 
			
		||||
        return other.whiteGroup.includes(Number(e.group_id))
 | 
			
		||||
      }
 | 
			
		||||
      /** 黑名单群 */
 | 
			
		||||
      if (Array.isArray(other.blackGroup) && other.blackGroup.length > 0) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ export class dailyNote extends plugin {
 | 
			
		|||
      event: 'message',
 | 
			
		||||
      priority: 300,
 | 
			
		||||
      rule: [{
 | 
			
		||||
        reg: '^#*(原神|星铁|崩坏星穹铁道|铁道)?(体力|树脂|查询体力)$',
 | 
			
		||||
        reg: '^#*(原神|星铁)?(体力|树脂|查询体力)$',
 | 
			
		||||
        fnc: 'note'
 | 
			
		||||
      }]
 | 
			
		||||
    })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,7 +32,7 @@ export class gcLog extends plugin {
 | 
			
		|||
          fnc: 'logJson'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          reg: '^#*(原神|星铁|崩坏星穹铁道|铁道)?(抽卡|抽奖|角色|武器|常驻|up|新手|光锥)池*(记录|祈愿|分析)$',
 | 
			
		||||
          reg: '^#*(原神|星铁)?(抽卡|抽奖|角色|武器|常驻|up|新手|光锥)池*(记录|祈愿|分析)$',
 | 
			
		||||
          fnc: 'getLog'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -48,7 +48,7 @@ export class gcLog extends plugin {
 | 
			
		|||
          fnc: 'helpPort'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          reg: '^#*(原神|星铁|崩坏星穹铁道|铁道)?(抽卡|抽奖|角色|武器|常驻|up|新手|光锥)池*统计$',
 | 
			
		||||
          reg: '^#*(原神|星铁)?(抽卡|抽奖|角色|武器|常驻|up|新手|光锥)池*统计$',
 | 
			
		||||
          fnc: 'logCount'
 | 
			
		||||
        }
 | 
			
		||||
      ]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ export class user extends plugin {
 | 
			
		|||
          fnc: 'bingUid'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          reg: '^#(我的)?(uid|UID)[0-9]{0,2}$',
 | 
			
		||||
          reg: '^#(原神|星铁)?(我的)?(uid|UID)[0-9]{0,2}$',
 | 
			
		||||
          fnc: 'showUid'
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -147,78 +147,6 @@ export default class MysUser extends BaseModel {
 | 
			
		|||
    return false
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 为当前MysUser绑定uid
 | 
			
		||||
  addUid (uid) {
 | 
			
		||||
    if (lodash.isArray(uid)) {
 | 
			
		||||
      for (let u of uid) {
 | 
			
		||||
        this.addUid(u)
 | 
			
		||||
      }
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    uid = '' + uid
 | 
			
		||||
    if (/\d{9}/.test(uid) || uid === 'pub') {
 | 
			
		||||
      if (!this.uids.includes(uid)) {
 | 
			
		||||
        this.uids.push(uid)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 初始化当前MysUser缓存记录
 | 
			
		||||
  async initCache (user) {
 | 
			
		||||
    if (!this.ltuid || !this.servCache || !this.ck) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 为当前MysUser添加uid查询记录
 | 
			
		||||
    if (!lodash.isEmpty(this.uids)) {
 | 
			
		||||
      for (let uid of this.uids) {
 | 
			
		||||
        if (uid !== 'pub') {
 | 
			
		||||
          await this.addQueryUid(uid)
 | 
			
		||||
          // 添加ltuid-uid记录,用于判定ltuid绑定个数及自ltuid查询
 | 
			
		||||
          await this.cache.zAdd(tables.uid, this.ltuid, uid)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log(`ltuid:${this.ltuid}暂无uid信息,请检查...`)
 | 
			
		||||
      // 公共ck暂无uid信息不添加
 | 
			
		||||
      if (user?.qq === 'pub') {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // 缓存ckData,供后续缓存使用
 | 
			
		||||
    // ltuid关系存储到与server无关的cache中,方便后续检索
 | 
			
		||||
    if (this.ckData && this.ckData.ck) {
 | 
			
		||||
      await this.cache.kSet(tables.ck, this.ltuid, this.ckData)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 缓存qq,用于删除ltuid时查找
 | 
			
		||||
    if (user && user.qq) {
 | 
			
		||||
      let qq = user.qq === 'pub' ? 'pub' : user.qq * 1
 | 
			
		||||
      let qqArr = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
      if (!lodash.isArray(qqArr)) {
 | 
			
		||||
        qqArr = []
 | 
			
		||||
      }
 | 
			
		||||
      if (!qqArr.includes(qq)) {
 | 
			
		||||
        qqArr.push(qq)
 | 
			
		||||
        await this.cache.kSet(tables.qq, this.ltuid, qqArr)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 从删除记录中查找并恢复查询记录
 | 
			
		||||
    let cacheSearchList = await this.servCache.get(tables.del, this.ltuid, true)
 | 
			
		||||
    // 这里不直接插入,只插入当前查询记录中没有的值
 | 
			
		||||
    if (cacheSearchList && cacheSearchList.length > 0) {
 | 
			
		||||
      for (let searchedUid of cacheSearchList) {
 | 
			
		||||
        // 检查对应uid是否有新的查询记录
 | 
			
		||||
        if (!await this.getQueryLtuid(searchedUid)) {
 | 
			
		||||
          await this.addQueryUid(searchedUid)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  static async eachServ (fn) {
 | 
			
		||||
    let servs = ['mys', 'hoyolab']
 | 
			
		||||
    for (let serv of servs) {
 | 
			
		||||
| 
						 | 
				
			
			@ -238,82 +166,6 @@ export default class MysUser extends BaseModel {
 | 
			
		|||
    await cache.empty(tables.qq)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async disable () {
 | 
			
		||||
    await this.servCache.zDel(tables.detail, this.ltuid)
 | 
			
		||||
    logger.mark(`[标记无效ck][ltuid:${this.ltuid}]`)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  //
 | 
			
		||||
  /**
 | 
			
		||||
   * 删除缓存, 供User解绑CK时调用
 | 
			
		||||
   * @param user
 | 
			
		||||
   * @returns {Promise<boolean>}
 | 
			
		||||
   */
 | 
			
		||||
  async del (user) {
 | 
			
		||||
    if (user && user.qq) {
 | 
			
		||||
      let qqList = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
      let newList = lodash.pull(qqList, user.qq * 1)
 | 
			
		||||
      await this.cache.kSet(tables.qq, this.ltuid, newList)
 | 
			
		||||
      if (newList.length > 0) {
 | 
			
		||||
        // 如果数组还有其他元素,说明该ltuid还有其他绑定,不进行缓存删除
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // 将查询过的uid缓存起来,以备后续重新绑定时恢复
 | 
			
		||||
    let uids = await this.getQueryUids()
 | 
			
		||||
    await this.servCache.set(tables.del, uids)
 | 
			
		||||
 | 
			
		||||
    // 标记ltuid为失效
 | 
			
		||||
    await this.servCache.zDel(tables.detail, this.ltuid)
 | 
			
		||||
    await this.cache.zDel(tables.uid, this.ltuid)
 | 
			
		||||
    await this.cache.kDel(tables.ck, this.ltuid)
 | 
			
		||||
    await this.cache.kDel(tables.qq, this.ltuid)
 | 
			
		||||
    logger.mark(`[删除失效ck][ltuid:${this.ltuid}]`)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 删除MysUser用户记录,会反向删除User中的记录及绑定关系
 | 
			
		||||
  async delWithUser () {
 | 
			
		||||
    // 查找用户
 | 
			
		||||
    let qqArr = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
    if (qqArr && qqArr.length > 0) {
 | 
			
		||||
      for (let qq of qqArr) {
 | 
			
		||||
        let user = await NoteUser.create(qq)
 | 
			
		||||
        if (user) {
 | 
			
		||||
          // 调用user删除ck
 | 
			
		||||
          await user.delCk(this.ltuid, false)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    await this.del()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 为当前用户添加uid查询记录
 | 
			
		||||
  async addQueryUid (uid) {
 | 
			
		||||
    if (uid) {
 | 
			
		||||
      await this.servCache.zAdd(tables.detail, this.ltuid, uid)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 获取当前用户已查询uid列表
 | 
			
		||||
  async getQueryUids () {
 | 
			
		||||
    return await this.servCache.zList(tables.detail, this.ltuid)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 根据uid获取查询ltuid
 | 
			
		||||
  async getQueryLtuid (uid) {
 | 
			
		||||
    return await this.servCache.zKey(tables.detail, uid)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 检查指定uid是否为当前MysUser所有
 | 
			
		||||
  async ownUid (uid) {
 | 
			
		||||
    if (!uid) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
    let uidArr = await this.cache.zList(tables.uid, this.ltuid) || []
 | 
			
		||||
    return uid && uidArr.join(',').split(',').includes(uid + '')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 获取用户统计数据
 | 
			
		||||
  static async getStatData () {
 | 
			
		||||
    let totalCount = {}
 | 
			
		||||
| 
						 | 
				
			
			@ -358,13 +210,11 @@ export default class MysUser extends BaseModel {
 | 
			
		|||
    let count = 0
 | 
			
		||||
    await MysUser.eachServ(async function (servCache) {
 | 
			
		||||
      let cks = await servCache.zGetDisableKey(tables.detail)
 | 
			
		||||
      console.log('cks', cks)
 | 
			
		||||
      for (let ck of cks) {
 | 
			
		||||
        if (await servCache.zDel(tables.detail, ck, true)) {
 | 
			
		||||
          count++
 | 
			
		||||
        }
 | 
			
		||||
        let ckUser = await MysUser.create(ck)
 | 
			
		||||
        console.log('ckUser', ck, ckUser)
 | 
			
		||||
        if (ckUser) {
 | 
			
		||||
          await ckUser.delWithUser()
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -462,7 +312,7 @@ export default class MysUser extends BaseModel {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    for (let val of res.data.list) {
 | 
			
		||||
      if (/\d{9}/.test(val.game_uid)&&val.game_biz=='hk4e_cn') {
 | 
			
		||||
      if (/\d{9}/.test(val.game_uid) && val.game_biz === 'hk4e_cn') {
 | 
			
		||||
        uids.push(val.game_uid + '')
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -525,4 +375,151 @@ export default class MysUser extends BaseModel {
 | 
			
		|||
      msg: 'CK状态正常'
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 为当前MysUser绑定uid
 | 
			
		||||
  addUid (uid) {
 | 
			
		||||
    if (lodash.isArray(uid)) {
 | 
			
		||||
      for (let u of uid) {
 | 
			
		||||
        this.addUid(u)
 | 
			
		||||
      }
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
    uid = '' + uid
 | 
			
		||||
    if (/\d{9}/.test(uid) || uid === 'pub') {
 | 
			
		||||
      if (!this.uids.includes(uid)) {
 | 
			
		||||
        this.uids.push(uid)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 初始化当前MysUser缓存记录
 | 
			
		||||
  async initCache (user) {
 | 
			
		||||
    if (!this.ltuid || !this.servCache || !this.ck) {
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 为当前MysUser添加uid查询记录
 | 
			
		||||
    if (!lodash.isEmpty(this.uids)) {
 | 
			
		||||
      for (let uid of this.uids) {
 | 
			
		||||
        if (uid !== 'pub') {
 | 
			
		||||
          await this.addQueryUid(uid)
 | 
			
		||||
          // 添加ltuid-uid记录,用于判定ltuid绑定个数及自ltuid查询
 | 
			
		||||
          await this.cache.zAdd(tables.uid, this.ltuid, uid)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      console.log(`ltuid:${this.ltuid}暂无uid信息,请检查...`)
 | 
			
		||||
      // 公共ck暂无uid信息不添加
 | 
			
		||||
      if (user?.qq === 'pub') {
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // 缓存ckData,供后续缓存使用
 | 
			
		||||
    // ltuid关系存储到与server无关的cache中,方便后续检索
 | 
			
		||||
    if (this.ckData && this.ckData.ck) {
 | 
			
		||||
      await this.cache.kSet(tables.ck, this.ltuid, this.ckData)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 缓存qq,用于删除ltuid时查找
 | 
			
		||||
    if (user && user.qq) {
 | 
			
		||||
      let qq = user.qq === 'pub' ? 'pub' : user.qq * 1
 | 
			
		||||
      let qqArr = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
      if (!lodash.isArray(qqArr)) {
 | 
			
		||||
        qqArr = []
 | 
			
		||||
      }
 | 
			
		||||
      if (!qqArr.includes(qq)) {
 | 
			
		||||
        qqArr.push(qq)
 | 
			
		||||
        await this.cache.kSet(tables.qq, this.ltuid, qqArr)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 从删除记录中查找并恢复查询记录
 | 
			
		||||
    let cacheSearchList = await this.servCache.get(tables.del, this.ltuid, true)
 | 
			
		||||
    // 这里不直接插入,只插入当前查询记录中没有的值
 | 
			
		||||
    if (cacheSearchList && cacheSearchList.length > 0) {
 | 
			
		||||
      for (let searchedUid of cacheSearchList) {
 | 
			
		||||
        // 检查对应uid是否有新的查询记录
 | 
			
		||||
        if (!await this.getQueryLtuid(searchedUid)) {
 | 
			
		||||
          await this.addQueryUid(searchedUid)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  async disable () {
 | 
			
		||||
    await this.servCache.zDel(tables.detail, this.ltuid)
 | 
			
		||||
    logger.mark(`[标记无效ck][ltuid:${this.ltuid}]`)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //
 | 
			
		||||
  /**
 | 
			
		||||
   * 删除缓存, 供User解绑CK时调用
 | 
			
		||||
   * @param user
 | 
			
		||||
   * @returns {Promise<boolean>}
 | 
			
		||||
   */
 | 
			
		||||
  async del (user) {
 | 
			
		||||
    if (user && user.qq) {
 | 
			
		||||
      let qqList = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
      let newList = lodash.pull(qqList, user.qq * 1)
 | 
			
		||||
      await this.cache.kSet(tables.qq, this.ltuid, newList)
 | 
			
		||||
      if (newList.length > 0) {
 | 
			
		||||
        // 如果数组还有其他元素,说明该ltuid还有其他绑定,不进行缓存删除
 | 
			
		||||
        return false
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    // 将查询过的uid缓存起来,以备后续重新绑定时恢复
 | 
			
		||||
    let uids = await this.getQueryUids()
 | 
			
		||||
    await this.servCache.set(tables.del, uids)
 | 
			
		||||
 | 
			
		||||
    // 标记ltuid为失效
 | 
			
		||||
    await this.servCache.zDel(tables.detail, this.ltuid)
 | 
			
		||||
    await this.cache.zDel(tables.uid, this.ltuid)
 | 
			
		||||
    await this.cache.kDel(tables.ck, this.ltuid)
 | 
			
		||||
    await this.cache.kDel(tables.qq, this.ltuid)
 | 
			
		||||
    logger.mark(`[删除失效ck][ltuid:${this.ltuid}]`)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 删除MysUser用户记录,会反向删除User中的记录及绑定关系
 | 
			
		||||
  async delWithUser () {
 | 
			
		||||
    // 查找用户
 | 
			
		||||
    let qqArr = await this.cache.kGet(tables.qq, this.ltuid, true)
 | 
			
		||||
    if (qqArr && qqArr.length > 0) {
 | 
			
		||||
      for (let qq of qqArr) {
 | 
			
		||||
        let user = await NoteUser.create(qq)
 | 
			
		||||
        if (user) {
 | 
			
		||||
          // 调用user删除ck
 | 
			
		||||
          await user.delCk(this.ltuid, false)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    await this.del()
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 为当前用户添加uid查询记录
 | 
			
		||||
  async addQueryUid (uid) {
 | 
			
		||||
    if (uid) {
 | 
			
		||||
      await this.servCache.zAdd(tables.detail, this.ltuid, uid)
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 获取当前用户已查询uid列表
 | 
			
		||||
  async getQueryUids () {
 | 
			
		||||
    return await this.servCache.zList(tables.detail, this.ltuid)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 根据uid获取查询ltuid
 | 
			
		||||
  async getQueryLtuid (uid) {
 | 
			
		||||
    return await this.servCache.zKey(tables.detail, uid)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 检查指定uid是否为当前MysUser所有
 | 
			
		||||
  async ownUid (uid) {
 | 
			
		||||
    if (!uid) {
 | 
			
		||||
      return false
 | 
			
		||||
    }
 | 
			
		||||
    let uidArr = await this.cache.zList(tables.uid, this.ltuid) || []
 | 
			
		||||
    return uid && uidArr.join(',').split(',').includes(uid + '')
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ export default class User extends base {
 | 
			
		|||
 | 
			
		||||
    /** 检查ck是否失效 */
 | 
			
		||||
    if (!await this.checkCk(param)) {
 | 
			
		||||
      logger.mark(`绑定cookie错误:${this.checkMsg || 'cookie错误'}`)
 | 
			
		||||
      logger.mark(`绑定cookie错误1:${this.checkMsg || 'cookie错误'}`)
 | 
			
		||||
      await this.e.reply(`绑定cookie失败:${this.checkMsg || 'cookie错误'}`)
 | 
			
		||||
      return
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -82,7 +82,7 @@ export default class User extends base {
 | 
			
		|||
        this.ltuid = userInfo.uid
 | 
			
		||||
        this.ck = `${this.ck}ltuid=${this.ltuid};`
 | 
			
		||||
      } else {
 | 
			
		||||
        logger.mark(`绑定cookie错误:${userFullInfo.message || 'cookie错误'}`)
 | 
			
		||||
        logger.mark(`绑定cookie错误2:${userFullInfo.message || 'cookie错误'}`)
 | 
			
		||||
        await this.e.reply(`绑定cookie失败:${userFullInfo.message || 'cookie错误'}`)
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ export default class User extends base {
 | 
			
		|||
      msg += '\n【#删除ck】删除当前绑定ck'
 | 
			
		||||
    }
 | 
			
		||||
    if (/星穹列车/.test(this.region_name)) {
 | 
			
		||||
      msg += "\n星穹铁道支持:\n功能还在咕咕咕~"
 | 
			
		||||
      msg += '\n星穹铁道支持:\n功能还在咕咕咕~'
 | 
			
		||||
    }
 | 
			
		||||
    msg += '\n 支持绑定多个ck'
 | 
			
		||||
    msg = await common.makeForwardMsg(this.e, ['使用命令说明', msg], '绑定成功:使用命令说明')
 | 
			
		||||
| 
						 | 
				
			
			@ -132,16 +132,17 @@ export default class User extends base {
 | 
			
		|||
      if (roleRes?.retcode === 0) {
 | 
			
		||||
        res = roleRes
 | 
			
		||||
        /** 国际服的标记 */
 | 
			
		||||
        if (type == 'hoyolab' && typeof (param.mi18nLang) === 'string') {
 | 
			
		||||
        if (type === 'hoyolab' && typeof (param.mi18nLang) === 'string') {
 | 
			
		||||
          this.ck += ` mi18nLang=${param.mi18nLang};`
 | 
			
		||||
        }
 | 
			
		||||
        break
 | 
			
		||||
      }
 | 
			
		||||
      if (roleRes.retcode == -100) {
 | 
			
		||||
      if (roleRes.retcode === -100) {
 | 
			
		||||
        this.checkMsg = '该ck已失效,请重新登录获取'
 | 
			
		||||
      }
 | 
			
		||||
      } else {
 | 
			
		||||
        this.checkMsg = roleRes.message || 'error'
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!res) return false
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -255,8 +256,8 @@ export default class User extends base {
 | 
			
		|||
      if (!region_name.includes(ckData[v].region_name)) {
 | 
			
		||||
        region_name.push(ckData[v].region_name)
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
    let count = 0;
 | 
			
		||||
    })
 | 
			
		||||
    let count = 0
 | 
			
		||||
    for (let n of region_name) {
 | 
			
		||||
      msg.push(n)
 | 
			
		||||
      for (let i in uids) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue