Example #1
0
        /// <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
            }));
        }
Example #2
0
        public void UpdateVariableValue()
        {
            var v = VariableValueController.GetAll("");

            foreach (var item in v)
            {
                string value = LeoUtils.ConvertToUnSign(item.VariableValue.Trim().ToLower());
                VariableValueController.UpdateVariableValueText(item.ID, value);
            }
        }
Example #3
0
        public JsonResult AdminQRCode(int eid)
        {
            var md = ActivesManageApplyBussiness.GetActivesManageApplyModel(m => m.ActiveID == eid && m.ExpirseDate <= DateTime.Now && m.Status == 0);

            if (md == null)
            {
                string floder = "/Image/AdminQRCode";
                string path   = Server.MapPath(floder);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                string url = Common.HostUrl + floder + "/" + Guid.NewGuid().ToString() + ".png";
                try
                {
                    MiniprogramApiHelper.CreateShareCode(eid.ToString(), "subpackage/addadmin/addadmin").Save(url);
                }
                catch (Exception)
                {
                    url = "https://res.wx.qq.com/wxdoc/dist/assets/img/WXAQRCode.053ccc63.png";
                }
                md              = new ActivesManageApplyModel();
                md.Status       = 0;
                md.CreateUserID = LoginUserInfo.ID;
                md.URL          = url;
                md.Code         = LeoUtils.GetRandomStr();
                md.CreateTime   = DateTime.Now;
                md.ExpirseDate  = md.CreateTime.Value.AddMinutes(10);
                ActivesManageApplyBussiness.InsertActivesManageApplyModel(md);
            }
            else
            {
                md.Code        = LeoUtils.GetRandomStr();
                md.UpdateTime  = DateTime.Now;
                md.ExpirseDate = md.UpdateTime.Value.AddMinutes(10);
            }

            return(Success(new {
                url = md.URL,
                code = md.Code,
                expire_at = LeoUtils.ConvertDateTimeInt1(md.ExpirseDate)
            }));
        }
Example #4
0
        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
            })));
        }
Example #5
0
        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
            }));
        }
Example #6
0
        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("编辑失败,请重试"));
            }
        }
Example #7
0
        /// <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,
            }));
        }