123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package com.ygj.yuemum.controller.coupon;
- import com.alibaba.fastjson.JSONObject;
- import com.ygj.yuemum.domain.coupon.Coupon;
- import com.ygj.yuemum.service.coupon.CouponService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- import java.util.Map;
- @RestController
- public class CouponController {
- @Autowired
- private CouponService couponService;
- @GetMapping("/getCoupons")
- public String getCoupons(@RequestParam("page") Integer page,@RequestParam("limit") Integer limit) {
- Map<String, Object> coupons= couponService.getCoupons(page,limit);
- String jso = JSONObject.toJSONString(coupons);
- return jso;
- }
- @GetMapping("/getAllCoupons")
- public List<Coupon> getAllCoupons() {
- return couponService.getAll();
- }
- @PostMapping("/addCoupon")
- public int add(@ModelAttribute Coupon coupon) {
- return couponService.addCoupon(coupon);
- }
- @GetMapping("/deleteCoupon/{id}")
- public int delete(@PathVariable("id") Integer id) {
- return couponService.deleteCoupon(id);
- }
- @PostMapping("/updateCoupon")
- public int update(@ModelAttribute Coupon coupon) {
- return couponService.updateCoupon(coupon);
- }
- @GetMapping("/getCoupon/{id}")
- public Coupon getOne(@PathVariable("id") Integer id) {
- return couponService.getCoupon(id);
- }
- //Modoo API
- @GetMapping("/getNewUserCoupon") //新用户礼包
- public int getNewUserCoupon(@RequestParam("phone") String phone, @RequestParam("channel") Integer channel) {
- return couponService.getNewUserCoupon(phone,channel);
- }
- @GetMapping("/getConsultTaskCoupon") //咨询任务
- public int getConsultTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
- return couponService.getConsultTaskCoupon(phone,channel);
- }
- @GetMapping("/getDetectionTaskCoupon") //测胎心任务
- public int getDetectionTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
- return couponService.getDetectionTaskCoupon(phone,channel);
- }
- @GetMapping("/getRechargeTaskCoupon") //充值任务
- public int getRechargeTaskCoupon(@RequestParam("phone") String phone , @RequestParam("channel") Integer channel) {
- return couponService.getRechargeTaskCoupon(phone,channel);
- }
- }
|