/// <summary>
 /// 获取用户C端等级信息(免费、付费)
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/3134"/>
 /// <returns></returns>
 public YouZanResponse <ScrmLevelGetUserLevelResponse> ScrmLevelGetUserLevel(YouZanRequest request)
 {
     return(ApiInvoke <ScrmLevelGetUserLevelResponse>(
                request,
                API.SCRM_LEVEL_GET_USER_LEVEL,
                API.VERSION_1_0_0));
 }
 /// <summary>
 /// 删除用户的权益卡
 /// 1、删除用户的权益卡支持的用户账号类型
 ///     1)有赞粉丝id(有赞不同的合作渠道会生成不同渠道对应在有赞平台下的fans_id) ;
 ///     2)手机号;
 ///     3)三方帐号(原open_user_id:三方App用户ID,该参数仅限购买App开店插件的商家使用) ;
 ///     5)有赞用户id,用户在有赞的唯一id。推荐使用)
 /// 2、仅支持零售连锁总部调用
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/870"/>
 /// <returns></returns>
 public YouZanResponse <SuccessResponse> ScrmCustomerCardDelete(YouZanRequest request)
 {
     return(ApiInvoke <SuccessResponse>(
                request,
                API.SCRM_CUSTOMER_CARD_DELETE,
                API.VERSION_4_0_0));
 }
 /// <summary>
 /// 根据商品id,kdtId等,删除积分商品
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/1068"/>
 /// <returns></returns>
 public YouZanResponse CrmCustomerPointGoodsDelete(YouZanRequest request)
 {
     return(ApiInvoke(
                request,
                API.CRM_CUSTOMER_POINTGOODS_DELETE,
                API.VERSION_1_0_0));
 }
 /// <summary>
 /// 根据卡号获取用户购卡记录
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/2107"/>
 /// <returns></returns>
 public YouZanResponse <ScrmCustomerGetRecordResponse> ScrmCustomerGetRecord(YouZanRequest request)
 {
     return(ApiInvoke <ScrmCustomerGetRecordResponse>(
                request,
                API.SCRM_CUSTOMER_GET_RECORD,
                API.VERSION_1_0_0));
 }
 /// <summary>
 /// 创建客户
 /// 手机号和{"name":"丽丽"}必填
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/92"/>
 /// <returns></returns>
 public YouZanResponse <ScrmCustomerCreateResponse> ScrmCustomerCreate(YouZanRequest request)
 {
     return(ApiInvoke <ScrmCustomerCreateResponse>(
                request,
                API.SCRM_CUSTOMER_CREATE,
                API.VERSION_3_0_0));
 }
 /// <summary>
 /// 查询权益卡下对应的会员列表
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/94"/>
 /// <returns></returns>
 public YouZanResponse <ScrmCustomerSearchResponse> ScrmCustomerSearch(YouZanRequest request)
 {
     return(ApiInvoke <ScrmCustomerSearchResponse>(
                request,
                API.SCRM_CUSTOMER_SEARCH,
                API.VERSION_3_0_0));
 }
예제 #7
0
        public void TestItemsOnsaleGet()
        {
            var request  = new YouZanRequest();
            var response = api.ItemsOnsaleGet(request);

            Debug.WriteLine(JsonConvert.SerializeObject(response));
        }
예제 #8
0
 /// <summary>
 /// 获取有赞openId,根据userId(有赞账号id)查询有赞openId(注意是有赞openId,非微信openId)
 /// </summary>
 /// <remarks>
 /// 已支持:微商城单店、零售单店、美业总部、教育多校区-总部、有赞连锁D-总部、有赞连锁D-网店、有赞连锁D-合伙人、零售连锁前置仓、有赞连锁L-总部、有赞连锁L-总部-高级版、有赞连锁L-网店、有赞连锁L-网店-Lite、有赞连锁L-门店、有赞连锁L-合伙人、有赞连锁L-供货商、有赞连锁L-独立仓库、教育单校区、教育多校区-分部、酒店、企微助手
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/323"/>
 /// <returns></returns>
 public YouZanResponse <UserOpenApiGetResponse> UserOpenApiGet(YouZanRequest request)
 {
     return(ApiInvoke <UserOpenApiGetResponse>(
                request,
                API.USER_OPENAPI_GET,
                API.VERSION_1_0_0));
 }
예제 #9
0
 /// <summary>
 /// 查询是否存在有赞帐号
 /// 传入参数参考{"account_type":"Mobile", "account_id":"1385716120"}
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/21"/>
 /// <returns></returns>
 public YouZanResponse <bool> UsersAccountCheck(YouZanRequest request)
 {
     return(ApiInvoke <bool>(
                request,
                API.USERS_ACCOUNT_CHECK,
                API.VERSION_1_0_0));
 }
