<file_sep>package com.interesting;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

/**
 * @author libinghui
 * @date 2019/1/2 11:31
 */
@EnableEurekaClient
@SpringBootApplication
public class InterestingApplication {

    public static void main(String[] args) {
        SpringApplication.run(InterestingApplication.class, args);
    }

}
<file_sep>package com.interesting.ticketgrabbing.controller;

import com.interesting.ticketgrabbing.service.GrabRedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author libinghui
 * @date 2019/1/23 13:37
 */
@RestController
public class GrabRedController {

    @Autowired
    GrabRedService grabRedService;

    @RequestMapping("/ticket-grabbing")
    public  void grapRed() {
        //price  红包总金额
        //person 红包个数
        int price = 100;
        int person = 28;
        grabRedService.grapRed(price,person);
    }

}
<file_sep>package com.interesting.ticketgrabbing.service;

/**
 * @author libinghui
 * @date 2019/1/23 13:38
 */
public interface GrabRedService {

    /**
     * 抢红包实现
     * @param price
     * @param person
     */
    void grapRed(int price, int person);

}
