From 68170cf7923d0c9236e37c03dca0879af7612372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?old=E6=98=93?= <156663459@qq.com> Date: Fri, 15 Mar 2024 22:09:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=91=E6=8D=A2=E7=A0=81=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../V_CustomerInfoServices.cs | 109 ++++++++++-------- 1 file changed, 60 insertions(+), 49 deletions(-) diff --git a/New_College.Services/V_CustomerInfoServices.cs b/New_College.Services/V_CustomerInfoServices.cs index 8596b3c..eed24f9 100644 --- a/New_College.Services/V_CustomerInfoServices.cs +++ b/New_College.Services/V_CustomerInfoServices.cs @@ -325,55 +325,7 @@ namespace New_College.Services { 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); - - } - } - } + SyncXET(info); }); } @@ -409,6 +361,64 @@ namespace New_College.Services }; } + /// + /// 同步小鹅通 + /// + /// + /// + private async Task SyncXET(V_CustomerInfo info) + { + 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 info; + } + /// /// 查询CustomerInfo表信息 /// @@ -505,6 +515,7 @@ namespace New_College.Services var userinfo = (await _dal.Query(w => w.OpenId == query.openId && w.IsDelete == false)).ToList().FirstOrDefault(); if (userinfo != null) { + await SyncXET(userinfo); return new Tuple(true, new CustomerInfoResult() { AreaId = userinfo.AreaId,