美文网首页工作生活
2019-07-03布置cmswing后台遇到的问题(加固201

2019-07-03布置cmswing后台遇到的问题(加固201

作者: 静止_381f | 来源:发表于2019-07-03 18:57 被阅读0次

    1.cmswing迁移服务端需更改其端口号,端口号位置:src--config--config.js

    默认端口为8360,更改端口号需要重新定义


       // default config
      module.exports = {
        http_: 1, // 1:http,2:https
        host:"0.0.0.0",//新增添加
        port:8362,//新增添加
        document_model_type: {2: '主题', 1: '目录', 3: '段落'}, // 文档模型配置 (文档模型核心配置,请勿更改)
        user_administrator: [1] // 数组格式,可以配置多个[1,2,3]
    };
    

    2.查看端口号是否被占用

      netstat -aon|findstr "端口号"
      tasklist|findstr "端口号" //查看端口号被谁占用
    

    3.node.js发送邮件需要配置路由,否则ajax异步请求不到数据

    路由位置:src--config--router.js,配置路由时如果请求是post,路由接收参数也必须是post

    4.node.js 配置邮件

    注意:配置邮件功能属于那个模型,相应的邮件配置参数需对应其模型,配置在控制器中对应的模型。

      async messageAction() {
      var nodemailer = require('nodemailer');
      let transporter = nodemailer.createTransport({
        host: 'smtp.qq.com',
        secureConnection: true, // use SSL
        port: 465,
        secure: true, // secure:true for port 465, secure:false for port 587
        auth: {
          user: '601657393@qq.com',
          pass: 'ilotxvoxdcdfbcdg' // QQ邮箱需要使用授权码
        }
      });
      // 设置邮件内容(谁发送什么给谁)
      const data = this.post();
      const text = "留言人公司名称:\n"+data.gcName+"\n留言人姓名:\n"+data.yourName+"\n留言人电话:\n"+data.phone;
      let mailOptions = {
        from: '601657393@qq.com', // 发件人
        to: '495583090@qq.com', // 收件人
        subject: '有新的网站留言', // 主题
        text: text, // plain text body
        html: '<b> '+text+'</b>', // html body
        
      }; m
      transporter.sendMail(mailOptions, (error, info) => {
        if (error) {
          return console.log(error);
        }
        console.log('Message: ${info.messageId}');
        console.log('sent: ${info.response}');
      });
      return this.success("OK");
    }
    

    5.cmswing配置后台参数模型时需注意

    (1)、删除字段时需先把选择字段中的字段解除占用,然后再去删除字段,否则出现数据匹配不到,后台配置详情崩溃,原因:空字段占用数据匹配,解决方法查找数据库当前数据中的值与字段匹配,多出的空数据删除即可。

    6.解决上传图片不压缩uplodaFile,因为图片在上传时就已经压缩过,而不是前台渲染时才压缩

      cmswing采用WebUploader组件,cmswing上传组件的位置src--controller--ext--attachment--view--pc--hooks_adminUpPic.html
      var uploader = WebUploader.Uploader({
          compress:false//图片不压缩,默认没有这个参数,默认压缩
      })

    相关文章

      网友评论

        本文标题:2019-07-03布置cmswing后台遇到的问题(加固201

        本文链接:https://www.haomeiwen.com/subject/esmchctx.html