师傅注册接口

This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-08-09 18:07:57 +08:00
parent a23b9fea1f
commit 76ecbc8ea9
2 changed files with 30 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.core.page.TableDataInfo;
import com.ghy.common.enums.GoodsStatus; import com.ghy.common.enums.GoodsStatus;
import com.ghy.common.enums.WorkerStatus; import com.ghy.common.enums.WorkerStatus;
import com.ghy.common.utils.CacheUtils;
import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.ExceptionUtil;
import com.ghy.goods.domain.Goods; import com.ghy.goods.domain.Goods;
import com.ghy.goods.domain.GoodsCategory; import com.ghy.goods.domain.GoodsCategory;
@ -69,6 +70,32 @@ public class WorkerController extends BaseController {
return prefix + "/worker"; return prefix + "/worker";
} }
@PostMapping("/register")
@ResponseBody
public AjaxResult register(@RequestBody Worker request){
try {
if (CacheUtils.get(request.getPhone()) == null){
return AjaxResult.error("验证码无效!");
}
// 验证码校验正确
if(CacheUtils.get(request.getPhone()).toString().equals(request.getRegisterCode())){
int result = workerService.updateWorker(request);
if(result > 0){
CacheUtils.remove(request.getPhone());
return AjaxResult.success("注册成功!");
}else {
return AjaxResult.error("注册失败!");
}
}else {
return AjaxResult.error("验证码错误!");
}
}catch (Exception e){
e.printStackTrace();
logger.error(ExceptionUtil.getExceptionMessage(e));
return AjaxResult.error(e.getMessage());
}
}
// @RequiresPermissions("worker:worker:list") // @RequiresPermissions("worker:worker:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody

View File

@ -56,5 +56,8 @@ public class Worker extends BaseEntity {
private String bannerUrl; private String bannerUrl;
// 注册验证码
private String registerCode;
private List<Long> workerIds; private List<Long> workerIds;
} }