[HttpPost]//添加每个会员可以绑定openid个数 public JsonResult AddMemberBindNum(AddMemberBindNumModel data) { using (var db = new MemberEntities()) { var obj = db.OpenidToMobile_t.FirstOrDefault(x => x.id == data.id); if (obj == null) { db.OpenidToMobile_t.Add(new OpenidToMobile_t { realbosscard = data.realbosscard, bosscard = data.bosscard, mobile = data.mobile, openidnum = data.openidnum, grouptype = data.grouptype, addtime = DateTime.Now, hotelcode = data.hotelcode, }); db.bindopenidlogs.Add(new bindopenidlog { realbosscard = data.realbosscard, addtime = DateTime.Now, bindnum = data.openidnum.ToString(), bosscard = data.bosscard, isbind = "true", mobile = data.mobile, name = data.name, type = "add", usercode = data.usercode, grouptype = data.grouptype, hotelcode = data.hotelcode, }); jsonResult.code = ApiCode.成功; jsonResult.msg = "添加成功"; } else { db.bindopenidlogs.Add(new bindopenidlog { realbosscard = data.realbosscard, addtime = DateTime.Now, bindnum = data.openidnum.ToString(), bosscard = data.bosscard, isbind = "true", mobile = data.mobile, name = data.name, type = "update", usercode = data.usercode, grouptype = data.grouptype, hotelcode = data.hotelcode, }); obj.openidnum = data.openidnum; obj.realbosscard = data.realbosscard; //obj.bosscard = data.bosscard; jsonResult.code = ApiCode.成功; jsonResult.msg = "修改成功"; } db.SaveChanges(); } return(this.Json(jsonResult)); }
[HttpPost]//获取绑定操作记录 public JsonResult GetMemberBindLog(AddMemberBindNumModel data) { using (var db = new MemberEntities()) { var list = db.bindopenidlogs.Where(x => x.hotelcode == data.hotelcode && x.grouptype == data.grouptype && x.mobile == data.mobile).ToList(); if (list.Count > 0) { jsonResult.code = ApiCode.成功; jsonResult.msg = "成功"; jsonResult.data = list; } else { jsonResult.code = ApiCode.没有实体数据; jsonResult.msg = "没有实体数据"; } } return(this.Json(jsonResult)); }
[HttpPost]//获取 public JsonResult GetMemberBindNum(AddMemberBindNumModel data) { using (var db = new MemberEntities()) { var list = db.OpenidToMobile_t.Where(x => x.mobile == data.mobile && x.hotelcode == data.hotelcode).ToList(); if (list.Count > 0) { jsonResult.code = ApiCode.成功; jsonResult.data = list; jsonResult.msg = "成功"; } else { jsonResult.code = ApiCode.没有实体数据; // jsonResult.data = list; jsonResult.msg = "没有实体数据"; } } return(this.MyJson(jsonResult, "yyyy-MM-dd", NullValueHandling.Include)); }