package com.ruoyi.admin.controller;
|
|
import com.ruoyi.admin.entity.Order;
|
import com.ruoyi.admin.service.OrderService;
|
import com.ruoyi.admin.service.SendSmsService;
|
import com.ruoyi.common.core.domain.R;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @author HJL
|
* @version 1.0
|
* @since 2024-05-30 15:28
|
*/
|
@RestController
|
@RequestMapping("/sendSms")
|
@Api(tags = {"发送短信"})
|
public class SendSmsController {
|
|
@Resource
|
private SendSmsService sendSmsService;
|
@Resource
|
private OrderService orderService;
|
|
/**
|
* 发送派单短信给用户
|
*
|
* @param orderId 订单记录id
|
*/
|
@ApiOperation(value = "后台-发送派单短信", tags = {"发送短信"})
|
@GetMapping(value = "/dispatchSms")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "订单记录id", name = "orderId", dataType = "Integer", required = true)
|
})
|
public R<Object> dispatchSms(@RequestParam Integer orderId) {
|
Order order = orderService.lambdaQuery()
|
.eq(Order::getId, orderId)
|
.eq(Order::getIsDelete, 0).one();
|
if (null == order) {
|
return R.fail("订单不存在或已删除!");
|
}
|
return R.ok(sendSmsService.dispatchOrder(order));
|
}
|
|
/**
|
* 用户端-发送登录验证码短信
|
*
|
* @param phone 订单记录id
|
*/
|
@ApiOperation(value = "用户端-发送登录验证码短信", tags = {"发送短信"})
|
@GetMapping(value = "/userLoginSms")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "手机号", name = "phone", dataType = "String", required = true)
|
})
|
public R<Object> userLoginSms(@RequestParam String phone) {
|
return R.ok(sendSmsService.userLoginSms(phone));
|
}
|
|
/**
|
* 师傅端-找回密码/验证手机号/验证码登录
|
*
|
* @param phone 订单记录id
|
*/
|
@ApiOperation(value = "师傅端-找回密码/验证手机号/验证码登录短信", tags = {"发送短信"})
|
@GetMapping(value = "/workerLoginSms")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "手机号", name = "phone", dataType = "String", required = true)
|
})
|
public R<String> workerLoginSms(@RequestParam String phone) {
|
return R.ok(sendSmsService.workerLoginSms(phone));
|
}
|
|
/**
|
* 师傅端-发送登录验证码短信
|
*
|
* @param phone 订单记录id
|
*/
|
@ApiOperation(value = "师傅端-发送入驻验证码短信", tags = {"发送短信"})
|
@GetMapping(value = "/workerSettleSms")
|
@ApiImplicitParams({
|
@ApiImplicitParam(value = "手机号", name = "phone", dataType = "String", required = true)
|
})
|
public R<String> workerSettleSms(@RequestParam String phone) {
|
return R.ok(sendSmsService.workerSettleSms(phone));
|
}
|
|
}
|