Esempio n. 1
0
    void Start()
    {
        storeInfoManager = GameObject.Find("StoreInfoManager").GetComponent <StoreInfoManager>();
        storeName        = storeInfoManager.storeInfos[storeInfoManager.missionStoreIndexArray[UnityEngine.Random.Range(0, 4)]].storeName;
        validTime        = DateTime.Today.AddDays(30).ToString("yyyy-MM-dd");
        giftItem         = Gift[UnityEngine.Random.Range(0, 10)];
        informText.text  = "오늘의 상점 [ " + storeName + " ] 에서 " + giftItem + " 를 받아가세요!!";
        Coupon coupon = new Coupon(validTime, storeName, giftItem);

        couponInfoManager.Add(coupon);
    }
Esempio n. 2
0
    public void Start()
    {
        storeInfoManager = GameObject.Find("StoreInfoManager").GetComponent <StoreInfoManager>();

        findingInfo.SetActive(false);
        for (int i = 0; i < 4; i++)
        {
            int num = storeInfoManager.missionStoreIndexArray[i];
            Panels[i].sprite = storeInfoManager.storeInfos[num].storeImage;
            stamps[i].sprite = storeInfoManager.storeInfos[num].storeImage; //
            stampPictures[i].SetActive(false);                              //
            toggleText[i].text   = storeInfoManager.storeInfos[storeInfoManager.missionStoreIndexArray[i]].storeName;
            storeToggles[i].isOn = false;
            popUpAudio           = findingInfo.GetComponent <AudioSource>();
        }
    }
Esempio n. 3
0
        /// <summary>
        /// 订阅宝SSO登录
        /// </summary>
        public ActionResult DybLogin()
        {
            try
            {
                LogUtil.WriteLog($"开始登陆 url:{WebHelper.GetRawUrl()}");
                if (WorkContext.Uid > 0)
                {
                    WebHelper.DeleteCookie("bma");
                    Sessions.RemoverSession(WorkContext.Sid);
                    OnlineUsers.DeleteOnlineUserBySid(WorkContext.Sid);
                }
                string username    = WebHelper.GetQueryString("username");
                string agentname   = WebHelper.GetQueryString("agentname");
                string redirectUrl = WebHelper.GetQueryString("redirect");
                string ak          = WebHelper.GetQueryString("ak");
                if (string.IsNullOrEmpty(username))
                {
                    return(PromptView("该单点登录链接缺少用户信息"));
                }

                var storepid = 0;
                if (!string.IsNullOrEmpty(agentname))
                {
                    var agentUid = OAuths.GetUidByOpenIdAndServer(agentname, "dyb");
                    if (agentUid > 0)
                    {
                        var agentUser = Users.GetPartUserById(agentUid);
                        storepid = agentUser.StoreId;
                    }
                }
                var uid = OAuths.GetUidByOpenIdAndServer(username, "dyb");
                if (uid < 1)
                {
                    //创建用户
                    var userInfo = OAuths.CreateOAuthUser(DateTime.Now.ToString("yyMMddHHmmssms"), "dyb", username, "dyb",
                                                          WorkContext.RegionId);
                    uid = userInfo.Uid;
                }
                var partUserInfo = Users.GetPartUserById(uid);
                if (partUserInfo.StoreId == 0)
                {
                    //创建店铺
                    var storeId = AdminStores.CreateStore(new StoreInfo
                    {
                        Announcement = "",
                        Banner       = "",
                        CreateTime   = DateTime.Now,
                        DePoint      = 10,
                        Description  = "",
                        Honesties    = 0,
                        Logo         = "",
                        Mobile       = "",
                        Name         = "微信小程序",
                        Phone        = "",
                        QQ           = "",
                        RegionId     = 0,
                        SePoint      = 10,
                        ShPoint      = 10,
                        State        = 0,
                        StateEndTime = DateTime.Now.AddYears(1),
                        StoreIid     = 0,
                        StoreRid     = 1,
                        Theme        = "default",
                        WW           = "",
                        StorePid     = storepid
                    }, new StoreKeeperInfo
                    {
                        Address = username,
                        IdCard  = username,
                        Name    = partUserInfo.UserName,
                        Type    = 0
                    });

                    AdminStores.CreateStoreShipTemplate(new StoreShipTemplateInfo
                    {
                        Free    = 1,
                        StoreId = storeId,
                        Title   = "全场包邮",
                        Type    = 0
                    });

                    //创建会员等级
                    AdminUserRanks.CreateUserRank(new UserRankInfo
                    {
                        Avatar       = string.Empty,
                        CreditsLower = 0,
                        CreditsUpper = -1,
                        LimitDays    = 0,
                        StoreId      = storeId,
                        System       = 0,
                        Title        = "初级会员"
                    });
                    partUserInfo.StoreId = storeId;
                    partUserInfo.UserRid = UserRanks.GetLowestUserRank(storeId).UserRid;
                    WorkContext.StoreId  = storeId;

                    Users.UpdatePartUser(partUserInfo);
                }
                //如果对应的店铺没有平台ID,则可以更改storepid,否则不行
                if (storepid > 0)
                {
                    var store = Stores.GetStoreById(partUserInfo.StoreId);
                    if (store != null && store.StorePid == 0 && store.StoreId != storepid)
                    {
                        AdminStores.UpdateStorePId(store.StoreId, storepid);
                    }
                }

                //将用户信息写入cookie中
                MallUtils.SetUserCookie(partUserInfo, 365);
                StoreInfoManager.UpdateDistributor(partUserInfo.StoreId,
                                                   ak.Equals("dis", StringComparison.InvariantCultureIgnoreCase));
                LogUtil.WriteLog($"开始登陆 开始跳转");
                if (string.IsNullOrEmpty(redirectUrl))
                {
                    return(RedirectToAction("index", "home", new RouteValueDictionary {
                        { "area", "storeadmin" }
                    }));
                }
                else
                {
                    return(Redirect(redirectUrl));
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(e.Message);
                throw;
            }
        }