#
luxiaotao1123
2025-01-08 aa6f20d98b5d8e18ae56f9562a78d403a5417b48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.zy.acs.manager.fake;
 
import com.zy.acs.framework.common.BaseRes;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.R;
import com.zy.acs.manager.system.controller.BaseController;
import com.zy.acs.manager.system.service.ConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.PostConstruct;
 
/**
 * Created by vincent on 11/9/2024
 */
@RestController
@RequestMapping("/api/fake")
public class FakeController extends BaseController {
 
    @Autowired
    private ConfigService configService;
 
    @PostConstruct
    public void init() {
        configService.setVal("fakeSign", Boolean.FALSE);
    }
 
    @GetMapping("/sign/get")
    public R getSign() {
        return R.ok().add(configService.getVal("fakeSign", Boolean.class));
    }
 
    @PostMapping("/sign/set")
    public synchronized R setSign(@RequestParam(required = false) Boolean sign) {
        if (Cools.isEmpty(sign)) {
            return R.parse(BaseRes.PARAM);
        }
        boolean res = configService.setVal("fakeSign", sign);
        if (!res) {
            return R.error();
        }
        return R.ok().add(configService.getVal("fakeSign", Boolean.class));
    }
 
}