const express = require('express'), http = require('http');

const cors = require('cors')
const app = express()
 
app.use(cors())

const bodyParser = require('body-parser')
//读取json配置
app.use(bodyParser.json({ limit: '1mb' }))
app.use(bodyParser.urlencoded({
    extended: true
})) 

// mockjs
const Mock = require('mockjs')

const img = {"code":0,"msg":"Success","data":{"token":null,"uuid":"bcbe638a-79e4-421d-ba7b-d1c052aca63f","img":"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","platform":null,"currencyUnit":null,"exchangeRate":null,"countryCode":null,"usRate":null}};
app.get('/api/captchaImage', (req,res,next) =>{
    res.end(JSON.stringify(img));
})

// 获取验证码
app.post('/api/sendSms', (req, res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            verifyCode:'123456'
        },
    }))
});


// 登录
app.post('/api/user/login',(req,res,next) => {
    const { loginType,phone,verifyCode,username, password } = req.body;
    let retObj = {
        code: 0,
        message: '登录成功',
        data: {
          'id': '@id',
          'name': '@cname',
          'token': '@guid',
          'avatar': '@image("100x100", "#4A7BF7", "avatar")',
          'roles|1': ['admin', 'editor', 'visitor']
        }
    }

    // console.log("/api/user/login=>",loginType,phone,verifyCode,username, password)
    // console.log("/api/user/login=>",Mock.mock(retObj))

    if(loginType===0){//验证码登录
        if (phone === '15112345600'  && verifyCode === '123456') {
            res.json(Mock.mock(retObj))
          } else {
            res.json(Mock.mock({
                code: 401,
                message: '验证码错误'
            }))
        }
    }else if(loginType===1){//用户名密码登录
        if (username === 'admin' && password === '123456') {
            res.json(Mock.mock(retObj))
        } else {
            res.json(Mock.mock({
                code: 401,
                message: '用户名或密码错误'
            }))
        }

    }else{
        res.json(Mock.mock({
            code: -1,
            msg: '请正确输入登录信息'
        }))
    }
    
});

// 获取用户信息
app.post('/api/getUserInfo', (req,res) => {
    // console.log("req=>",req)
    // reqBody = JSON.parse(req.body)
    res.json(Mock.mock({
        code: 0,
        data: {
            'id': '@id',
            'name': '小北',
            'token': '@guid',
            'avatar': '@image("100x100", "#4A7BF7", "avatar")',
            'deptName':'数字信息服务中心',
            'jobName':'副总经理',
            'joinDay':1953,
            'level':5
        }
    }))
});

// 搜索功能
app.post('/api/search', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            'id': '@id',
            'content': '@cname',
        }
    }))
});

