From 957a8e8f5a01de49baa837e30492de511bf407e3 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 27 三月 2023 18:10:06 +0800
Subject: [PATCH] 权限配置,基础信息管理

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCommercialController.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCommercialController.java b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCommercialController.java
index 85fa9f5..684eb4a 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCommercialController.java
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCommercialController.java
@@ -1,6 +1,8 @@
 package com.stylefeng.guns.modular.system.controller.general;
 
 import com.stylefeng.guns.core.base.controller.BaseController;
+import com.stylefeng.guns.core.base.tips.SuccessTip;
+import com.stylefeng.guns.modular.system.controller.util.LabelReplaceUtil;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -11,6 +13,8 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import com.stylefeng.guns.modular.system.model.TCommercial;
 import com.stylefeng.guns.modular.system.service.ITCommercialService;
+
+import java.util.Date;
 
 /**
  * 控制器
@@ -69,6 +73,8 @@
     @RequestMapping(value = "/add")
     @ResponseBody
     public Object add(TCommercial tCommercial) {
+        tCommercial.setHtml(LabelReplaceUtil.replace(tCommercial.getHtml()));
+        tCommercial.setCreateTime(new Date());
         tCommercialService.insert(tCommercial);
         return SUCCESS_TIP;
     }
@@ -84,11 +90,44 @@
     }
 
     /**
+     * 上线
+     */
+    @RequestMapping(value = "/onLine")
+    @ResponseBody
+    public Object onLine(@RequestParam Integer tCommercialId) {
+        TCommercial tCommercial = tCommercialService.selectById(tCommercialId);
+        Boolean exit = tCommercialService.isExit(tCommercialId, 1);
+        if(exit){
+            return new SuccessTip(500,"最多可上架4个弹窗广告!");
+        }
+        tCommercial.setOnOffLine(1);
+        tCommercialService.updateById(tCommercial);
+        return SUCCESS_TIP;
+    }
+
+    /**
+     * 下线
+     */
+    @RequestMapping(value = "/offLine")
+    @ResponseBody
+    public Object offLine(@RequestParam Integer tCommercialId) {
+        TCommercial tCommercial = tCommercialService.selectById(tCommercialId);
+        tCommercial.setOnOffLine(2);
+        tCommercialService.updateById(tCommercial);
+        return SUCCESS_TIP;
+    }
+
+    /**
      * 修改
      */
     @RequestMapping(value = "/update")
     @ResponseBody
     public Object update(TCommercial tCommercial) {
+        if(0 == tCommercial.getIsJump()){
+            tCommercial.setJumpType(0);
+            tCommercial.setJumpUrl("");
+        }
+        tCommercial.setHtml(LabelReplaceUtil.replace(tCommercial.getHtml()));
         tCommercialService.updateById(tCommercial);
         return SUCCESS_TIP;
     }

--
Gitblit v1.7.1