Example #1
0
        public ActionResult verify(string access_token, string comment, int info_id, int verified)
        {
            var user = UserBussiness.GetUserModel(m => m.OpenID == access_token);
            var si   = SignInRecordBussiness.GetSignInRecordModel(info_id);

            si.Status    = verified;
            si.AuditDesc = comment;
            bool flag = SignInRecordBussiness.UpdateSignInRecordModel(si);

            if (flag)
            {
                Task.Factory.StartNew(() =>
                {
                    AuditLogModel auditLogModel  = new AuditLogModel();
                    auditLogModel.CreateTime     = DateTime.Now;
                    auditLogModel.CreateUserID   = user.ID;
                    auditLogModel.remark         = comment;
                    auditLogModel.Status         = verified;
                    auditLogModel.SignInRecordID = info_id;
                    AuditLogBussiness.InsertActiveModel(auditLogModel);
                });
                return(Success("操作成功"));
            }
            else
            {
                return(Fail("请重试"));
            }
        }
Example #2
0
        public JsonResult Login(string code, View_UserData user_data)
        {
            dynamic result = null;
            dynamic data   = JsonConvert.DeserializeObject <dynamic>(user_data.rawData);

            result = JsonConvert.DeserializeObject <dynamic>(MiniprogramApiHelper.Login(code));
            string    encryptedData = user_data.encryptedData;
            string    iv            = user_data.iv;
            string    key           = result.session_key;
            string    nickName      = data.nickName;
            string    avatarUrl     = data.avatarUrl;
            UserModel userModel     = new UserModel();

            userModel.LastLoginTime = DateTime.Now;
            userModel.OpenID        = result.openid;
            userModel.UserName      = nickName;
            userModel.Avatars       = avatarUrl;
            try
            {
                dynamic decrptObj = JsonConvert.DeserializeObject <dynamic>(MiniprogramApiHelper.AES_decrypt(encryptedData, key, iv));
                userModel.city     = decrptObj.city;
                userModel.province = decrptObj.province;
                userModel.country  = decrptObj.country;
            }
            catch (Exception)
            {
            }
            var user = UserBussiness.GetUserModel(m => m.OpenID == userModel.OpenID);

            if (user == null)
            {
                string token = UserBussiness.Login(userModel);
            }
            else
            {
                UserBussiness.UpdateUserModel(userModel);
            }
            return(Success(new
            {
                uname = nickName,
                upic = avatarUrl,
                signName = nickName,
                access_token = userModel.OpenID,
                nickName,
                phone = userModel.UserMobile,
                userModel.city,
                userModel.province,
                userModel.country,
                auth = 2,
                avatarUrl = avatarUrl,
            }));
        }
Example #3
0
        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 <ResultObject> UserInfo(string access_token)
        {
            var user = UserBussiness.GetUserModel(m => m.OpenID == access_token);

            return(Success(new
            {
                unionid = access_token,
                authInfo = new {
                    user.UserName,
                    user.OpenID,
                    nickName = user.UserName,
                    signName = user.UserName,
                },
                roleIndex = 2,
                authType = 2
            }));
        }
Example #5
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 #6
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 #7
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 #8
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,
            }));
        }
Example #9
0
        //校验sign(数据库数据匹配)
        private bool ValidateTicket(string token)
        {
            var userInfo = UserBussiness.GetUserModel(m => m.OpenID == token);

            return(userInfo != null);
        }