// 查询业务列表
app.post('/api/businessList', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {bizId:1,bizName:'企业日常',children:[
                    {bizId:11,bizName:'任务计划',icon:'static/images/business/icon-rwjh.png',status:1,isDaily:true},
                    {bizId:12,bizName:'日报',icon:'static/images/business/icon-rb.png',status:1,isDaily:true},
                    {bizId:13,bizName:'设备管理',icon:'static/images/business/icon-sbgl.png',status:1},
                    {bizId:14,bizName:'绩效管理',icon:'static/images/business/icon-jxgl.png',status:1},
                    {bizId:15,bizName:'公章申请',icon:'static/images/business/icon-gzsq.png',status:1,isDaily:true},
                    {bizId:16,bizName:'会议室预约',icon:'static/images/business/icon-hysyy.png',status:1,isDaily:true},
                    {bizId:17,bizName:'报修',icon:'static/images/business/icon-bx.png',status:1}
                ]},
                {bizId:2,bizName:'CRM系统',children:[
                    {bizId:21,bizName:'走访报告',icon:'static/images/business/demo.png',bizUrl:'/pages/business/CRM/visitorReport',status:true},
                    {bizId:101,bizName:'走访报告',icon:'static/images/business/icon-zfbg.png',status:1},
                    {bizId:102,bizName:'走访查看',icon:'static/images/business/icon-zfck.png',status:1,isDaily:true},
                    {bizId:103,bizName:'走访审批',icon:'static/images/business/icon-zfsp.png',status:1},
                    {bizId:104,bizName:'计划查看',icon:'static/images/business/icon-jhck.png',status:1},
                    {bizId:105,bizName:'签到打卡',icon:'static/images/business/icon-qddk.png',status:1},
                    {bizId:106,bizName:'打卡信息',icon:'static/images/business/icon-dkxx.png',status:1},
                    {bizId:107,bizName:'打卡统计',icon:'static/images/business/icon-dktj.png',status:1},
                    {bizId:108,bizName:'人员新增',icon:'static/images/business/icon-ryxz.png',status:1},
                    {bizId:109,bizName:'信息查看',icon:'static/images/business/icon-xxck.png',status:1,isDaily:true},
                    {bizId:1010,bizName:'信息审核',icon:'static/images/business/xxsh.png',badgeCount:5,status:1,isDaily:true},
                    {bizId:1011,bizName:'信息统计',icon:'static/images/business/icon-xxtj.png',status:1},
                    {bizId:1012,bizName:'回款查看',icon:'static/images/business/icon-hkck.png',status:1},
                    {bizId:1013,bizName:'客户人员审核',icon:'static/images/business/icon-khrysh.png',badgeCount:3,status:true},
                    {bizId:1014,bizName:'客户人员所属',icon:'static/images/business/icon-khryss.png',status:1},
                    {bizId:1015,bizName:'客户人员归属人变更',icon:'static/images/business/icon-khrybg.png',status:1},
                    {bizId:1016,bizName:'市场活动',icon:'static/images/business/icon-schd.png',status:1}
                ]},
                {bizId:3,bizName:'供应链采纳',children:[]},
                {bizId:4,bizName:'PLM系统',children:[]}
            ]
        }
    }))
});

// 查询企业日常 Daily business
app.post('/api/businessDaily', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {id:11,name:'任务计划',imgSrc:'static/images/business/icon-rwjh.png'},
                {id:12,name:'日报',imgSrc:'static/images/business/icon-rb.png'},
                {id:13,name:'设备管理',imgSrc:'static/images/business/icon-sbgl.png'},
                {id:14,name:'绩效管理',imgSrc:'static/images/business/icon-jxgl.png'},
                {id:15,name:'公章申请',imgSrc:'static/images/business/icon-gzsq.png'},
                {id:16,name:'会议室预约',imgSrc:'static/images/business/icon-hysyy.png'},
                {id:17,name:'报修',imgSrc:'static/images/business/icon-bx.png'}
            ]
        }
    }))
});

// 查询CRM系统 Daily business
app.post('/api/businessCRMList', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {id:21,name:'走访报告',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReport'},
                {id:22,name:'走访报告添加',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportAdd'},
                {id:23,name:'走访报告详情',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportDetail'},
                {id:24,name:'走访报告内容录入',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/visitorReportEnter'},
                {id:25,name:'市场信息管理',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/marketInformation'},
                {id:26,name:'修改周计划',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/weekPlanUpdate'},
                {id:27,name:'签到打卡',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/vistorCheckin'},
                {id:28,name:'打卡统计',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/checkinStatistics'},
                {id:29,name:'回款查看',imgSrc:'static/images/business/demo.png',url:'/pages/business/CRM/paymentCollection'},
                {id:101,name:'走访报告',imgSrc:'static/images/business/icon-zfbg.png'},
                {id:102,name:'走访查看',imgSrc:'static/images/business/icon-zfck.png'},
                {id:103,name:'走访审批',imgSrc:'static/images/business/icon-zfsp.png'},
                {id:104,name:'计划查看',imgSrc:'static/images/business/icon-jhck.png'},
                {id:105,name:'签到打卡',imgSrc:'static/images/business/icon-qddk.png'},
                {id:106,name:'打卡信息',imgSrc:'static/images/business/icon-dkxx.png'},
                {id:107,name:'打卡统计',imgSrc:'static/images/business/icon-dktj.png'},
                {id:108,name:'人员新增',imgSrc:'static/images/business/icon-ryxz.png'},
                {id:109,name:'信息查看',imgSrc:'static/images/business/icon-xxck.png'},
                {id:1010,name:'信息审核',imgSrc:'static/images/business/xxsh.png',badgeCount:5},
                {id:1011,name:'信息统计',imgSrc:'static/images/business/icon-xxtj.png'},
                {id:1012,name:'回款查看',imgSrc:'static/images/business/icon-hkck.png'},
                {id:1013,name:'客户人员审核',imgSrc:'static/images/business/icon-khrysh.png',badgeCount:3},
                {id:1014,name:'客户人员所属',imgSrc:'static/images/business/icon-khryss.png'},
                {id:1015,name:'客户人员归属人变更',imgSrc:'static/images/business/icon-khrybg.png'},
                {id:1016,name:'市场活动',imgSrc:'static/images/business/icon-schd.png'}
            ]
        }
    }))
});

// 首页待办数据
app.post('/api/backBlogCount', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            count1:3,
            count2:7,
            count3:2,
            count4:6,
        }
    }))
});