예제 #10
0
 /// <summary>
 /// 依据有赞openid 或者手机号 获取用户简要信息
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public YouZanResponse <UserBasicGetResponse> UserBasicGet(YouZanRequest request)
 {
     return(ApiInvoke <UserBasicGetResponse>(
                request,
                API.USER_BASIC_GET,
                API.VERSION_3_0_1));
 }
예제 #11
0
 /// <summary>
 /// [新增] 仅限购买APP开店插件商家使用,查询app开店的用户信息。
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/3606"/>
 /// <returns></returns>
 public YouZanResponse <UserAppShopGetInfoResponse> UserAppShopGetInfo(YouZanRequest request)
 {
     return(ApiInvoke <UserAppShopGetInfoResponse>(
                request,
                API.USER_APP_SHOP_GET_INFO,
                API.VERSION_1_0_0));
 }
 /// <summary>
 /// 给客户减成长值
 /// 给客户减成长值,帐号类型(与帐户ID配合使用: 1:粉丝(原fansId),2:手机号,3:三方帐号(原open_user_id),4:UnionID,5:有赞客户唯一id即yz_open_id
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/864"/>
 /// <returns></returns>
 public YouZanResponse <SuccessResponse> CrmCustomerGrowthDecrease(YouZanRequest request)
 {
     return(ApiInvoke <SuccessResponse>(
                request,
                API.CRM_CUSTOMER_GROWTH_DECREASE,
                API.VERSION_2_0_0));
 }
예제 #13
0
 /// <summary>
 /// 使用手机号获取用户微信openId
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/12"/>
 /// <returns></returns>
 public YouZanResponse <UserWeiXinOpenIdGetResponse> UserWeiXinOpenIdGet(YouZanRequest request)
 {
     return(ApiInvoke <UserWeiXinOpenIdGetResponse>(
                request,
                API.USER_WEIXIN_OPENID_GET,
                API.VERSION_3_0_0));
 }
예제 #14
0
 /// <summary>
 /// 根据微信粉丝用户的 weixin_openid 或 fans_id 删除对应的标签,一次删除的标签数量不能大于20。只支持商家自有粉丝(fanstype为1的)
 /// </summary>
 /// <remarks>
 /// 已支持:微商城单店、零售单店、教育多校区-总部
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/133"/>
 /// <returns></returns>
 public YouZanResponse <SuccessResponse> UsersWeixinFollowerTagsDelete(YouZanRequest request)
 {
     return(ApiInvoke <SuccessResponse>(
                request,
                API.USERS_WEIXIN_FOLLOWER_TAGS_DELETE,
                API.VERSION_3_0_0));
 }
예제 #15
0
 /// <summary>
 /// 获取分销员账户信息,不支持返回分销员等级
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/67"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanAccountGetResponse> SalesmanAccountGet(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanAccountGetResponse>(
                request,
                API.SALESMAN_ACCOUNT_GET,
                API.VERSION_3_0_0));
 }
예제 #16
0
 /// <summary>
 /// 设置用户为分销员
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/41"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanAccountAddResponse> SalesmanAccountAdd(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanAccountAddResponse>(
                request,
                API.SALESMAN_ACCOUNT_ADD,
                API.VERSION_3_0_1));
 }
예제 #17
0
 /// <summary>
 /// 更新分销员信息,客户已经是分销员才可以更新
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/42"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanAccountUpdateResponse> SalesmanAccountUpdate(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanAccountUpdateResponse>(
                request,
                API.SALESMAN_ACCOUNT_UPDATE,
                API.VERSION_3_0_0));
 }
예제 #18
0
 /// <summary>
 /// 用户查询接口,用户信息查询接口。 查询条件说明: 1. 支持根据yz_open_id查询 2. 支持根据mobile(国内手机号)查询 3. 支持根据unionId(微信体系下帐号标识)查询 4. 支持weixin_open_id + open_id_type查询,支持微信公众号H5,微信小程序、有赞大账号 5. 查询优先级yz_open_id>mobile>weixin_union_id>weixin_open_id 返回结果说明: 1. 默认只返回用户对应的手机帐号信息(platform_type = 0) 2. 可使用result_type_list控制返回结果,如传入[1, 9]则返回自有粉丝和大账号粉丝; 补充说明:在微信公众号场景下,正常会进行两次授权,一次通过商家公众号授权,一次通过有赞公众号授权,分别产生不同的用户数据: 1)1-微信公众号:通过商家的公众号授权产生的用户 2)9-微信大账号:通过”有赞“公众号授权产生的用户
 /// </summary>
 /// <remarks>
 /// 已支持:微商城单店、有赞连锁D-总部、有赞连锁D-网店、有赞连锁D-合伙人、零售单店、美业总部、教育多校区-总部、零售连锁前置仓、有赞连锁L-总部、有赞连锁L-总部-高级版、有赞连锁L-网店、有赞连锁L-网店-Lite、有赞连锁L-门店、有赞连锁L-合伙人、有赞连锁L-供货商、有赞连锁L-独立仓库、教育单校区、教育多校区-分部、酒店、企微助手
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/2193"/>
 /// <returns></returns>
 public YouZanResponse <UsersInfoQueryResponse> UsersInfoQuery(YouZanRequest request)
 {
     return(ApiInvoke <UsersInfoQueryResponse>(
                request,
                API.USERS_INFO_QUERY,
                API.VERSION_1_0_0));
 }
