package com.doumee.api.web; import com.doumee.config.annotation.UserLoginRequired; import com.doumee.core.annotation.trace.Trace; import com.doumee.core.model.ApiResponse; import com.doumee.dao.business.model.SmsEmail; import com.doumee.dao.web.response.AccountResponse; import com.doumee.service.business.MemberService; import com.doumee.service.business.SmsEmailService; import com.doumee.service.business.UsersService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; 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; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2024/7/10 18:06 */ @Api(tags = "【B端小程序】用户业务") @Trace(exclude = true) @RestController @RequestMapping("/web/personnel") @Slf4j public class PersonnelApi extends ApiController{ @Autowired public UsersService usersService; @Autowired public SmsEmailService smsEmailService; @ApiOperation(value = "小程序登陆", notes = "员工端小程序") @GetMapping("/loginByWx") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true), }) public ApiResponse loginByWx(@RequestParam String code) { return ApiResponse.success(usersService.wxLogin(code)); } @ApiOperation(value = "发送短信验证码", notes = "员工端小程序") @GetMapping("/sendSms") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true), }) public ApiResponse sendSms(@RequestParam String phone) { SmsEmail smsEmail = new SmsEmail(); smsEmail.setPhone(phone); smsEmailService.sendSms(smsEmail); return ApiResponse.success("发送成功"); } @ApiOperation(value = "手机号验证码登陆", notes = "员工端小程序") @GetMapping("/loginByPhone") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true), @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "短信验证码", required = true), }) public ApiResponse loginByPhone(@RequestParam String phone,@RequestParam String code) { return ApiResponse.success(usersService.phoneLogin(phone,code)); } @UserLoginRequired @ApiOperation(value = "绑定openid", notes = "员工端小程序") @GetMapping("/bindingOpenid") @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true), }) public ApiResponse bindingOpenid(@RequestParam String code) { usersService.bindingOpenid(code,getMemberId()); return ApiResponse.success("操作成功"); } }