|
@@ -47,39 +47,55 @@ public class PosChannelHelper
|
|
|
|
|
|
public void DoSomething(WebCMSEntities db)
|
|
|
{
|
|
|
- List<PosChannelSetRecord> list = db.PosChannelSetRecord.Where(m => m.Status == 0).ToList();
|
|
|
- foreach(PosChannelSetRecord sub in list)
|
|
|
+ List<PosChannelSet> mains = db.PosChannelSet.Where(m => m.Status == 0).ToList();
|
|
|
+ foreach(PosChannelSet main in mains)
|
|
|
{
|
|
|
- string jsonString = QueryTermAcqInfo(sub.PosSn);
|
|
|
- JsonData jsonData = JsonMapper.ToObject(jsonString);
|
|
|
- if(jsonData["resultCode"].ToString() == "1")
|
|
|
+ int PassCount = 0;
|
|
|
+ string PosSnList = "";
|
|
|
+ List<PosChannelSetRecord> list = db.PosChannelSetRecord.Where(m => m.RecordId == main.Id).ToList();
|
|
|
+ foreach(PosChannelSetRecord sub in list)
|
|
|
{
|
|
|
- // string acqInstId = jsonData["data"]["acqInstId"].ToString();
|
|
|
- // if(sub.ChannelNo == acqInstId)
|
|
|
- // {
|
|
|
- PosChannelSetRecord edit = db.PosChannelSetRecord.FirstOrDefault(m => m.Id == sub.Id);
|
|
|
- if(edit != null)
|
|
|
- {
|
|
|
- edit.Status = 1;
|
|
|
- db.SaveChanges();
|
|
|
- PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == edit.PosId) ?? new PosMachinesTwo();
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
|
|
|
- string ChannelName = "";
|
|
|
- if(sub.ChannelNo == "48130000") ChannelName = "环讯";
|
|
|
- if(sub.ChannelNo == "48310000") ChannelName = "易生";
|
|
|
- if(sub.ChannelNo == "48330000") ChannelName = "海科";
|
|
|
- if(sub.ChannelNo == "48470000") ChannelName = "中付";
|
|
|
- RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
+ string jsonString = QueryTermAcqInfo(sub.PosSn);
|
|
|
+ JsonData jsonData = JsonMapper.ToObject(jsonString);
|
|
|
+ if(jsonData["resultCode"].ToString() == "1")
|
|
|
+ {
|
|
|
+ // string acqInstId = jsonData["data"]["acqInstId"].ToString();
|
|
|
+ // if(sub.ChannelNo == acqInstId)
|
|
|
+ // {
|
|
|
+ PosChannelSetRecord edit = db.PosChannelSetRecord.FirstOrDefault(m => m.Id == sub.Id);
|
|
|
+ if(edit != null)
|
|
|
{
|
|
|
- UserId = pos.BuyUserId, //创客
|
|
|
- Title = "机具通道变更通知", //标题
|
|
|
- Content = "<div class='f16' style='padding:12px 16px;'>尊敬的" + user.RealName + "盟主您好:<br/><br/><div class='f14' style='text-indent:2em;'>您名下的机具" + pos.PosSn + ",通道已更改为" + ChannelName + ",请知悉!</ div> </ div>", //内容
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- }));
|
|
|
- }
|
|
|
- // }
|
|
|
+ edit.Status = 1;
|
|
|
+ db.SaveChanges();
|
|
|
+ PosSnList += edit.PosSn + ",";
|
|
|
+ PassCount += 1;
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ if(PassCount >= list.Count)
|
|
|
+ {
|
|
|
+ PosChannelSet edit = db.PosChannelSet.FirstOrDefault(m => m.Id == main.Id);
|
|
|
+ if(edit != null)
|
|
|
+ {
|
|
|
+ edit.Status = 1;
|
|
|
+ db.SaveChanges();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == edit.UserId) ?? new Users();
|
|
|
+ string ChannelName = "";
|
|
|
+ if(edit.ChannelNo == "48130000") ChannelName = "环讯";
|
|
|
+ if(edit.ChannelNo == "48310000") ChannelName = "易生";
|
|
|
+ if(edit.ChannelNo == "48330000") ChannelName = "海科";
|
|
|
+ if(edit.ChannelNo == "48470000") ChannelName = "中付";
|
|
|
+ RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
+ {
|
|
|
+ UserId = edit.UserId, //创客
|
|
|
+ Title = "机具通道变更通知", //标题
|
|
|
+ Content = "<div class='f16' style='padding:12px 16px;'>尊敬的" + user.RealName + "盟主您好:<br/><br/><div class='f14' style='text-indent:2em;'>您名下的机具" + PosSnList.TrimEnd(',') + ",通道已更改为" + ChannelName + ",请知悉!</ div> </ div>", //内容
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|