|
|
@@ -3,22 +3,22 @@ package com.mokamrp.privates.controller.pangu;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.mokamrp.privates.constant.Constants;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
+import com.mokamrp.privates.controller.BaseController;
|
|
|
import com.mokamrp.privates.entity.AddHandle;
|
|
|
import com.mokamrp.privates.entity.EditHandle;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.mokamrp.privates.entity.pangu.LoginStationHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import com.mokamrp.privates.service.CoralApiService;
|
|
|
import com.mokamrp.privates.service.WechatApiService;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import com.mokamrp.privates.controller.BaseController;
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -51,11 +51,11 @@ public class FosterwxStationController extends BaseController<FosterwxStation> {
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
- public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult){
|
|
|
+ public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult) {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
|
- Map<String,Object> res = fosterwxStationService.getList(postBasePageHandle);
|
|
|
+ Map<String, Object> res = fosterwxStationService.getList(postBasePageHandle);
|
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
|
|
|
|
@@ -78,6 +78,12 @@ public class FosterwxStationController extends BaseController<FosterwxStation> {
|
|
|
this.onInsert(addHandle.getRaw());
|
|
|
Boolean res = fosterwxStationService.save(addHandle.getRaw());
|
|
|
if (res) {
|
|
|
+ FosterwxStation fosterwxStation = new FosterwxStation();
|
|
|
+ String response = coralApiService.getBoxToken("gh_e529abe24cce");
|
|
|
+ String qrcodeUrl = wechatApiService.BuildBoxUnlimited(response, "asd=123", "pages/index/index");
|
|
|
+ fosterwxStation.setBoxShareUrl(fosterwxStationService.makeBoxShareUrl(qrcodeUrl, String.valueOf(addHandle.getRaw().getId()), addHandle.getRaw().getStationName()));
|
|
|
+ fosterwxStation.setId(addHandle.getRaw().getId());
|
|
|
+ fosterwxStationService.updateById(fosterwxStation);
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
} else {
|
|
|
return AjaxResult.error("新增失败", res);
|
|
|
@@ -90,18 +96,18 @@ public class FosterwxStationController extends BaseController<FosterwxStation> {
|
|
|
* @return
|
|
|
*/
|
|
|
@PostMapping("/login")
|
|
|
- public Object login(@Valid @RequestBody LoginStationHandle loginStationHandle){
|
|
|
- Map<String,Object> res = fosterwxStationService.login(loginStationHandle);
|
|
|
- if (res.get("token") == null || res.get("token").toString().isEmpty()){
|
|
|
+ public Object login(@Valid @RequestBody LoginStationHandle loginStationHandle) {
|
|
|
+ Map<String, Object> res = fosterwxStationService.login(loginStationHandle);
|
|
|
+ if (res.get("token") == null || res.get("token").toString().isEmpty()) {
|
|
|
return AjaxResult.error(res.get("msg").toString());
|
|
|
}
|
|
|
- return AjaxResult.success(res.get("msg").toString(),res);
|
|
|
+ return AjaxResult.success(res.get("msg").toString(), res);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/test")
|
|
|
- public Object test(){
|
|
|
+ public Object test() {
|
|
|
String res = coralApiService.getBoxToken("gh_e529abe24cce");
|
|
|
- String qrcodeUrl = wechatApiService.BuildBoxUnlimited(res,"asd=123","pages/index/index");
|
|
|
+ String qrcodeUrl = wechatApiService.BuildBoxUnlimited(res, "asd=123", "pages/index/index");
|
|
|
return AjaxResult.success(qrcodeUrl);
|
|
|
}
|
|
|
|