/// <summary> /// 活动报名列表 /// </summary> /// <param name="eid"></param> /// <param name="lt"></param> /// <param name="page"></param> /// <param name="count"></param> /// <returns></returns> public ActionResult SignInList(int eid, int lt = -1, int page = 1, int count = 10) { var model = ActivesBussiness.GetActivesModel(eid); PageFliter pageFliter = new PageFliter(); pageFliter.PageIndex = page; pageFliter.PageSize = count; var list = SignInRecordBussiness.GetSignInRecordsByActiveID(eid, lt, pageFliter); return(Success(new { items = list.Select(m => new { name = m.CreateUserName, verified = m.Status ?? 0, head_img = m.CreateUserAvatars, user_visible = 1, info_id = m.ID, date_str = m.CreateTime.Value.ToString("yyyy-MM-dd HH:mm"), last_update = LeoUtils.ConvertDateTimeInt1(m.UpdateTime.Value) }), total = pageFliter.TotalCount, endCount = pageFliter.TotalPage, info_id = 0 })); }
public ActionResult RemoveActives(int eid, string final_word = "") { bool flag = ActivesBussiness.DeleteActive(eid); if (flag) { return(Success(new { eid = eid })); } else { return(Fail("编辑失败,请重试")); } }
public JsonResult AdminAdd(string eid, string code, string access_token) { int id = eid.ToInt32(); var user = UserBussiness.GetUserModel(m => m.OpenID == access_token); var model = ActivesBussiness.GetActivesModel(id); var md = ActivesManageApplyBussiness.GetActivesManageApplyModel(m => m.ActiveID == id && m.ExpirseDate <= DateTime.Now && m.Status == 0); if (md == null) { return(Fail("请找管理员索要验证码")); } if (code != md.Code) { return(Fail("验证码错误")); } var userid = user.ID; if (model.CreateUserID == userid) { return(Fail("您已经是管理员了")); } var isManage = ActiveManagesBussiness.GetActiveManagesModel(m => m.ActiveID == id && m.ManageUserID == userid); if (isManage != null) { return(Fail("您已经是管理员了")); } md.UseUserID = md.ID; md.JoinTime = DateTime.Now; md.Status = 1; ActiveManagesModel activeManagesModel = new ActiveManagesModel(); activeManagesModel.ManageUserID = user.ID; activeManagesModel.ActiveID = id; activeManagesModel.ApplyUserID = md.CreateUserID; activeManagesModel.CreateTime = DateTime.Now; bool flag = ActiveManagesBussiness.AddAdmin(activeManagesModel, md); if (flag) { return(Success("success")); } else { return(Fail("fail")); } }
public JsonResult AdminList(int eid) { var active = ActivesBussiness.GetActivesModel(eid); var userInfo = UserBussiness.GetUserModel(active.CreateUserID.Value); List <ActiveManagesModel> manages = new List <ActiveManagesModel>(); manages.Add(new ActiveManagesModel() { ID = 0, CreateUserName = userInfo.UserName, CreateUserAvatars = userInfo.Avatars }); manages.AddRange(ActiveManagesBussiness.GetListByActiveID(eid)); return(Success(manages.Select(m => new { unionid = m.ID, date = LeoUtils.ConvertDateTimeInt1(m.CreateTime), name = m.CreateUserName, img = m.CreateUserAvatars }))); }
/// <summary> /// 获取我的活动列表 /// </summary> /// <param name="type"></param> /// <param name="page"></param> /// <param name="count"></param> /// <returns></returns> public ActionResult GetActives(int type = 0, int page = 1, int count = 10) { PageFliter pageFliter = new PageFliter(); pageFliter.PageSize = count; pageFliter.PageIndex = page; var list = ActivesBussiness.GetList(type, LoginUserInfo.ID, pageFliter); return(Success(list.Select(m => new { title = m.Title, eid = m.ID, banner = m.Img, user_visible = m.ListReportPermission, count = m.SignInCount, limit = m.SignIntMaxCount, fee = (m.CollectFees / m.SignIntMaxCount) * 100, charge = 0, has_balance = string.IsNullOrEmpty(m.Img) ? 0 : 1, status = m.SigninEndTime <= DateTime.Now ? 2 : m.SigninBeginTIme <= DateTime.Now ? 1: 0 }), "enrollList")); }
public JsonResult CertDetail(int info_id) { var signin = SignInRecordBussiness.GetSignInRecordModel(info_id); var active = ActivesBussiness.GetActivesModel(signin.ActiveID.Value); var user = UserBussiness.GetUserModel(signin.CreateUserID ?? 0); string filePath = Server.MapPath("/Images"); if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } string fileName = filePath + "/" + Guid.NewGuid().ToString(); try { Image img = MiniprogramApiHelper.CreateShareCode(signin.ActiveID.Value.ToString() + "_" + info_id, "pages/detail/detail"); img.Save(fileName); } catch (Exception ex) { fileName = "https://res.wx.qq.com/wxdoc/dist/assets/img/WXAQRCode.053ccc63.png"; } return(Success(new { start_time = LeoUtils.ConvertDateTimeInt1(active.SigninBeginTIme), end_time = LeoUtils.ConvertDateTimeInt1(active.SigninEndTime), act_start = LeoUtils.ConvertDateTimeInt1(active.ActiveBeginTime), act_end = LeoUtils.ConvertDateTimeInt1(active.ActiveEndTime), enroll_time = LeoUtils.ConvertDateTimeInt1(signin.CreateTime), qrcode = fileName, items = new ArrayList(), title = active.Title, name = user.UserName })); }
public JsonResult UpdateActive(VM_FormModel data) { var user = UserBussiness.GetUserModel(m => m.OpenID == data.access_token); ActivesModel actives = new ActivesModel(); actives.ActiveAddress = data.address; actives.ActiveBeginTime = LeoUtils.ConvertIntDateTime1(double.Parse(data.act_start)); actives.ActiveEndTime = LeoUtils.ConvertIntDateTime1(double.Parse(data.act_end)); actives.CreateUserID = user.ID; actives.Content = data.content; actives.Img = data.banner; actives.ImgDetails = data.pics != null?string.Join(",", data.pics) : ""; actives.IsAllowCancel = data.can_quit; actives.ListReportPermission = data.visibility; actives.ListShowType = data.user_visible; actives.ManyCount = data.on_behalf_limit; actives.PromoterMobile = data.phone; actives.PromoterName = data.sign_name; actives.PromoterWechat = data.wx_no; actives.SignIntMaxCount = data.limit.ToInt32(); actives.Title = data.title; actives.can_quit = data.can_quit; actives.group_qr = data.group_qr; actives.is_public = data.is_public; actives.latitude = data.latitude; actives.longitude = data.longitude; actives.on_behalf_limit = data.on_behalf_limit; actives.queue = data.queue; actives.role = data.role; actives.user_visible = data.user_visible; actives.verify = data.verify; actives.version = data.version; actives.visibility = data.visibility; actives.ID = data.eid.ToInt32(); List <CustomFieldModel> customFieldValueModel = new List <CustomFieldModel>(); int i = 1; foreach (var item in data.req_info) { CustomFieldModel customField = new CustomFieldModel(); customField.CreateUserID = user.ID; customField.MaxTextCount = item.max_length.ToInt32(); customField.MinTextCount = item.min_length.ToInt32(); customField.Name = item.field_name; customField.PlaceHolder = item.field_desc; customField.Type = item.field_type; customField.Status = item.status.ToInt32(); customField.require = item.require; customField.Sort = i; customField.Options = item.options != null?string.Join(",", item.options) : ""; i++; customFieldValueModel.Add(customField); } bool flag = ActivesBussiness.UpdateActiveByTran(actives, customFieldValueModel); if (flag) { return(Success(new { eid = actives.ID })); } else { return(Fail("编辑失败,请重试")); } }
/// <summary> /// 活动详情 /// </summary> /// <param name="eid"></param> /// <param name="access_token"></param> /// <returns></returns> public ActionResult Detail(int eid, string access_token) { int UserID = LoginUserInfo.ID; var model = ActivesBussiness.GetActivesModel(eid); var list = CustomFieldBussiness.GetCustomFieldModels(m => m.ActiveID == eid); var signInList = SignInRecordBussiness.GetSignInRecordModels(m => m.CreateUserID == UserID && m.ActiveID == eid).OrderBy(m => m.type).ToList(); List <VM_Feild> req_info = new List <VM_Feild>(); foreach (var item in list) { VM_Feild feild = new VM_Feild(); feild.field_key = item.ID.ToString(); feild.field_desc = item.PlaceHolder; feild.field_name = item.Name; feild.field_type = item.Type.Value; feild.max_length = item.MaxTextCount.ToString(); feild.min_length = item.MinTextCount.ToString(); feild.status = item.Status.ToString(); feild.require = item.require.Value; feild.options = !string.IsNullOrEmpty(item.Options) ? item.Options.SplitExtension(",") : new string[] { }; req_info.Add(feild); } var createUser = UserBussiness.GetUserModel(model.CreateUserID.Value); model.ReadCount = (model.ReadCount ?? 0) + 1; Task.Factory.StartNew(() => { ActivesModel a = new ActivesModel() { ID = model.ID, ReadCount = model.ReadCount }; ActivesBussiness.UpdateActiveModel(a); }); int is_owner = 0; var mng = ActiveManagesBussiness.GetActiveManagesModel(m => m.ManageUserID == UserID); if (model.CreateUserID == UserID || mng != null) { is_owner = 1; } return(Success(new { cid = "", start_time = LeoUtils.ConvertDateTimeInt1(model.SigninBeginTIme).ToString(), end_time = LeoUtils.ConvertDateTimeInt1(model.SigninEndTime).ToString(), act_start = LeoUtils.ConvertDateTimeInt1(model.ActiveBeginTime).ToString(), act_end = LeoUtils.ConvertDateTimeInt1(model.ActiveEndTime).ToString(), pics = model.ImgDetails.SplitExtension(","), req_info, is_admin = model.CreateUserID == UserID, sign_name = model.PromoterName, fee = model.SignIntMaxCount != null?(model.CollectFees ?? 0 / model.SignIntMaxCount):0, status = model.SigninEndTime != null && model.SigninEndTime.Value <= DateTime.Now ? 2 : model.SigninBeginTIme != null && model.SigninBeginTIme.Value <= DateTime.Now ? 1 : 0, verify = model.verify, banner = model.Img, count = model.SignInCount, limit = model.SignIntMaxCount, address = model.ActiveAddress, latitude = !string.IsNullOrEmpty(model.latitude) ? double.Parse(model.latitude) : 0, longitude = !string.IsNullOrEmpty(model.longitude) ? double.Parse(model.longitude) : 0, on_behalf_limit = model.on_behalf_limit, queue = model.queue, role = model.role, user_visible = model.user_visible, version = model.version, visibility = model.visibility, content = model.Content, wx_no = model.PromoterWechat, owner_pic = createUser?.Avatars ?? "", title = model.Title, views = model.ReadCount ?? 0, is_owner, eid = model.ID, on_behalf = signInList.Count(), info_id = signInList.FirstOrDefault()?.ID ?? 0, phone = model.PromoterMobile, can_quit = model.can_quit, verified = signInList.FirstOrDefault()?.Status ?? 0, })); }