1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- us = {};
- // us.qs = require("querystring"); //引用文件解析包
- // us.http = require("http"); //引用http server服务
- // 引入Express模块
- const express = require('express');
- const qs = require('qs');
- const path = require('path');
- us.http = require("http"); //引用http server服务
- const http = require('http');
- // 创建Express应用
- const app = express();
- // 设置静态文件目录
- app.use(express.static(path.join(__dirname, '/')));
- us.server = us.http.createServer(function (reqo, reso) {
- // 定义路由
- // app.all('/', (req, res) => {
- //设置跨域
- reso.writeHead(200, {
- "Content-Type": "application/json",
- 'Access-Control-Allow-Origin': '*',
- "Connection": "keep-alive",
- 'Access-Control-Allow-Headers': 'Origin, No-Cache, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type, X-E4M-With'
- });
- // http://apis.ssti.net.cn:80/taskcenterapp/sys/taskCenter/taskReceive/pushTask.do
- const options = {
- hostname: 'apis.ssti.net.cn',
- port: 80,
- path: '/taskcenterapp/sys/taskCenter/taskReceive/pushTask.do',
- method: 'POST',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'appId': '36dd21cde3b2f30a',
- 'accessToken': '463e95bdad1a9506bd1b271194f89383'
- }
- };
- const req = http.request(options, (res) => {
- console.log(`statusCode: ${res.statusCode}`);
- res.on('data', (data) => {
- console.log(data.toString());
- });
- });
- req.on('error', (error) => {
- console.error(error);
- });
- const bodyData = qs.stringify({ appId: "36dd21cde3b2f30a", taskInfo: '{"inserttasks":[{"app_id":"test11","assignments":[{"assign_dept":"图书部门","assign_id":"ampadmin","assign_name":"ampadmin"}],"biz_domain":"测试部门","biz_key":"bizkey_1000112","created_by_depts":"图书部门","created_by_ids":"ampadmin","created_by_names":"ampadmin","created_on":"2018-01-16 15:06:18","form_url":"https://baidu.com","form_url_view":"https://baidu.com","node_id":"1000112","node_name":"人事审核","priority":0,"process_delete_flag":0,"process_id":"leave_1233211932","process_instance_form_view":"https://taobao.com","process_instance_id":"1233211932","process_instance_image_url":"https://baidu.com","process_instance_initiator":"ampadmin","process_instance_initiator_dp":"图书部门","process_instance_initiator_id":"ampadmin","process_instance_start_date":"2018-01-16 15:06:18","process_instance_status":"RUNNING","process_instance_subject":"请假流程:ampadmin","process_name":"请假流程","process_version":"1.0","status":"ACTIVE","subject":"test_发起请假流程-tstsysys","task_delete_flag":0,"task_id":"1000112"}],"updatetasks":[]}' });
- req.write(bodyData);
- req.end();
- reso.end("")
- });
- // 启动服务器
- app.listen(3000, () => {
- console.log('Server is running on port 3000');
- });
- /**
- * 监听1473端口的处理
- *
- **/
- us.server.listen('1473', '', function () {
- //在控制台输出监听提示
- console.log("开始监听" + us.server.address().port + "......");
- });
|