Commit e826d161 authored by jiangjiantao's avatar jiangjiantao

增加错误监控&打印机问题处理

parent 3232eae9
var fundebug = require('./utils/fundebug.0.2.0.min.js');
import monitor from '/utils/alipayLogger'; import monitor from '/utils/alipayLogger';
fundebug.init(
{
apikey: 'c0c5937571f82aecab3f7578bea5d8163455cd2407863f94829bee12324f57b4'
})
App(monitor.hookApp({ App(monitor.hookApp({
globalData: { globalData: {
version: "1.0.1.20200311", version: "1.0.1.20200311",
...@@ -15,6 +10,7 @@ App(monitor.hookApp({ ...@@ -15,6 +10,7 @@ App(monitor.hookApp({
TEST_URL: "https://cashier.test.miyahub.net/", TEST_URL: "https://cashier.test.miyahub.net/",
RELEASE_URL: "https://cashier.miyahub.com/", RELEASE_URL: "https://cashier.miyahub.com/",
BASE_URL: "https://cashier.miyahub.com/", BASE_URL: "https://cashier.miyahub.com/",
LOG_URL: "https://log.test.miyahub.net/log",
appId: "2021001107603212", appId: "2021001107603212",
backScreenAppId: "2021001107617164", backScreenAppId: "2021001107617164",
//小程序容器版本 //小程序容器版本
...@@ -23,7 +19,7 @@ App(monitor.hookApp({ ...@@ -23,7 +19,7 @@ App(monitor.hookApp({
//模拟器上需要sn有值 //模拟器上需要sn有值
sn: "xx", sn: "xx",
//是否登录完成 //是否登录完成
isLoginOk: false userName:""
}, },
...@@ -136,8 +132,32 @@ App(monitor.hookApp({ ...@@ -136,8 +132,32 @@ App(monitor.hookApp({
}); });
}, },
//错误上报
onError(err) { onError(err) {
fundebug.onError(err); try {
var commonRequest = {
appId: this.globalData.appId,
account: this.globalData.userName,
version: this.globalData.version,
extra_data: err
};
my.request({
url: this.globalData.LOG_URL,
method: 'POST',
dataType: 'json',
timeout: 30000,
data: commonRequest,
success: (res) => {
console.log("upload log success");
}, },
fail: (res) => {
console.log("upload log fail");
}
});
} catch (e) {
console.log("upload log exp",e);
}
}
})); }));
...@@ -178,6 +178,7 @@ Page({ ...@@ -178,6 +178,7 @@ Page({
}); });
//登陆信息设置到全局变量 //登陆信息设置到全局变量
getApp().globalData.localAccountInfo = res.data; getApp().globalData.localAccountInfo = res.data;
getApp().globalData.userName = res.data.userName
console.info(`localAccountInfo: ${JSON.stringify(getApp().globalData.localAccountInfo)}`); console.info(`localAccountInfo: ${JSON.stringify(getApp().globalData.localAccountInfo)}`);
//通知后屏登录成功 //通知后屏登录成功
this.sendLoginOkToBackScreen(); this.sendLoginOkToBackScreen();
......
...@@ -18,11 +18,6 @@ function print({ isCheckStatus, cmds, callback }) { ...@@ -18,11 +18,6 @@ function print({ isCheckStatus, cmds, callback }) {
console.log("查询打印机成功:" + JSON.stringify(res)); console.log("查询打印机成功:" + JSON.stringify(res));
if (res.usb != null && res.usb.length != 0) { if (res.usb != null && res.usb.length != 0) {
targetId = res.usb[0].id; targetId = res.usb[0].id;
if (isCheckStatus == true) {
//先检测下状态
my.ix.printerStatus({
success: (r) => {
console.log("printStatus success==>" + JSON.stringify(r));
//滚去打印 //滚去打印
my.ix.printer({ my.ix.printer({
target: targetId, target: targetId,
...@@ -42,36 +37,43 @@ function print({ isCheckStatus, cmds, callback }) { ...@@ -42,36 +37,43 @@ function print({ isCheckStatus, cmds, callback }) {
} }
} }
}); });
},
fail: (r) => { // if (isCheckStatus == true) {
console.log("printStatus fail==>" + JSON.stringify(r)); // //先检测下状态
if (callback != null) { // my.ix.printerStatus({
var result = { code: -1, data: "" + r.errorMessage }; // success: (r) => {
callback(result); // console.log("printStatus success==>" + JSON.stringify(r));
} // //滚去打印
} // my.ix.printer({
}); // target: targetId,
} else { // cmds: cmds,
//滚去打印 // success: (res) => {
my.ix.printer({ // console.log("打印成功:" + JSON.stringify(res));
target: targetId, // if (callback != null) {
cmds: cmds, // var result = { code: 0, data: "打印成功" };
success: (res) => { // callback(result);
console.log("打印成功:" + JSON.stringify(res)); // }
if (callback != null) { // },
var result = { code: 0, data: "打印成功" }; // fail: (res) => {
callback(result); // console.log("打印失败:" + JSON.stringify(res));
} // if (callback != null) {
}, // var result = { code: -1, data: "" + res.errorMessage };
fail: (res) => { // callback(result);
console.log("打印失败:" + JSON.stringify(res)); // }
if (callback != null) { // }
var result = { code: -1, data: "" + res.errorMessage }; // });
callback(result); // },
} // fail: (r) => {
} // console.log("printStatus fail==>" + JSON.stringify(r));
}); // if (callback != null) {
} // var result = { code: -1, data: "" + r.errorMessage };
// callback(result);
// }
// }
// });
// } else {
// }
} else { } else {
if (callback != null) { if (callback != null) {
......
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