分类
解决方案

fiddler抓手机包

思路

  • 电脑和手机在同一个网络
  • 开启fiddler查找电脑ip和fildder服务端口
  • 手机打开wlan的连接网络,长按修改网络并设置代理
  • 手机浏览器查找ip:fildder服务端口下载证书
  • 手机回到设置代理处选择CA证书为使用系统证书
  • 从fiddler查询包
qi ye wei xin jie tu 16183992113947 1024x174 - fiddler抓手机包
电脑ip
qi ye wei xin jie tu 16183996739834 - fiddler抓手机包
tools -> options -> connections查询fiddler服务端口
c660794a7242bd204908388ab3013b7f 140x300 - fiddler抓手机包
长按修改网络
a5921f028667f5627d828d08e9d51d66 479x1024 - fiddler抓手机包
修改代理
ccd7e16866f86ddc62d3cf5f4500a846 1024x541 - fiddler抓手机包
手机浏览器查找ip:fildder服务端口下载证书
eff87595726bf703933d834aec8bfe54 479x1024 - fiddler抓手机包
使用证书,填写域名,完成抓包

关闭电脑防火墙!关闭电脑防火墙!关闭电脑防火墙!

分类
javascript

FTS迁移代码优化

接口从多变少

从前在写fts的时候会有转办,加签,同意,驳回等接口。每个步骤的转办都不是同一个接口。因此为每个接口都写了一个api和store。现在,需要让接口精简,所有的转办都用同一个接口,但接口地址不同。

以转办举例

  // 转办api
  entrustTask(param) {
    let path = '';
    if (Reflect.has(param, 'path')) {
      path = Reflect.get(param, 'path');
      Reflect.deleteProperty(param, 'path');
    }
    return db.post(path, param);
  },
 // 转办store
    entrustTask(store, param) {
      return db.entrustTask(param);
    },
// 转办调用
this.entrustTask({
                remarks,
                entrustUsers: people.toString(),
                nodeId: this.$route.params.nodeId,
                requestId: this.$route.params.id,
                taskId: this.$route.params.taskId,
                path,
              }).then((req) => {
                this.modal.visible = false;
                this.$message.success(req.msg);
                this.closePage();
              });

使用查表

现在的方式

 const pathConfig = {
        11: 'new/mqf/wfMarketIssueTrack/rejectDelay',
        12: 'new/mqf/wfMarketIssueApplyClose/rejectTask',
        13: 'new/mqf/wfMarketIssueRespDeptLeaderApproval/rejectTask',
        14: 'new/mqf/wfMarketIssueMgtDeptApproval/rejectTask',
        15: 'new/mqf/wfMarketIssueMgtDeptLeaderApproval/rejectTask',
      };
      this.approveForm.validateFieldsAndScroll((err, values) => {
        if (!err) {
          this.loading.reject = true;
          const { remarks } = values;
          this.rejectApproval({
            path: pathConfig[this.$route.params.status],
            nodeId: this.$route.params.nodeId,
            remarks,
            requestId: this.$route.params.id,
            taskId: this.$route.params.taskId,
          }).then((res) => {
            this.$message.success(res.msg);
            setTimeout(window.close, 2000);
          }).catch((error) => {
            this.$message.error(error.meta.message);
            this.loading.reject = false;
          });
        }
      });

曾经的方式

switch (this.$route.params.status) {
                  case '10':
                    this.entrustTaskTaskTrack({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  case '11':
                    this.entrustTaskDelay({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  case '12':
                    this.entrustTaskApplyClose({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  case '13':
                    this.respDeptLeaderEntrustTask({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  case '14':
                    this.mgtDeptEntrustTask({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  case '15':
                    this.mgtDeptLeaderEntrustTask({
                      remarks,
                      entrustUsers: people.toString(),
                      nodeId: this.$route.params.nodeId,
                      requestId: this.$route.params.id,
                      taskId: this.$route.params.taskId,
                    }).then((req) => {
                      this.modal.visible = false;
                      this.$message.success(req.msg);
                      setTimeout(window.close, 2000);
                    }).catch((error) => {
                      this.$message.error(error.meta.message);
                    });
                    break;
                  default:
                }

代码质量显而易见的提升了(完)