tijian_tieying/web/dccdc/Common/Deepleo.Weixin.SDK/Card/Special/AirTickectAPI.cs
2025-02-20 12:14:39 +08:00

58 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Http;
using Codeplex.Data;
namespace Deepleo.Weixin.SDK.Card.Special
{
/// <summary>
/// 特殊卡票接口=> 飞机票
/// 飞机票与其他卡券相比具有更强的时效性和特殊性,故机票生成后无需经过微信审核,即时生效。
/// 机票使用场景主要分为以下两种:
/// 1、通过微信购买后直接添加至卡包可值机时段由卡包在线办理登机牌。
/// 2、在微信商户一般为航空公司公众号内完成值机后添加至微信卡包。
/// 第一种场景用户点击商户H5页面“添加至卡包”的JSAPI2.2添加到卡包JSAPI商户根据用户机票信息调用接口创建卡券1.1创建卡券接口获取card_id后
/// 将机票下发给用户。在可值机时段用户点击商户指定的URL在线办理登机牌。办理成功后商户调用选座接口6.3.1在线选座接口),将值机信息同步。
/// 第二种场景用户点击商户H5页面提供的JSAPI2.2添加到卡包JSAPI商户根据用户机票信息调用接口生成卡券1.1创建卡券接口获取card_id后将机票下发
/// 给用户。并立即调用选座接口6.3.1.在线选座接口),将值机信息同步。
/// </summary>
public class AirTickectAPI
{
/// <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 dynamic CheckinBoardingPass(string access_token, dynamic tickect)
{
var url = string.Format("https://api.weixin.qq.com/card/boardingpass/checkin?access_token={0}", access_token);
var client = new HttpClient();
var result = client.PostAsync(url, new StringContent(DynamicJson.Serialize(tickect))).Result;
if (result.IsSuccessStatusCode) return string.Empty;
return DynamicJson.Parse(result.Content.ReadAsStringAsync().Result);
}
}
}