예제 #1
0
 protected async Task <T> PostSendJson <T>(string url, object data)
 {
     return(await CommonJsonSend.SendAsync <T>(string.Empty, url, data, RequestCallBack));
 }
예제 #2
0
        /// <summary>
        /// 创建二维码
        /// </summary>
        /// <param name="accessToken">AccessToken</param>
        /// <param name="expireSeconds">临时二维码有效时间,以秒为单位。最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒,永久二维码将忽略此参数</param>
        /// <param name="sceneId">场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)</param>
        /// <param name="sceneStr">场景字符串,字符串类型,长度限制为1到64,仅actionName为QR_LIMIT_STR_SCENE时有效</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <param name="actionName">二维码类型,当actionName为QR_LIMIT_STR_SCENE时,sceneId会被忽略</param>
        /// <returns></returns>
        public async System.Threading.Tasks.Task <CreateQrCodeResult> CreateQrCodeAsync(int expireSeconds, int sceneId, QRCodeActionName actionName, string sceneStr = null, int timeOut = 10000)
        {
            var urlFormat = WeiXinApiHelper.BaseCgiBinssl + "/qrcode/create?access_token={0}";
            CreateQrCodeRequestBase data = default(CreateQrCodeRequestBase);

            switch (actionName)
            {
            case QRCodeActionName.QR_SCENE:
                data = new QR_SCENE()
                {
                    expire_seconds = expireSeconds,
                    action_name    = "QR_SCENE",
                    action_info    = new ActionInfo()
                    {
                        scene = new Scene_Id()
                        {
                            scene_id = sceneId
                        }
                    }
                };
                break;

            case QRCodeActionName.QR_LIMIT_SCENE:
                data = new QR_LIMIT_SCENE()
                {
                    action_name = "QR_LIMIT_SCENE",
                    action_info = new ActionInfo()
                    {
                        scene = new Scene_Id()
                        {
                            scene_id = sceneId
                        }
                    }
                };
                break;

            case QRCodeActionName.QR_LIMIT_STR_SCENE:
                data = new QR_LIMIT_STR_SCENE()
                {
                    action_name = "QR_LIMIT_STR_SCENE",
                    action_info = new ActionInfo()
                    {
                        scene = new Scene_Str()
                        {
                            scene_str = sceneStr
                        }
                    }
                };
                break;

            case QRCodeActionName.QR_STR_SCENE:
                data = new QR_STR_SCENE()
                {
                    expire_seconds = expireSeconds,
                    action_name    = "QR_STR_SCENE",
                    action_info    = new ActionInfo()
                    {
                        scene = new Scene_Str()
                        {
                            scene_str = sceneStr
                        }
                    }
                };
                break;

            default:
                //throw new ArgumentOutOfRangeException(nameof(actionName), actionName, null);
                throw new ArgumentOutOfRangeException(actionName.GetType().Name, actionName, null);
            }

            return(await CommonJsonSend.SendAsync <CreateQrCodeResult, CreateQrCodeRequestBase>(await this.GetAccessTokenAsync(), urlFormat, data));
        }
예제 #3
0
        /// <summary>
        /// 获取用户基本信息
        /// </summary>
        /// <param name="accessToken">调用接口凭证</param>
        /// <param name="openId">普通用户的标识,对当前公众号唯一</param>
        /// <param name="lang">返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语</param>
        /// <returns></returns>
        public static OAuthUserInfo GetUserInfo(string accessToken, string openId, Language lang = Language.zh_CN)
        {
            var url = string.Format("https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang={2}", accessToken, openId, lang);

            return(CommonJsonSend.Send <OAuthUserInfo>(null, url, null, CommonJsonSendType.GET));
        }
예제 #4
0
        /// <summary>
        /// 获取代码模版库中的所有小程序代码模版
        /// </summary>
        /// <param name="accessToken">第三方平台自己的component_access_token</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static GetTemplateListResultJson GetTemplateList(string accessToken, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format(Config.ApiMpHost + "/wxa/gettemplatelist?access_token={0}", accessToken.AsUrlData());

            return(CommonJsonSend.Send <GetTemplateListResultJson>(null, url, null, CommonJsonSendType.GET, timeOut));
        }