// 首页通知消息跑马灯
app.post('/api/swiperList', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: ["祝贺“友晟夏季封装外壳发布会”圆满成功","祝贺“友晟科技发布会”圆满成功","祝贺“友晟夏季封装外壳发布会”圆满成功"]
    }))
});


// 首页日程提醒
app.post('/api/stepData', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            date:new Date().getTime(),
            list:[
                { id:1,desc: '2025秋季产品发布前期准备会，在科研楼0317会议室召开。', title: '13:30 — 15:30',beginTime:'13:30',endTime:'15:30'}, 
                { id:2,desc: '生产间安全巡检。', title: '16:30 — 18:00',beginTime:'16:30',endTime:'18:00'}, 
            ]
        }
    }))
});

// 首页销售任务
app.post('/api/salesTask', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            salesList:['2025-3季度', '2025-2季度', '2025-1季度'],
            percentNum:82,
            totalSales:62075000,
            targetSales:75000000
        }
    }))
});

// 首页常用服务
app.post('/api/commonServices', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {id:1,name:'设备管理',imgSrc:'static/images/business/icon-sbgl.png'},
                {id:2,name:'目标管理',imgSrc:'static/images/business/icon-mbgl.png'},
                {id:3,name:'科研工艺',imgSrc:'static/images/business/icon-kygy.png'},
                {id:4,name:'工艺攻关',imgSrc:'static/images/business/icon-gygg.png'},
                {id:5,name:'数据采集',imgSrc:'static/images/business/icon-sjcj.png'}
            ],
        }
    }))
});

// 新闻列表
app.post('/api/newsQueryList', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {id:1,date:'2025-06-29',name:'友晟亮相2025慕尼黑上海电子展',imgSrc:'https://img2.baidu.com/it/u=363858033,1221485415&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1067'},
                {id:2,date:'2025-06-26',name:'孜孜不倦，谱写公司发展新篇章',imgSrc:'https://img0.baidu.com/it/u=2830423559,3962669886&fm=253&app=138&f=JPEG?w=570&h=760'},
                {id:3,date:'2025-03-29 08:10:00',name:'质量管理体系提升助力实现质的飞跃',imgSrc:''},
            ],
        }
    }))
});

