package cn.iocoder.yudao.module.rescue.controller.admin;


import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.rescue.core.controller.BaseController;
import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
import cn.iocoder.yudao.module.rescue.service.IRescueOrderInfoService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RequestMapping("/rescuePayApi")
@RestController
public class RescuePayController extends BaseController {
    @Autowired
    private IRescueOrderInfoService rescueOrderInfoService;



    @PostMapping("/createOrder")
    public CommonResult createOrder(RescueInfo orderInfo) throws Exception {
        return success(rescueOrderInfoService.createOrder(orderInfo));
    }
//    @ApiOperation(value = "支付回调", notes = "支付回调")
    @PostMapping("/payNotify")
    @TenantIgnore
    public Map<String, String> payNotify(@RequestBody JSONObject jsonObject) {
        return rescueOrderInfoService.payNotify(jsonObject);
    }
    //评论商品和星级
    @PostMapping("/reviewOrder")
    public CommonResult reviewOrder(String rescueId, Integer starLevel, String reviewStr) throws Exception {
        rescueOrderInfoService.reviewOrder(rescueId, starLevel, reviewStr);
        return success();
    }
}
