| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | @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; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 上线 |
| | | */ |
| | | @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; |
| | | } |