예제 #19
0
 /// <summary>
 /// 执行API请求
 /// </summary>
 /// <typeparam name="T">响应参数</typeparam>
 /// <param name="request">请求参数值</param>
 /// <param name="apiName">api名称</param>
 /// <param name="apiVersion">api版本</param>
 /// <param name="method">api版本</param>
 /// <param name="headers">http请求头信息</param>
 /// <param name="files">文件列表(暂不支持)</param>
 /// <returns></returns>
 protected YouZanResponse <T> ApiInvoke <T>(YouZanRequest request,
                                            string apiName,
                                            string apiVersion,
                                            string method = API.HTTP_POST,
                                            IDictionary <string, string> headers        = null,
                                            List <KeyValuePair <string, string> > files = null)
 {
     return(Invoke <YouZanResponse <T> >(request, apiName, apiVersion, method, headers, files));
 }
예제 #20
0
        private T Invoke <T>(YouZanRequest request,
                             string apiName,
                             string apiVersion,
                             string method = API.HTTP_POST,
                             IDictionary <string, string> headers        = null,
                             List <KeyValuePair <string, string> > files = null) where T : YouZanResponse
        {
            GeneralApi generalApi = new GeneralApi();

            generalApi.SetName(apiName);
            generalApi.SetVersion(apiVersion);
            generalApi.SetClientId(ClientId);
            generalApi.SetGrantId(GrantId);
            generalApi.SetHttpMethod(method);
            generalApi.SetOAuthType(OAuthEnum.TOKEN);

            GeneralApiParams apiParams = new GeneralApiParams();

            apiParams.AddParam(this.GenericParameter(request));

            generalApi.SetAPIParams(apiParams);

            var resp = GetResponse <T>(generalApi, new Token(oAuthToken.Token), headers, files);

            // 当Token失效或Token不存在时,强制刷新AccessToken并且重新请求
            var errCodes = new[] { 4201, 4202, 4203 };

            if (resp.ErrorResponse != null && errCodes.Contains(resp.ErrorResponse.ErrorCode))
            {
                if (_checkToken)
                {
                    if (_funcGetTokenData == null)
                    {
                        return(resp);
                    }
                    oAuthToken = _funcGetTokenData();
                }
                else
                {
                    this.GetAccessToken(true);
                }
                resp = GetResponse <T>(generalApi, new Token(oAuthToken.Token), headers, files);
            }

            return(resp);
        }
예제 #21
0
        /// <summary>
        /// 执行API请求
        /// </summary>
        /// <typeparam name="TIn">请求参数</typeparam>
        /// <typeparam name="T">响应参数</typeparam>
        /// <param name="request">请求参数值</param>
        /// <param name="apiName">api名称</param>
        /// <param name="apiVersion">api版本</param>
        /// <param name="method">api版本</param>
        /// <param name="headers">http请求头信息</param>
        /// <param name="files">文件列表(暂不支持)</param>
        /// <returns></returns>
        protected YouZanResponse <T> ApiInvoke <T>(YouZanRequest request,
                                                   string apiName,
                                                   string apiVersion,
                                                   string method = API.METHOD_POST,
                                                   IDictionary <string, string> headers        = null,
                                                   List <KeyValuePair <string, string> > files = null)
        {
            GeneralApi generalApi = new GeneralApi();

            generalApi.SetName(apiName);
            generalApi.SetVersion(apiVersion);
            generalApi.SetHttpMethod(method);
            generalApi.SetOAuthType(OAuthEnum.TOKEN);

            GeneralApiParams apiParams = new GeneralApiParams();

            apiParams.AddParam(this.GenericParameter(request));

            generalApi.SetAPIParams(apiParams);

            string result = _YouZanClient.Invoke(generalApi, new Token(oAuthToken.Token), headers, files);

            return(JsonConvert.DeserializeObject <YouZanResponse <T> >(result));
        }
예제 #22
0
 /// <summary>
 /// 获取推广订单列表
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/74"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanTradesGetResponse> SalesmanTradesGet(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanTradesGetResponse>(request,
                                                  API.SALESMAN_TRADES_GET,
                                                  API.VERSION_3_0_1));
 }
