diff --git a/New_College.Api/Controllers/Front/CustomerController.cs b/New_College.Api/Controllers/Front/CustomerController.cs index 00c3ee7..d6b00c0 100644 --- a/New_College.Api/Controllers/Front/CustomerController.cs +++ b/New_College.Api/Controllers/Front/CustomerController.cs @@ -200,9 +200,12 @@ namespace New_College.Api.Controllers.Front { try { - - await DistrFanc(request.SaleId, customerinfo.Id); + Task.Run(async () => + { + await DistrFanc(request.SaleId, customerinfo.Id); + }); newId = await updatesync(customerinfo.Phone); + } catch (Exception ex) { @@ -383,7 +386,11 @@ namespace New_College.Api.Controllers.Front { if (query.Score != customersingle.Expectedscore) { - await _userSetting.UpdateSingleCustomerSetting(new UserBaseSettingUpdateDTO() { UType = 0, CustomerId = query.StudentId });//修改参数次数 + Task.Run(async () => + { + await _userSetting.UpdateSingleCustomerSetting(new UserBaseSettingUpdateDTO() { UType = 0, CustomerId = query.StudentId });//修改参数次数 + + }); } var token = JwtHelper.IssueJwt(new TokenModelJwt() { Uid = result.Id, Role = "学生" }); result.Token = token; diff --git a/New_College.Api/Controllers/Front/XETongController.cs b/New_College.Api/Controllers/Front/XETongController.cs new file mode 100644 index 0000000..4175f13 --- /dev/null +++ b/New_College.Api/Controllers/Front/XETongController.cs @@ -0,0 +1,78 @@ +using Microsoft.AspNetCore.Mvc; +using New_College.Model.ViewModels; +using New_College.Model; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Text.Json; +using System.Xml.Linq; +using System; +using System.IO; + +namespace New_College.Api.Controllers +{ + + /// + /// 小鹅通 + /// + [Route("api/front/[controller]/[action]")] + [ApiController] + public class XETongController : ControllerBase + { + + public XETongController() + { + } + + + + /// + /// 回调 + /// + /// + /// + [HttpPost] + public async Task> hooks() + { + using (var reader = new StreamReader(Request.Body)) + { + try + { + var builder = reader.ReadToEnd(); + if (string.IsNullOrEmpty(builder.ToString())) { return new MessageModel() { response = "XML data is empty or not provided.", success = true, msg = "ok" }; } + // 使用XDocument解析XML字符串 + XDocument xdoc = XDocument.Parse(builder.ToString()); + // 访问XML元素 + var encryptElement = xdoc.Root.Element("Encrypt"); + var encryptValue = encryptElement?.Value; + var msgSignatureElement = xdoc.Root.Element("MsgSignature"); + var msgSignatureValue = msgSignatureElement?.Value; + var timeStampElement = xdoc.Root.Element("TimeStamp"); + var timeStampValue = timeStampElement?.Value; + var nonceElement = xdoc.Root.Element("Nonce"); + var nonceValue = nonceElement?.Value; // 这里可以根据需要处理解析后的数据,例如保存到数据库或进行其他业务逻辑处理 + + + + + + return new MessageModel() + { + msg = "ok", + response = "ok", + success = true, + }; + } + catch (Exception ex) + { + return new MessageModel() + { + response = ex.Message, + msg = "ok" + }; + } + } + + + } + } +} diff --git a/New_College.Api/New_College.Api.csproj b/New_College.Api/New_College.Api.csproj index f22d5ce..ba3c7fb 100644 --- a/New_College.Api/New_College.Api.csproj +++ b/New_College.Api/New_College.Api.csproj @@ -14,11 +14,13 @@ ..\New_College.Api\New_College.xml 1701;1702;1591 + True ..\New_College\New_College.xml 1701;1702;1591 + False @@ -109,6 +111,10 @@ + + + + diff --git a/New_College.Api/New_College.xml b/New_College.Api/New_College.xml index 70c28bd..0dae566 100644 --- a/New_College.Api/New_College.xml +++ b/New_College.Api/New_College.xml @@ -1099,6 +1099,18 @@ + + + 小鹅通 + + + + + 回调 + + + + 省市区操作类 diff --git a/New_College.Api/Startup.cs b/New_College.Api/Startup.cs index bd26012..8d89cb5 100644 --- a/New_College.Api/Startup.cs +++ b/New_College.Api/Startup.cs @@ -15,8 +15,6 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using System.Reflection; using New_College.Model.ViewModels; @@ -91,6 +89,11 @@ namespace New_College ThridConfig.secretKey = Appsettings.app(new string[] { "ThridConfig", "secretKey" }); ThridConfig.Url = Appsettings.app(new string[] { "ThridConfig", "Url" }); + //小鹅通 + XIAOETongConfig.app_id = Appsettings.app(new string[] { "XiaoETONG", "app_id" }); + XIAOETongConfig.client_id = Appsettings.app(new string[] { "XiaoETONG", "client_id" }); + XIAOETongConfig.secret_key = Appsettings.app(new string[] { "XiaoETONG", "secret_key" }); + XIAOETongConfig.base_url = Appsettings.app(new string[] { "XiaoETONG", "basurl" }); services.AddMemoryCacheSetup(); services.AddSqlsugarSetup(); diff --git a/New_College.Api/appsettings.Development.json b/New_College.Api/appsettings.Development.json index 9a424da..d067e2a 100644 --- a/New_College.Api/appsettings.Development.json +++ b/New_College.Api/appsettings.Development.json @@ -252,6 +252,12 @@ "SHanDongTel": { "Tel": "15662627992|18724728603|17362186261|15264182912" + }, + "XiaoETONG": { + "app_id": "appn9m3yups9098", + "client_id": "xopvGAr405P6261", + "secret_key": "AeHT1p4GzDYZuaBLZYOBa0r2Npp22uWv", + "basurl": "https://api.xiaoe-tech.com/" } } diff --git a/New_College.Api/appsettings.json b/New_College.Api/appsettings.json index bd08faa..1171ef7 100644 --- a/New_College.Api/appsettings.json +++ b/New_College.Api/appsettings.json @@ -247,6 +247,11 @@ }, "SHanDongTel": { "Tel": "15662627992|18724728603|17362186261|15264182912" - + }, + "XiaoETONG": { + "app_id": "appn9m3yups9098", + "client_id": "xopvGAr405P6261", + "secret_key": "AeHT1p4GzDYZuaBLZYOBa0r2Npp22uWv", + "basurl": "https://api.xiaoe-tech.com/" } } diff --git a/New_College.Common/GlobalVar/XIAOETongConfig.cs b/New_College.Common/GlobalVar/XIAOETongConfig.cs new file mode 100644 index 0000000..9513adf --- /dev/null +++ b/New_College.Common/GlobalVar/XIAOETongConfig.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Common +{ + public class XIAOETongConfig + { + /// + /// + /// + public static string app_id { get; set; } + + + /// + /// + /// + public static string client_id { get; set; } + + /// + /// + /// + public static string secret_key { get; set; } + + /// + /// + /// + public static string grant_type { get; set; } + + + /// + /// + /// + public static string base_url { get; set; } + + } +} diff --git a/New_College.Common/Helper/ModelToUrIHelper.cs b/New_College.Common/Helper/ModelToUrIHelper.cs new file mode 100644 index 0000000..9266ce4 --- /dev/null +++ b/New_College.Common/Helper/ModelToUrIHelper.cs @@ -0,0 +1,34 @@ +using System.Web; +using System.Reflection; +using System.Text; +namespace New_College.Common.Helper +{ + public static class ModelToUrIHelper + { + /// + /// Model对象转换为uri网址参数形式 + /// + /// Model对象 + /// 前部分网址 + /// + public static string ModelToUriParam(this object obj, string url = "") + { + PropertyInfo[] propertis = obj.GetType().GetProperties(); + StringBuilder sb = new StringBuilder(); + sb.Append(url); + //sb.Append("?"); + foreach (var p in propertis) + { + var v = p.GetValue(obj, null); + if (v == null) + continue; + sb.Append(p.Name); + sb.Append("="); + sb.Append(HttpUtility.UrlEncode(v.ToString())); + sb.Append("&"); + } + sb.Remove(sb.Length - 1, 1); + return sb.ToString(); + } + } +} diff --git a/New_College.Common/Helper/RSAHelper.cs b/New_College.Common/Helper/RSAHelper.cs new file mode 100644 index 0000000..13d7da2 --- /dev/null +++ b/New_College.Common/Helper/RSAHelper.cs @@ -0,0 +1,72 @@ +using MathNet.Numerics.Random; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Common +{ + /// + /// aes解密 + /// + public static class RSAHelper + { + /// + ///aes解密 + /// + /// + /// + /// + /// + public static string AESDecrypt(string text, string AesKey, string AesIV) + { + try + { + + //判断是否是16位 如果不够补0 + //text = tests(text); + //16进制数据转换成byte + byte[] encryptedData = Convert.FromBase64String(text); // strToToHexByte(text); + RijndaelManaged rijndaelCipher = new RijndaelManaged(); + rijndaelCipher.Key = Convert.FromBase64String(AesKey); // Encoding.UTF8.GetBytes(AesKey); + rijndaelCipher.IV = Convert.FromBase64String(AesIV);// Encoding.UTF8.GetBytes(AesIV); + rijndaelCipher.Mode = CipherMode.CBC; + rijndaelCipher.Padding = PaddingMode.PKCS7; + ICryptoTransform transform = rijndaelCipher.CreateDecryptor(); + byte[] plainText = transform.TransformFinalBlock(encryptedData, 0, encryptedData.Length); + string result = Encoding.Default.GetString(plainText); + //int index = result.LastIndexOf('>'); + //result = result.Remove(index + 1); + return result; + } + catch (Exception ex) + { + return null; + + } + } + + + + /// + ///获取随机数 + /// + /// + public static string GetRandomStr() + { + const string baseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + Random random = new Random(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 16; i++) + { + int index = random.Next(baseChars.Length); + sb.Append(baseChars[index]); + } + return sb.ToString(); + } + + } +} diff --git a/New_College.Common/XiaoETong/ETongModel.cs b/New_College.Common/XiaoETong/ETongModel.cs new file mode 100644 index 0000000..28dccf3 --- /dev/null +++ b/New_College.Common/XiaoETong/ETongModel.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College +{ + public class ETongModel + { + + + } + + public class app_token + { + + /// + /// + /// + public string app_id { get; set; } + + + /// + /// + /// + public string client_id { get; set; } + + /// + /// + /// + public string secret_key { get; set; } + + /// + /// + /// + public string grant_type { get; set; } + + + + } + + + + public class app_response + { + public int code { get; set; } + public string msg { get; set; } + public Data data { get; set; } + } + + public class Data + { + public string access_token { get; set; } + public int expires_in { get; set; } + } + + + + + + public class usersobject + { + public int code { get; set; } + public string msg { get; set; } + public userData data { get; set; } + } + + public class userData + { + public uList[] list { get; set; } + public int total { get; set; } + } + + public class uList + { + public string avatar { get; set; } + public string bind_phone { get; set; } + public string collect_phone { get; set; } + public string from { get; set; } + public int pay_sum { get; set; } + public int punch_count { get; set; } + public string user_created_at { get; set; } + public string user_id { get; set; } + public string user_nickname { get; set; } + public string wx_app_open_id { get; set; } + public string wx_open_id { get; set; } + public string wx_union_id { get; set; } + } + + + + + + public class UserRequest + { + /// + /// + /// + public string access_token { get; set; } + public int page { get; set; } + public int page_size { get; set; } + public string phone { get; set; } + } + + + + + +} diff --git a/New_College.Common/XiaoETong/XETOrders.cs b/New_College.Common/XiaoETong/XETOrders.cs new file mode 100644 index 0000000..26e9238 --- /dev/null +++ b/New_College.Common/XiaoETong/XETOrders.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College +{ + + + + + public class XETOrdersRequest + { + public string access_token { get; set; } + public int page { get; set; } + public int page_size { get; set; } + public string user_id { get; set; } + + + } + + public class XETOrdersResponse + { + + public int code { get; set; } + public string msg { get; set; } + public XETOrdersData data { get; set; } + + } + + + + public class XETOrdersData + { + public List list { get; set; } + public int page { get; set; } + public int page_size { get; set; } + public int total { get; set; } + } + + public class OrderItem + { + public Buyer_Info buyer_info { get; set; } + public Good_List[] good_list { get; set; } + public Order_Info order_info { get; set; } + public Payment_Info payment_info { get; set; } + public Price_Info price_info { get; set; } + public Ship_Info ship_info { get; set; } + } + + public class Buyer_Info + { + public string avatar_url { get; set; } + public string comment { get; set; } + public string nickname { get; set; } + public string phone_number { get; set; } + } + + public class Order_Info + { + public int?[] activity_type_bitmap { get; set; } + public int actual_fee { get; set; } + public int aftersale_show_state { get; set; } + public string aftersale_show_state_time { get; set; } + public string app_id { get; set; } + public string channel_bus_id { get; set; } + public int channel_type { get; set; } + public int check_state { get; set; } + public string created_time { get; set; } + public int deduct_amount { get; set; } + public int discount_amount { get; set; } + public object[] distribute_type_bitmap { get; set; } + public int freight_actual_price { get; set; } + public int freight_original_price { get; set; } + public int goods_buy_num { get; set; } + public string goods_name { get; set; } + public int goods_original_total_price { get; set; } + public string goods_spu_sub_type { get; set; } + public int goods_spu_type { get; set; } + public int modified_amount { get; set; } + public int order_close_type { get; set; } + public string order_id { get; set; } + public int order_state { get; set; } + public string order_state_time { get; set; } + public int order_type { get; set; } + public int pay_state { get; set; } + public string pay_state_time { get; set; } + public int pay_type { get; set; } + public int refund_fee { get; set; } + public string refund_time { get; set; } + public string relation_order_appid { get; set; } + public string relation_order_id { get; set; } + public int relation_order_type { get; set; } + public int settle_state { get; set; } + public string settle_state_time { get; set; } + public int share_type { get; set; } + public string share_user_id { get; set; } + public int ship_way_choose_type { get; set; } + public int sub_order_type { get; set; } + public string trade_id { get; set; } + public string update_time { get; set; } + public int use_collection { get; set; } + public string user_id { get; set; } + public int wx_app_type { get; set; } + } + + public class Payment_Info + { + public string out_order_id { get; set; } + public string third_order_id { get; set; } + } + + public class Price_Info + { + public int actual_price { get; set; } + public int freight_modified_price { get; set; } + public int freight_price { get; set; } + public int origin_price { get; set; } + public int total_modified_amount { get; set; } + public int total_price { get; set; } + } + + public class Ship_Info + { + public string city { get; set; } + public string company { get; set; } + public string confirm_time { get; set; } + public string county { get; set; } + public string detail { get; set; } + public string express_id { get; set; } + public string invalid_time { get; set; } + public string phone { get; set; } + public string province { get; set; } + public string receiver { get; set; } + public string remark { get; set; } + public string ship_time { get; set; } + public string user_id { get; set; } + } + + public class Good_List + { + public int buy_num { get; set; } + public int check_state { get; set; } + public Discounts_Info discounts_info { get; set; } + public string expire_desc { get; set; } + public string expire_end { get; set; } + public string expire_start { get; set; } + public string goods_desc { get; set; } + public string goods_image { get; set; } + public string goods_name { get; set; } + public string goods_sn { get; set; } + public string goods_spec_desc { get; set; } + public int period_type { get; set; } + public int refund_state { get; set; } + public string refund_state_desc { get; set; } + public string relation_goods_id { get; set; } + public int relation_goods_type { get; set; } + public string relation_goods_type_desc { get; set; } + public string resource_id { get; set; } + public int resource_type { get; set; } + public int ship_state { get; set; } + public string ship_state_desc { get; set; } + public string sku_id { get; set; } + public string sku_spec_code { get; set; } + public string spu_id { get; set; } + public string spu_type { get; set; } + public int total_price { get; set; } + public int unit_price { get; set; } + } + + public class Discounts_Info + { + public int discount_amount_total { get; set; } + public int discount_count { get; set; } + public object[] discount_detail { get; set; } + } + + + +} diff --git a/New_College.Common/XiaoETong/XiaoEtongApp.cs b/New_College.Common/XiaoETong/XiaoEtongApp.cs new file mode 100644 index 0000000..4dcd6ee --- /dev/null +++ b/New_College.Common/XiaoETong/XiaoEtongApp.cs @@ -0,0 +1,71 @@ +using New_College.Common; +using New_College.Common.Helper; +using New_College.Common.HttpRestSharp; +using NPOI.POIFS.Crypt; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College +{ + + /// + /// + /// + public class XiaoEtongApp + { + /// + /// 获取token + /// + /// + public static app_response xetong_token() + { + var request = new app_token() + { + app_id = XIAOETongConfig.app_id, + client_id = XIAOETongConfig.client_id, + secret_key = XIAOETongConfig.secret_key, + grant_type = "client_credential" + }; + var result = HttpHelper.GetApi(XIAOETongConfig.base_url, "token", ModelToUrIHelper.ModelToUriParam(request)); + return result; + } + + + /// + /// 获取用户列表 + /// + /// + /// + public static usersobject GetUsersList(UserRequest request) + { + var access_token = xetong_token().data.access_token; + request.access_token = access_token; + var result = HttpHelper.PostApi(XIAOETongConfig.base_url + "xe.user.batch.get/1.0.0", request); + return result; + } + + + + /// + /// 获取用户订单列表 + /// + /// + /// + public static XETOrdersResponse GetOrdersList(XETOrdersRequest request) + { + var access_token = xetong_token().data.access_token; + request.access_token = access_token; + var result = HttpHelper.PostApi(XIAOETongConfig.base_url + "xe.ecommerce.order.list/1.0.0", request); + return result; + + } + + + + + + } +} diff --git a/New_College.Model/Models/D_XiaoETONGModel.cs b/New_College.Model/Models/D_XiaoETONGModel.cs new file mode 100644 index 0000000..0df31e6 --- /dev/null +++ b/New_College.Model/Models/D_XiaoETONGModel.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Model.Models +{ + public class D_XiaoEtongUser: RootEntity + { + public string avatar { get; set; } + public string bind_phone { get; set; } + public string collect_phone { get; set; } + public string from { get; set; } + public int pay_sum { get; set; } + public int punch_count { get; set; } + public string user_created_at { get; set; } + public string user_id { get; set; } + public string user_nickname { get; set; } + public string wx_app_open_id { get; set; } + public string wx_open_id { get; set; } + public string wx_union_id { get; set; } + } +} diff --git a/New_College.Repository/BASE/D_XiaoEtongUserRepository.cs b/New_College.Repository/BASE/D_XiaoEtongUserRepository.cs new file mode 100644 index 0000000..3b78d0f --- /dev/null +++ b/New_College.Repository/BASE/D_XiaoEtongUserRepository.cs @@ -0,0 +1,21 @@ +using New_College.IRepository.UnitOfWork; +using New_College.IRepository; +using New_College.Model.Models; +using New_College.Repository.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Repository +{ + public class D_XiaoEtongUserRepository : BaseRepository, ID_XiaoEtongUserRepository + { + public D_XiaoEtongUserRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + + + } + } +} diff --git a/New_College.Repository/BASE/ID_XiaoEtongUser.cs b/New_College.Repository/BASE/ID_XiaoEtongUser.cs new file mode 100644 index 0000000..6ba1f79 --- /dev/null +++ b/New_College.Repository/BASE/ID_XiaoEtongUser.cs @@ -0,0 +1,22 @@ +using New_College.IRepository.Base; +using New_College.Model.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace New_College.Repository +{ + + /// + /// + /// + public interface ID_XiaoEtongUserRepository : IBaseRepository + { + + + + + } +} diff --git a/New_College.Services/V_CustomerInfoServices.cs b/New_College.Services/V_CustomerInfoServices.cs index 47f3dbf..8596b3c 100644 --- a/New_College.Services/V_CustomerInfoServices.cs +++ b/New_College.Services/V_CustomerInfoServices.cs @@ -6,7 +6,6 @@ using New_College.IRepository.Base; using New_College.Model.ViewModels; using System.Threading.Tasks; using New_College.Common; -using static New_College.Common.AliyunSmsSender; using System; using System.Collections.Generic; using System.Linq; @@ -15,12 +14,10 @@ using New_College.Model; using LinqKit; using New_College.Model.Request; using New_College.IRepository; -using NPOI.SS.Formula.Functions; -using System.Net.Http; -using System.Text; using Newtonsoft.Json; using New_College.Common.HttpRestSharp; -using System.Data.Entity; +using StackExchange.Profiling.Internal; +using New_College.Repository; namespace New_College.Services { @@ -30,13 +27,15 @@ namespace New_College.Services private readonly IT_BatchlineRepository t_BatchlineRepository; private readonly ICasdoorUserRepository _casdoorUserRepository; private readonly ID_UserSettingBaseServices _userSetting; - public V_CustomerInfoServices(IBaseRepository dal, IT_BatchlineRepository t_Batchline, ICasdoorUserRepository casdoorUserRepository, ID_UserSettingBaseServices userSetting) + private readonly ID_XiaoEtongUserRepository _XiaoEtongUserRepository; + public V_CustomerInfoServices(IBaseRepository dal, IT_BatchlineRepository t_Batchline, ICasdoorUserRepository casdoorUserRepository, ID_UserSettingBaseServices userSetting, ID_XiaoEtongUserRepository d_XiaoEtongUserRepository) { this._dal = dal; base.BaseDal = dal; t_BatchlineRepository = t_Batchline; _casdoorUserRepository = casdoorUserRepository; _userSetting = userSetting; + _XiaoEtongUserRepository = d_XiaoEtongUserRepository; } @@ -322,6 +321,61 @@ namespace New_College.Services return new MessageModel() { success = false, msg = "获取失败,用户信息为空" }; var years = info.Year > 2023 ? 2023 : info.Year; var batchlist = await t_BatchlineRepository.Query(c => c.Year == years && c.AreaName == info.AreaName && c.Type_name == "综合"); + if (!string.IsNullOrWhiteSpace(info.Phone)) + { + Task.Run(async () => + { + var xet = XiaoEtongApp.GetUsersList(new UserRequest() + { + phone = info.Phone, + page = 1, + page_size = 1, + }); + if (xet.data.list != null && xet.data.list.Count() > 0) + { + var xiaoetong = (await _XiaoEtongUserRepository.Query(e => e.bind_phone == info.Phone)); + if (!xiaoetong.Any()) + { + await _XiaoEtongUserRepository.Add(new D_XiaoEtongUser() + { + avatar = xet.data.list.First().avatar, + bind_phone = xet.data.list.First().bind_phone, + collect_phone = xet.data.list.First().collect_phone, + CreateBy = "system", + CreateTime = DateTime.Now, + from = xet.data.list.First().from, + IsDelete = false, + ModifyBy = "system", + ModifyTime = DateTime.Now, + OrderSort = 0, + pay_sum = xet.data.list.First().pay_sum, + punch_count = xet.data.list.First().punch_count, + user_created_at = xet.data.list.First().user_created_at, + user_nickname = xet.data.list.First().user_nickname, + wx_app_open_id = xet.data.list.First().wx_app_open_id, + wx_open_id = xet.data.list.First().wx_open_id, + wx_union_id = xet.data.list.First().wx_union_id, + user_id = xet.data.list.First().user_id + }); + var orders = XiaoEtongApp.GetOrdersList(new XETOrdersRequest() + { + page = 1, + page_size = 30, + user_id = xet.data.list.First().user_id + }); + if (orders.data.list.Any() && orders.data.list.Count() > 0 && !info.IsVIP) + { + var isvip = orders.data.list.Select(c => c.order_info).Where(e => e.activity_type_bitmap.Contains(11)); + info.IsVIP = isvip.Count() > 0 ? true : false; + info.ModifyTime = DateTime.Now; + + await _dal.Update(info); + + } + } + } + }); + } return new MessageModel() { diff --git a/New_Spider/Program.cs b/New_Spider/Program.cs index f5c379c..1598caa 100644 --- a/New_Spider/Program.cs +++ b/New_Spider/Program.cs @@ -1,5 +1,6 @@  using HtmlAgilityPack; +using New_College.Common.Helper; using New_Spider; using System.Text.RegularExpressions; @@ -9,10 +10,19 @@ using System.Text.RegularExpressions; //HtmlAgMajorHelper agMajorHelper = new HtmlAgMajorHelper(); //agMajorHelper.DownloadTypeListFile(); //agMajorHelper.DownloadChildTypeListFile(); -HtmlAgNewsHelper agNewsHelper = new HtmlAgNewsHelper(); +//HtmlAgNewsHelper agNewsHelper = new HtmlAgNewsHelper(); //agNewsHelper.HtmlCreatePageData(); -agNewsHelper.HtmlSpiderYangGuangData(); +//agNewsHelper.HtmlSpiderYangGuangData(); + +//var result = XIAO_ETONG.Xiao_EtongApp.xiao_Etong_token(new XIAO_ETONG.app_token() +//{ +// app_id = "appn9m3yups9098", +// client_id = "xopvGAr405P6261", +// grant_type = "client_credential", +// secret_key = "AeHT1p4GzDYZuaBLZYOBa0r2Npp22uWv" +//}, "https://api.xiaoe-tech.com/"); +//Console.WriteLine(result.ToJson()); Console.Read(); // See https://aka.ms/new-console-template for more information