0%

订阅号、服务号区别

订阅号 服务号
群发消息 1天只能群发1条消息 1个月内可发送4条群发消息
消息提示音 没有提示音的,在微信会话列表会有新消息提示(“红点”标志) 会收到提示音
模版消息 不支持 支持
一对一发送 粉丝给公众号发送消息,48小时以内是可以在消息对话中进行实时内容回复

随访消息推送使用场景

不同的业务场景给患者推送表单、宣教、通知等。

每一次发送会生成一个唯一的端链接,所以要用模版消息推送功能实现。

必须使用服务号的原因

  1. 服务号推送消息会有提示音,订阅号没有

  2. 订阅号1天只能主动给粉丝群发一条消息,无法给不同粉丝发送不同内容

  3. 订阅号客服回复功能只能给48小时内主动发送消息的粉丝回复

问题

Tomcat启动到一半闪退,bin目录下生成了hs_err_pidXXXX.log文件

日志内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1660496 bytes for Chunk::new
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is
# placed in the first 4GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (allocation.cpp:390), pid=6684, tid=0x0000000000000df8
#
# JRE version: Java(TM) SE Runtime Environment (8.0_201-b09) (build 1.8.0_201-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Call to MiniDumpWriteDump() failed (Error 0x800705af: 页面文件太小,无法完成操作。

)

翻译过来就是本地内存分配失败, 可能的原因有两种

  1. 系统物理内存或虚拟内存不足
  2. 程序在压缩指针模式下运行, Java堆会阻塞本地堆的增长

解决方案

查看服务器,发现内存足够,尝试按第二个问题进行解决。

禁止使用压缩指针模式,在Catalina.bat中的JAVA_OPTS的值后面加

1
-XX:-UseCompressedOops 

问题

fastjson默认对日期格式序列化,默认是使用时间戳

方案一

1
2
@JSONField (format="yyyy-MM-dd HH:mm:ss")  
public Date birthday;

方案二

1
JSON.toJSONStringWithDateFormat(Object, dateformat, SerializerFeature.WriteDateUseDateFormat)