redisKeys.js 855 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. /** @param {number} month1to12 */
  15. function monthState(studentNum, year, month1to12) {
  16. const m = String(month1to12).padStart(2, '0')
  17. return `jkes_month:${studentNum}:${year}-${m}`
  18. }
  19. function consume(baseKey) {
  20. return `jkes_lepao:consume:${baseKey}`
  21. }
  22. function refund(baseKey) {
  23. return `jkes_lepao:refund:${baseKey}`
  24. }
  25. module.exports = {
  26. runnerFlag,
  27. lepaoSuccess,
  28. lepaoProgress,
  29. monthState,
  30. consume,
  31. refund
  32. }