Przeglądaj źródła

修复
1:修改Ajax提交错误

2 miesięcy temu
rodzic
commit
14be3c0a63

+ 11 - 11
08.src/Xingxi/xingxi-admin/src/main/java/com/xingxi/web/controller/business/newProd/controller/NewProdController.java

@@ -19,7 +19,7 @@ import javax.annotation.Resource;
 import java.util.List;
 
 /**
- * 今日热门Controller
+ * 新品上架Controller
  *
  * @author ruoyi
  * @date 2025-05-15
@@ -43,7 +43,7 @@ public class NewProdController extends BaseController {
     }
 
     /**
-     * 查询今日热门列表
+     * 查询新品上架列表
      */
     @RequiresPermissions("business:newProd:list")
     @PostMapping("/list")
@@ -55,23 +55,23 @@ public class NewProdController extends BaseController {
     }
 
     /**
-     * 导出今日热门列表
+     * 导出新品上架列表
      */
     @RequiresPermissions("business:newProd:export")
-    @Log(title = "今日热门", businessType = BusinessType.EXPORT)
+    @Log(title = "新品上架", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ResponseBody
     public AjaxResult export(NewProd newProd) {
         List<NewProd> list = newProdService.selectNewProdList(newProd);
         ExcelUtil<NewProd> util = new ExcelUtil<>(NewProd.class);
-        return util.exportExcel(list, "今日热门数据");
+        return util.exportExcel(list, "新品上架数据");
     }
 
     /**
-     * 新增保存今日热门
+     * 新增保存新品上架
      */
     @RequiresPermissions("business:newProd:add")
-    @Log(title = "今日热门", businessType = BusinessType.INSERT)
+    @Log(title = "新品上架", businessType = BusinessType.INSERT)
     @PostMapping("/add")
     @ResponseBody
     public AjaxResult addSave(NewProd newProd) {
@@ -85,10 +85,10 @@ public class NewProdController extends BaseController {
     }
 
     /**
-     * 新增保存今日热门
+     * 新增保存新品上架
      */
     @RequiresPermissions("business:newProd:edit")
-    @Log(title = "今日热门", businessType = BusinessType.UPDATE)
+    @Log(title = "新品上架", businessType = BusinessType.UPDATE)
     @PostMapping("/editSort")
     @ResponseBody
     public AjaxResult editSort(@RequestBody List<NewProd> newProdList) {
@@ -96,10 +96,10 @@ public class NewProdController extends BaseController {
     }
 
     /**
-     * 删除今日热门
+     * 删除新品上架
      */
     @RequiresPermissions("business:newProd:remove")
-    @Log(title = "今日热门", businessType = BusinessType.DELETE)
+    @Log(title = "新品上架", businessType = BusinessType.DELETE)
     @PostMapping("/remove")
     @ResponseBody
     public AjaxResult remove(String ids) {

+ 0 - 1
08.src/Xingxi/xingxi-admin/src/main/resources/templates/business/newProd/newProd.html

@@ -242,7 +242,6 @@
                         url: prefix + "/add",
                         data: data,
                         type: "post",
-                        processData: false,
                         success: function(result) {
                             if (result.code === web_status.SUCCESS) {
                                 $.modal.closeAll();

+ 21 - 14
08.src/Xingxi/xingxi-admin/src/main/resources/templates/business/popularProd/popularProd.html

@@ -238,20 +238,27 @@
                         "mercProdId": $("#mercProdId").val(),
                         "sort": $("#sort").val() * 1 + 1,
                     };
-                    if (result.code === web_status.SUCCESS) {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertSuccess("添加成功。");
-                        refreshTab();
-                    } else if (result.code === web_status.WARNING) {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertWarning(result.msg)
-                    } else {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertError(result.msg);
-                    }
+                    $.ajax({
+                        url: prefix + "/add",
+                        data: data,
+                        type: "post",
+                        success: function(result) {
+                            if (result.code === web_status.SUCCESS) {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertSuccess("添加成功。");
+                                refreshTab();
+                            } else if (result.code === web_status.WARNING) {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertWarning(result.msg)
+                            } else {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertError(result.msg);
+                            }
+                        }
+                    });
                 }
             });
         }

+ 21 - 15
08.src/Xingxi/xingxi-admin/src/main/resources/templates/business/suggestProd/suggestProd.html

@@ -103,7 +103,6 @@
                         contentType: 'application/json',
                         data: JSON.stringify(datas),
                         type: "post",
-                        processData: false,
                         success: function(result) {
                             $.operate.successCallback(result);
                         }
@@ -238,20 +237,27 @@
                         "mercProdId": $("#mercProdId").val(),
                         "sort": $("#sort").val() * 1 + 1,
                     };
