1. 程式人生 > 實用技巧 >抖音api介面呼叫-關注與取消關注抖音號

抖音api介面呼叫-關注與取消關注抖音號

抖音sdk介面API呼叫-關注與取消關注抖音號

/**
 * @author wechat:happybabby110
 * @blog http://www.wlkankan.cn
 * 關注抖音號
 */
@Async
public  void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
    try {
        log.debug(contentJsonStr);
        FollowTaskMessage.Builder bd = FollowTaskMessage.newBuilder();
        JsonFormat.parser().merge(contentJsonStr, bd);
        FollowTaskMessage req = bd.build();
        //將訊息轉發送給手機客戶端
        asyncTaskService.msgSend2Phone(ctx, req.getImUid(), EnumMsgType.FollowTask, vo, req);
    } catch (Exception e) {
        e.printStackTrace();
        MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
    }
}

/**
 * 取消關注抖音號
 * @author wechat:happybabby110
 * @blog http://www.wlkankan.cn
 */
@Async
public  void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
    try {
        log.debug(contentJsonStr);
        UnFollowTaskMessage.Builder bd = UnFollowTaskMessage.newBuilder();
        JsonFormat.parser().merge(contentJsonStr, bd);
        UnFollowTaskMessage req = bd.build();
        //將訊息轉發送給手機客戶端
        asyncTaskService.msgSend2Phone(ctx, req.getImUid(), EnumMsgType.UnFollowTask, vo, req);
    } catch (Exception e) {
        e.printStackTrace();
        MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
    }
}