leon 5 лет назад
Родитель
Сommit
d5dc18edcf

+ 23 - 2
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.mokamrp.privates.constant.Constants;
 import com.mokamrp.privates.constant.HttpMsg;
 import com.mokamrp.privates.constant.HttpStatus;
+import com.mokamrp.privates.entity.AddHandle;
 import com.mokamrp.privates.entity.DelHandle;
 import com.mokamrp.privates.entity.EditHandle;
 import com.mokamrp.privates.controller.BaseController;
@@ -85,14 +86,13 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
     public Object addPro(@RequestBody FosterwxMobile fosterwxMobile, @AuthUser User authUser) {
         // 新增账号
         fosterwxMobileService.save(fosterwxMobile);
-
         // 判断开始做任务时间是否设置了
         AjaxResult ajaxResult = null;
         if (null != fosterwxMobile.getTaskStartAt() && fosterwxMobile.getWxStatus() != 2) {
             ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser, false);
         }
 
-        if (null == ajaxResult) return AjaxResult.success("新增账号成功");
+        if (null == ajaxResult) return AjaxResult.success(HttpMsg.success,fosterwxMobile.getId());
 
         return ajaxResult;
     }
@@ -168,6 +168,27 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         return AjaxResult.success(Constants.SUCCESS, res);
     }
 
+    @PostMapping("/addMobilePro")
+    public Object addMobile(@RequestParam(name = "token") String token,
+                            @Valid @RequestBody AddHandle<FosterwxMobile> addHandle, BindingResult bindingResult){
+        if (bindingResult.hasErrors()) {
+            return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
+        }
+        //.登录验证
+        FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
+        if (fosterwxStation == null){
+            return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
+        }
+        this.onInsert(addHandle.getRaw());
+        Boolean res = fosterwxMobileService.save(addHandle.getRaw());
+        if (res) {
+            return AjaxResult.success(Constants.SUCCESS, addHandle.getRaw().getId());
+        } else {
+            return AjaxResult.error("新增失败", res);
+        }
+
+    }
+
     @PostMapping("/editMobile")
     public Object editMobile(@RequestParam(name = "token") String token,
                              @Valid @RequestBody EditHandle<FosterwxMobile> editHandle, BindingResult bindingResult) {

+ 2 - 1
src/main/resources/application-local.properties

@@ -51,7 +51,8 @@ xxl-sso.excluded.paths=/healthy,\
   /pangu/fosterwxMobile/getMobileList,\
   /pangu/fosterwxMobile/delMobile,\
   /pangu/fosterwxMobile/editMobile,\
-  /pangu/fosterwxMobile/mobileInfo
+  /pangu/fosterwxMobile/mobileInfo,\
+  /pangu/fosterwxMobile/addMobilePro
 #xxl.sso.redis.address=redis://xxl-sso:Jch9shshl@r-uf633f3f27aa2174pd.redis.rds.aliyuncs.com:6379/0
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72pd.redis.rds.aliyuncs.com:23563/0
 menu.host=http://space-server.mokamrp.com/space/menu/getMenuInterface?sysCode=1006&userId=

+ 2 - 1
src/main/resources/application-prod.properties

@@ -55,7 +55,8 @@ xxl-sso.excluded.paths=/healthy,\
   /pangu/fosterwxMobile/getMobileList,\
   /pangu/fosterwxMobile/delMobile,\
   /pangu/fosterwxMobile/editMobile,\
-  /pangu/fosterwxMobile/mobileInfo
+  /pangu/fosterwxMobile/mobileInfo,\
+  /pangu/fosterwxMobile/addMobilePro
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72.redis.rds.aliyuncs.com:6379/0
 
 menu.host=http://space-server-in-svc/space/menu/getMenuInterface?sysCode=1006&userId=

+ 2 - 1
src/main/resources/application-test.properties

@@ -56,7 +56,8 @@ xxl-sso.excluded.paths=/healthy,\
   /pangu/fosterwxMobile/getMobileList,\
   /pangu/fosterwxMobile/delMobile,\
   /pangu/fosterwxMobile/editMobile,\
-  /pangu/fosterwxMobile/mobileInfo
+  /pangu/fosterwxMobile/mobileInfo,\
+  /pangu/fosterwxMobile/addMobilePro
 #xxl.sso.redis.address=redis://xxl-sso:Jch9shshl@r-uf633f3f27aa2174pd.redis.rds.aliyuncs.com:6379/0
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72pd.redis.rds.aliyuncs.com:23563/0