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