Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
0f2cd814
Commit
0f2cd814
authored
Jul 21, 2020
by
vip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
content浏览量+1
parent
82f7af69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
+29
-10
ContentAction.java
src/main/java/net/mingsoft/cms/action/web/ContentAction.java
+29
-10
No files found.
src/main/java/net/mingsoft/cms/action/web/ContentAction.java
View file @
0f2cd814
...
@@ -4,13 +4,13 @@ import io.swagger.annotations.Api;
...
@@ -4,13 +4,13 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
net.mingsoft.base.entity.BaseEntity
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.bean.EUListBean
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.StringUtil
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.biz.IHistoryLogBiz
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.entity.HistoryLogEntity
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.ui.ModelMap
;
...
@@ -18,14 +18,13 @@ import org.springframework.validation.BindingResult;
...
@@ -18,14 +18,13 @@ import org.springframework.validation.BindingResult;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.ModelAttribute
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
* 文章管理控制层
* 文章管理控制层
...
@@ -37,14 +36,17 @@ import java.util.List;
...
@@ -37,14 +36,17 @@ import java.util.List;
@Controller
(
"WebcmsContentAction"
)
@Controller
(
"WebcmsContentAction"
)
@RequestMapping
(
"/cms/content"
)
@RequestMapping
(
"/cms/content"
)
public
class
ContentAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
public
class
ContentAction
extends
net
.
mingsoft
.
cms
.
action
.
BaseAction
{
/**
/**
* 注入文章业务层
* 注入文章业务层
*/
*/
@Autowired
@Autowired
private
IContentBiz
contentBiz
;
private
IContentBiz
contentBiz
;
@Autowired
private
IHistoryLogBiz
historyLogBiz
;
/**
/**
* 查询文章列表
* 查询文章列表
* @param content 文章实体
* @param content 文章实体
...
@@ -79,7 +81,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
...
@@ -79,7 +81,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
List
contentList
=
contentBiz
.
query
(
content
);
List
contentList
=
contentBiz
.
query
(
content
);
return
ResultData
.
build
().
success
(
new
EUListBean
(
contentList
,(
int
)
BasicUtil
.
endPage
(
contentList
).
getTotal
()));
return
ResultData
.
build
().
success
(
new
EUListBean
(
contentList
,(
int
)
BasicUtil
.
endPage
(
contentList
).
getTotal
()));
}
}
/**
/**
* 获取文章
* 获取文章
...
@@ -106,7 +108,25 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
...
@@ -106,7 +108,25 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
this
.
outString
(
response
,
"document.write(0)"
);
this
.
outString
(
response
,
"document.write(0)"
);
return
;
return
;
}
}
//获取ip
String
ip
=
BasicUtil
.
getIp
();
//获取端口(移动/web..)
boolean
isMobileDevice
=
BasicUtil
.
isMobileDevice
();
ContentEntity
content
=
(
ContentEntity
)
contentBiz
.
getEntity
(
contentId
);
ContentEntity
content
=
(
ContentEntity
)
contentBiz
.
getEntity
(
contentId
);
//浏览数+1
content
.
setContentHit
(
content
.
getContentHit
()+
1
);
contentBiz
.
updateEntity
(
content
);
// cms_history 增加相应记录
HistoryLogEntity
entity
=
new
HistoryLogEntity
();
entity
.
setHlIsMobile
(
isMobileDevice
);
entity
.
setHlIp
(
ip
);
entity
.
setContentId
(
content
.
getId
());
entity
.
setCreateDate
(
new
Date
());
historyLogBiz
.
saveEntity
(
entity
);
if
(
content
==
null
){
if
(
content
==
null
){
this
.
outString
(
response
,
"document.write(0)"
);
this
.
outString
(
response
,
"document.write(0)"
);
return
;
return
;
...
@@ -119,4 +139,4 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
...
@@ -119,4 +139,4 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
return
;
return
;
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment