| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc.Controllers;
- using Microsoft.AspNetCore.Mvc.Filters;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using dodohold.core;
- using Dataoke;
- using System.Text.RegularExpressions;
- using Org.BouncyCastle.Ocsp;
- using System.Diagnostics;
- using TencentCloud.Fmu.V20191213.Models;
- using Microsoft.VisualBasic;
- using System.Text.Json;
- using static System.Runtime.InteropServices.JavaScript.JSType;
- using System.Security.Cryptography;
- using System.Security.Policy;
- using Google.Protobuf.WellKnownTypes;
- using Microsoft.AspNetCore.Components;
- using Org.BouncyCastle.Pqc.Crypto.Ntru;
- using Newtonsoft.Json;
- namespace molilian.core
- {
- public partial class JdUnionPlus
- {
- /// <summary>
- /// 网站/APP获取推广链接接口
- /// </summary>
- /// <param name="unionId"></param>
- /// <param name="materialId"></param>
- /// <returns></returns>
- public string promotion_get(string siteId, string materialId)
- {
- string method = "jd.union.open.promotion.common.get";
- string version = "1.0";
- var data = new
- {
- promotionCodeReq = new
- {
- siteId,
- materialId,
- command = 1,
- chainType = 2,
- }
- };
- var body = Request(method, version, data.Convert2Json());
- var root = body.Convert2Object<JdUnionResponse>();
- string code = root.jd_union_open_promotion_common_get_responce.code;
- if ("0".Equals(code))
- {
- var _promotion_data = root.jd_union_open_promotion_common_get_responce.getResult;
- var promotion_data = _promotion_data.Convert2Object<JdData>();
- if (promotion_data.code == 200)
- {
- var url = promotion_data.data.clickURL;
- return url;
- }
- }
- _ = new LoggerLibrary("JdUnion", "promotion_get_error").Info(body).SaveAsync();
- return null;
- }
- public async Task<string> GetPromotionAsync(string siteId, string materialId)
- {
- string method = "jd.union.open.promotion.common.get";
- string version = "1.0";
- var data = new
- {
- promotionCodeReq = new
- {
- siteId,
- materialId,
- command = 1,
- chainType = 2,
- }
- };
- var body = await RequestAsync(method, version, data.Convert2Json());
- var root = body.Convert2Object<JdUnionResponse>();
- string code = root.jd_union_open_promotion_common_get_responce.code;
- if ("0".Equals(code))
- {
- var _promotion_data = root.jd_union_open_promotion_common_get_responce.getResult;
- var promotion_data = _promotion_data.Convert2Object<JdData>();
- if (promotion_data.code == 200)
- {
- var url = promotion_data.data.clickURL;
- return url;
- }
- }
- _ = new LoggerLibrary("JdUnion", "promotion_get_error").Info(body).SaveAsync();
- return null;
- }
- }
- public class JdData
- {
- public int code { get; set; }
- public JdClickData data { get; set; }
- }
- public class JdClickData
- {
- public string clickURL { get; set; }
- }
- public class JdUnionResponse
- {
- public JdUnionOpenPromotionCommonGetResponce jd_union_open_promotion_common_get_responce { get; set; }
- }
- public class JdUnionOpenPromotionCommonGetResponce
- {
- public string code { get; set; }
- public string getResult { get; set; }
- public string message { get; set; }
- public string requestId { get; set; }
- }
- }
|