Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            string trueName = context.Request["true_name"];
            string phone    = context.Request["phone"];

            UserInfo model = new UserInfo();

            model.UserID          = string.Format("PCUser{0}", Guid.NewGuid().ToString());//Guid
            model.Password        = ZentCloud.Common.Rand.Str_char(12);
            model.UserType        = 2;
            model.WebsiteOwner    = bllUser.WebsiteOwner;
            model.Regtime         = DateTime.Now;
            model.WXOpenId        = "";
            model.RegIP           = ZentCloud.Common.MySpider.GetClientIP();
            model.LastLoginIP     = ZentCloud.Common.MySpider.GetClientIP();
            model.LastLoginDate   = DateTime.Now;
            model.LoginTotalCount = 1;
            model.TrueName        = trueName;
            model.Phone           = phone;
            if (bllUser.GetCount <UserInfo>(string.Format("Websiteowner='{0}' And Phone='{1}'", bllUser.WebsiteOwner, phone)) > 0)
            {
                apiResp.msg = "手机号重复";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (bllUser.Add(model))
            {
                apiResp.status = true;
                apiResp.msg    = "ok";
            }
            else
            {
            }
            bllUser.ContextResponse(context, apiResp);
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            var websiteInfo = bllUser.GetWebsiteInfoModelFromDataBase();

            string ids = context.Request["ids"];

            if (string.IsNullOrEmpty(ids))
            {
                apiResp.msg  = "ids为必填参数,请检查";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            string[] strIds = ids.Split(',');
            for (int i = 0; i < strIds.Length; i++)
            {
                UserInfo userModel = bllUser.GetUserInfoByAutoID(int.Parse(strIds[i]));
                if (websiteInfo.IsUnionHongware == 1)
                {
                    Open.HongWareSDK.Client hongWareClient = new Open.HongWareSDK.Client(websiteInfo.WebsiteOwner);
                    var memberInfo = hongWareClient.GetMemberInfo(userModel.WXOpenId);
                    if (memberInfo.member == null)
                    {
                        apiResp.msg = "宏巍会员不存在";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                        return;
                    }
                    if (!hongWareClient.UpdateMemberScore(memberInfo.member.mobile, userModel.WXOpenId, -memberInfo.member.point))
                    {
                        apiResp.msg = "清空宏巍会员积分失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                        return;
                    }
                }

                if (userModel.TotalScore == 0)
                {
                    continue;
                }
                double score = userModel.TotalScore;
                bllUser.Update(new UserInfo(), string.Format(" TotalScore=0"), string.Format("  AutoId={0} ", userModel.AutoID));

                UserScoreDetailsInfo scoreRecord = new UserScoreDetailsInfo();
                scoreRecord.UserID       = userModel.UserID;
                scoreRecord.AddTime      = DateTime.Now;
                scoreRecord.TotalScore   = 0;
                scoreRecord.Score        = -score;
                scoreRecord.ScoreType    = "AdminSubmit";
                scoreRecord.AddNote      = "积分清零";
                scoreRecord.RelationID   = bllUser.GetCurrUserID();
                scoreRecord.WebSiteOwner = bllUser.WebsiteOwner;
                bllUser.Add(scoreRecord);
            }
            apiResp.msg    = "操作完成";
            apiResp.status = true;
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["lotteryId"]))
            {
                int lotteryId = Convert.ToInt32(Request["lotteryId"]);

                lottery = bllLotery.Get <WXLotteryV1>(string.Format(" WebsiteOwner='{0}' AND  LotteryID={1} ", bllLotery.WebsiteOwner, lotteryId));

                webSite = bllLotery.GetWebsiteInfoModel();

                var currentUserInfo = bllUser.GetCurrentUserInfo();


                if (string.IsNullOrEmpty(currentUserInfo.WXNickname))
                {
                    Session.Clear();
                    Response.Redirect(Request.Url.ToString());
                }


                lotteryUser = bllUser.Get <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryId={1} AND UserId='{2}' ", bllUser.WebsiteOwner, lotteryId, currentUserInfo.UserID));
                if (lotteryUser == null)
                {
                    lotteryUser = new BLLJIMP.Model.LotteryUserInfo();
                    lotteryUser.WebsiteOwner = bllUser.WebsiteOwner;
                    lotteryUser.CreateDate   = DateTime.Now;
                    lotteryUser.WinnerDate   = DateTime.Now;
                    lotteryUser.IsWinning    = 0;
                    lotteryUser.LotteryId    = Convert.ToInt32(lotteryId);
                    lotteryUser.UserId       = currentUserInfo.UserID;
                    lotteryUser.WXHeadimgurl = currentUserInfo.WXHeadimgurl;
                    lotteryUser.WXNickname   = bllUser.GetUserDispalyName(currentUserInfo);
                    if (bllUser.Add(lotteryUser))
                    {
                        msg       = "加入成功";
                        isSuccess = true;
                        int count = bllUser.GetCount <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1}", bllUser.WebsiteOwner, lotteryId));
                        bllUser.UpdateByKey <WXLotteryV1>("LotteryID", Request["lotteryId"], "WinnerCount", count.ToString());
                    }
                    else
                    {
                        isSuccess = false;
                        msg       = "加入失败";
                    }
                }
                else
                {
                    msg       = "您已参加抽奖";
                    isSuccess = true;
                }
            }
        }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            string lotteryId = context.Request["lottery_id"];

            curUser = bllUser.GetCurrentUserInfo();

            if (string.IsNullOrEmpty(lotteryId))
            {
                apiResp.msg  = "抽奖活动id为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            BLLJIMP.Model.LotteryUserInfo model = bllUser.Get <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryId={1} AND UserId='{2}' ", bllUser.WebsiteOwner, lotteryId, curUser.UserID));
            if (model != null)
            {
                apiResp.msg  = "您已参加抽奖";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            model = new BLLJIMP.Model.LotteryUserInfo();
            model.WebsiteOwner = bllUser.WebsiteOwner;
            model.CreateDate   = DateTime.Now;
            model.WinnerDate   = DateTime.Now;
            model.IsWinning    = 0;
            model.LotteryId    = Convert.ToInt32(lotteryId);
            model.UserId       = curUser.UserID;
            model.WXHeadimgurl = curUser.WXHeadimgurl;
            model.WXNickname   = bllUser.GetUserDispalyName(curUser);
            if (model.WXNickname.Trim() == string.Empty)
            {
                apiResp.msg  = "无昵称不能加入";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (bllUser.Add(model))
            {
                int count = bllUser.GetCount <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1}", bllUser.WebsiteOwner, lotteryId));
                bllUser.UpdateByKey <WXLotteryV1>("LotteryID", lotteryId, "WinnerCount", count.ToString());
                apiResp.msg    = "加入成功";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "加入失败";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllUser.ContextResponse(context, apiResp);
        }
Exemplo n.º 5
0
Arquivo: Add.ashx.cs Projeto: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            string pId   = context.Request["product_id"];
            string props = context.Request["props"];
            string count = context.Request["num"];
            string pName = context.Request["product_name"];

            if (string.IsNullOrEmpty(pId))
            {
                apiResp.msg  = "必填参数为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }


            UserInfo curUser = bllUser.GetCurrentUserInfo();

            ProductStock stock = new ProductStock();

            stock.ProductId    = Convert.ToInt32(pId);
            stock.UserId       = curUser.UserID;
            stock.PName        = pName;
            stock.CreateDate   = DateTime.Now;
            stock.Count        = Convert.ToInt32(count);
            stock.WebsiteOwner = bllUser.WebsiteOwner;
            stock.Props        = props;
            stock.WXNickname   = curUser.WXNickname;
            stock.WXHeadimgurl = curUser.WXHeadimgurl;


            if (bllUser.Add(stock))
            {
                apiResp.msg    = "成功";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "失败";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllUser.ContextResponse(context, apiResp);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Reg(HttpContext context)
        {
            string phone   = context.Request["phone"];
            string pwd     = context.Request["pwd"];
            string verCode = context.Request["vercode"];

            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入手机号";
                goto outoff;
            }
            if ((!phone.StartsWith("1")) || (!phone.Length.Equals(11)))
            {
                resp.errcode = 2;
                resp.errmsg  = "手机号格式不正确";
                goto outoff;
            }
            if (string.IsNullOrEmpty(pwd))
            {
                resp.errcode = 3;
                resp.errmsg  = "请输入密码";
                goto outoff;
            }
            if (string.IsNullOrEmpty(verCode))
            {
                resp.errcode = 4;
                resp.errmsg  = "请输入验证码";
                goto outoff;
            }
            if (bllUser.GetUserInfo(phone, webSiteOwner) != null)
            {
                resp.errcode = 5;
                resp.errmsg  = "此手机号已经被注册";
                goto outoff;
            }
            ////验证码检查
            var lastSmsVerificationCode = bllSms.GetLastSmsVerificationCode(phone);

            if (lastSmsVerificationCode == null)
            {
                resp.errcode = 6;
                resp.errmsg  = "请先获取手机验证码";
                goto outoff;
            }
            if (!lastSmsVerificationCode.VerificationCode.Equals(verCode))
            {
                resp.errcode = 7;
                resp.errmsg  = "验证码不正确";
                goto outoff;
            }
            ////
            UserInfo regUser = new UserInfo();

            regUser.WXHeadimgurl  = basePath + "/img/persion.png";
            regUser.UserID        = phone;
            regUser.Password      = pwd;
            regUser.WebsiteOwner  = webSiteOwner;
            regUser.UserType      = 2;
            regUser.Regtime       = DateTime.Now;
            regUser.LastLoginDate = DateTime.Now;
            if (bllUser.Add(regUser))
            {
                resp.errcode = 0;
                resp.errmsg  = "注册成功";

                context.Session[SessionKey.LoginStatu] = 1;
                context.Session[SessionKey.UserID]     = regUser.UserID;

                //绑定微信
                BindWXUser(context, regUser.UserID);

                goto outoff;
            }
            else
            {
                resp.errcode = 6;
                resp.errmsg  = "注册失败";
                goto outoff;
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            string company         = context.Request["company"]; //公司名称
            string licence         = context.Request["licence"]; //营业执照
            string password        = context.Request["pwd"];     //密码
            string confirmPassword = context.Request["confirm_pwd"];

            if (string.IsNullOrEmpty(company))
            {
                apiResp.msg  = "请输入公司名称";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (string.IsNullOrEmpty(licence))
            {
                apiResp.msg  = "请上传你的营业执照";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
            }
            if (string.IsNullOrEmpty(password) || string.IsNullOrEmpty(confirmPassword))
            {
                apiResp.msg  = "请输入密码";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (password != confirmPassword)
            {
                apiResp.msg  = "两次输入的密码不一致";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (password.Length < 6)
            {
                apiResp.msg  = "密码长度不少于6位";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            UserInfo userInfo = bllUser.GetUserInfoByCompany(company);

            if (userInfo != null)
            {
                apiResp.msg  = "公司名称重复";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                bllUser.ContextResponse(context, apiResp);
                return;
            }


            string pattern = @"^[A-Za-z0-9]+$";
            Regex  regex   = new Regex(pattern);

            if (!regex.IsMatch(password))
            {
                apiResp.msg  = "密码只能为字母或者数字";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            string userId = "";

            try
            {
                userId = "JRWJ" + bllUser.GetNewGUID(bllUser.WebsiteOwner, "Company", 6);
            }
            catch (Exception ex)
            {
                apiResp.msg  = "生成id出错:" + ex.Message;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.RegisterFailure;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            userInfo                   = new UserInfo();
            userInfo.UserID            = userId;
            userInfo.Password          = password;
            userInfo.UserType          = 6;//6公司  2普通用户
            userInfo.WebsiteOwner      = bllUser.WebsiteOwner;
            userInfo.Regtime           = DateTime.Now;
            userInfo.Company           = company;
            userInfo.TrueName          = company;
            userInfo.RegIP             = ZentCloud.Common.MySpider.GetClientIP();
            userInfo.LastLoginIP       = ZentCloud.Common.MySpider.GetClientIP();
            userInfo.LastLoginDate     = DateTime.Now;
            userInfo.LoginTotalCount   = 1;
            userInfo.MemberApplyStatus = 1;       //待审核
            userInfo.Ex3               = licence; //营业执照


            try
            {
                if (bllUser.Add(userInfo))
                {
                    bllUser.UpdateNewGUID(bllUser.WebsiteOwner, "Company");
                    apiResp.msg = "注册成功,您的公司账号为:" + userInfo.UserID;
                    context.Session[SessionKey.UserID]     = userInfo.UserID;
                    context.Session[SessionKey.LoginStatu] = 1;
                    apiResp.status = true;
                }
                else
                {
                    apiResp.msg  = "注册失败";
                    apiResp.code = (int)BLLJIMP.Enums.APIErrCode.RegisterFailure;
                }
            }
            catch (Exception ex)
            {
                apiResp.msg  = "添加账号出错:" + ex.Message;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.RegisterFailure;
            }
            bllUser.ContextResponse(context, apiResp);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 手动添加报名数据
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddActivityData(HttpContext context)
        {
            //接收到的实体
            BLLJIMP.Model.ActivityDataInfo reqModel = bllActivity.ConvertRequestToModel <BLLJIMP.Model.ActivityDataInfo>(new BLLJIMP.Model.ActivityDataInfo());

            string activityId           = context.Request["ActivityID"];
            var    newActivityUId       = 1001;
            var    lastActivityDataInfo = bllActivity.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityId));

            if (lastActivityDataInfo != null)
            {
                newActivityUId = lastActivityDataInfo.UID + 1;
            }
            reqModel.ActivityID   = activityId;
            reqModel.UID          = newActivityUId;
            reqModel.InsertDate   = DateTime.Now;
            reqModel.WebsiteOwner = bllActivity.WebsiteOwner;

            #region OLD
            //BLLJIMP.Model.ActivityDataInfo Model = new ActivityDataInfo();
            //Model.UserId = context.Request["UserId"];
            //Model.ActivityID = ActivityID;
            //Model.UID = NewActivityUID;
            //Model.InsertDate = DateTime.Now;
            //Model.Name = GetPostParm("Name");
            //Model.Phone = GetPostParm("Phone");
            //Model.K1 = GetPostParm("K1");
            //Model.K2 = GetPostParm("K2");
            //Model.K3 = GetPostParm("K3");
            //Model.K4 = GetPostParm("K4");
            //Model.K5 = GetPostParm("K5");
            //Model.K6 = GetPostParm("K6");
            //Model.K7 = GetPostParm("K7");
            //Model.K8 = GetPostParm("K8");
            //Model.K9 = GetPostParm("K9");
            //Model.K10 = GetPostParm("K10");
            //Model.K11 = GetPostParm("K11");
            //Model.K12 = GetPostParm("K12");
            //Model.K13 = GetPostParm("K13");
            //Model.K14 = GetPostParm("K14");
            //Model.K15 = GetPostParm("K15");
            //Model.K16 = GetPostParm("K16");
            //Model.K17 = GetPostParm("K17");
            //Model.K18 = GetPostParm("K18");
            //Model.K19 = GetPostParm("K19");
            //Model.K20 = GetPostParm("K20");

            //Model.K21 = GetPostParm("K21");
            //Model.K22 = GetPostParm("K22");
            //Model.K23 = GetPostParm("K23");
            //Model.K24 = GetPostParm("K24");
            //Model.K25 = GetPostParm("K25");
            //Model.K26 = GetPostParm("K26");
            //Model.K27 = GetPostParm("K27");
            //Model.K28 = GetPostParm("K28");
            //Model.K29 = GetPostParm("K29");
            //Model.K30 = GetPostParm("K30");

            //Model.K31 = GetPostParm("K31");
            //Model.K32 = GetPostParm("K32");
            //Model.K33 = GetPostParm("K33");
            //Model.K34 = GetPostParm("K34");
            //Model.K35 = GetPostParm("K35");
            //Model.K36 = GetPostParm("K36");
            //Model.K37 = GetPostParm("K37");
            //Model.K38 = GetPostParm("K38");
            //Model.K39 = GetPostParm("K39");
            //Model.K40 = GetPostParm("K40");

            //Model.K41 = GetPostParm("K41");
            //Model.K42 = GetPostParm("K42");
            //Model.K43 = GetPostParm("K43");
            //Model.K44 = GetPostParm("K44");
            //Model.K45 = GetPostParm("K45");
            //Model.K46 = GetPostParm("K46");
            //Model.K47 = GetPostParm("K47");
            //Model.K48 = GetPostParm("K48");
            //Model.K49 = GetPostParm("K49");
            //Model.K50 = GetPostParm("K50");

            //Model.K51 = GetPostParm("K51");
            //Model.K52 = GetPostParm("K52");
            //Model.K53 = GetPostParm("K53");
            //Model.K54 = GetPostParm("K54");
            //Model.K55 = GetPostParm("K55");
            //Model.K56 = GetPostParm("K56");
            //Model.K57 = GetPostParm("K57");
            //Model.K58 = GetPostParm("K58");
            //Model.K59 = GetPostParm("K59");
            //Model.K60 = GetPostParm("K60");
            #endregion

            UserInfo userInfo = bllUser.GetUserInfo(reqModel.UserId);
            if (!string.IsNullOrEmpty(reqModel.UserId))
            {
                if (userInfo == null)
                {
                    resp.Msg = "用户不存在,请检查";
                    return(Common.JSONHelper.ObjectToJson(resp));
                }
                else
                {
                    #region 自动补充信息
                    reqModel.WeixinOpenID = userInfo.WXOpenId;
                    reqModel.UserId       = userInfo.UserID;
                    if (!string.IsNullOrEmpty(userInfo.TrueName))
                    {
                        reqModel.Name = userInfo.TrueName;
                    }
                    if (!string.IsNullOrEmpty(userInfo.Phone))
                    {
                        reqModel.Phone = userInfo.Phone;
                    }
                    var  fieldMappingList = bllActivity.GetActivityFieldMappingList(reqModel.ActivityID);
                    Type type             = reqModel.GetType();
                    if (!string.IsNullOrEmpty(userInfo.Company))
                    {
                        if (fieldMappingList.Where(p => p.MappingName.Contains("公司")).Count() > 0)
                        {
                            PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("公司")).First().ExFieldIndex.ToString());

                            propertyInfo.SetValue(reqModel, userInfo.Company, null);
                        }
                    }
                    if (!string.IsNullOrEmpty(userInfo.Postion))
                    {
                        if (fieldMappingList.Where(p => p.MappingName.Contains("职位")).Count() > 0)
                        {
                            PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("职位")).First().ExFieldIndex.ToString());

                            propertyInfo.SetValue(reqModel, userInfo.Postion, null);
                        }
                    }
                    if (!string.IsNullOrEmpty(userInfo.Email))
                    {
                        if (fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).Count() > 0)
                        {
                            PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).First().ExFieldIndex.ToString());

                            propertyInfo.SetValue(reqModel, userInfo.Email, null);
                        }
                    }



                    #endregion
                }
            }
            if (string.IsNullOrEmpty(reqModel.Name))
            {
                resp.Msg = "该用户没有填写姓名,请填写姓名";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (string.IsNullOrEmpty(reqModel.Phone))
            {
                resp.Msg = "该用户没有填写手机号,请填写手机号";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (bllActivity.Add(reqModel))
            {
                resp.Status = 1;
                #region 扣积分
                JuActivityInfo juActivityInfo = bllJuActivity.GetJuActivityByActivityID(activityId);
                if ((juActivityInfo != null) && (juActivityInfo.ActivityIntegral > 0))
                {
                    if (userInfo != null)
                    {
                        //userInfo.TotalScore -= juActivityInfo.ActivityIntegral;
                        if (bllUser.Update(userInfo, string.Format(" TotalScore-={0}", juActivityInfo.ActivityIntegral), string.Format(" AutoID={0}", userInfo.AutoID)) > 0)
                        {
                            ////积分记录
                            //BLLJIMP.Model.WBHScoreRecord record = new BLLJIMP.Model.WBHScoreRecord()
                            //{
                            //    InsertDate = DateTime.Now,
                            //    ScoreNum = "-" + juActivityInfo.ActivityIntegral.ToString(),
                            //    WebsiteOwner = bllUser.WebsiteOwner,
                            //    UserId = reqModel.UserId,
                            //    NameStr = "参加" + juActivityInfo.ActivityName,
                            //    Nums = "b55",
                            //    RecordType = "1",
                            //};
                            UserScoreDetailsInfo scoreRecord = new UserScoreDetailsInfo();
                            scoreRecord.AddTime      = DateTime.Now;
                            scoreRecord.Score        = juActivityInfo.ActivityIntegral;
                            scoreRecord.ScoreType    = "ActivityUse";
                            scoreRecord.UserID       = userInfo.UserID;
                            scoreRecord.AddNote      = "参加" + juActivityInfo.ActivityName + "使用" + juActivityInfo.ActivityIntegral + "积分";
                            scoreRecord.WebSiteOwner = userInfo.WebsiteOwner;
                            //bllUser.Add(record);
                            bllUser.Add(scoreRecord);
                        }
                        else
                        {
                            resp.Msg = "更新用户积分失败";
                            return(Common.JSONHelper.ObjectToJson(resp));
                        }
                    }
                }
                #endregion
            }
            else
            {
                resp.Msg = "添加失败";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Exemplo n.º 9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (bllUser.IsLogin == false)
            {
                resp.errcode = -1;
                resp.errmsg  = "你还没有登录,请先登录";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            string       data = context.Request["data"];
            RequestModel requestModel;

            try
            {
                requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(context.Request["data"]);
            }
            catch (Exception)
            {
                resp.errcode = -1;
                resp.errmsg  = "json格式错误,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            //检查必填项
            if (requestModel.order_id <= 0)
            {
                resp.errcode = 1;
                resp.errmsg  = "订单号出错";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_name))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人姓名";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人电话";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_province))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人省份名称";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_province_code))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人省份代码";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_city))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人城市名称";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_city_code))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人城市代码";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_dist))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人区域名称";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_dist_code))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人区域代码";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_address))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人街道地址";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.receiver_zip))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入收货人邮政编码";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            WXMallGiftOrderInfo giftorder = bllUser.Get <WXMallGiftOrderInfo>(string.Format(" OrderId={0} AND UserId='{1}' AND WebsiteOwner='{2}'", requestModel.order_id, bllUser.GetCurrUserID(), bllUser.WebsiteOwner));

            //检查是否已经领取
            if (giftorder != null)
            {
                resp.errcode = -1;
                resp.errmsg  = "你已经领取过了";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            //查看订单详情
            WXMallOrderDetailsInfo orderdetail = bllUser.Get <WXMallOrderDetailsInfo>(string.Format(" OrderID={0} ", requestModel.order_id));
            int OrderCount = bllUser.GetCount <WXMallGiftOrderInfo>(string.Format(" OrderId={0} ", requestModel.order_id));

            if (OrderCount >= orderdetail.TotalCount)
            {
                resp.errcode = -1;
                resp.errmsg  = "已经领完";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            WXMallGiftOrderInfo mallGiftOrderInfo = new WXMallGiftOrderInfo();

            mallGiftOrderInfo.GiftOrderId          = int.Parse(bllUser.GetGUID(BLLJIMP.TransacType.CommAdd));
            mallGiftOrderInfo.OrderId              = requestModel.order_id;
            mallGiftOrderInfo.ReceiveName          = requestModel.receiver_name;
            mallGiftOrderInfo.ReceivePhone         = requestModel.receiver_phone;
            mallGiftOrderInfo.InsertDate           = DateTime.Now;
            mallGiftOrderInfo.WebsiteOwner         = bllUser.WebsiteOwner;
            mallGiftOrderInfo.UserId               = bllUser.GetCurrUserID();
            mallGiftOrderInfo.ReceiverProvince     = requestModel.receiver_province;
            mallGiftOrderInfo.ReceiverProvinceCode = requestModel.receiver_province_code;
            mallGiftOrderInfo.ReceiverCity         = requestModel.receiver_city;
            mallGiftOrderInfo.ReceiverCityCode     = requestModel.receiver_city_code;
            mallGiftOrderInfo.ReceiverDist         = requestModel.receiver_dist;
            mallGiftOrderInfo.ReceiverDistCode     = requestModel.receiver_dist_code;
            mallGiftOrderInfo.Address              = requestModel.receiver_address;
            mallGiftOrderInfo.ZipCode              = requestModel.receiver_zip;
            if (bllUser.Add(mallGiftOrderInfo))
            {
                resp.errcode = 0;
                resp.errmsg  = "领取成功";
            }
            else
            {
                resp.errcode = -1;
                resp.errmsg  = "领取出错";
            }

            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            return;
        }