예제 #5
0
        /// <summary>
        /// 获取用户基本信息
        /// </summary>
        /// <param name="oauthAccessToken">调用接口凭证(OAuth专用)</param>
        /// <param name="openId">普通用户的标识,对当前公众号唯一</param>
        /// <param name="lang">返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语</param>
        /// <returns></returns>
        public static OAuthUserInfo GetUserInfo(string oauthAccessToken, string openId, Language lang = Language.zh_CN)
        {
            var url = string.Format(Config.ApiMpHost + "/sns/userinfo?access_token={0}&openid={1}&lang={2}", oauthAccessToken.AsUrlData(), openId.AsUrlData(), lang.ToString("g").AsUrlData());

            return(CommonJsonSend.Send <OAuthUserInfo>(null, url, null, CommonJsonSendType.GET));
        }
예제 #6
0
        /// <summary>
        /// 减少库存
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="reduceStockData">减少库存需要Post的数据</param>
        /// <returns></returns>
        public static WxJsonResult ReduceStock(string accessToken, ReduceStockData reduceStockData)
        {
            var urlFormat = "https://api.weixin.qq.com/merchant/stock/reduce?access_token={0}";

            return(CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, reduceStockData));
        }
예제 #7
0
        /// <summary>
        /// 发消息
        /// </summary>
        /// <param name="accessTokenOrAppKey"></param>
        /// <param name="sender">发送人的userId</param>
        /// <param name="type">接收人类型:single|group,分别表示:群聊|单聊</param>
        /// <param name="msgType">消息类型,text|image|file</param>
        /// <param name="chatIdOrUserId">会话值,为userid|chatid,分别表示:成员id|会话id,单聊是userid,群聊是chatid</param>
        /// <param name="contentOrMediaId">文本消息是content,图片或文件是mediaId</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static WorkJsonResult SendChatMessage(string accessTokenOrAppKey, string sender, Chat_Type type, ChatMsgType msgType, string chatIdOrUserId, string contentOrMediaId, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/chat/send?access_token={0}", accessToken.AsUrlData());

                BaseSendChatMessageData data;

                switch (msgType)
                {
                case ChatMsgType.text:
                    data = new SendTextMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        text = new Chat_Content()
                        {
                            content = contentOrMediaId
                        }
                    };
                    break;

                case ChatMsgType.image:
                    data = new SendImageMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        image = new Chat_Image()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;

                case ChatMsgType.file:
                    data = new SendFileMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        file = new Chat_File()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;

                default:
                    throw new ArgumentOutOfRangeException("msgType");
                }

                return CommonJsonSend.Send <WorkJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppKey));
        }
예제 #8
0
        /// <summary>
        /// 增加分组
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="addGroupData">增加分组需要Post的数据</param>
        /// <returns></returns>
        public static AddGroupResult AddGroup(string accessToken, AddGroupData addGroupData)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/group/add?access_token={0}";

            return(CommonJsonSend.Send <AddGroupResult>(accessToken, urlFormat, addGroupData));
        }
예제 #9
0
        /// <summary>
        /// 修改分组属性
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="propertyModGroup">修改分组属性需要Post的数据</param>
        /// <returns></returns>
        public static WxJsonResult PropertyModGroup(string accessToken, PropertyModGroup propertyModGroup)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/group/propertymod?access_token={0}";

            return(CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, propertyModGroup));
        }
