示例#1
0
 public MerchantAdmin Convert(Merchant merchant, EnjoyUser user)
 {
     return(new MerchantAdmin()
     {
         Merchant = merchant,
         EnjoyUser = user
     });
 }
示例#2
0
        public int UpdateFrom2()
        {
            //导入柠檬工坊基础数据
            var session   = this.OrchardServices.TransactionManager.GetSession();
            var enjoyUser = new EnjoyUser()
            {
                Mobile           = "13961576298",
                NickName         = "稻草人",
                WxUser           = null,
                Password         = this.EncryptionService.Ciphertext("Window2008"),
                LastPassword     = this.EncryptionService.Ciphertext("Window2008"),
                Profile          = string.Empty,
                CreatedTime      = DateTime.Now.ToUnixStampDateTime(),
                LastActivityTime = DateTime.Now.ToUnixStampDateTime()
            };

            session.SaveOrUpdate(enjoyUser);
            var miniprogarm = new WeChatConfig("wx6a15c5888e292f99", "74c4c300a46b8c6eb8c79b3689065673",
                                               "1520961881", "EA62B75D5D3941C3A632B8F18C7B3575");
            var official = new WeChatConfig("wx20da9548445a2ca7", "8fd877e51aa338a2c660e35d1f876e70",
                                            "1520961881", "EA62B75D5D3941C3A632B8F18C7B3575");
            var payment = new Dictionary <string, string>();

            payment.Add("1520961881", "EA62B75D5D3941C3A632B8F18C7B3575");

            var merchant = new Merchant()
            {
                Address          = "四川省眉山市东坡区东坡里商业水街2号楼14号",
                BrandName        = "柠檬工坊",
                Code             = "92511402MA6941EG0R",
                Contact          = "刘丽群",
                CreateTime       = DateTime.Now.ToUnixStampDateTime(),
                EnjoyUser        = enjoyUser,
                LastActivityTime = DateTime.Now.ToUnixStampDateTime(),
                Miniprogram      = miniprogarm.SerializeToJson(),
                Official         = official.SerializeToJson(),
                Payment          = payment.SerializeToJson(),
                Mobile           = "13890397856"
            };

            session.SaveOrUpdate(merchant);
            var shop = new Shop()
            {
                Address          = merchant.Address,
                Pid              = 491431822,
                LastActivityTime = DateTime.Now.ToUnixStampDateTime(),
                Leader           = "刘丽群",
                Merchant         = merchant,
                ShopName         = "柠檬工坊东坡店"
            };

            session.SaveOrUpdate(shop);
            return(3);
        }
示例#3
0
 public EnjoyUserModel(EnjoyUser record)
 {
     this.Id             = record.Id;
     this.Mobile         = record.Mobile;
     this.NickName       = record.NickName;
     this.Password       = record.Password;
     this.WxUser         = new WxUserModel(record.WxUser);
     this.LastPassword   = record.LastPassword;
     this.CreatedTime    = record.CreatedTime;
     this.LastActiveTime = record.LastActivityTime;
     this.AvatarUrl      = record.Profile;
 }
示例#4
0
        public AuthQueryResponse SignUp(SignUpViewModel model)
        {
            if (string.IsNullOrEmpty(model.Password))
            {
                return(new AuthQueryResponse(Constants.PasswordCantBeNullOrEmpty));
            }
            if (model.Password.Equals(model.ConfirmPassword) == false)
            {
                return(new AuthQueryResponse(Constants.ConfirPasswordIncorrent));
            }

            try
            {
                var profile = QueryByMobile(model.Mobile);
                if (profile.ErrorCode == Constants.MobileNotExists)
                {
                    var record = new EnjoyUser()
                    {
                        Mobile           = model.Mobile,
                        Password         = this._encryption.Ciphertext(model.Password),
                        NickName         = string.Format("U{0}{1}", model.Mobile.Substring(0, 3), model.Mobile.Substring(model.Mobile.Length - 4, 4)),
                        CreatedTime      = DateTime.UtcNow.ToUnixStampDateTime(),
                        LastActivityTime = DateTime.UtcNow.ToUnixStampDateTime(),
                        LastPassword     = string.Empty
                    };
                    this.OS.TransactionManager.GetSession().SaveOrUpdate(record);
#if DEBUG
#else
                    this.SignIn(new EnjoyUserModel(record), true);
#endif
                    return(new AuthQueryResponse(Constants.Success, new EnjoyUserModel(record)));
                }
                return(new AuthQueryResponse(Constants.MobileExists, string.Empty));
            }
            catch (NHibernate.Exceptions.GenericADOException ex)
            {
                return(new AuthQueryResponse(Constants.ErrorMessageNotDefined, ex.Message));
            }
        }