package com.nq.controller.echo; import com.nq.common.ServerResponse; import com.nq.pojo.User; import com.nq.service.IEchoServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; /** * 利息报接口 */ @Controller @RequestMapping("/api/echo") public class EChoController { @Autowired IEchoServices iEchoServices; @PostMapping("queryEcho.do") @ResponseBody public ServerResponse queryEcho() { return ServerResponse.createBySuccess(iEchoServices.queryList()); } @PostMapping("buyEcho.do") @ResponseBody public ServerResponse buyEcho(@RequestParam("eId") String eid, @RequestParam("money") Integer money, HttpServletRequest request) { if (iEchoServices.buyECho(eid, money,request)) { return ServerResponse.createBySuccess("Buy Successed"); } else { return ServerResponse.createByErrorMsg("Buy Fail"); } } @PostMapping("queryOrderEcho.do") @ResponseBody public ServerResponse queryOrderEcho(HttpServletRequest request) { return ServerResponse.createBySuccess(iEchoServices.queryOrderEcho(request)); } }