微信小程序登录接口
parent
a7cee65d5e
commit
1b5b46a7e0
@ -0,0 +1,37 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.system.domain.req.WechatRegisterReq;
|
||||||
|
import com.ruoyi.system.service.IWechatService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信登录相关接口
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wechat/register")
|
||||||
|
public class WechatRegisterController {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(WechatRegisterController.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWechatService iWechatService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/for/app")
|
||||||
|
public AjaxResult wechatRegister(@RequestBody WechatRegisterReq req) {
|
||||||
|
logger.info("wechat register, req = [{}]", req);
|
||||||
|
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.CompositionType;
|
||||||
|
import org.hibernate.validator.constraints.ConstraintComposition;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import javax.validation.ReportAsSingleViolation;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
@ConstraintComposition(CompositionType.OR)
|
||||||
|
@Pattern(regexp = "1[3|4|5|7|8][0-9]\\d{8}")
|
||||||
|
@Documented
|
||||||
|
@Constraint(validatedBy = {})
|
||||||
|
@Target({ElementType.METHOD,ElementType.FIELD,ElementType.CONSTRUCTOR,ElementType.PARAMETER})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@ReportAsSingleViolation
|
||||||
|
public @interface Phone {
|
||||||
|
String message() default "手机号码校验错误";
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.ruoyi.system.domain.req;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class WechatRegisterReq implements Serializable {
|
||||||
|
private static final long serialVersionUID = -2536864616757279758L;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue