redisKeys.js 957 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * JKES 相关 Redis 键(与旧系统 lepao* 隔离,统一 jkes_ / jkes_* 前缀)
  3. * 账户以学号 student_num(JKES 的 code)为主键。
  4. */
  5. function runnerFlag(studentNum) {
  6. return `jkes_runner:${studentNum}`
  7. }
  8. function lepaoSuccess(studentNum) {
  9. return `jkes_lepaoSuccess:${studentNum}`
  10. }
  11. function lepaoProgress(studentNum) {
  12. return `jkes_lepaoProgress:${studentNum}`
  13. }
  14. function lepaoSchedule(recordId) {
  15. return `jkes_lepaoSchedule:${recordId}`
  16. }
  17. /** @param {number} month1to12 */
  18. function monthState(studentNum, year, month1to12) {
  19. const m = String(month1to12).padStart(2, '0')
  20. return `jkes_month:${studentNum}:${year}-${m}`
  21. }
  22. function consume(baseKey) {
  23. return `jkes_lepao:consume:${baseKey}`
  24. }
  25. function refund(baseKey) {
  26. return `jkes_lepao:refund:${baseKey}`
  27. }
  28. module.exports = {
  29. runnerFlag,
  30. lepaoSuccess,
  31. lepaoProgress,
  32. lepaoSchedule,
  33. monthState,
  34. consume,
  35. refund
  36. }