// 消息列表
app.post('/api/noticeList', (req,res) => {
    // console.log(req.body)
    let param = req.body;
    if(param.pageIndex==1){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    {id:1,date:'2025-06-30',isReady:true,title:'临时调整本周工作时间的通知',imgSrc:'static/images/notice/icon-TiXing@2x.png'},
                    {id:2,date:'2025-06-27',isReady:false,title:'8月个税扣缴申报已完成',imgSrc:'static/images/notice/icon-RiCheng@2x.png'},
                    {id:3,date:'2025-09-10 17:29:00',isReady:true,title:'公司班车北五环线路调整的通知',imgSrc:'static/images/notice/icon-DaiBan@2x.png'},
                    {id:4,date:'2025-09-09 15:36:00',isReady:true,title:'祝贺“友晟夏季封装外壳发布会”圆满成功',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    {id:5,date:'2025-09-07 08:41:00',isReady:false,title:'研发部采购验收流程【2025】修改版',imgSrc:'static/images/notice/icon-FuWu@2x.png'},
                    {id:6,date:'2025-09-07 08:08:00',isReady:false,title:'加强公司安全管理 迎接全市年度检查',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    {id:7,date:'2025-09-05 13:18:00',isReady:false,title:'2025年国庆节放假安排通知',imgSrc:'static/images/notice/icon-TiXing@2x.png'},
                    {id:8,date:'2025-06-30',isReady:true,title:'临时调整本周工作时间的通知',imgSrc:'static/images/notice/icon-TiXing@2x.png'},
                    {id:9,date:'2025-06-27',isReady:false,title:'8月个税扣缴申报已完成',imgSrc:'static/images/notice/icon-RiCheng@2x.png'},
                    {id:10,date:'2025-09-10 17:29:00',isReady:true,title:'公司班车北五环线路调整的通知',imgSrc:'static/images/notice/icon-DaiBan@2x.png'},
                    // {id:11,date:'2025-09-09 15:36:00',isReady:true,title:'祝贺“友晟夏季封装外壳发布会”圆满成功',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    // {id:12,date:'2025-09-07 08:41:00',isReady:false,title:'研发部采购验收流程【2025】修改版',imgSrc:'static/images/notice/icon-FuWu@2x.png'},
                    // {id:13,date:'2025-09-07 08:08:00',isReady:false,title:'加强公司安全管理 迎接全市年度检查',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    // {id:14,date:'2025-09-05 13:18:00',isReady:false,title:'2025年国庆节放假安排通知',imgSrc:'static/images/notice/icon-TiXing@2x.png'},
                ],
                totalCount:14
            }
        }))
    }else if(param.pageIndex==2){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    {id:11,date:'2025-09-09 15:36:00',isReady:true,title:'祝贺“友晟夏季封装外壳发布会”圆满成功',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    {id:12,date:'2025-09-07 08:41:00',isReady:false,title:'研发部采购验收流程【2025】修改版',imgSrc:'static/images/notice/icon-FuWu@2x.png'},
                    {id:13,date:'2025-09-07 08:08:00',isReady:false,title:'加强公司安全管理 迎接全市年度检查',imgSrc:'static/images/notice/icon-TongZhi@2x.png'},
                    {id:14,date:'2025-09-05 13:18:00',isReady:false,title:'2025年国庆节放假安排通知',imgSrc:'static/images/notice/icon-TiXing@2x.png'},
                ],
                totalCount:14
            }
        }))
    }else{
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[],
                totalCount:14
            }
        }))
    }
});


// 走访报告列表
app.post('/api/visitorReportList', (req,res) => {
    let param = req.body;
    // console.log(param)
    if(param.pageIndex==1){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    {
                        id:1,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:2,title:'客户：中国船舶集团有限公司第七一 七研究所',name:'YS-VR2025091307',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:3,title:'客户：旭日阳（北京）科技有限公司',name:'YS-VR2025090902',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:4,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:5,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:6,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:7,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:8,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:9,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:10,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    }
                ],
                totalCount:14
            }
        }))
    }else if(param.pageIndex==2){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    {
                        id:11,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:12,title:'客户：中国船舶集团有限公司第七一 七研究所',name:'YS-VR2025091307',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:13,title:'客户：旭日阳（北京）科技有限公司',name:'YS-VR2025090902',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    },
                    {
                        id:14,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                        reportType:1,reportTypeName:'I 类活动 (走访)',statusName:'待胡本华审核',
                        reportPeople:'管理员',dateStr:'2025-09-15'
                    }
                ],
                totalCount:14
            }
        }))
    }else{
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[],
                totalCount:14
            }
        }))
    }
})


