
CREATE TABLE `cb_msg`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `msgid` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息ID',
  `open_kfid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客服ID',
  `external_userid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户UserID',
  `send_time` bigint(20) NOT NULL COMMENT '发送时间',
  `origin` tinyint(4) NOT NULL COMMENT '消息来源 3-微信客户发送的消息 4-系统推送的事件消息 5-接待人员在企业微信客户端发送的消息',
  `servicer_userid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '接待人员userid',
  `msgtype` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息类型',
  `data_info` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '消息内容（json格式，各个消息类型不一致）',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `open_kfid`(`open_kfid`) USING BTREE,
  INDEX `msgid`(`msgid`) USING BTREE,
  INDEX `external_userid`(`external_userid`) USING BTREE,
  INDEX `send_time`(`send_time`) USING BTREE,
  INDEX `servicer_userid`(`servicer_userid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '客服消息' ROW_FORMAT = Compact;
