Exemple #1
0
        /// <summary>
        ///据订单状态/创建时间获取订单详情
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="status">订单状态(不带该字段-全部状态, 2-待发货, 3-已发货, 5-已完成, 8-维权中, )</param>
        /// <param name="begintime">订单创建时间起始时间(不带该字段则不按照时间做筛选)</param>
        /// <param name="endtime">订单创建时间终止时间(不带该字段则不按照时间做筛选)</param>
        /// <returns>订单详情,参见官方文档</returns>
        public static string GetByFilter(string access_token, int status, long begintime = 0, long endtime = 0)
        {
            var content = new StringBuilder();

            content.Append("{")
            .Append('"' + "status" + '"' + ": " + status);
            if (begintime > 0 || endtime > 0)
            {
                content.Append(",");
                if (begintime <= 0)
                {
                    begintime = NetnrCore.ToTimestamp(DateTime.MinValue);
                }
                if (endtime <= 0)
                {
                    endtime = NetnrCore.ToTimestamp(DateTime.Now);
                }
                content.Append('"' + "begintime" + '"' + ": " + begintime).Append(",");
                if (endtime <= 0)
                {
                    endtime = NetnrCore.ToTimestamp(DateTime.Now);
                }
                content.Append('"' + "endtime" + '"' + ": " + endtime);
            }
            content.Append("}");
            var result = NetnrCore.HttpTo.Post(string.Format("https://api.weixin.qq.com/merchant/order/getbyfilter?access_token={0}", access_token),
                                               content.ToString());

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 批量导入门店信息
        /// 接口说明
        ///支持商户调用该接口批量导入/新建门店信息,获取门店ID。
        ///注:通过该接口导入的门店信息将进入门店审核流程,审核期间可正常使用。若导入的
        ///门店信息未通过审核,则会被剔除出门店列表。
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="location_list">门店列表
        /// 数据示意:
        /// {"location_list":[
        ///{
        ///"business_name":"麦当劳",
        ///"branch_name":"赤岗店",
        ///"province":"广东省",
        ///"city":"广州市",
        ///"district":"海珠区",
        ///"address":"中国广东省广州市海珠区艺苑路11号",
        ///"telephone":"020-89772059",
        ///"category":"房产小区",
        ///"longitude":"115.32375",
        ///"latitude":"25.097486"
        ///},
        ///{
        ///"business_name":"麦当劳",
        ///"branch_name":"珠江店",
        ///"province":"广东省",
        ///"city":"广州市",
        ///"district":"海珠区",
        ///"address":"中国广东省广州市海珠区艺苑路12号",
        ///"telephone":"020-89772059",
        ///"category":"房产小区",
        ///"longitude":"113.32375",
        ///"latitude":"23.097486"
        ///}]}</param>
        /// <returns>
        /// {
        /// "errcode":0,
        /// "errmsg":"ok",
        /// "location_id_list":[271262077,-1]
        ///}
        ///其中location_id_list中的 -1 表示失败
        /// </returns>
        public static string BatchAdd(string access_token, object location_list)
        {
            var url    = string.Format("https://api.weixin.qq.com/card/location/batchadd?access_token={0}", access_token);
            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(location_list));

            return(result);
        }
Exemple #3
0
            /// <summary>
            /// 更新电影票
            /// 领取电影票后通过调用“更新电影票”接口update电影信息及用户选座信息。
            /// </summary>
            /// <param name="access_token"></param>
            /// <param name="tickect">
            /// {
            ///"code":"198374613512",
            ///"card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI",
            ///"passenger_name":"乘客姓名",//乘客姓名,上限为15个汉字。
            ///"class":"舱等",//舱等,如头等舱等,上限为5个汉字。
            ///"seat":"座位号",//乘客座位号。
            ///"etkt_bnr":"电子客票号",//电子客票号,上限为14个数字
            ///"qrcode_data":"二维码数据",//乘客用于值机的二维码字符串,微信会通过此数据为用户生成值机用的二维码。
            ///"is_cancel ":false//填写true或false。true代表取消,如填写true上述字段(如calss等)均不做判断,机票返回未值机状态,乘客可重新值机。默认填写false
            ///   }
            /// </param>
            /// <returns>
            /// {
            ///"errcode":0,
            ///"errmsg":"ok"
            ///}
            ///</returns>
            public static string CheckIn(string access_token, object tickect)
            {
                var url    = string.Format("https://api.weixin.qq.com/card/boardingpass/checkin?access_token={0}", access_token);
                var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(tickect));

                return(result);
            }
Exemple #4
0
        /// <summary>
        /// 创建卡券
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="card">
        /// 数据示意:
        /// {"card":{
        /// "card_type":"GROUPON",
        /// "groupon":{
        /// "base_info":{
        /// "logo_url":
        /// "http:\/\/www.supadmin.cn\/uploads\/allimg\/120216\/1_120216214725_1.jpg",
        /// "brand_name":"海底捞",
        /// "code_type":"CODE_TYPE_TEXT",
        /// "title":"132元双人火锅套餐",
        /// "sub_title":"",
        /// "color":"Color010",
        /// "notice":"使用时向服务员出示此券",
        /// "service_phone":"020-88888888",
        /// "description":"不可与其他优惠同享\n如需团购券发票,请在消费时向商户提出\n店内均可
        ///                使用,仅限堂食\n餐前不可打包,餐后未吃完,可打包\n本团购券不限人数,建议2人使用,超过建议人
        ///                数须另收酱料费5元/位\n本单谢绝自带酒水饮料",
        /// "date_info":{
        /// "type":1,
        /// "begin_timestamp":1397577600,
        /// "end_timestamp":1422724261
        /// },
        /// "sku":{
        /// "quantity":50000000
        /// },
        ///  "get_limit":3,
        /// "use_custom_code":false,
        /// "bind_openid":false,
        /// "can_share":true,
        /// "can_give_friend":true,
        /// "location_id_list": [123,12321,345345],
        /// "url_name_type":"URL_NAME_TYPE_RESERVATION",
        /// "custom_url":"http://www.qq.com",
        /// "source":"大众点评"
        ///   },
        /// "deal_detail":"以下锅底2选1(有菌王锅、麻辣锅、大骨锅、番茄锅、清补凉锅、酸菜鱼锅可
        /// 选):\n大锅1份12元\n小锅2份16元\n以下菜品2选1\n特级肥牛1份30元\n洞庭鮰鱼卷1份
        /// 20元\n其他\n鲜菇猪肉滑1份18元\n金针菇1份16元\n黑木耳1份9元\n娃娃菜1份8元\n冬
        /// 瓜1份6元\n火锅面2个6元\n欢乐畅饮2位12元\n自助酱料2位10元"}
        /// }
        /// }
        /// 具体参数意义,请参见官方文档。
        /// </param>
        /// <returns>
        /// {
        ///"errcode":0,
        ///"errmsg":"ok",
        ///"card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI"
        /// }</returns>
        public static string Create(string access_token, object card)
        {
            var url    = string.Format("https://api.weixin.qq.com/card/create?access_token={0}", access_token);
            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(card));

            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 设置测试用户白名单
        /// 由于卡券有审核要求,为方便公众号调试,可以设置一些测试帐号,这些帐号可领取未通过审核的卡券,体验整个流程。
        /// 注:同时支持“openid”、“username”两种字段设置白名单,总数上限为10个。
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="testwhitelist">
        /// {
        ///"openid":[ //测试的openid列表
        ///"o1Pj9jmZvwSyyyyyyBa4aULW2mA",
        ///"o1Pj9jmZvxxxxxxxxxULW2mA"
        ///],
        ///"username":[ //测试的微信号列表
        ///"afdvvf",
        ///"abcd"
        ///]
        ///}
        /// </param>
        /// <returns></returns>
        public static string Set(string access_token, object testwhitelist)
        {
            var url    = string.Format("https://api.weixin.qq.com/card/testwhitelist/set?access_token={0}", access_token);
            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(testwhitelist));

            return(result);
        }
