Browse Source

项目通知测试并提交

ellisran 1 year ago
parent
commit
dd514bba58

+ 3 - 3
app/controller/dashboard_controller.js

@@ -140,7 +140,7 @@ module.exports = app => {
 
                 const type = msgInfo ? msgInfo.type : ctx.request.query.type ? parseInt(ctx.request.query.type) : 1;
 
-                if (msgInfo && msgInfo.project_id !== ctx.session.sessionProject.id) {
+                if (msgInfo && msgInfo.type === 1 && msgInfo.project_id !== ctx.session.sessionProject.id) {
                     throw '非该项目通知无权查看';
                 }
 
@@ -239,7 +239,7 @@ module.exports = app => {
                             const url = ctx.protocol + '://' + ctx.host + '/wap/dashboard/msg/' + msgInfo.id;
                             const msgData = {
                                 thing21: {
-                                    value: projectData.code,
+                                    value: ctx.helper.contentChange(projectData.name),
                                 },
                                 thing2: {
                                     value: ctx.helper.contentChange(msgInfo.title),
@@ -252,7 +252,7 @@ module.exports = app => {
                                 },
                             };
                             for (const wx of wechats) {
-                                await app.wechat.api.sendTemplate(wx.wx_openid, templateId, url, '', msgData);
+                                const result = await app.wechat.api.sendTemplate(wx.wx_openid, templateId, url, '', msgData);
                             }
                         }
                     }

+ 1 - 1
app/controller/wap_controller.js

@@ -805,7 +805,7 @@ module.exports = app => {
                 if (!msgInfo) {
                     throw '项目通知不存在';
                 }
-                if (msgInfo && msgInfo.project_id !== ctx.session.sessionProject.id) {
+                if (msgInfo && msgInfo.type === 1 && msgInfo.project_id !== ctx.session.sessionProject.id) {
                     throw '非该项目通知无权查看';
                 }
                 const renderData = {

+ 1 - 1
app/view/wap/msg.ejs

@@ -40,7 +40,7 @@
         <div>
             <h4 class="text-center" id="title"><%= msgInfo.title %></h4>
             <p class="text-center text-muted">
-                <span id="creator"><%- msgInfo.creator %></span> 发布于 <span id="release_time"><%= moment(msgInfo.release_time*1000).format('YYYY-MM-DD') %></span>
+                <span id="creator"><%- msgInfo.type === 1 ? msgInfo.creator : '' %></span> 发布于 <span id="release_time"><%= moment(msgInfo.release_time*1000).format('YYYY-MM-DD') %></span>
             </p>
             <!--内容开始-->
             <div class="msg-content border-top-1 pt-3" id="content">