appid问题

master
xierz 5 years ago
parent ee9869ca48
commit 26043a14e6
  1. 37
      pom.xml
  2. 12
      src/main/java/net/mingsoft/cms/action/web/ContentAction.java
  3. 11
      src/main/resources/application-test.yml
  4. 1
      src/main/resources/application.yml

@ -22,10 +22,47 @@
</properties>
<dependencies>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-ad</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-clean</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mattention</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mcomment</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mpay</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-msend</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mpeople</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-quartz</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-spider</artifactId>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mweixin</artifactId>
</dependency>
<!-- 此部分是铭飞平台MStroe的客户端(MStore不在铭飞开源产品范围),如果不需要使用MStore可以删除掉 -->
<dependency>
<groupId>net.mingsoft</groupId>

@ -12,6 +12,7 @@ import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.entity.HistoryLogEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@ -104,8 +105,8 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
@ApiImplicitParam(name = "contentId", value = "文章编号", required = true,paramType="path")
@GetMapping(value = "/{contentId}/hit")
@ResponseBody
public String hit(@PathVariable @ApiIgnore int contentId, HttpServletRequest request, HttpServletResponse response){
if(contentId<=0){
public String hit(@PathVariable @ApiIgnore String contentId, HttpServletRequest request, HttpServletResponse response){
if(StringUtils.isEmpty(contentId)){
return "document.write(0)";
}
//获取ip
@ -113,7 +114,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
//获取端口(移动/web..)
boolean isMobileDevice = BasicUtil.isMobileDevice();
ContentEntity content = (ContentEntity)contentBiz.getEntity(contentId);
ContentEntity content = contentBiz.getById(contentId);
if(content == null){
return "document.write(0)";
}
@ -132,7 +133,10 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
entity.setContentId(content.getId());
entity.setCreateDate(new Date());
historyLogBiz.saveEntity(entity);
if(content.getAppId() == null || content.getAppId() != BasicUtil.getApp().getAppId()){
// 单站点不存在appid
if(content.getAppId() == null ){
return "document.write(" + content.getContentHit() + ")";
}else if(content.getAppId() != BasicUtil.getApp().getAppId()){
return "document.write(0)";
}
return "document.write(" + content.getContentHit() + ")";

@ -1,7 +1,10 @@
spring:
datasource:
url: jdbc:mysql://192.168.0.8:3316/mcms-5.2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: mcms
password: mcms
url: jdbc:mysql://192.168.0.8:3316/demo-cms-dev-4?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: democms
password: democms
filters: wall,mergeStat
type: com.alibaba.druid.pool.DruidDataSource
type: com.alibaba.druid.pool.DruidDataSource
server:
port: 5108

@ -13,6 +13,7 @@ logging:
path: log #会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log
ms:
database: demo-cms-dev-4
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
swagger:
enable: true #启用swagger文档,生产的时候务必关掉 访问地址:http://ip|域名/项目发布名/swagger-ui.html

Loading…
Cancel
Save