Exemple #6
0
        /// <summary>
        /// 创建二维码
        /// 创建卡券后,商户可通过接口生成一张卡券二维码供用户扫码后添加卡券到卡包。
        ///自定义code的卡券调用接口时,post数据中需指定code,非自定义code不需指定,
        ///指定openid同理。指定后的二维码只能被扫描领取一次。
        ///
        /// 获取二维码ticket后,开发者可用ticket换取二维码图片详情
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="action">
        /// 数据示意:
        /// {
        /// "action_name":"QR_CARD",
        /// "action_info":{
        /// "card":{
        /// "card_id":"pFS7Fjg8kV1IdDz01r4SQwMkuCKc",
        /// "code":"198374613512",
        /// "openid":"oFS7Fjl0WsZ9AMZqrI80nbIq8xrA",
        /// "expire_seconds":"1800",
        /// "is_unique_code":false,
        /// "outer_id": 1
        /// }
        /// }
        /// }</param>
        /// <returns>二维码图片地址</returns>
        public static string Create(string access_token, object action)
        {
            var url    = string.Format("https://api.weixin.qq.com/card/qrcode/create?access_token={0}", access_token);
            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(action));
            var ticket = JObject.Parse(result)["ticket"].ToString();

            return(string.Format("https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={0}", ticket));
        }
Exemple #7
0
        /// <summary>
        /// 更新电影票
        /// 领取电影票后通过调用“更新电影票”接口update电影信息及用户选座信息。
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="tickect">
        /// {
        ///"code": "277217129962",
        ///"card_id":"p1Pj9jr90_SQRaVqYI239Ka1erkI",
        ///"ticket_class":"4D",
        ///"show_time":1408493192,
        ///"duration":120,
        ///"screening_room":"5号影厅",
        ///"seat_number":["5排14号", "5排15号"]
        ///   }
        /// </param>
        /// <returns>
        /// {
        ///"errcode":0,
        ///"errmsg":"ok"
        ///}
        ///</returns>
        public static string UpdateUser(string access_token, object tickect)
        {
            var url = string.Format("https://api.weixin.qq.com/card/movieticket/updateuser?access_token={0}", access_token);

            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(tickect));

            return(result);
        }
Exemple #8
0
        /// <summary>
        /// 激活/绑定会员卡支持以下两种方式:
        ///1.用户点击卡券内“bind_old_card_url”、“activate_url”跳转商户自定义的H5页面,填写相关身份认证信息后,商户调用接口,完成激活/绑定。
        ///2.商户已知用户身份或无需进行绑定等操作,用户领取会员卡后,商户后台即时调用“激活/绑定会员卡”接口update会员卡编号及积分信息。
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="memeber_card">
        /// {
        ///"init_bonus": 100,
        ///"init_balance": 200,
        ///"membership_number": "AAA00000001",
        ///"code":"12312313",
        ///"card_id":"xxxx_card_id"
        ///}
        ///或
        ///{
        ///"bonus": “www.xxxx.com”,
        ///"balance":“www.xxxx.com”,
        ///"membership_number": "AAA00000001",
        ///"code":"12312313",
        ///"card_id":"xxxx_card_id"
        ///}
        /// </param>
        /// <returns>
        /// {
        ///"errcode":0,
        ///"errmsg":"ok"
        ///}
        ///</returns>
        public static string Activate(string access_token, object memeber_card)
        {
            var url = string.Format("https://api.weixin.qq.com/card/membercard/activate?access_token={0}", access_token);

            var result = NetnrCore.HttpTo.Post(url, NetnrCore.ToJson(memeber_card));

            return(result);
        }
Exemple #9
0
        /// <summary>
        /// 修改分组商品
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="group_id"></param>
        /// <param name="product">分组商品信息, 数据示例:
        /// [
        /// {
        ///     "product_id": "pDF3iY-CgqlAL3k8Ilz-6sj0UYpk",
        ///     "mod_action": 1
        /// },
        /// {
        ///     "product_id": "pDF3iY-RewlAL3k8Ilz-6sjsepp9",
        ///     "mod_action": 0
        /// },
        /// ]
        /// </param>
        /// <returns>
        /// {
        ///  "errcode":0,
        /// "errmsg":"success"
        /// }
        /// </returns>
        public static string ProductMod(string access_token, int group_id, object product)
        {
            var content = new StringBuilder();

            content.Append("{")
            .Append('"' + "group_id" + '"' + ": " + group_id).Append(",")
            .Append('"' + "product" + '"' + ": ").Append(NetnrCore.ToJson(product))
            .Append("}");
            var result = NetnrCore.HttpTo.Post(string.Format("https://api.weixin.qq.com/merchant/group/productmod?access_token={0}", access_token), content.ToString());

            return(result);
        }
Exemple #10
0
        /// <summary>
        /// 修改邮费模板
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="template_id">邮费模板ID</param>
        /// <param name="delivery_template">邮费模板信息(字段说明详见增加邮费模板)</param>
        /// <returns>
        /// {
        /// "errcode": 0,
        ///"errmsg": "success"
        ///}
        /// </returns>
        public static string Del(string access_token, int template_id, object delivery_template)
        {
            var content = new StringBuilder();

            content.Append("{")
            .Append('"' + "template_id" + '"' + ": " + template_id).Append(",")
            .Append('"' + "delivery_template" + '"' + ": ").Append(NetnrCore.ToJson(delivery_template))
            .Append("}");
            var result = NetnrCore.HttpTo.Post(string.Format("https://api.weixin.qq.com/merchant/express/del?access_token={0}", access_token), content.ToString());

            return(result);
        }
Exemple #11
0
        /// <summary>
        /// 修改货架
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="shelf_id">货架ID</param>
        /// <param name="shelf_data">货架详情(字段说明详见增加货架)</param>
        /// <param name="shelf_banner">货架banner(图片需调用图片上传接口获得图片Url填写至此,否则修改货架失败)</param>
        /// <param name="shelf_name">货架名称</param>
        /// <returns>
        /// {
        /// "errcode":0,
        ///"errmsg":"success"
        ///}
        /// </returns>
        public static string Mod(string access_token, int shelf_id, object shelf_data, string shelf_banner, string shelf_name)
        {
            var content = new StringBuilder();

            content.Append("{")
            .Append('"' + "shelf_id" + '"' + ": " + shelf_id).Append(",")
            .Append('"' + "shelf_data" + '"' + ": " + NetnrCore.ToJson(shelf_data)).Append(",")
            .Append('"' + "shelf_banner" + '"' + ": " + '"' + shelf_banner + '"').Append(",")
            .Append('"' + "shelf_name" + '"' + ": " + '"' + shelf_name + '"')
            .Append("}");
            var result = NetnrCore.HttpTo.Post(string.Format("https://api.weixin.qq.com/merchant/shelf/mod?access_token={0}", access_token), content.ToString());

            return(result);
        }
Exemple #12
0
        /// <summary>
        /// 修改商品
        ///
        /// 备注:
        /// 1.product_id表示要更新的商品的ID,其他字段说明请参考增加商品接口。
        ///2.从未上架的商品所有信息均可修改,否则商品的名称(name)、商品分类(category)、商品属性(property)这三个字段不可修改。
        /// </summary>
        /// <param name="access_token"></param>
        /// <param name="content"></param>
        /// <returns>
        /// {
        /// "errcode":0,
        /// "errmsg":"success"
        /// }
        /// </returns>
        public static string Update(string access_token, object content)
        {
            var result = NetnrCore.HttpTo.Post(string.Format("https://api.weixin.qq.com/merchant/update?access_token={0}", access_token), NetnrCore.ToJson(content));

            return(result);
        }