public static RequestApiResult BatchUntagging(DomainContext domainContext, WeixinTagBatchTaggingArgs args)
        {
            string           accessToken = domainContext.AccessToken;
            RequestApiResult result      = TagsApi.BatchUntagging(accessToken, args);

            if (result.Success == false)
            {
                if (result.Retry)
                {
                    if (result.ApiError.ErrorCode == 40001)
                    {
                        accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken);
                    }

                    result = TagsApi.BatchUntagging(accessToken, args);
                    if (result.Success == false)
                    {
                        _log.Write("TagsApi.BatchUntagging 失败",
                                   result.GetDetail(), TraceEventType.Warning);
                    }
                }
                else
                {
                    _log.Write("TagsApi.BatchUntagging 失败",
                               result.GetDetail(), TraceEventType.Warning);
                }
            }

            return(result);
        }
        public NormalResult BatchUntagging(DomainContext domainContext, MemberBatchTaggingArgs args)
        {
            NormalResult result = new NormalResult(false);

            if (args == null || args.OpenIdList == null || args.OpenIdList.Length == 0)
            {
                result.Message = "没有指定要更新的会员。";
                return(result);
            }

            WeixinTagBatchTaggingArgs apiArgs = new WeixinTagBatchTaggingArgs();

            apiArgs.TagId           = args.TagId;
            apiArgs.Data            = new WeixinTagBatchTaggingArgs_Data();
            apiArgs.Data.OpenIdList = args.OpenIdList;
            RequestApiResult updateResult = TagsApiWrapper.BatchUntagging(domainContext, apiArgs);

            if (updateResult.Success == false)
            {
                result.Message = updateResult.Message;
                return(result);
            }

            //更新数据库MEMBER表字段
            List <CommandParameter> parameterList = new List <CommandParameter>();

            parameterList.Add(new CommandParameter("@domain", domainContext.Domain.Id));
            parameterList.Add(new CommandParameter("@appId", domainContext.AppId));
            parameterList.Add(new CommandParameter("@tagId", args.TagId + ","));

            StringBuilder sqlWhere = new StringBuilder();

            for (int i = 0; i < args.OpenIdList.Length; i++)
            {
                sqlWhere.Append("@openId" + i);

                if (i < args.OpenIdList.Length - 1)
                {
                    sqlWhere.Append(",");
                }

                parameterList.Add(new CommandParameter("@openId" + i, args.OpenIdList[i]));
            }

            _dataBase.ExecuteNonQuery(
                "UPDATE [Member] SET [TagList] = REPLACE([TagList],@tagId,'') WHERE [Domain] = @domain AND [AppId] = @appId AND CHARINDEX(@tagId,[TagList]) > 0 AND [OpenId] IN (" + sqlWhere.ToString() + ")",
                parameterList);

            result.Success = true;
            return(result);
        }