public void UpdateFilghtGroupsByUserId_Test() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateFightGroupsPacketByUserId(new Models.Requests.FightGroupsPacketsUpdateRequest() { FightGroupsIdentity = Guid.Parse("d7244c17-c16c-400c-b84c-0814a001f02c"), PKID = 418, UserId = Guid.Parse("{009d858b-bda0-4fed-9655-2ce34b704cc9}") }); result = client.UpdateFightGroupsPacketByUserId(new Models.Requests.FightGroupsPacketsUpdateRequest() { FightGroupsIdentity = Guid.Parse("d7244c17-c16c-400c-b84c-0814a001f02c"), PKID = 419, UserId = Guid.Parse("{00a076fa-1d78-4860-9b33-d4e6af057977}") }); result = client.UpdateFightGroupsPacketByUserId(new Models.Requests.FightGroupsPacketsUpdateRequest() { FightGroupsIdentity = Guid.Parse("d7244c17-c16c-400c-b84c-0814a001f02c"), PKID = 420, UserId = Guid.Parse("{00a475c9-7d24-48f8-b151-e379b8677613}") }); result.ThrowIfException(true); Assert.AreEqual(result.Result, true); } }
public ActionResult Reload(int?pkid) { RepositoryManager manager = new RepositoryManager(); Expression <Func <BigBrandRewardListEntity, bool> > exp = _ => _.PKID == pkid.Value; var entity = manager.GetEntity <BigBrandRewardListEntity>(exp); using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateBigBrand(entity.HashKeyValue); result.ThrowIfException(true); if (result.Result) { return(Content(JsonConvert.SerializeObject(new { Code = 1, Msg = "刷新成功" }))); } else { return(Content(JsonConvert.SerializeObject(new { Code = 0, Msg = "刷新失败" }))); } } }
public void UpdateRealPackAddress() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateBigBrandRealLog("AEE792AF", Guid.Parse("5010BDED-8492-4F5D-8016-DA28ED34A623"), "上海市闵行区莲花南路与江淮路交叉口向东2000米路西*********", Guid.Parse("CC5CC7F6-43F3-47B5-BA73-B0008E55846F"), "18037108212", "dfsdfsd", "H5", "姓名"); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void IsNullSelectRealPack() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.IsNULLBigBrandRealByAddress("AEE792AF", Guid.Parse("16c2921e-adf2-433c-b693-92d5bb6a1c3d"), "18037108212", "dfsdfsd", "H5"); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void GetPackRealTest() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.GetPacket(Guid.Empty, "dfsdfsd", "H5", "1818BFD0", "18037108212", "http://wx.tuhu.cn", "oPD5Ns0lDuMghgvyTZwL1q9EADc8"); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void GetPackQuest_Test() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.GetAnswerPacket(Guid.Parse("{0013eeed-2c14-43ff-a859-c2dc71c65def}"), "dfsdfsd", "H5", "7543DFC0", "18037108212", "http://wx.tuhu.cn"); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void UpdateBigBrand() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateBigBrand("A2E4E6A9"); result.ThrowIfException(true); Console.WriteLine(result.Result?"成功":"失败"); } }
public void GetBigBrand() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.GetBigBrand("8513920B"); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void SelectShareList() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.SelectShareList(Guid.Parse("{0052aa43-5b14-4fb8-ac8b-c5f78fcb2d64}"), "1818BFD0", 3); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void AddBigBrandTimes() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.AddBigBrandTimes(Guid.Parse("2088993c-e721-4686-9f25-fd257ee9d4d3"), "", DateTime.Now.ToString("yyyyMMddHHmmss"), "DCF3DF88", "", "GroupByingAddBigBrandTimesConsumer", 1); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void ShareAddByOrder() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.ShareAddByOrder(Guid.Parse("2088993c-e721-4686-9f25-fd257ee9d4d3"), "", "拼团增加抽奖次数", "DCF3DF88", "", "GroupByingAddBigBrandTimesConsumer", 1); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void CreateFilghtGroupsPromotion_Test() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.CreateFightGroupsPacketByPromotion(Guid.Parse("d7244c17-c16c-400c-b84c-0814a001f02c")); result.ThrowIfException(true); Console.WriteLine(result.Result.Msg); Assert.AreEqual(result?.Result.IsSuccess, true, result.Result.Msg); } }
public async Task GetSelectPacketTest() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = await client.SelectCanPackerAsync(Guid.Empty, "dfsdfsd", "H5", "1818BFD0", "", "http://wx.tuhu.cn", "oPD5Ns51t9l2ZfETpXmHVYVbxGfs"); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public void ShareAddTest() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.ShareAddOne(Guid.Parse("{0052aa43-5b14-4fb8-ac8b-c5f78fcb2d64}"), "dfsdfsd", "H5", "A2E4E6A9", "18037108212", "http://wx.tuhu.cn"); Console.WriteLine(result.Exception); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } }
public async Task GetSelectPacketTestByRecord() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { //var result = client.AddBigBrandTimes(Guid.Parse("2088993c-e721-4686-9f25-fd257ee9d4d3"), "", DateTime.Now.ToString("yyyyMMddHHmmss"), "DCF3DF88", "", "GroupByingAddBigBrandTimesConsumer", 1); var result = await client.SelectCanPackerAsync(Guid.Parse("2088993c-e721-4686-9f25-fd257ee9d4d3"), "dfsdfsd", "H5", "DCF3DF88", "18037108212", "http://wx.tuhu.cn"); result.ThrowIfException(true); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result, Newtonsoft.Json.Formatting.Indented)); } }
public void FilghtGroupsList_Test() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.GetFightGroupsPacketsList(null, Guid.Parse("{63d457cd-8b83-4901-893a-98a6656dd35f}")); result.ThrowIfException(true); Assert.IsNotNull(result.Result); if (result.Result != null) { Console.WriteLine(JsonConvert.SerializeObject(result.Result, new JsonSerializerSettings() { Formatting = Formatting.Indented })); } } }
public void GetPacketTest() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { //var result = client.GetPacket(new Guid("062cf32e-a4a9-47e1-9955-ed5b563055c0"), "1", "H5", "DCF3DF88", "18801794888", "http://wx.tuhu.cn", ""); for (int i = 0; i < 40; i++) { var result = client.GetPacket(new Guid("062cf32e-a4a9-47e1-9955-ed5b563055c0"), "1", "H5", "DCF3DF88", "18801794888", "http://wx.tuhu.cn", ""); System.Diagnostics.Debug.WriteLine(result.Result.Msg); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result.Result)); } } }
/// <summary> /// 更新问答题库缓存 /// </summary> /// <param name="pkid"></param> public void RefreshQuestionInfoListCache() { try { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateQuestionInfoList(); if (!result.Success) { Logger.Log(Level.Warning, $"更新问题库缓存失败", result.ErrorMessage); } } } catch (Exception ex) { Logger.Log(Level.Error, $"AnswerController -> RefreshQuestionInfoListCache ,异常信息:{ex.Message},堆栈异常:{ex.StackTrace}"); } }
public ActionResult Reload() { using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateQuestionInfoList(); if (result.Success && result.Result) { return(Content(JsonConvert.SerializeObject(new { Code = 1, Msg = "刷新成功" }))); } else { return(Content(JsonConvert.SerializeObject(new { Code = 0, Msg = "刷新失败", Error = result.Exception.Message }))); } } }
/// <summary> /// 提交大翻盘的配置 /// </summary> /// <param name="modeljson"></param> /// <param name="wheeljson"></param> /// <returns></returns> public async Task <ActionResult> SubmitForm(string modeljson, string wheeljson) { modeljson = modeljson.Replace("\" \"", "null"); wheeljson = wheeljson.Replace("\" \"", "null"); try { BigBrandRewardListEntity entity = JsonConvert.DeserializeObject <BigBrandRewardListEntity>(modeljson); IEnumerable <BigBrandWheelEntity> wheel = null; if (!string.IsNullOrWhiteSpace(wheeljson)) { wheel = JsonConvert.DeserializeObject <IEnumerable <BigBrandWheelEntity> >(wheeljson); } RepositoryManager manager = new RepositoryManager(); using (var db = manager.BeginTrans()) { if (entity.PKID == 0) { entity.HashKeyValue = Tuhu.Provisioning.Common.SecurityHelper.Sha1Encrypt(Guid.NewGuid().ToString(), System.Text.Encoding.UTF8).Substring(0, 8); entity.CreateDateTime = DateTime.Now; entity.LastUpdateDateTime = DateTime.Now; entity.UpdateUserName = User.Identity.Name; entity.CreateUserName = User.Identity.Name; manager.Add <BigBrandRewardListEntity>(entity); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(entity), Author = User.Identity.Name, Operation = "新增大翻牌活动", ObjectType = "BigBrand" }); } else { entity.LastUpdateDateTime = DateTime.Now; entity.UpdateUserName = User.Identity.Name; manager.Update <BigBrandRewardListEntity>(entity); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(entity), Author = User.Identity.Name, Operation = "更新大翻牌活动", ObjectType = "BigBrand" }); } Expression <Func <BigBrandWheelEntity, bool> > exp = _ => _.FKBigBrand == entity.PKID; db.Delete <BigBrandWheelEntity>(exp); if (wheel != null) { foreach (var item in wheel) { item.CreateDateTime = DateTime.Now; item.CreateUserName = User.Identity.Name; item.LastUpdateDateTime = DateTime.Now; item.UpdateUserName = User.Identity.Name; item.FKBigBrand = entity.PKID; var array = item.FKPoolPKIDText.TrimEnd(',').Split(','); if (array != null && array.Length > 0) { foreach (var s in array) { int poolPKID = 0; if (int.TryParse(s, out poolPKID)) { if (poolPKID != 0) { item.FKPoolPKID = poolPKID; string json = JsonConvert.SerializeObject(item); var tempModel = JsonConvert.DeserializeObject <BigBrandWheelEntity>(json); db.Insert <BigBrandWheelEntity>(tempModel); } } } } } } db.Commit(); LoggerManager.InsertOplog(new ConfigHistory() { AfterValue = JsonConvert.SerializeObject(wheel), Author = User.Identity.Name, Operation = "大翻牌明细", ObjectType = "BigBrand" }); } entity = manager.GetEntity <BigBrandRewardListEntity>(p => p.PKID == entity.PKID); //读写分离 做延时 await Task.Delay(3000); #region 更新大翻盘缓存 using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var result = client.UpdateBigBrand(entity.HashKeyValue); result.ThrowIfException(true); } #endregion #region 更新 活动页的 缓存 //筛选 出大翻盘相关的 活动页 配置 List <ActivePageContentEntity> activeEntityList = manager.GetEntityList <ActivePageContentEntity>(p => p.HashKey == entity.HashKeyValue && p.Type == 20).ToList(); foreach (var activeEntity in activeEntityList) { var activePageList = manager.GetEntity <ActivePageListEntity>(activeEntity.FKActiveID); using (var client = new Tuhu.Service.Activity.ActivityClient()) { var result1 = await client.RefreshActivePageListModelCacheAsync(new Service.Activity.Models.Requests.ActivtyPageRequest() { Channel = "wap", HashKey = activePageList.HashKey, }); result1.ThrowIfException(true); var result2 = await client.RefreshActivePageListModelCacheAsync(new Service.Activity.Models.Requests.ActivtyPageRequest() { ActivityId = activePageList.PKGuid.Value, Channel = "website", HashKey = activePageList.HashKey, }); result2.ThrowIfException(true); } var list = manager.GetEntityList <ActivePageContentEntity>(_ => _.FKActiveID == activeEntity.FKActiveID); var lucy = list?.Where(_ => _.Type == 13)?.FirstOrDefault(); if (lucy != null) { using (var client = new Tuhu.Service.Activity.ActivityClient()) { var result = await client.RefreshLuckWheelCacheAsync(lucy.ActivityID.ToString()); result.ThrowIfException(true); } } } #endregion return(Content(JsonConvert.SerializeObject(new { state = "success", message = "操作成功", data = "" }))); } catch (Exception em) { throw em; } }
public void Finish() { string hashKey = "A2E4E6A9"; int Total = 0; //总人数 int TotalPack = 0; //抽奖总数 int TotalShare = 0; //分享总数 using (var client = new Tuhu.Service.Activity.BigBrandClient()) { var bigBrand = client.GetBigBrand(hashKey); Assert.IsNotNull(bigBrand.Result, "hashKey不存在"); List <User> userIds = GetUserIds(bigBrand.Result.PKID, 20); Total = userIds.Count; if (userIds != null) { foreach (var item in userIds) { var userId = item.UserID; var selectResult = client.SelectCanPacker(userId, "deviceId", "测试", bigBrand.Result.HashKeyValue, "18037108212", "Tuhu.Service.Activity.Server.UnitTest.Finish"); selectResult.ThrowIfException(true); if (selectResult.Success) { if (selectResult.Result.Code == 1) { for (int i = 0; i < selectResult.Result.Times; i++) { var result = client.GetPacket(userId, "deviceId", "测试", bigBrand.Result.HashKeyValue, "18037108212", "Tuhu.Service.Activity.Server.UnitTest.Finish"); result.ThrowIfException(true); if (result.Result.TimeCount <= 0 && selectResult.Result.IsShare == false) { TotalPack++; var shareResult = client.ShareAddOne(userId, "deviceId", "测试", bigBrand.Result.HashKeyValue, "18037108212", "Tuhu.Service.Activity.Server.UnitTest.Finish"); if (shareResult.Result) { TotalShare++; var selectResult1 = client.SelectCanPacker(userId, "deviceId", "测试", bigBrand.Result.HashKeyValue, "18037108212", "Tuhu.Service.Activity.Server.UnitTest.Finish"); #region for (int n = 0; n < selectResult1.Result.Times; n++) { var result1 = client.GetPacket(userId, "deviceId", "测试", bigBrand.Result.HashKeyValue, "18037108212", "Tuhu.Service.Activity.Server.UnitTest.Finish"); result1.ThrowIfException(true); if (result1.Result.Code == 1) { TotalPack++; } } #endregion } } } } else { Console.WriteLine($"{userId} 不能抽奖的原因:{selectResult.Result.Msg}"); } } } } Console.WriteLine($"参加抽奖的总数:{Total}"); Console.WriteLine($"抽中奖励的总数:{TotalPack}"); Console.WriteLine($"分享加一次抽奖的总数:{TotalShare}"); } }