Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
5498261b
Commit
5498261b
authored
Jun 19, 2021
by
季圣华
Browse files
Ad展示优化
parent
bc3c0a44
Changes
1
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/PlatformConfigController.java
View file @
5498261b
...
...
@@ -2,11 +2,14 @@ package com.jsh.erp.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.datasource.entities.PlatformConfig
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.service.platformConfig.PlatformConfigService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.ErpInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -24,9 +27,17 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
public
class
PlatformConfigController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
PlatformConfigController
.
class
);
@Value
(
"${demonstrate.open}"
)
private
boolean
demonstrateOpen
;
@Resource
private
PlatformConfigService
platformConfigService
;
@Resource
private
UserService
userService
;
private
static
final
String
TEST_USER
=
"jsh"
;
/**
* 获取平台名称
* @param request
...
...
@@ -65,6 +76,31 @@ public class PlatformConfigController {
return
res
;
}
/**
* 是否显示广告
* @param request
* @return
*/
@GetMapping
(
value
=
"/isShowAd"
)
public
BaseResponseInfo
isShowAd
(
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
User
user
=
userService
.
getCurrentUser
();
if
(
demonstrateOpen
&&
TEST_USER
.
equals
(
user
.
getLoginName
()))
{
res
.
code
=
200
;
res
.
data
=
true
;
}
else
{
res
.
code
=
200
;
res
.
data
=
false
;
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
res
.
code
=
500
;
res
.
data
=
"获取数据失败"
;
}
return
res
;
}
/**
* 根据platformKey更新platformValue
* @param object
...
...
Write
Preview
Supports
Markdown
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