// 客户列表
app.post('/api/guestList', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            list:[
                {id:1,name:'西安微电子技术研究所'},
                {id:2,name:'西安微电子技术研究所2'},
                {id:3,name:'旭日阳（北京）科技有限公司'},
                {id:4,name:'北京中科睿信科技有限公司'},
            ]
        }
    }))
})

// 走访报告详情
app.post('/api/visitorReportDetail', (req,res) => {
    let param = req.body;
    // console.log(111,param.id)
    res.json(Mock.mock({
        code: 0,
        data: {
            activeObj:{
                id:1,title:'客户：北京中科睿信科技有限公司',name:'YS-VR2025091515',
                isJoin:'否',activityType:1,activityTypeName:'I 类活动 (走访)',
                dateStr:'2025-09-10',reportPeople:'刘启运'
            },
            reportObj:{
                
            }
            
        }
    }))
})

// 重大事项信息
app.post('/api/mattersList', (req,res) => {
    let param = req.body;
    // console.log(param)
    if(param.pageIndex==1){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    { id:1,status:1,statusName:'待王彦琳审核',title:'西安微电子技术研究所',desc:'a该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:2,status:1,statusName:'待曾诚审核',title:'中国船舶集团有限公司第七研究所',desc:'b该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:3,status:2,statusName:'完成',title:'旭日阳（北京）科技有限公司',desc:'c该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:4,status:2,statusName:'完成',title:'北京中科睿信科技有限公司',desc:'d该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:5,status:1,statusName:'待王彦琳审核',title:'旭日阳（北京）科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:6,status:1,statusName:'待曾诚审核',title:'北京中科睿信科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:7,status:1,statusName:'待王彦琳审核',title:'旭日阳（北京）科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:8,status:1,statusName:'待王彦琳审核',title:'北京中科睿信科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:9,status:1,statusName:'待王彦琳审核',title:'旭日阳（北京）科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:10,status:1,statusName:'待王彦琳审核',title:'中国船舶集团有限公司第七研究所',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                ],
                totalCount:14
            }
        }))
    }else if(param.pageIndex==2){
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[
                    { id:11,status:1,statusName:'待王彦琳审核',title:'北京中科睿信科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:12,status:1,statusName:'待王彦琳审核',title:'中国船舶集团有限公司第七研究所',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:13,status:1,statusName:'待王彦琳审核',title:'旭日阳（北京）科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                    { id:14,status:1,statusName:'待王彦琳审核',title:'北京中科睿信科技有限公司',desc:'该企业产品线技术改造延期，本月设备供应周期预 计延长7-15天。' },
                ],
                totalCount:14
            }
        }))
    }else{
        res.json(Mock.mock({
            code: 0,
            data: {
                list:[],
                totalCount:14
            }
        }))
    }
})

// 查询设备绑定状态 绑定状态（1=已提交、2=等待审核、3=审核通过、4=绑定成功、5=审核拒绝）
app.post('/api/getBindStatus', (req,res) => {
    res.json(Mock.mock({
        code: 0,
        data: {
            bindStatus:4
        }
    }))
})

// 查询版本号
app.post('/api/versionCheck', (req,res) => {
    res.json(Mock.mock({
        "code": 0,
        "message": "Success.",
        "data": {
            "status": 0,//版本状态 0-最新版本  1-有新版本，但现有版本可用  2-现有版本不可用，需要下载新版本
            "latestVersion": "1.0.1",
            "downloadURL": "https://www.718ys.com/downloads/android/ys718_test_v1.0.0.apk",
            "availableVersionsList": "1.0.0",
            remark:'fdsfddf'
        },
        "ok": true
    }))
})



//2.创建server
const server = http.createServer(app);


//3.监听端口
server.listen(3000, () => {
    console.log('服务器运行在 http://localhost:3000')
})

