师傅注册接口
This commit is contained in:
parent
a23b9fea1f
commit
76ecbc8ea9
|
|
@ -7,6 +7,7 @@ import com.ghy.common.core.domain.AjaxResult;
|
|||
import com.ghy.common.core.page.TableDataInfo;
|
||||
import com.ghy.common.enums.GoodsStatus;
|
||||
import com.ghy.common.enums.WorkerStatus;
|
||||
import com.ghy.common.utils.CacheUtils;
|
||||
import com.ghy.common.utils.ExceptionUtil;
|
||||
import com.ghy.goods.domain.Goods;
|
||||
import com.ghy.goods.domain.GoodsCategory;
|
||||
|
|
@ -69,6 +70,32 @@ public class WorkerController extends BaseController {
|
|||
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")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
|
|
|
|||
|
|
@ -56,5 +56,8 @@ public class Worker extends BaseEntity {
|
|||
|
||||
private String bannerUrl;
|
||||
|
||||
// 注册验证码
|
||||
private String registerCode;
|
||||
|
||||
private List<Long> workerIds;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue