package com.fjs.scenic.controller.good;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fjs.scenic.controller.common.BaseController;
import com.fjs.scenic.entity.good.Goods;
import com.fjs.scenic.service.good.StopTimeService;
import com.fjs.scenic.utils.ReturnResult;

@RestController
@RequestMapping("/stop")
public class StopTimeController extends BaseController<Goods> {

    @Autowired
    private StopTimeService stopTimeService;

    @GetMapping("/stopTiket")
    public ReturnResult sceniclist(String startTime,String endTime) {
    	if(startTime.equals(endTime)){
    		return ReturnResult.error("结束时间必须大于开始时间");
    	}
        return stopTimeService.stopTiket(startTime, endTime);
    }

    @GetMapping("/openTiket")
    @ResponseBody
    public ReturnResult refund() {
        return stopTimeService.openTiket();
    }
    
    @GetMapping("/test")
    @ResponseBody
    public ReturnResult test() throws Exception {
        return ReturnResult.ok(stopTimeService.isStopTime());
    }

}
