diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java index 30217dd0f..d767c8fda 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/ManagerWechatBindService.java @@ -9,4 +9,6 @@ public interface ManagerWechatBindService { JSONObject newBindRequest(String managerId); void bindWechatUser(String bindId, String openid); + + JSONObject removeBindWechat(String managerId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java index 9d14988de..abc0d9d7e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/ManagerWechatBindServiceImpl.java @@ -71,6 +71,14 @@ public class ManagerWechatBindServiceImpl implements ManagerWechatBindService,Ap publisher.publishEvent(new CommonPageEvent(this, bindId, "manager_bind_success",manager)); } + @Override + public JSONObject removeBindWechat(String managerId) { + JSONObject manager = managerMapper.findById(managerId); + manager.put("wx_openid", null); + managerMapper.update(manager); + return managerMapper.findById(managerId); + } + private void setOpenId(String managerId, String openId) { JSONObject manager = new JSONObject(); manager.put("manager_id", managerId); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java index f9d9b29d6..515d413a8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/web/ManagerWechatBindController.java @@ -1,6 +1,7 @@ package au.com.royalpay.payment.manage.signin.web; import au.com.royalpay.payment.manage.permission.manager.RequireManager; +import au.com.royalpay.payment.manage.signin.beans.ManagerInfo; import au.com.royalpay.payment.manage.signin.core.ManagerWechatBindService; import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType; @@ -32,4 +33,11 @@ public class ManagerWechatBindController { public JSONObject newBindRequest(@ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) { return managerWechatBindService.newBindRequest(manager.getString("manager_id")); } + + @PutMapping(value = "/remove/{manager_id}") + @ResponseBody + public JSONObject removeBind(@PathVariable("manager_id") String managerId) { + return managerWechatBindService.removeBindWechat(managerId); + + } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml index 7cac18eba..ca1174a32 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.xml @@ -15,7 +15,7 @@ m.org_id, m.display_name, m.username,m.role,m.is_valid,m.create_time,m.last_login,o.name org_name, - m.email,m.phone,m.wechat, + m.email,m.phone,m.wechat,m.wx_openid, co.headimg, co.nickname, o.parent_org_id diff --git a/src/main/ui/static/config/managers/manager.js b/src/main/ui/static/config/managers/manager.js index ffea729ac..d4cbf90d2 100644 --- a/src/main/ui/static/config/managers/manager.js +++ b/src/main/ui/static/config/managers/manager.js @@ -71,6 +71,14 @@ define(['angular', 'uiRouter', 'uiBootstrap'], function (angular) { }).result.then(function () { $scope.listManagers(); }) + }; + $scope.removeWechatBind = function (manager) { + $http.put('/system/manager_wechat_binds/remove/' + manager.manager_id).then(function () { + console.log(manager) + $scope.listManagers(); + }, function (resp) { + commonDialog.alert({title: 'Error', content: resp.data.message, type: 'error'}) + }) } }]); app.controller('modifyManagerDialogCtrl', ['$scope', '$http', 'manager', function ($scope, $http, manager) { diff --git a/src/main/ui/static/config/managers/templates/managers.html b/src/main/ui/static/config/managers/templates/managers.html index 4acfb3305..0006548c4 100644 --- a/src/main/ui/static/config/managers/templates/managers.html +++ b/src/main/ui/static/config/managers/templates/managers.html @@ -96,7 +96,11 @@ - {{manager.nickname}} + + + {{manager.nickname}} + +