예제 #10
0
        public static CategoryListJsonResult GetAllCategories(string accessToken)
        {
            var url = $"{Config.ApiMpHost}/cgi-bin/wxopen/getallcategories?access_token={accessToken.AsUrlData()}";

            return(CommonJsonSend.Send <CategoryListJsonResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #11
0
        /// <summary>
        /// 获取所有分组
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static GetAllGroup GetAllGroup(string accessToken)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/group/getall?access_token={0}";

            return(CommonJsonSend.Send <GetAllGroup>(accessToken, urlFormat, null, CommonJsonSendType.GET));
        }
예제 #12
0
        public static CreateQrCodeResult Create(string accessTokenOrAppId, int expireSeconds, int sceneId, QrCode_ActionName actionName, string sceneStr = null, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var urlFormat = Config.ApiMpHost + "/cgi-bin/qrcode/create?access_token={0}";
                object data = null;

                switch (actionName)
                {
                case QrCode_ActionName.QR_SCENE:
                    data = new
                    {
                        expire_seconds = expireSeconds,
                        action_name = "QR_SCENE",
                        action_info = new
                        {
                            scene = new
                            {
                                scene_id = sceneId
                            }
                        }
                    };
                    break;

                case QrCode_ActionName.QR_LIMIT_SCENE:
                    data = new
                    {
                        action_name = "QR_LIMIT_SCENE",
                        action_info = new
                        {
                            scene = new
                            {
                                scene_id = sceneId
                            }
                        }
                    };
                    break;

                case QrCode_ActionName.QR_LIMIT_STR_SCENE:
                    data = new
                    {
                        action_name = "QR_LIMIT_STR_SCENE",
                        action_info = new
                        {
                            scene = new
                            {
                                scene_str = sceneStr
                            }
                        }
                    };
                    break;

                case QrCode_ActionName.QR_STR_SCENE:
                    data = new
                    {
                        expire_seconds = expireSeconds,
                        action_name = "QR_STR_SCENE",
                        action_info = new
                        {
                            scene = new
                            {
                                scene_str = sceneStr
                            }
                        }
                    };
                    break;

                default:
                    //throw new ArgumentOutOfRangeException(nameof(actionName), actionName, null);
                    throw new ArgumentOutOfRangeException(actionName.GetType().Name, actionName, null);
                }

                return CommonJsonSend.Send <CreateQrCodeResult>(accessToken, urlFormat, data, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
예제 #13
0
        public static WxJsonResult UpDateExpress(string accessToken, UpDateExpressData upDateExpressData)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/express/update?access_token={0}";

            return(CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, upDateExpressData));
        }
예제 #14
0
        public static GetAllExpressResult GetAllExpress(string accessToken)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/express/getall?access_token={0}";

            return(CommonJsonSend.Send <GetAllExpressResult>(accessToken, urlFormat, null, CommonJsonSendType.GET));
        }
예제 #15
0
        /// <summary>
        /// 设置企业号应用
        /// 此App只能修改现有的并且有权限管理的应用,无法创建新应用(因为新应用没有权限)
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="data">设置应用需要Post的数据</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <returns></returns>
        public static WxJsonResult SetApp(string accessToken, SetAppPostData data, int timeOut = Config.TIME_OUT)
        {
            string url = "https://qyapi.weixin.qq.com/cgi-bin/agent/set?access_token={0}";

            return(CommonJsonSend.Send <WxJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut));
        }
예제 #16
0
        /// <summary>
        /// 减少库存
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="reduceStockData">减少库存需要Post的数据</param>
        /// <returns></returns>
        public static WxJsonResult ReduceStock(string accessToken, ReduceStockData reduceStockData)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/stock/reduce?access_token={0}";

            return(CommonJsonSend.Send <WxJsonResult>(accessToken, urlFormat, reduceStockData));
        }
예제 #17
0
        public static GetAllShelfResult GetAllShelves(string accessToken)
        {
            var urlFormat = Config.ApiMpHost + "/merchant/shelf/getall?access_token=ACCESS_TOKEN";

            return(CommonJsonSend.Send <GetAllShelfResult>(accessToken, urlFormat, null, CommonJsonSendType.GET));
        }
        /// <summary>
        /// 获取调用微信JS接口的临时票据
        /// </summary>
        /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
        /// <param name="type">默认为jsapi,当作为卡券接口使用时,应当为wx_card</param>
        /// <returns></returns>
        public async Task <JsApiTicketResult> GetTicketAsync(string type = "jsapi")
        {
            var url = WeiXinApiHelper.BaseUrl + "/cgi-bin/ticket/getticket?access_token={0}" + $"&type={type}";

            return(await CommonJsonSend.SendAsync <JsApiTicketResult, StringRef>(await this.GetAccessTokenAsync(), url, null, CommonJsonSendType.GET));
        }
