yujian
2019-12-10 c8041ec0544bf122e6819e6bf698997ccbf30aaf
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/DynamicController.java
@@ -26,7 +26,7 @@
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
@@ -199,19 +199,33 @@
               
               long old = value.getTime();
               long now = nowDate.getTime();
               if (y1 == y2 && d1 == d2) {//判断是不是同一年的同一天
                  long cha = now - old;
                  if (cha < 1000 * 60 * 2L)
                     desc = "刚刚";
                  else if (cha < 1000 * 60 * 60L)
                     desc = (cha / (1000 * 60)) + "分钟前";
                  else
                     desc = (cha / (1000 * 60 * 60)) + "小时前";
               } else if (d2 - d1 == 1) {
                  desc = "昨天";
               if (y1 == y2) {
                  if (d1 == d2) {
                     long cha = now - old;
                     if (cha < 1000 * 60 * 2L) {
                        desc = "刚刚";
                     }else if (cha < 1000 * 60 * 60L) {
                        desc = (cha / (1000 * 60)) + "分钟前";
                     }else {
                        desc = (cha / (1000 * 60 * 60)) + "小时前";
                     }
                  } else if (d2 - d1 == 1) {
                     desc = "昨天";
                  } else {
                     desc = (d2 - d1) + "天前";
                  }
               } else {
                  desc = (d2 - d1) + "天前";
                  int timeDistance = 0;
                  for (int i = y1; i < y2; i++) {
                     if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
                        timeDistance += 366; // 闰年
                     } else {
                        timeDistance += 365; // 不是闰年
                     }
                  }
                  desc = timeDistance + (d2 - d1) + "天前";
               }
               return new JsonPrimitive(desc);
            }