예제 #23
0
 /// <summary>
 /// 获取商品推广链接
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/43"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanItemShareGetResponse> SalesmanItemShareGet(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanItemShareGetResponse>(request,
                                                     API.SALESMAN_ITEM_SHARE_GET,
                                                     API.VERSION_3_0_0));
 }
예제 #24
0
 /// <summary>
 /// 更新备注
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/137"/>
 /// <returns></returns>
 public YouZanResponse <SuccessResponse> TradeMemoUpdate(YouZanRequest request)
 {
     return(ApiInvoke <SuccessResponse>(request,
                                        API.TRADE_MEMO_UPDATE,
                                        API.VERSION_3_0_0));
 }
예제 #25
0
 /// <summary>
 /// 清退分销员,客户必须是分销员才能清退
 /// </summary>
 /// <param name="request">请求参数</param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/345"/>
 /// <returns></returns>
 public YouZanResponse <bool> SalesmanAccountFire(YouZanRequest request)
 {
     return(ApiInvoke <bool>(request,
                             API.SALESMAN_ACCOUNT_FIRE,
                             API.VERSION_3_0_0));
 }
예제 #26
0
 /// <summary>
 /// 查询单笔交易详情接口
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/120"/>
 /// <returns></returns>
 public YouZanResponse <TradeGetResponse> TradesGet(YouZanRequest request)
 {
     return(ApiInvoke <TradeGetResponse>(request,
                                         API.TRADE_GET,
                                         API.VERSION_4_0_0));
 }
예제 #27
0
 /// <summary>
 /// 获取单个粉丝标签集合,调用时,参数 weixin_openid 和 fans_id 选其一即可,只支持商家自有粉丝(fanstype为1的)
 /// </summary>
 /// <remarks>
 /// 已支持:微商城单店、零售单店、教育多校区-总部
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/910"/>
 /// <returns></returns>
 public YouZanResponse <UsersChannelCodeUltraGetResponse> UsersChannelCodeUltraGet(YouZanRequest request)
 {
     return(ApiInvoke <UsersChannelCodeUltraGetResponse>(
                request,
                API.USERS_CHANNEL_CODE_ULTRA_GET,
                API.VERSION_1_0_0));
 }
예제 #28
0
 /// <summary>
 /// 获取分销员业绩统计
 /// </summary>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/37"/>
 /// <returns></returns>
 public YouZanResponse <SalesmanAccountScoreSearchResponse> SalesmanAccountScoreSearch(YouZanRequest request)
 {
     return(ApiInvoke <SalesmanAccountScoreSearchResponse>(request,
                                                           API.SALESMAN_ACCOUNT_SCORE_SEARCH,
                                                           API.VERSION_3_0_0));
 }
예제 #29
0
 /// <summary>
 /// 获取单个粉丝标签集合,调用时,参数 weixin_openid 和 fans_id 选其一即可,只支持商家自有粉丝(fanstype为1的)
 /// </summary>
 /// <remarks>
 /// 已支持:微商城单店、零售单店、教育多校区-总部
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/105"/>
 /// <returns></returns>
 public YouZanResponse <UsersWeixinFollowerTagsGetResponse> UsersWeixinFollowerTagsGet(YouZanRequest request)
 {
     return(ApiInvoke <UsersWeixinFollowerTagsGetResponse>(
                request,
                API.USERS_WEIXIN_FOLLOWER_TAGS_GET,
                API.VERSION_3_0_0));
 }
예제 #30
0
 /// <summary>
 /// 根据关注时间段批量查询微信粉丝用户信息,根据fansId正序批量查询微信粉丝用户信息(不受关注时间限制),仅支持商家自己公众号下的粉丝查新
 /// </summary>
 /// <remarks>
 /// 已支持:零售单店、教育多校区-总部、微商城单店、有赞连锁D-总部、有赞连锁D-网店、有赞连锁D-合伙人、美业总部、零售连锁前置仓、有赞连锁L-总部、有赞连锁L-总部-高级版、有赞连锁L-网店、有赞连锁L-网店-Lite、有赞连锁L-门店、有赞连锁L-合伙人、有赞连锁L-供货商、有赞连锁L-独立仓库、教育单校区、教育多校区-分部、酒店、企微助手
 /// </remarks>
 /// <param name="request"></param>
 /// <see cref="https://doc.youzanyun.com/detail/API/0/132"/>
 /// <returns></returns>
 public YouZanResponse <UsersWeixinFollowersInfoSearchResponse> UsersWeixinFollowersInfoSearch(YouZanRequest request)
 {
     return(ApiInvoke <UsersWeixinFollowersInfoSearchResponse>(
                request,
                API.USERS_WEIXIN_FOLLOWS_INFO_SEARCH,
                API.VERSION_3_0_0));
 }