예제 #19
0
        public static GetAuditStatusResultJson GetLatestAuditStatus(string accessToken, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format(Config.ApiMpHost + "/wxa/get_latest_auditstatus?access_token={0}", accessToken.AsUrlData());

            return(CommonJsonSend.Send <GetAuditStatusResultJson>(null, url, null, CommonJsonSendType.GET, timeOut));
        }
        /// <summary>
        /// 获取微信服务器的ip段
        /// </summary>
        /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
        /// <returns></returns>
        public async Task <GetCallBackIpResult> GetCallBackIpAsync()
        {
            var url = WeiXinApiHelper.BaseUrl + "/cgi-bin/getcallbackip?access_token={0}";

            return(await CommonJsonSend.SendAsync <GetCallBackIpResult, StringRef>(await this.GetAccessTokenAsync(), url, null, CommonJsonSendType.GET));
        }
예제 #21
0
        /// <summary>
        /// 获取草稿箱内的所有临时代码草稿
        /// </summary>
        /// <param name="accessToken">第三方平台自己的component_access_token</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <GetTemplateDraftListResultJson> GetTemplateDraftListAsync(string accessToken, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format(Config.ApiMpHost + "/wxa/gettemplatedraftlist?access_token={0}", accessToken.AsUrlData());

            return(await CommonJsonSend.SendAsync <GetTemplateDraftListResultJson>(null, url, null, CommonJsonSendType.GET, timeOut));
        }
        /// <summary>
        ///公众号调用或第三方平台帮公众号调用对公众号的所有api调用(包括第三方帮其调用)次数进行清零
        /// </summary>
        /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param>
        /// <param name="appId"></param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public async Task <WxJsonResult> Clear_quotaAsync()
        {
            var url = WeiXinApiHelper.BaseUrl + "/cgi-bin/clear_quota?access_token={0}";

            return(await CommonJsonSend.SendAsync <StringRef>(await this.GetAccessTokenAsync(), url, null, CommonJsonSendType.GET));
        }
예제 #23
0
        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="accessToken">调用接口凭证</param>
        /// <param name="id">部门id。(注:不能删除根部门;不能删除含有子部门、成员的部门)</param>
        /// <returns></returns>
        public static WxJsonResult DeleteDepartment(string accessToken, string id)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/department/delete?access_token={0}&id={1}", accessToken, id);

            return(CommonJsonSend.Send <WxJsonResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #24
0
        /// <summary>
        /// 获取成员
        /// </summary>
        /// <param name="accessToken">调用接口凭证</param>
        /// <param name="userId">员工UserID</param>
        /// <returns></returns>
        public static GetMemberResult GetMember(string accessToken, string userId)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={0}&userid={1}", accessToken, userId);

            return(CommonJsonSend.Send <GetMemberResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #25
0
        /// <summary>
        /// 检验授权凭证(access_token)是否有效(OAuth专用)
        /// </summary>
        /// <param name="oauthAccessToken">调用接口凭证(OAuth专用)</param>
        /// <param name="openId">用户的唯一标识</param>
        /// <returns></returns>
        public static WxJsonResult Auth(string oauthAccessToken, string openId)
        {
            var url = string.Format(Config.ApiMpHost + "/sns/auth?access_token={0}&openid={1}", oauthAccessToken.AsUrlData(), openId.AsUrlData());

            return(CommonJsonSend.Send <WxJsonResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #26
0
        /// <summary>
        /// 获取部门成员(详情)
        /// </summary>
        /// <param name="accessToken">调用接口凭证</param>
        /// <param name="departmentId">获取的部门id</param>
        /// <param name="fetchChild">1/0:是否递归获取子部门下面的成员</param>
        /// <param name="status">0获取全部员工,1获取已关注成员列表,2获取禁用成员列表,4获取未关注成员列表。status可叠加</param>
        /// <returns></returns>
        public static GetDepartmentMemberInfoResult GetDepartmentMemberInfo(string accessToken, int departmentId, int fetchChild, int status)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token={0}&department_id={1}&fetch_child={2}&status={3}", accessToken, departmentId, fetchChild, status);

            return(CommonJsonSend.Send <GetDepartmentMemberInfoResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #27
0
        /// <summary>
        /// 检验授权凭证(access_token)是否有效
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="openId">用户的唯一标识</param>
        /// <returns></returns>
        public static WxJsonResult Auth(string accessToken, string openId)
        {
            var url = string.Format("https://api.weixin.qq.com/sns/auth?access_token={0}&openid={1}", accessToken, openId);

            return(CommonJsonSend.Send <WxJsonResult>(null, url, null, CommonJsonSendType.GET));
        }
예제 #28
0
        /// <summary>
        /// 获取企业号应用信息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="agentId">企业应用的id,可在应用的设置页面查看</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <returns></returns>
        public static GetAppInfoResult GetAppInfo(string accessToken, int agentId, int timeOut = Config.TIME_OUT)
        {
            string url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/agent/get?access_token={0}&agentid={1}", accessToken, agentId);

            return(CommonJsonSend.Send <GetAppInfoResult>(null, url, null, CommonJsonSendType.GET, timeOut));
        }
예제 #29
0
        /// <summary>
        /// 创建卡券
        /// </summary>
        /// <param name="accessTokenOrAppId"></param>
        /// <param name="cardInfo">创建卡券需要的数据,格式可以看CardCreateData.cs</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <returns></returns>
        public static CardCreateResultJson CreateCard(string accessTokenOrAppId, BaseCardInfo cardInfo, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var urlFormat = string.Format("https://api.weixin.qq.com/card/create?access_token={0}", accessToken);

                CardCreateInfo cardData = null;
                CardType cardType = cardInfo.GetCardType();

                switch (cardType)
                {
                case CardType.GENERAL_COUPON:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_GeneralCoupon()
                        {
                            card_type = cardType.ToString(),
                            general_coupon = cardInfo as Card_GeneralCouponData
                        }
                    };
                    break;

                case CardType.GROUPON:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_Groupon()
                        {
                            card_type = cardType.ToString(),
                            groupon = cardInfo as Card_GrouponData
                        }
                    };
                    break;

                case CardType.GIFT:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_Gift()
                        {
                            card_type = cardType.ToString(),
                            gift = cardInfo as Card_GiftData
                        }
                    };
                    break;

                case CardType.CASH:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_Cash()
                        {
                            card_type = cardType.ToString(),
                            cash = cardInfo as Card_CashData
                        }
                    };
                    break;

                case CardType.DISCOUNT:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_DisCount()
                        {
                            card_type = cardType.ToString(),
                            discount = cardInfo as Card_DisCountData
                        }
                    };
                    break;

                case CardType.MEMBER_CARD:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_MemberCard()
                        {
                            card_type = cardType.ToString(),
                            member_card = cardInfo as Card_MemberCardData
                        }
                    };
                    break;

                case CardType.SCENIC_TICKET:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_ScenicTicket()
                        {
                            card_type = cardType.ToString(),
                            scenic_ticket = cardInfo as Card_ScenicTicketData
                        }
                    };
                    break;

                case CardType.MOVIE_TICKET:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_MovieTicket()
                        {
                            card_type = cardType.ToString(),

                            movie_ticket = cardInfo as Card_MovieTicketData
                        }
                    };
                    break;

                case CardType.BOARDING_PASS:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_BoardingPass()
                        {
                            card_type = cardType.ToString(),
                            boarding_pass = cardInfo as Card_BoardingPassData
                        }
                    };
                    break;

                case CardType.LUCKY_MONEY:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_LuckyMoney()
                        {
                            card_type = cardType.ToString(),
                            lucky_money = cardInfo as Card_LuckyMoneyData
                        }
                    };
                    break;

                case CardType.MEETING_TICKET:
                    cardData = new CardCreateInfo()
                    {
                        card = new Card_MeetingTicket()
                        {
                            card_type = cardType.ToString(),
                            meeting_ticket = cardInfo as Card_MeetingTicketData
                        }
                    };
                    break;

                default:
                    break;
                }

                return CommonJsonSend.Send <CardCreateResultJson>(null, urlFormat, cardData, timeOut: timeOut);
            }, accessTokenOrAppId));
        }
예제 #30
0
        /// <summary>
        /// 获取所有货架
        /// </summary>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        public static GetAllShelfResult GetAllShelves(string accessToken)
        {
            var urlFormat = "https://api.weixin.qq.com/merchant/shelf/getall?access_token=ACCESS_TOKEN";

            return(CommonJsonSend.Send <GetAllShelfResult>(accessToken, urlFormat, null, CommonJsonSendType.GET));
        }