-                    if (result.code === web_status.SUCCESS) {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertSuccess("添加成功。");
-                        refreshTab();
-                    } else if (result.code === web_status.WARNING) {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertWarning(result.msg)
-                    } else {
-                        $.modal.closeAll();
-                        $.modal.enable();
-                        $.modal.alertError(result.msg);
-                    }
+                    $.ajax({
+                        url: prefix + "/add",
+                        data: data,
+                        type: "post",
+                        success: function(result) {
+                            if (result.code === web_status.SUCCESS) {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertSuccess("添加成功。");
+                                refreshTab();
+                            } else if (result.code === web_status.WARNING) {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertWarning(result.msg)
+                            } else {
+                                $.modal.closeAll();
+                                $.modal.enable();
+                                $.modal.alertError(result.msg);
+                            }
+                        }
+                    });
                     layer.closeAll();
                 }
             });

+ 4 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/NewProd/service/impl/NewProdServiceImpl.java

@@ -1,10 +1,12 @@
 package com.xingxi.business.NewProd.service.impl;
 
 import com.xingxi.common.core.text.Convert;
+import com.xingxi.common.enums.EDelFlag;
 import com.xingxi.common.utils.DateUtils;
 import com.xingxi.business.NewProd.domain.NewProd;
 import com.xingxi.business.NewProd.mapper.NewProdMapper;
 import com.xingxi.business.NewProd.service.INewProdService;
+import com.xingxi.common.utils.ShiroUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -51,6 +53,8 @@ public class NewProdServiceImpl implements INewProdService {
      */
     @Override
     public int insertNewProd(NewProd newProd) {
+        newProd.setDelFlag(EDelFlag.NO.getVal());
+        newProd.setCreateUser(ShiroUtils.getLoginName());
         newProd.setCreateTime(DateUtils.getNowDate());
         return newProdMapper.insertNewProd(newProd);
     }

+ 4 - 0
08.src/Xingxi/xingxi-system/src/main/java/com/xingxi/business/PopularProd/service/impl/PopularProdServiceImpl.java

@@ -1,10 +1,12 @@
 package com.xingxi.business.PopularProd.service.impl;
 
 import com.xingxi.common.core.text.Convert;
+import com.xingxi.common.enums.EDelFlag;
 import com.xingxi.common.utils.DateUtils;
 import com.xingxi.business.PopularProd.domain.PopularProd;
 import com.xingxi.business.PopularProd.mapper.PopularProdMapper;
 import com.xingxi.business.PopularProd.service.IPopularProdService;
+import com.xingxi.common.utils.ShiroUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -53,6 +55,8 @@ public class PopularProdServiceImpl implements IPopularProdService {
      */
     @Override
     public int insertPopularProd(PopularProd popularProd) {
+        popularProd.setDelFlag(EDelFlag.NO.getVal());
+        popularProd.setCreateUser(ShiroUtils.getLoginName());
         popularProd.setCreateTime(DateUtils.getNowDate());
         return popularProdMapper.insertPopularProd(popularProd);
     }