Преглед на файлове

外部资讯分享页完善订单

xiaoshushu преди 4 години
родител
ревизия
931b0160d7

+ 14 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TbNewsController.java

@@ -70,6 +70,19 @@ public class TbNewsController extends BaseController {
     }
 
     /**
+     * 外部获取资讯详细信息(用于app分享资讯)
+     */
+    @GetMapping(value = "/detail/{id}")
+    public AjaxResult detail(@PathVariable("id") Long id) {
+        TbNews news = iTbNewsService.getById(id);
+        if (news != null && news.getState() == 0) {
+            return AjaxResult.success(iTbNewsService.getById(id));
+        } else {
+            return AjaxResult.success();
+        }
+    }
+
+    /**
      * 新增资讯
      */
     @PreAuthorize("@ss.hasPermi('system:news:add')")
@@ -103,7 +116,7 @@ public class TbNewsController extends BaseController {
         return toAjax(iTbNewsService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
     }
 
-    //从html中提取纯文本
+    //从html中提取纯文本作为摘要
     private String StripHT(String strHtml) {
         String txtcontent = strHtml.replaceAll("</?[^>]+>", ""); //剔出<html>的标签
         txtcontent = txtcontent.replaceAll("<a>\\s*|\t|\r|\n</a>", "");//去除字符串中的空格,回车,换行符,制表符

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/shop/TbOrdersController.java

@@ -15,6 +15,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -67,6 +68,9 @@ public class TbOrdersController extends BaseController {
     @Log(title = "订单", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TbOrders tbOrders) {
+        if (tbOrders.getState() == 2) {
+            tbOrders.setUpdateTime(new Date());
+        }
         return toAjax(iTbOrdersService.updateById(tbOrders) ? 1 : 0);
     }
 

+ 2 - 0
ruoyi-app/src/main/java/com/ruoyi/app/controller/shop/TbOrdersController.java

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -59,6 +60,7 @@ public class TbOrdersController extends BaseController {
         TbOrders orders = service.getById(id);
         if (orders != null && orders.getState() == 0) {
             orders.setState(-1);
+            orders.setPayCancelTime(new Date());
             service.updateById(orders);
             return AjaxResult.success(orders);
         }

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -114,6 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/*/api-docs").anonymous()
                 .antMatchers("/druid/**").anonymous()
                 .antMatchers("/template/**").anonymous()
+                .antMatchers("/system/news/detail/**").anonymous()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()
                 .and()

+ 2 - 0
ruoyi-system/src/main/resources/mapper/app/shop/TbOrdersMapper.xml

@@ -44,12 +44,14 @@
         <result property="id" column="app_user_id"/>
         <result property="nickName" column="nick_name"/>
         <result property="mobile" column="mobile"/>
+        <result property="avatar"    column="avatar"    />
     </resultMap>
     <sql id="selectTbOrdersVo">
          SELECT
 	       o.*, u.avatar,
 	       u.nick_name,
 	       u.mobile,
+	       u.avatar,
 	       g.pic,
 	       g.price,
 	       g.id,