| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package com.izouma.nineth.web;
- import com.izouma.nineth.dto.R;
- import com.izouma.nineth.repo.SysConfigRepo;
- import com.izouma.nineth.service.SysConfigService;
- import lombok.AllArgsConstructor;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Random;
- @RestController
- @RequestMapping("/MonkeyText")
- @AllArgsConstructor
- public class RiceMonkeyTextController extends BaseController {
- private SysConfigService sysConfigService;
- private SysConfigRepo sysConfigRepo;
- @GetMapping("/test")
- public R<String> monkeyText(){
- String rice_monkey_text = sysConfigService.getString("rice_monkey_text");
- String[] strings = rice_monkey_text.split(",");
- int length = strings.length;
- Random random = new Random();
- int i = random.nextInt(length);
- String s = strings[i];
- return R.success(s);
- }
- }
|