瀏覽代碼

:zap: 状态标签

Aron 6 年之前
父節點
當前提交
a9b3f4886c

+ 5 - 0
src/main/java/com/ifast/common/config/IFastProperties.java

@@ -32,4 +32,9 @@ public class IFastProperties {
      */
     private boolean devMode;
 
+    /**
+     * 临时目录,用于存放一些临时文件
+     */
+    private String tempDir;
+
 }

+ 7 - 2
src/main/java/com/ifast/wxmp/controller/mp/WxMediaController.java

@@ -1,6 +1,7 @@
 package com.ifast.wxmp.controller.mp;
 
 import com.ifast.common.base.AdminBaseController;
+import com.ifast.common.config.IFastProperties;
 import com.ifast.common.exception.IFastException;
 import com.ifast.common.type.EnumErrorCode;
 import com.ifast.common.utils.JSONUtils;
@@ -46,6 +47,8 @@ public class WxMediaController extends AdminBaseController {
     private MpArticleService mpArticleService;
     @Autowired
     private MpFansService mpFansService;
+    @Autowired
+    private IFastProperties properties;
 
     ///////////////
     // 图片
@@ -57,7 +60,7 @@ public class WxMediaController extends AdminBaseController {
         log.info("素材同步");
         WxMpMaterialUploadResult wxMpMaterialUploadResult = null;
         try {
-            File file = new File("/Users/Aron/dev_projects/idea/ifast/temp/" + System.currentTimeMillis() + ".jpg");
+            File file = new File(properties.getTempDir() + System.currentTimeMillis() + ".jpg");
             FileUtils.copyURLToFile(new URL(article.getImgurl()), file);
             WxMpMaterial material = new WxMpMaterial();
             material.setName(file.getName());
@@ -77,6 +80,7 @@ public class WxMediaController extends AdminBaseController {
     public Result imageGroupsend(String appId, @PathVariable Long articleId) {
         MpArticleDO article = mpArticleService.selectById(articleId);
         WxMpMassOpenIdsMessage message = new WxMpMassOpenIdsMessage();
+        // TODO 群发对象
         message.addUser(mpFansService.selectById(1).getOpenid());
         message.addUser(mpFansService.selectById(1).getOpenid());
         message.setMsgType(article.getMsgtype());
@@ -101,7 +105,7 @@ public class WxMediaController extends AdminBaseController {
 
         WeixinService weixinService = wxService.init();
         // 封面上传
-        File file = new File("/Users/Aron/dev_projects/idea/ifast/temp/" + System.currentTimeMillis() + ".jpg");
+        File file = new File(properties.getTempDir() + System.currentTimeMillis() + ".jpg");
         FileUtils.copyURLToFile(new URL(article.getImgurl()), file);
         WxMpMaterial material = new WxMpMaterial();
         material.setFile(file);
@@ -133,6 +137,7 @@ public class WxMediaController extends AdminBaseController {
         }
         log.debug(JSONUtils.beanToJson(wxMediaUploadResult));
         article.setTid(wxMediaUploadResult.getMediaId());
+        article.setThumbid(mediaId);
         mpArticleService.updateById(article);
         return Result.ok();
     }

+ 1 - 0
src/main/resources/application-dev.yml

@@ -3,6 +3,7 @@ ifast:
   projectRootURL: http://127.0.0.1:8888/
   demoMode: false
   devMode: true
+  tempDir: /Users/Aron/dev_projects/idea/ifast/temp/
   jwt:
     userPrimaryKey: userId
     expireTokenKeyPrefix: ifast:expireToken

+ 1 - 0
src/main/resources/application-prod.yml

@@ -2,6 +2,7 @@ ifast:
   projectName: ifast
   projectRootURL: http://ifast.site/
   demoMode: false
+  tempDir: /Users/Aron/dev_projects/idea/ifast/temp/
   jwt:
     userPrimaryKey: userId
     expireTokenKeyPrefix: ifast:expireToken

+ 7 - 1
src/main/resources/static/js/appjs/wxmp/mpArticleDemo/mpArticle.js

@@ -83,7 +83,13 @@ function load() {
                     },
                     {
                         field: 'status',
-                        title: '文章状态:1启用 0停用'
+                        title: '文章状态:1启用 0停用',
+                        formatter : function(value, row, index) {
+                            if (1 == value) {
+                                return "<span class='badge badge-success'>启用</span>";
+                            }
+                            return "<span class='badge badge-danger'>停用</span>";
+                        }
                     },
                     {
                         field: 'sort',

+ 6 - 7
src/main/resources/static/js/appjs/wxmp/mpArticleImage/mpArticle.js

@@ -90,21 +90,20 @@ function load() {
                         field: 'status',
                         title: '状态',
                         formatter : function(value, row, index) {
-                            if(1 == value){
-                                return "1启用";
+                            if (1 == value) {
+                                return "<span class='badge badge-success'>启用</span>";
                             }
-                            return "0停用";
+                            return "<span class='badge badge-danger'>停用</span>";
                         }
                     },
                     {
                         field: 'tid',
                         title: '同步到微信素材',
                         formatter : function(value, row, index) {
-                            console.log(value)
-                            if(value){
-                                return "已同步";
+                            if (value) {
+                                return "<span class='badge badge-success'>已同步</span>";
                             }
-                            return "未同步";
+                            return "<span class='badge badge-danger'>未同步</span>";
                         }
                     },
                     {

+ 6 - 6
src/main/resources/static/js/appjs/wxmp/mpArticleNews/mpArticle.js

@@ -94,20 +94,20 @@ function load() {
                         field: 'status',
                         title: '状态',
                         formatter : function(value, row, index) {
-                            if(1 == value){
-                                return "1启用";
+                            if (1 == value) {
+                                return "<span class='badge badge-success'>启用</span>";
                             }
-                            return "0停用";
+                            return "<span class='badge badge-danger'>停用</span>";
                         }
                     },
                     {
                         field: 'thumbid',
                         title: '同步到微信素材',
                         formatter : function(value, row, index) {
-                            if(value){
-                                return "已同步";
+                            if (value) {
+                                return "<span class='badge badge-success'>已同步</span>";
                             }
-                            return "未同步";
+                            return "<span class='badge badge-danger'>未同步</span>";
                         }
                     },
                     {

+ 2 - 2
src/main/resources/static/js/appjs/wxmp/mpArticleTxt/mpArticle.js

@@ -79,9 +79,9 @@ function load() {
                         title: '状态',
                         formatter: function (value, row, index) {
                             if (1 == value) {
-                                return "1启用";
+                                return "<span class='badge badge-success'>启用</span>";
                             }
-                            return "0停用";
+                            return "<span class='badge badge-danger'>停用</span>";
                         }
                     },
                     {