package com.tax.sign.web.controller;

import com.tax.sign.model.IpModel;
import com.tax.sign.service.api.IpService;
import com.yxcheng.token.common.model.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/ip")
@ComponentScan(basePackages = {"com.tax.sign.service"})
public class IpController {
    @Autowired
    private HttpServletRequest request;

    @Autowired
    private IpService ipService;

    @RequestMapping(value ="/saveIpV1" , method = RequestMethod.POST)
    public JsonResult<IpModel> saveIpV1(@RequestBody IpModel model){
        return ipService.saveIpV1(model,request);
    }

    @RequestMapping(value ="/saveIpV2" , method = RequestMethod.POST)
    public JsonResult<IpModel> saveIpV2(@RequestBody IpModel model){
        return ipService.saveIpV2(model,request);
    }

    @RequestMapping(value ="/getIpV1" , method = RequestMethod.POST)
    public JsonResult<IpModel> getIpV1(){
        return ipService.getIpV1();
    }

    @RequestMapping(value ="/getIpV2" , method = RequestMethod.POST)
    public JsonResult<IpModel> getIpV2(){
        return ipService.getIpV2();
    }
}
