Ejemplo n.º 1
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)
            }));
        }
Ejemplo n.º 2
0
        public ActionResult Share(int eid)
        {
            string filePath = Server.MapPath("/Images");

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }
            string fileName = filePath + "/" + Guid.NewGuid().ToString();

            try
            {
                Image img = MiniprogramApiHelper.CreateShareCode(eid.ToString(), "pages/detail/detail");
                img.Save(fileName);
            }
            catch (Exception)
            {
                fileName = "https://res.wx.qq.com/wxdoc/dist/assets/img/WXAQRCode.053ccc63.png";
            }
            return(Success(new
            {
                url = fileName
            }));
        }
Ejemplo n.º 3
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
            }));
        }