Ejemplo n.º 1
0
        public IActionResult Registe([FromServices] AppData appData,
                                     string name,
                                     string pwd,
                                     string code,
                                     string invitationCode,
                                     string email,
                                     string address,
                                     string phone,
                                     string mark,
                                     string license)
        {
            var result = new JsonData();

            if (service.Exists(a => (a.Name == name)))
            {
                result.Msg     = "该商户已注册";
                result.Success = false;
                return(Json(result));
            }
            else if (service.Exists(a => (a.Code == code)))
            {
                result.Msg     = "该用户名已注册";
                result.Success = false;
                return(Json(result));
            }
            else
            {
                var userInfo = new Business
                {
                    Name                = name,
                    Password            = UtilHelper.MD5Encrypt(pwd),
                    Code                = code,
                    Email               = email,
                    InvitationCode      = invitationCode,
                    Address             = address,
                    Mobile              = phone,
                    BusinessLicense     = license,
                    RegisterDate        = DateTime.Now,
                    Description         = mark,
                    Freight             = 4,
                    BusinessStartTime   = "06:00",
                    BusinessEndTime     = "21:00",
                    Category            = BusinessCategory.Store,
                    StoreId             = service.GetNextStoreNumber(),
                    ObjectId            = Guid.NewGuid().ToString().ToLower(),
                    Score               = 5,
                    Delivery            = 5,
                    IsEnjoymentActivity = false,
                    DiscountQuantity    = 1,
                    WeChatAppId         = appData.WeChatAppId,
                    WeChatSecret        = appData.WeChatSecret,
                    RefundTemplateId    = appData.Msg_Refund,
                    NewOrderTemplateId  = appData.EventMessageTemplateId,
                    PayServerAppId      = appData.ServerAppId,
                    PayServerKey        = appData.ServerKey,
                    PayServerMchId      = appData.ServerMchId,
                    CertFile            = appData.CertFile
                };
                userInfo.FeyinMemberCode = appData.FeyinMemberCode;
                userInfo.FeyinApiKey     = appData.FeyinApiKey;
                service.Add(userInfo);
                result.Msg     = "注册成功";
                result.Success = true;
                return(Json(result));
            }
        }