Commit 6fd2685f authored by chenqikuai's avatar chenqikuai

存储代码

parent 8bdecc66
...@@ -146,7 +146,7 @@ class MessageStore { ...@@ -146,7 +146,7 @@ class MessageStore {
} }
// 多媒体类的消息(语音、图片、视频)上传阿里云 OSS,取得 url,发送 url // 多媒体类的消息(语音、图片、视频)上传阿里云 OSS,取得 url,发送 url
if (type !== ChatMessageTypes.Text && type !== ChatMessageTypes.Card) { if (type !== ChatMessageTypes.Text && type !== ChatMessageTypes.Card && type !== ChatMessageTypes.FOO) {
// 特殊情况处理:当发送微信和支付宝收款方式时,由于是直接从后端拿到的图片外链,所以直接发送 // 特殊情况处理:当发送微信和支付宝收款方式时,由于是直接从后端拿到的图片外链,所以直接发送
if (!content.rawMessage) { if (!content.rawMessage) {
if ( if (
......
...@@ -8,4 +8,5 @@ export enum ChatMessageTypes { ...@@ -8,4 +8,5 @@ export enum ChatMessageTypes {
File = 5, File = 5,
Card = 6, Card = 6,
robot = 100, robot = 100,
FOO = 9,
} }
...@@ -37,6 +37,7 @@ enum MsgType { ...@@ -37,6 +37,7 @@ enum MsgType {
Card = 6; Card = 6;
Alert = 7; Alert = 7;
Forward = 8; Forward = 8;
FOO = 9;
} }
message CommonMsg { message CommonMsg {
......
...@@ -44,6 +44,8 @@ export default (data: Uint8Array): DecodedMessage | null => { ...@@ -44,6 +44,8 @@ export default (data: Uint8Array): DecodedMessage | null => {
case 6: case 6:
content = CardMsg.toObject(CardMsg.decode(commonMsg.msg || new Uint8Array())) content = CardMsg.toObject(CardMsg.decode(commonMsg.msg || new Uint8Array()))
break break
case 9:
content = TextMsg.toObject(TextMsg.decode(commonMsg.msg || new Uint8Array()))
default: default:
throw '解码消息时发现未知的消息类型:' + commonMsg.msgType throw '解码消息时发现未知的消息类型:' + commonMsg.msgType
} }
......
...@@ -55,6 +55,11 @@ export default (msg: ChatMessageEncoderArgs): Uint8Array => { ...@@ -55,6 +55,11 @@ export default (msg: ChatMessageEncoderArgs): Uint8Array => {
account: (msg.msg as dtalk.proto.CardMsg).account, account: (msg.msg as dtalk.proto.CardMsg).account,
}).finish() }).finish()
break break
case ChatMessageTypes.FOO:
content = dtalk.proto.TextMsg.encode({
content: (msg.msg as dtalk.proto.ITextMsg).content,
}).finish()
break
default: default:
throw '未知的消息类型:' + msg.msgType throw '未知的消息类型:' + msg.msgType
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -528,6 +528,7 @@ export const dtalk = $root.dtalk = (() => { ...@@ -528,6 +528,7 @@ export const dtalk = $root.dtalk = (() => {
* @property {number} Card=6 Card value * @property {number} Card=6 Card value
* @property {number} Alert=7 Alert value * @property {number} Alert=7 Alert value
* @property {number} Forward=8 Forward value * @property {number} Forward=8 Forward value
* @property {number} FOO=9 FOO value
*/ */
proto.MsgType = (function() { proto.MsgType = (function() {
const valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
...@@ -540,6 +541,7 @@ export const dtalk = $root.dtalk = (() => { ...@@ -540,6 +541,7 @@ export const dtalk = $root.dtalk = (() => {
values[valuesById[6] = "Card"] = 6; values[valuesById[6] = "Card"] = 6;
values[valuesById[7] = "Alert"] = 7; values[valuesById[7] = "Alert"] = 7;
values[valuesById[8] = "Forward"] = 8; values[valuesById[8] = "Forward"] = 8;
values[valuesById[9] = "FOO"] = 9;
return values; return values;
})(); })();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<!-- 有输入文字,显示 `发送` 按钮 --> <!-- 有输入文字,显示 `发送` 按钮 -->
<button <button
v-else v-else
@click="inputText.trim().length !== 0 &&sendChatMessage({ type: 1, content: { content: inputText } })" @click="inputText.trim().length !== 0 &&sendChatMessage({ type: 9, content: { content: inputText } })"
class=" class="
mx-2.5 mx-2.5
px-4 px-4
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment