init
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.yutou.bilibili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.Services.ISystemConfigService;
|
||||
import com.yutou.bilibili.Tools.Config;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class SystemConfigController {
|
||||
@Resource
|
||||
ISystemConfigService configService;
|
||||
|
||||
@RequestMapping("/system/get/config.do")
|
||||
@ResponseBody
|
||||
public JSONObject getRegUser() {
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data=new JSONObject();
|
||||
String reg = configService.getConfig(Config.USER_REG);
|
||||
String bLive = configService.getConfig(Config.BILI_LIVE_FLAG);
|
||||
if (reg == null) {
|
||||
reg = "0";
|
||||
}
|
||||
if (bLive == null) {
|
||||
bLive = "0";
|
||||
}
|
||||
data.put(Config.USER_REG, reg);
|
||||
data.put(Config.BILI_LIVE_FLAG,bLive);
|
||||
json.put("code",0);
|
||||
json.put("data",data);
|
||||
return json;
|
||||
}
|
||||
|
||||
@RequestMapping("/system/set/config.do")
|
||||
@ResponseBody
|
||||
public JSONObject setConfig(String key,String value){
|
||||
configService.setConfig(key, value);
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("code",0);
|
||||
json.put("msg","ok");
|
||||
return json;
|
||||
}
|
||||
@RequestMapping("/system/public/reg.do")
|
||||
@ResponseBody
|
||||
public JSONObject getRegModel(){
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data=new JSONObject();
|
||||
String reg = configService.getConfig(Config.USER_REG);
|
||||
boolean model=false;
|
||||
if (reg == null) {
|
||||
reg = "0";
|
||||
}
|
||||
if(reg.equals("1")){
|
||||
model=true;
|
||||
}
|
||||
data.put(Config.USER_REG, model);
|
||||
json.put("code",0);
|
||||
json.put("data",data);
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user