pzc 4 роки тому
батько
коміт
4e229de8a3

+ 7 - 4
mpwechatApp/src/main/java/com/liangjian11/wx/mp/controller/WxFansController.java

@@ -11,6 +11,7 @@ import com.liangjian11.wx.mp.utils.ResultUtil;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.api.WxMpService;
 import me.chanjar.weixin.mp.api.WxMpUserService;
+import me.chanjar.weixin.mp.api.WxMpUserTagService;
 import me.chanjar.weixin.mp.bean.WxMpUserQuery;
 import me.chanjar.weixin.mp.bean.result.WxMpUser;
 import me.chanjar.weixin.mp.bean.result.WxMpUserList;
@@ -55,15 +56,17 @@ public class WxFansController {
     @GetMapping("/update")
     public ResultInfo updateTag(@PathVariable String appid, @RequestBody FansTag fansTag){
         try {
-            WxMpUserService userTagService = wxService.switchoverTo(appid).getUserService();
+            WxMpUserTagService userTagService = wxService.switchoverTo(appid).getUserTagService();
             Long id = fansTag.getTagId();
             String name = fansTag.getTagName();
-            Boolean update = userTagService.userUpdateRemark(id, name);
-            return ResultUtil.getUpdateResult(update);
+            String[] openids = new String[1];
+            openids[0] = fansTag.getOpenId();
+            Boolean update = userTagService.batchTagging(id, openids);
+            return ResultUtil.createSuccess(200,update);
         } catch (WxErrorException e) {
             e.printStackTrace();
         }
-        return ResultUtil.getFailureResult(null);
+        return ResultUtil.createFail(500);
     }
 
 //        try {