From ca716e07ef898d4ce407e2e0b66ce169b6baddfb Mon Sep 17 00:00:00 2001 From: Z Date: Mon, 2 Mar 2020 16:14:16 +0800 Subject: [PATCH] =?UTF-8?q?mask=E4=B8=8D=E5=90=8C=E5=A4=A9=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=B8=8D=E5=90=8C=E7=9A=84=E7=BC=96=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/statuses_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 8bec2e2fbc..826d55a6c3 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -38,7 +38,14 @@ class Api::V1::StatusesController < Api::BaseController end def to_cn(n) - "甲乙丙丁戊己庚辛壬癸"[n % 10] + [n % 20873, n % 20899].map{|i| i+0x4e00}.pack('U*') + case Time.new.wday + when 0, 3 + "秦汉魏晋隋唐宋元明清"[n % 10] + [n % 20873, n % 20899].map{|i| i+0x4e00}.pack('U*') + when 1, 4, 6 + "甲乙丙丁戊己庚辛壬癸"[n % 10] + [n % 20873, n % 20899].map{|i| i+0x4e00}.pack('U*') + else + "鼠牛虎兔龙蛇马羊猴鸡狗猪" [n % 12] + [n % 20873, n % 20899].map{|i| i+0x4e00}.pack('U*') + end end def create