package com.sckw.example.controller;

import com.sckw.core.common.enums.enums.DictEnum;
import com.sckw.core.web.response.HttpResult;
import com.sckw.message.api.dubbo.SmsInfoService;
import com.sckw.order.api.dubbo.TradeOrderInfoService;
import com.sckw.order.api.model.OrderDetailRes;
import lombok.RequiredArgsConstructor;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @desc: 测试
 * @author: yzc
 * @date: 2023-06-13 14:20
 */
@RestController
@RequestMapping(value = "/messageApi")
@RequiredArgsConstructor
public class MessageApiController {
    @DubboReference(version = "1.0.0", group = "design", check = false)
    private SmsInfoService smsInfoService;

    @DubboReference(version = "1.0.0", group = "design", check = false)
    private TradeOrderInfoService tradeOrderInfoService;

    @GetMapping("/getVerifyCode")
    public HttpResult getVerifyCode() {
        String verifyCode = smsInfoService.getVerifyCode(DictEnum.SMS_REGISTER.getValue(),"17780832879");
        return HttpResult.ok("获取验证码成功", verifyCode);
    }

    @GetMapping("/getOrderDetail")
    public HttpResult getOrderDetail() {
        OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(162213167693303808L);
        return HttpResult.ok("获取订单详情成功", orderDetailById);
    }
}
