Commit 9e69ee3f by Sixong.Zhu

Merge branch 'master' into pre

parents 7184aeda ea095725
......@@ -156,7 +156,6 @@
o && n && this.messages.length
? this.fetchNewMsg()
: setTimeout(() => this.fetchNewMsg(), 300);
this.scroll2End(this.messages.length ? 0 : 100);
}
private raiseFileOpen(value: boolean) {
......@@ -341,6 +340,9 @@
if (data.length === 0) {
// eslint-disable-next-line no-console
console.log("没有更多新消息了");
this.scroll2End();
} else {
setTimeout(() => this.fetchNewMsg(), 200);
}
const removingIds: number[] = [];
......
import Axios, { AxiosResponse } from "axios";
import { UniplatSdk } from "uniplat-sdk";
import { ImEnvironment } from "../model";
export const enum Product {
Default = 'default',
QqxbWeixin = 'qqxb-weixin',
QqxbApp = 'qqxb-app',
Fulibao = 'fulibao',
HrManager = 'hr-manager',
Hrs100 = 'hrs100',
HrsApp = 'hrs-app',
BiJie = 'bi-jie',
Cashier = 'cashier',
Uniplat = "uniplat",
}
const enum ProductTable {
Default = "",
Login = "login",
Error = "error",
}
export interface SdkMonitorOption {
userAgent?: boolean;
envir: ImEnvironment;
product: Product;
}
class WebMonitor {
private key = "";
private envir = ImEnvironment.Dev;
private product = Product.Default;
private cachedUa = '';
private readonly url = "https://pre-hrs-monitor.hrs100.com";
public updateKey(key: string) {
this.key = key;
return this;
}
private buildHeaders() {
return {
headers: { authorization: "cdd0a34e-f537-4e5b-808e-2ba06af21845" },
};
}
private enable() {
return this.envir !== ImEnvironment.Dev;
}
private envirString() {
if (this.envir === ImEnvironment.Dev) {
return "[Dev]";
}
if (this.envir === ImEnvironment.Stage) {
return "[Stage]";
}
return "";
}
public log(msg: any) {
return Axios.post(
this.url,
{
type: ProductTable.Login,
product: this.product,
msg: `${this.envirString()} ${msg} `,
key: this.key,
},
this.buildHeaders()
);
}
public error(msg: any) {
return Axios.post(
this.url,
{
type: ProductTable.Error,
product: this.product,
msg: `${this.envirString()} ${msg} `,
key: this.key,
},
this.buildHeaders()
);
}
private getUa() {
if (!this.cachedUa) {
const build = (t: string, c: string) => `<span class="${c}">${t}</span>`
this.cachedUa = window.navigator.userAgent
.replace(/Android/ig, build('Android', 'primary'))
.replace(/iPhone/ig, build('iPhone', 'primary'))
.replace(/Mac OS X/ig, build('Mac OS X', 'primary'))
.replace(/QQXBUA/ig, build('QQXBUA', 'secondary'))
.replace(/isFlutter/ig, build('isFlutter', 'secondary'))
.replace(/\"version\"/ig, build('"version"', 'secondary'));
}
return this.cachedUa;
}
public useSdk(sdk: UniplatSdk, options: SdkMonitorOption) {
this.envir = options.envir;
this.product = options.product;
sdk.events.addUniversalErrorResponseCallback((r: AxiosResponse<any>) => {
if (this.enable()) {
const msg: string[] = [];
msg.push(`URL: ${decodeURIComponent(r.config.url as string)}`);
msg.push(`Token: ${sdk.global.jwtToken}`);
const header = r.config.headers;
if (header) {
msg.push(`CurrentOrg: ${header.CurrentOrg}`);
msg.push(`Scenes: ${header.Scenes}`);
}
options &&
options.userAgent &&
msg.push(`UserAgent: ${this.getUa()}`);
r.config && r.config.data && msg.push(`Payload: ${JSON.stringify(r.config.data)}`);
msg.push(
`Exception: ${((r.data.error as string) || "").substring(
0,
500
)}`
);
r && r.config && this.error(msg.join("\n"));
}
});
}
}
export const monitor = new WebMonitor();
......@@ -10,14 +10,14 @@ import {
UploadImageItem,
orderPayItemPredict,
OrderComment,
PayStatus
PayStatus,
} from "../model";
import { GeneralOrderDirection } from "../model/order-product";
class OrderService {
public readonly generalOrder = "general_order_info";
public readonly generalOrderPaymentModel = "general_order_payment_info";
public readonly generalOrderDefaultDetailName = 'userOrderDetail';
public readonly generalOrderDefaultDetailName = "userOrderDetail";
private readonly commentModel = "uniplat_model_remark@general_order";
private readonly fileModel = "general_order_payment_file_info";
......@@ -138,11 +138,17 @@ class OrderService {
r.pageData.rows,
orderPayItemPredict
);
items = items.filter(i => i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel)
items = items.filter(
(i) =>
i.status !== PayStatus.Deleted &&
i.status !== PayStatus.Cancel
);
if (withActions) {
for (let i = 0; i < r.pageData.rows.length; i++) {
items[i].actions = r.pageData.rows[i].actions;
r.pageData &&
r.pageData.rows &&
r.pageData.rows[i] &&
(items[i].actions = r.pageData.rows[i].actions);
}
}
......@@ -227,7 +233,7 @@ class OrderService {
.query();
}
public sendPayAccountInfo(params: { send: string, type?: number }) {
public sendPayAccountInfo(params: { send: string; type?: number }) {
return this.getSdk()
.domainService("hro_spview", "OrderSetting", "sendPayAccountInfo")
.request("get", { params });
......
......@@ -780,10 +780,7 @@ export default {
};
if (e.type === MessageType.Withdraw) {
dbController
.removeMessage(
e.chat_id,
xim.withDrawMsgHandle(e)
)
.removeMessage(e.chat_id, xim.withDrawMsgHandle(e))
.finally(() => thenAction());
} else {
thenAction();
......@@ -903,19 +900,24 @@ export default {
commit(ChatStore.MUTATION_INITING_CHAT);
removeRegisterChatEvents.forEach((k) => k());
removeRegisterChatEvents = [];
try {
await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS);
await Promise.all([
dispatch(ChatStore.ACTION_REGISTER_EVENT),
dispatch(ChatStore.ACTION_GET_CHAT_MESSAGES),
]);
} catch (e) {
Chat.error(e);
} finally {
commit(
ChatStore.MUTATION_SAVE_CHAT_TITLE,
wantedChatRoom.title || `会话${chatId}`
wantedChatRoom.title || `在线咨询-${chatId}`
);
commit(ChatStore.MUTATION_INITING_CHAT_DONE);
commit(ChatStore.MUTATION_SCROLL_TO_BOTTOM);
(<any>state)[ChatStore.STATE_CHAT_CURRENT_IS_CHAT_ERROR] = null;
Chat.setRead(wantedChatRoom.model_name, wantedChatRoom.obj_id);
}
},
async [ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA]({ commit, state }) {
commit(ChatStore.MUTATION_CLEAR_CURRENT_CHAT_ID);
......
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 sign in to comment