Beispiel #1
0
 /// <summary>
 /// 占用车辆超时还车通知
 /// </summary>
 /// <param name="context"></param>
 public void Execute(IJobExecutionContext context)
 {
     try
     {
         int           minutes_timeout = 60;
         List <string> saasList        = ConfigHelper.GetSaasList();
         int           i = 0;
         foreach (string saas in saasList)
         {
             if (i == 0)
             {
                 ICache cache = null;
                 try
                 {
                     MyWorkerRequest.CreateHttpContext(saas, "", "");
                     OrdersManager  om = new OrdersManager();
                     VehicleManager vm = new VehicleManager();
                     //DataTable dt = om.GetVehicleReturnOrderList(minutes_timeout);
                     DataTable dt = vm.GetInUseVehicles();
                     Logger.Debug(string.Format("开始车辆还车通知任务,车辆数:{0},saas:{1}", dt.Rows.Count, saas));
                     UserInfoManager um  = new UserInfoManager();
                     SmsInfoManager  sim = new SmsInfoManager();
                     cache = CacheFactory.GetCache();
                     foreach (DataRow dr in dt.Rows)
                     {
                         string vehicleID   = dr["ID"].ToString();
                         string lockState   = dr["LockState"].ToString();
                         string vehicleName = dr["VehicleName"].ToString();
                         //string userID = dr["UserID"].ToString();
                         //string orderNum = dr["OrderNum"].ToString();
                         if (!string.IsNullOrEmpty(vehicleID))
                         {
                             //Hashtable htVehicle = vm.GetVehicleInfoByID(vehicleID);
                             Hashtable htOrder = om.GetInUseOrder(vehicleID);
                             if (htOrder != null)
                             {
                                 string userID = SiteHelper.GetHashTableValueByKey(htOrder, "UserID");
                                 //string lockState = SiteHelper.GetHashTableValueByKey(htVehicle, "LockState");
                                 //string vehicleName = SiteHelper.GetHashTableValueByKey(htVehicle, "VehicleName");
                                 string   orderNum      = SiteHelper.GetHashTableValueByKey(htOrder, "OrderNum");
                                 string   createTimeStr = SiteHelper.GetHashTableValueByKey(htOrder, "CreateTime");
                                 DateTime createTime    = DateTime.Parse(createTimeStr);
                                 TimeSpan span          = DateTime.Now - createTime;
                                 if ("lock".Equals(lockState) && span.TotalMinutes > minutes_timeout)
                                 {
                                     Hashtable htUser = um.GetUserInfoByUserID(userID);
                                     if (htUser != null)
                                     {
                                         string mobile     = SiteHelper.GetHashTableValueByKey(htUser, "BindPhone");
                                         string key        = "Return_Vehicle_Message_" + mobile + "_" + vehicleID;
                                         string code_value = cache.Get <string>(key);
                                         if (string.IsNullOrEmpty(code_value))
                                         {
                                             bool sendResult = sim.SendReturn(mobile);
                                             if (sendResult)
                                             {
                                                 Logger.Warn(string.Format("订单号{0},车辆{1}还车提醒,发送给{2}成功。", orderNum, vehicleName, mobile));
                                                 DateTime dtDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                                                 cache.Set(key, 1, dtDay - DateTime.Now);
                                             }
                                             else
                                             {
                                                 Logger.Error(string.Format("订单号{0},车辆{1}还车提醒,发送给{2}失败。", orderNum, vehicleName, mobile));
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                     if (cache != null)
                     {
                         cache.Dispose();
                     }
                 }
                 catch (Exception e)
                 {
                     if (cache != null)
                     {
                         cache.Dispose();
                     }
                     Logger.Error(string.Format("车辆还车通知任务(ReturnVehicleSendMessage:{0})失败,{1},{2}", saas, e.Message, e.StackTrace));
                 }
                 i++;
             }
         }
     }
     catch
     {
         Logger.Info("车辆还车通知任务(ReturnVehicleNotify)失败");
     }
 }
        static void pushPage(string type, string subType, string id, bool isPush = false)
        {
            if (type != "rank" && id.isEmpty())
            {
                return;
            }

            if (VersionManager.needForceUpdate())
            {
                return;
            }

            if (type == "project")
            {
                if (subType == "article")
                {
                    AnalyticsManager.ClickEnterArticleDetail("Push_Article", id, $"PushArticle_{id}");
                    if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                    {
                        return;
                    }

                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToArticleDetailAction {
                        articleId = id, isPush = isPush
                    });
                }
            }
            else if (type == "event")
            {
                var eventType = EventType.offline;
                if (subType == "online")
                {
                    eventType = EventType.online;
                }

                AnalyticsManager.ClickEnterEventDetail("Push_Event", id, $"PushEvent_{id}", eventType.ToString());

                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToEventDetailAction {
                    eventId = id, eventType = eventType
                });
            }
            else if (type == "team")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(
                        new MainNavigatorPushToTeamDetailAction {
                        teamId = id
                    });
                }
            }
            else if (type == "user")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (subType == "follower")
                {
                    StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToUserDetailAction {
                        userId = id
                    });
                }
            }
            else if (type == "webView")
            {
                StoreProvider.store.dispatcher.dispatch(
                    new MainNavigatorPushToWebViewAction {
                    url = id
                });
            }
            else if (type == "messenger")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }

                if (isPush)
                {
                    if (UserInfoManager.isLogin())
                    {
                        StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToChannelAction {
                            channelId = id
                        });
                    }
                    else
                    {
                        Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login);
                    }
                }
                else
                {
                    StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToChannelShareAction {
                        channelId = id
                    });
                }
            }
            else if (type == "rank")
            {
                if (CTemporaryValue.currentPageModelId.isNotEmpty() && id == CTemporaryValue.currentPageModelId)
                {
                    return;
                }
                var initIndex = 0;
                switch (subType)
                {
                case "column": {
                    initIndex = 1;
                    break;
                }

                case "blogger": {
                    initIndex = 2;
                    break;
                }
                }
                StoreProvider.store.dispatcher.dispatch(new MainNavigatorPushToLeaderBoardAction {
                    initIndex = initIndex
                });
            }
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int Id = 0;

        try
        {
            Id = int.Parse(Request.QueryString["Id"].ToString());
        }
        catch (Exception)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('没有找到任务编号!');", true);
            return;
        }

        //先给Page_load再加载页面绑定的ddl数据
        ddlLeader.DataSourceID   = null;
        ddlLeader.DataSource     = taskManager.GetAllDepartment();
        ddlLeader.DataTextField  = "DepartmentName";
        ddlLeader.DataValueField = "id";
        ddlLeader.DataBind();

        ddlFenguanLeder.DataSourceID   = null;
        ddlFenguanLeder.DataSource     = taskManager.GetAllTaskLeaders();
        ddlFenguanLeder.DataTextField  = "name";
        ddlFenguanLeder.DataValueField = "uid";
        ddlLeader.DataBind();


        ddlLeaderMan.DataSourceID   = null;
        ddlLeaderMan.DataSource     = taskManager.GetAllTaskLeaders();
        ddlLeaderMan.DataTextField  = "name";
        ddlLeaderMan.DataValueField = "uid";
        ddlLeaderMan.DataBind();


        ddlPutDepart.DataSourceID   = null;
        ddlPutDepart.DataSource     = taskManager.GetAllDepartment();
        ddlPutDepart.DataTextField  = "DepartmentName";
        ddlPutDepart.DataValueField = "id";
        ddlPutDepart.DataBind();


        ddlweihuMan.DataSourceID   = null;
        ddlweihuMan.DataSource     = UserInfoManager.GetAllUser();
        ddlweihuMan.DataTextField  = "name";
        ddlweihuMan.DataValueField = "uid";
        ddlweihuMan.DataBind();

        //ddlweihuMan.DataSource = taskManager.GetAllUsersByDepartmentId();



        t = taskManager.GetTaskByTaskId(Id);
        this.txtTitle.Text = t.Title;
        this.ddlweihuMan.SelectedItem.Text = t.Branch;
        this.txtLingyu.Text = t.Domain;
        this.ddlLeader.SelectedItem.Text       = t.dutyDepart;
        this.ddlFenguanLeder.SelectedItem.Text = t.Extrleader;
        this.txFDate.Text  = t.filishTime.ToShortDateString();
        this.txtMoney.Text = t.Money.ToString().Substring(0, t.Money.ToString().IndexOf('.'));

        this.txtTargeCode.Text = t.Mumber.ToString();
        this.ddlLeaderMan.SelectedItem.Text = t.Principal.ToString();

        this.txtMarks.Text                 = t.Remarks;
        this.txtTraget.Text                = t.targetTask;
        ddlSteps.SelectedItem.Text         = t.Tasktype;
        this.ddlAddPower.SelectedItem.Text = t.Vindicator;
        this.txtUserfulWork.Text           = t.Work;
        ddlYears.SelectedValue             = t.Year.ToString();
    }
Beispiel #4
0
        public static AppState initialState()
        {
            var loginInfo = UserInfoManager.initUserInfo();
            var isLogin   = UserInfoManager.isLogin();

            return(new AppState {
                Count = PlayerPrefs.GetInt("count", 0),
                loginState = new LoginState {
                    email = "",
                    password = "",
                    loginInfo = loginInfo,
                    isLoggedIn = isLogin,
                    loading = false
                },
                articleState = new ArticleState {
                    articleList = new List <string>(),
                    articleDict = new Dictionary <string, Article>(),
                    articlesLoading = false,
                    articleDetailLoading = false,
                    hottestHasMore = true,
                    articleHistory = HistoryManager.articleHistoryList(isLogin ? loginInfo.userId : null),
                    blockArticleList = HistoryManager.blockArticleList(isLogin ? loginInfo.userId : null)
                },
                eventState = new EventState {
                    ongoingEvents = new List <string>(),
                    eventsDict = new Dictionary <string, IEvent>(),
                    ongoingEventTotal = 0,
                    completedEvents = new List <string>(),
                    completedEventTotal = 0,
                    pageNumber = 1,
                    completedPageNumber = 1,
                    eventsOngoingLoading = false,
                    eventsCompletedLoading = false,
                    eventHistory = HistoryManager.eventHistoryList(isLogin ? loginInfo.userId : null),
                    channelId = ""
                },
                popularSearchState = new PopularSearchState {
                    popularSearchs = new List <PopularSearch>()
                },
                searchState = new SearchState {
                    loading = false,
                    keyword = "",
                    searchArticles = new List <Article>(),
                    currentPage = 0,
                    pages = new List <int>(),
                    searchHistoryList = HistoryManager.searchHistoryList(isLogin ? loginInfo.userId : null),
                },
                notificationState = new NotificationState {
                    loading = false,
                    notifications = new List <Notification>()
                },
                userState = new UserState {
                    userDict = UserInfoManager.initUserDict()
                },
                teamState = new TeamState {
                    teamDict = new Dictionary <string, Team>()
                },
                placeState = new PlaceState {
                    placeDict = new Dictionary <string, Place>()
                },
                mineState = new MineState {
                    futureEventsList = new List <IEvent>(),
                    pastEventsList = new List <IEvent>(),
                    futureListLoading = false,
                    pastListLoading = false,
                    futureEventTotal = 0,
                    pastEventTotal = 0
                },
                messageState = new MessageState {
                    channelMessageDict = new Dictionary <string, Dictionary <string, Message> >(),
                    channelMessageList = new Dictionary <string, List <string> >()
                },
                settingState = new SettingState {
                    hasReviewUrl = false,
                    reviewUrl = ""
                },
                reportState = new ReportState {
                    loading = false
                }
            });
        }
Beispiel #5
0
 public UserInfoService(UserInfoManager userInfoManager)
 {
     _userInfoManager = userInfoManager;
 }
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
Beispiel #7
0
 void BindDataListInfoByID()
 {
     this.PerInfoDataList.DataSource = UserInfoManager.SelectInfoByID(Convert.ToInt32(Session["id"]));
     this.PerInfoDataList.DataBind();
 }
Beispiel #8
0
        public string GetUserByID(int id)
        {
            UserInfoManager manager = new UserInfoManager();

            return(new JavaScriptSerializer().Serialize(manager.GetUserByID(id)));
        }
Beispiel #9
0
        public string GetUserByName(string name)
        {
            UserInfoManager manager = new UserInfoManager();

            return(new JavaScriptSerializer().Serialize(manager.GetUserByName(name)));
        }
Beispiel #10
0
        public override Widget build(BuildContext context)
        {
            var child = new Container(
                color: CColors.White,
                child: new CustomSafeArea(
                    top: false,
                    bottom: false,
                    child: new CustomTabBarConnector(
                        new List <Widget> {
                new ArticlesScreenConnector(),
                new EventsScreen(),
                new MessengerScreenConnector(),
                new PersonalScreenConnector()
            },
                        new List <CustomTabBarItem> {
                new CustomTabBarItem(
                    0,
                    normalIcon: Icons.tab_home_line,
                    selectedIcon: Icons.tab_home_fill,
                    _getSelectedImages("home"),
                    "首页"
                    ),
                new CustomTabBarItem(
                    1,
                    normalIcon: Icons.tab_events_line,
                    selectedIcon: Icons.tab_events_fill,
                    _getSelectedImages("event"),
                    "活动"
                    ),
                new CustomTabBarItem(
                    2,
                    normalIcon: Icons.tab_messenger_line,
                    selectedIcon: Icons.tab_messenger_fill,
                    _getSelectedImages("messenger"),
                    "群聊"
                    ),
                new CustomTabBarItem(
                    3,
                    normalIcon: Icons.tab_mine_line,
                    selectedIcon: Icons.tab_mine_fill,
                    _getSelectedImages("mine"),
                    "我的"
                    )
            },
                        backgroundColor: CColors.TabBarBg,
                        (fromIndex, toIndex) => {
                AnalyticsManager.ClickHomeTab(fromIndex: fromIndex, toIndex: toIndex);

                if (toIndex != 2 || UserInfoManager.isLogin())
                {
                    var myUserId = UserInfoManager.getUserInfo().userId;
                    if (toIndex == 3 && myUserId.isNotEmpty())               // mine page
                    {
                        StoreProvider.store.dispatcher.dispatch(Actions.fetchUserProfile(userId: myUserId));
                    }
                    StatusBarManager.statusBarStyle(toIndex == 3 && UserInfoManager.isLogin());
                    StoreProvider.store.dispatcher.dispatch(new SwitchTabBarIndexAction {
                        index = toIndex
                    });
                    JPushPlugin.showPushAlert(toIndex != 2);
                    return(true);
                }

                Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login);
                return(false);
            }
                        )
                    )
                );

            return(new VersionUpdater(
                       child: child
                       ));
        }
Beispiel #11
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["PayWay"] == null || res["PayWay"].ToString().Trim().Length <= 0 ||
                res["OrderNum"] == null || res["OrderNum"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();
                int.TryParse(res["PayWay"].ToString().Trim(), out payway);
                cacheKey += uid;
                string ordernum                    = res["OrderNum"].ToString().Trim();
                string couponID                    = "";
                UserFinancialManager ufm           = new UserFinancialManager();
                UserInfoManager      uim           = new UserInfoManager();
                OrdersManager        om            = new OrdersManager();
                UserCouponManager    couponManager = new UserCouponManager();
                Hashtable            order_ht      = om.GetOrderInfoByNum(ordernum);
                if (order_ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到订单数据,支付失败"));
                }
                int     payState   = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayState"));
                int     orderState = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "OrderState"));
                decimal payMoney   = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayMoney"));
                decimal totalMoney = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "TotalMoney"));

                if (OrderState.UnPay.GetHashCode() != orderState)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "订单支付失败"));
                }
                if (totalMoney <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未产生支付费用,无需进行支付操作"));
                }

                #region 检测前一笔未确认支付交易是否成功,成功则禁止重复支付

                Hashtable financial_ht = ufm.GetLatestUserFinancialInfo(uid, UserFinancialState.NewSubmit, UserFinancialChangesType.Consumption);
                if (financial_ht != null && financial_ht.Keys.Count > 0)
                {
                    string order_num    = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                    string order_payid  = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderPayID");
                    string operator_way = SiteHelper.GetHashTableValueByKey(financial_ht, "OperatorWay");
                    if (operator_way == UserFinancialOperatorWay.WeixinPay.GetHashCode().ToString())
                    {
                        WxOrderQuery     orderQuery  = new WxOrderQuery();
                        OrderQueryResult queryResult = orderQuery.Query(order_payid);
                        if (queryResult.trade_state == TradeStateEnum.SUCCESS)
                        {
                            Hashtable hashuf = new Hashtable();
                            hashuf["ID"]       = SiteHelper.GetHashTableValueByKey(financial_ht, "ID");
                            hashuf["OrderNum"] = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                            hashuf["UserID"]   = SiteHelper.GetHashTableValueByKey(financial_ht, "UserID");
                            hashuf["State"]    = UserFinancialState.Effect.GetHashCode();
                            hashuf["TradeNo"]  = queryResult.transaction_id;
                            hashuf["TotalFee"] = queryResult.total_fee;
                            hashuf["PayWay"]   = UserFinancialOperatorWay.WeixinPay;
                            decimal changesAmount = 0.00m;
                            decimal.TryParse(SiteHelper.GetHashTableValueByKey(financial_ht, "ChangesAmount"), out changesAmount);
                            bool isSuccess = false;
                            if (Math.Abs(changesAmount) == queryResult.total_fee)
                            {
                                isSuccess = uim.OrderPayCallback(hashuf);
                            }
                            if (isSuccess && ordernum == order_num)
                            {
                                return(SiteHelper.GetJsonFromHashTable(null, "faild", "您当前订单已成功支付"));
                            }
                        }
                    }
                    else if (operator_way == UserFinancialOperatorWay.Alipay.GetHashCode().ToString())
                    {
                        AlipayOrderQuery orderQuery  = new AlipayOrderQuery();
                        OrderQueryResult queryResult = orderQuery.Query(order_payid);
                        if (queryResult.trade_state == TradeStateEnum.SUCCESS)
                        {
                            Hashtable hashuf = new Hashtable();
                            hashuf["ID"]       = SiteHelper.GetHashTableValueByKey(financial_ht, "ID");
                            hashuf["OrderNum"] = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                            hashuf["UserID"]   = SiteHelper.GetHashTableValueByKey(financial_ht, "UserID");
                            hashuf["State"]    = UserFinancialState.Effect.GetHashCode();
                            hashuf["TradeNo"]  = queryResult.transaction_id;
                            hashuf["TotalFee"] = queryResult.total_fee;
                            hashuf["PayWay"]   = UserFinancialOperatorWay.Alipay;
                            decimal changesAmount = 0.00m;
                            decimal.TryParse(SiteHelper.GetHashTableValueByKey(financial_ht, "ChangesAmount"), out changesAmount);
                            bool isSuccess = false;
                            if (Math.Abs(changesAmount) == queryResult.total_fee)
                            {
                                isSuccess = uim.OrderPayCallback(hashuf);
                            }
                            if (isSuccess && ordernum == order_num)
                            {
                                return(SiteHelper.GetJsonFromHashTable(null, "faild", "您当前订单已成功支付"));
                            }
                        }
                    }
                }

                #endregion

                if (res["CouponID"] != null && res["CouponID"].ToString().Trim().Length > 0)
                {
                    couponID = res["CouponID"].ToString().Trim();
                    Hashtable coupon_ht = couponManager.GetDataByID(couponID);
                    if (coupon_ht == null || coupon_ht.Keys.Count == 0)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    string  orderid     = SiteHelper.GetHashTableValueByKey(coupon_ht, "OrderID");
                    string  begintime   = SiteHelper.GetHashTableValueByKey(coupon_ht, "BeginTime");
                    string  endtime     = SiteHelper.GetHashTableValueByKey(coupon_ht, "EndTime");
                    string  userid      = SiteHelper.GetHashTableValueByKey(coupon_ht, "UserID");
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(SiteHelper.GetHashTableValueByKey(coupon_ht, "Money"), out couponMoney);
                    if (userid != uid)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (!string.IsNullOrEmpty(orderid))
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (DateTime.Parse(begintime) > DateTime.Now || DateTime.Parse(endtime) < DateTime.Now)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (couponMoney > totalMoney)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }

                    Hashtable update_order_ht = new Hashtable();
                    update_order_ht["CouponID"]    = couponID;
                    update_order_ht["CouponMoney"] = couponMoney;
                    update_order_ht["PayMoney"]    = totalMoney - couponMoney;
                    bool rrr = om.AddOrEditOrdersInfo(update_order_ht, SiteHelper.GetHashTableValueByKey(order_ht, "ID"));
                }

                webRoot         = SiteHelper.GetWebRoot();
                weixinNotifyUrl = string.Format("{0}{1}", webRoot, "/api/app/pay/wxpay/order_notify_url.aspx");
                alipayNotifyUrl = string.Format("{0}{1}", webRoot, "/api/app/pay/alipay/order_notify_url.aspx");

                string result = "";
                ICache cache  = null;
                switch (payway)
                {
                case 1:
                    cache = CacheFactory.GetCache();
                    if (!string.IsNullOrEmpty(cache.Get <string>(cacheKey)))
                    {
                        cache.Dispose();
                        Logger.Error("订单支付宝支付5秒内," + uid);
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "5秒内请勿重复点击"));
                    }
                    cache.Dispose();
                    result = AliPay(uid, ordernum);
                    break;

                case 2:
                    cache = CacheFactory.GetCache();
                    if (!string.IsNullOrEmpty(cache.Get <string>(cacheKey)))
                    {
                        cache.Dispose();
                        Logger.Error("订单微信支付5秒内," + uid);
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "5秒内请勿重复点击"));
                    }
                    cache.Dispose();
                    result = WxPay(uid, ordernum);
                    break;

                case 3:
                    result = BalancePay(uid, ordernum);
                    break;

                default:
                    break;
                }
                return(result);
            }
        }
Beispiel #12
0
        public static AppState Reduce(AppState state, object bAction)
        {
            switch (bAction)
            {
            case AddCountAction action: {
                state.Count += action.number;
                PlayerPrefs.SetInt("count", state.Count);
                PlayerPrefs.Save();
                break;
            }

            case LoginChangeEmailAction action: {
                state.loginState.email = action.changeText;
                break;
            }

            case LoginChangePasswordAction action: {
                state.loginState.password = action.changeText;
                break;
            }

            case ShowChatWindowAction action: {
                state.eventState.showChatWindow = action.show;
                break;
            }

            case ChatWindowStatusAction action: {
                state.eventState.openChatWindow = action.status;
                break;
            }

            case StartLoginByEmailAction _: {
                state.loginState.loading = true;
                break;
            }

            case LoginByEmailSuccessAction action: {
                state.loginState.loading            = false;
                state.loginState.loginInfo          = action.loginInfo;
                state.loginState.isLoggedIn         = true;
                state.articleState.articleHistory   = HistoryManager.articleHistoryList(action.loginInfo.userId);
                state.eventState.eventHistory       = HistoryManager.eventHistoryList(action.loginInfo.userId);
                state.searchState.searchHistoryList = HistoryManager.searchHistoryList(action.loginInfo.userId);
                state.articleState.blockArticleList = HistoryManager.blockArticleList(action.loginInfo.userId);
                EventBus.publish(EventBusConstant.login_success, new List <object>());
                break;
            }

            case LoginByEmailFailureAction _: {
                state.loginState.loading = false;
                break;
            }

            case LoginByWechatAction action: {
                state.loginState.loading = true;
                break;
            }

            case LoginByWechatSuccessAction action: {
                state.loginState.loading            = false;
                state.loginState.loginInfo          = action.loginInfo;
                state.loginState.isLoggedIn         = true;
                state.articleState.articleHistory   = HistoryManager.articleHistoryList(action.loginInfo.userId);
                state.eventState.eventHistory       = HistoryManager.eventHistoryList(action.loginInfo.userId);
                state.searchState.searchHistoryList = HistoryManager.searchHistoryList(action.loginInfo.userId);
                EventBus.publish(EventBusConstant.login_success, new List <object>());
                break;
            }

            case LoginByWechatFailureAction action: {
                state.loginState.loading = false;
                break;
            }

            case LogoutAction _: {
                HttpManager.clearCookie();
                state.loginState.loginInfo  = new LoginInfo();
                state.loginState.isLoggedIn = false;
                UserInfoManager.clearUserInfo();
                state.articleState.articleHistory   = HistoryManager.articleHistoryList();
                state.eventState.eventHistory       = HistoryManager.eventHistoryList();
                state.searchState.searchHistoryList = HistoryManager.searchHistoryList();
                state.articleState.blockArticleList = HistoryManager.blockArticleList();
                break;
            }

            case CleanEmailAndPasswordAction action: {
                state.loginState.email    = "";
                state.loginState.password = "";
                break;
            }

            case JumpToCreateUnityIdAction _: {
                break;
            }

            case StartFetchArticlesAction _: {
                state.articleState.articlesLoading = true;
                break;
            }

            case FetchArticleSuccessAction action: {
                if (action.offset == 0)
                {
                    state.articleState.articleList.Clear();
                }

                foreach (var article in action.articleList)
                {
                    state.articleState.articleList.Add(article.id);
                    if (!state.articleState.articleDict.ContainsKey(article.id))
                    {
                        state.articleState.articleDict.Add(article.id, article);
                    }
                }

                state.articleState.hottestHasMore  = action.hottestHasMore;
                state.articleState.articlesLoading = false;
                break;
            }

            case FetchArticleFailureAction _: {
                state.articleState.articlesLoading = false;
                break;
            }

            case StartFetchArticleDetailAction _: {
                state.articleState.articleDetailLoading = true;
                break;
            }

            case FetchArticleDetailSuccessAction action: {
                state.articleState.articleDetailLoading = false;
                var article = action.articleDetail.projectData;
                article.like                = action.articleDetail.like;
                article.edit                = action.articleDetail.edit;
                article.projects            = action.articleDetail.projects;
                article.channelId           = action.articleDetail.channelId;
                article.contentMap          = action.articleDetail.contentMap;
                article.hasMore             = action.articleDetail.comments.hasMore;
                article.isNotFirst          = true;
                article.currOldestMessageId = action.articleDetail.comments.currOldestMessageId;
                var dict = state.articleState.articleDict;
                if (dict.ContainsKey(article.id))
                {
                    state.articleState.articleDict[article.id] = article;
                }
                else
                {
                    state.articleState.articleDict.Add(article.id, article);
                }

                break;
            }

            case FetchArticleDetailFailureAction _: {
                state.articleState.articleDetailLoading = false;
                break;
            }

            case SaveArticleHistoryAction action: {
                var article  = action.article;
                var fullName = "";
                if (article.ownerType == "user")
                {
                    var userDict = state.userState.userDict;
                    if (article.userId != null && userDict.ContainsKey(article.userId))
                    {
                        fullName = userDict[article.userId].fullName;
                    }
                }

                if (article.ownerType == "team")
                {
                    var teamDict = state.teamState.teamDict;
                    if (article.teamId != null && teamDict.ContainsKey(article.teamId))
                    {
                        fullName = teamDict[article.teamId].name;
                    }
                }

                article.fullName = fullName;
                var articleHistoryList = HistoryManager.saveArticleHistory(article,
                                                                           state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.articleState.articleHistory = articleHistoryList;
                break;
            }

            case DeleteArticleHistoryAction action: {
                var articleHistoryList = HistoryManager.deleteArticleHistory(action.articleId,
                                                                             state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.articleState.articleHistory = articleHistoryList;
                break;
            }

            case DeleteAllArticleHistoryAction _: {
                state.articleState.articleHistory = new List <Article>();
                HistoryManager.deleteAllArticleHistory(state.loginState.isLoggedIn
                        ? state.loginState.loginInfo.userId
                        : null);
                break;
            }

            case LikeArticleAction _: {
                break;
            }

            case LikeArticleSuccessAction action: {
                if (state.articleState.articleDict.ContainsKey(action.articleId))
                {
                    state.articleState.articleDict[action.articleId].like = true;
                }

                break;
            }

            case BlockArticleAction action: {
                var blockArticleList =
                    HistoryManager.saveBlockArticleList(action.articleId, state.loginState.loginInfo.userId);
                state.articleState.blockArticleList = blockArticleList;
                break;
            }

            case StartFetchArticleCommentsAction _: {
                break;
            }

            case FetchArticleCommentsSuccessAction action: {
                var channelMessageList = new Dictionary <string, List <string> >();
                var channelMessageDict = new Dictionary <string, Dictionary <string, Message> >();

                // action.commentsResponse.parents.ForEach(message => { messageItem[message.id] = message; });
                channelMessageList.Add(action.channelId, action.itemIds);
                channelMessageDict.Add(action.channelId, action.messageItems);

                if (action.channelId.isNotEmpty())
                {
                    foreach (var dict in state.articleState.articleDict)
                    {
                        if (dict.Value.channelId == action.channelId)
                        {
                            dict.Value.hasMore             = action.hasMore;
                            dict.Value.currOldestMessageId = action.currOldestMessageId;
                        }
                    }
                }

                foreach (var keyValuePair in channelMessageList)
                {
                    if (state.messageState.channelMessageList.ContainsKey(keyValuePair.Key))
                    {
                        var oldList = state.messageState.channelMessageList[keyValuePair.Key];
                        if (action.isRefreshList)
                        {
                            oldList.Clear();
                        }

                        oldList.AddRange(keyValuePair.Value);
                        state.messageState.channelMessageList[keyValuePair.Key] = oldList;
                    }
                    else
                    {
                        state.messageState.channelMessageList.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }

                foreach (var keyValuePair in channelMessageDict)
                {
                    if (state.messageState.channelMessageDict.ContainsKey(keyValuePair.Key))
                    {
                        var oldDict = state.messageState.channelMessageDict[keyValuePair.Key];
                        var newDict = keyValuePair.Value;
                        foreach (var valuePair in newDict)
                        {
                            if (oldDict.ContainsKey(valuePair.Key))
                            {
                                oldDict[valuePair.Key] = valuePair.Value;
                            }
                            else
                            {
                                oldDict.Add(valuePair.Key, valuePair.Value);
                            }
                        }

                        state.messageState.channelMessageDict[keyValuePair.Key] = oldDict;
                    }
                    else
                    {
                        state.messageState.channelMessageDict.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }

                break;
            }

            case StartLikeCommentAction _: {
                break;
            }

            case LikeCommentSuccessAction action: {
                state.messageState.channelMessageDict[action.message.channelId][action.message.id] = action.message;
                break;
            }

            case LikeCommentFailureAction _: {
                break;
            }

            case StartRemoveLikeCommentAction action: {
                break;
            }

            case RemoveLikeCommentSuccessAction action: {
                state.messageState.channelMessageDict[action.message.channelId][action.message.id] = action.message;
                break;
            }

            case StartSendCommentAction action: {
                break;
            }

            case SendCommentSuccessAction action: {
                if (state.messageState.channelMessageList.ContainsKey(action.message.channelId))
                {
                    var list = state.messageState.channelMessageList[action.message.channelId];
                    list.Insert(0, action.message.id);
                    state.messageState.channelMessageList[action.message.channelId] = list;
                }
                else
                {
                    state.messageState.channelMessageList.Add(action.message.channelId,
                                                              new List <string> {
                            action.message.id
                        });
                }

                if (state.messageState.channelMessageDict.ContainsKey(action.message.channelId))
                {
                    var dict = state.messageState.channelMessageDict[action.message.channelId];
                    dict.Add(action.message.id, action.message);
                    state.messageState.channelMessageDict[action.message.channelId] = dict;
                }
                else
                {
                    state.messageState.channelMessageDict.Add(
                        action.message.channelId,
                        new Dictionary <string, Message> {
                            { action.message.id, action.message }
                        }
                        );
                }

                break;
            }

            case StartFetchEventOngoingAction _: {
                state.eventState.eventsOngoingLoading = true;
                break;
            }

            case StartFetchEventCompletedAction _: {
                state.eventState.eventsCompletedLoading = true;
                break;
            }

            case FetchEventsFailureAction action: {
                if (action.pageNumber == 1)
                {
                    if (action.tab == "ongoing")
                    {
                        state.eventState.eventsOngoingLoading = false;
                        state.eventState.pageNumber           = action.pageNumber;
                    }
                    else
                    {
                        state.eventState.eventsCompletedLoading = false;
                        state.eventState.completedPageNumber    = action.pageNumber;
                    }
                }

                break;
            }

            case FetchEventsSuccessAction action: {
                if (action.tab == "ongoing")
                {
                    state.eventState.eventsOngoingLoading = false;
                    state.eventState.pageNumber           = action.pageNumber;
                    state.eventState.ongoingEventTotal    = action.eventsResponse.events.total;
                }
                else
                {
                    state.eventState.eventsCompletedLoading = false;
                    state.eventState.completedPageNumber    = action.pageNumber;
                    state.eventState.completedEventTotal    = action.eventsResponse.events.total;
                }

                if (action.pageNumber == 1)
                {
                    if (action.tab == "ongoing")
                    {
                        state.eventState.ongoingEvents.Clear();
                    }
                    else
                    {
                        state.eventState.completedEvents.Clear();
                    }
                }

                action.eventsResponse.events.items.ForEach(eventObj => {
//                        if (eventObj.mode == "online") return;
                        if (action.tab == "ongoing")
                        {
                            if (!state.eventState.ongoingEvents.Contains(eventObj.id))
                            {
                                state.eventState.ongoingEvents.Add(eventObj.id);
                            }
                        }
                        else
                        {
                            if (!state.eventState.completedEvents.Contains(eventObj.id))
                            {
                                state.eventState.completedEvents.Add(eventObj.id);
                            }
                        }

                        if (state.eventState.eventsDict.ContainsKey(eventObj.id))
                        {
                            state.eventState.eventsDict[eventObj.id] = eventObj;
                        }
                        else
                        {
                            state.eventState.eventsDict.Add(eventObj.id, eventObj);
                        }
                    });
                break;
            }

            case StartFetchEventDetailAction _: {
                state.eventState.eventDetailLoading = true;
                break;
            }

            case FetchEventDetailSuccessAction action: {
                state.eventState.eventDetailLoading = false;
                state.eventState.channelId          = action.eventObj.channelId;
                if (state.eventState.eventsDict.ContainsKey(action.eventObj.id))
                {
                    state.eventState.eventsDict[action.eventObj.id] = action.eventObj;
                }
                else
                {
                    state.eventState.eventsDict.Add(action.eventObj.id, action.eventObj);
                }

                break;
            }

            case FetchEventDetailFailedAction _: {
                state.eventState.eventDetailLoading = false;
                break;
            }

            case SaveEventHistoryAction action: {
                var eventObj = action.eventObj;
                var place    = "";
                if (eventObj.mode == "offline")
                {
                    var placeDict = state.placeState.placeDict;
                    if (eventObj.placeId != null && placeDict.ContainsKey(eventObj.placeId))
                    {
                        place = placeDict[eventObj.placeId].name;
                    }
                }

                eventObj.place = place;
                if (eventObj.mode.isEmpty())
                {
                    eventObj.mode = action.eventType == EventType.online ? "online" : "offline";
                }

                var eventHistoryList = HistoryManager.saveEventHistoryList(eventObj,
                                                                           state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.eventState.eventHistory = eventHistoryList;
                break;
            }

            case DeleteEventHistoryAction action: {
                var eventHistoryList = HistoryManager.deleteEventHistoryList(action.eventId,
                                                                             state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.eventState.eventHistory = eventHistoryList;
                break;
            }

            case DeleteAllEventHistoryAction action: {
                state.eventState.eventHistory = new List <IEvent>();
                HistoryManager.deleteAllEventHistory(
                    state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                break;
            }

            case StartJoinEventAction _: {
                state.eventState.joinEventLoading = true;
                break;
            }

            case JoinEventSuccessAction action: {
                state.eventState.joinEventLoading = false;
                var eventObj = state.eventState.eventsDict[action.eventId];
                eventObj.userIsCheckedIn = true;
                state.eventState.eventsDict[action.eventId] = eventObj;
                break;
            }

            case JoinEventFailureAction _: {
                state.eventState.joinEventLoading = false;
                break;
            }

            case StartFetchNotificationsAction _: {
                state.notificationState.loading = true;
                break;
            }

            case FetchNotificationsSuccessAction action: {
                state.notificationState.total         = action.total;
                state.notificationState.notifications = action.notifications;
                state.notificationState.loading       = false;
                break;
            }

            case FetchNotificationsFailureAction _: {
                state.notificationState.loading = false;
                break;
            }

            case StartReportItemAction _: {
                state.reportState.loading = true;
                break;
            }

            case ReportItemSuccessAction _: {
                state.reportState.loading = false;
                break;
            }

            case ReportItemFailureAction _: {
                state.reportState.loading = false;
                break;
            }

            case StartFetchMyFutureEventsAction _: {
                state.mineState.futureListLoading = true;
                break;
            }

            case FetchMyFutureEventsSuccessAction action: {
                state.mineState.futureListLoading = false;
                state.mineState.futureEventTotal  = action.eventsResponse.events.total;
                var offlineItems = action.eventsResponse.events.items.FindAll(item => item.mode != "online");
                if (action.pageNumber == 1)
                {
                    state.mineState.futureEventsList = offlineItems;
                }
                else
                {
                    var results = state.mineState.futureEventsList;
                    results.AddRange(offlineItems);
                    state.mineState.futureEventsList = results;
                }

                break;
            }

            case FetchMyFutureEventsFailureAction _: {
                state.mineState.futureListLoading = false;
                break;
            }

            case StartFetchMyPastEventsAction _: {
                state.mineState.pastListLoading = true;
                break;
            }

            case FetchMyPastEventsSuccessAction action: {
                state.mineState.pastListLoading = false;
                state.mineState.pastEventTotal  = action.eventsResponse.events.total;
                var offlineItems = action.eventsResponse.events.items;
                if (action.pageNumber == 1)
                {
                    state.mineState.pastEventsList = offlineItems;
                }
                else
                {
                    var results = state.mineState.pastEventsList;
                    results.AddRange(offlineItems);
                    state.mineState.pastEventsList = results;
                }

                break;
            }

            case FetchMyPastEventsFailureAction _: {
                state.mineState.pastListLoading = false;
                break;
            }

            case StartFetchMessagesAction _: {
                state.messageState.messageLoading = true;
                break;
            }

            case FetchMessagesSuccessAction action: {
                if (action.messageIds != null && action.messageIds.Count > 0 &&
                    action.messageDict != null && action.messageDict.Count > 0)
                {
                    var channelMessageList = state.messageState.channelMessageList;
                    var channelMessageDict = state.messageState.channelMessageDict;
                    if (channelMessageList.ContainsKey(action.channelId))
                    {
                        channelMessageList[action.channelId] = action.messageIds;
                    }
                    else
                    {
                        channelMessageList.Add(action.channelId, action.messageIds);
                    }

                    if (channelMessageDict.ContainsKey(action.channelId))
                    {
                        channelMessageDict[action.channelId] = action.messageDict;
                    }
                    else
                    {
                        channelMessageDict.Add(action.channelId, action.messageDict);
                    }

                    state.messageState.channelMessageList  = channelMessageList;
                    state.messageState.channelMessageDict  = channelMessageDict;
                    state.messageState.hasMore             = action.hasMore;
                    state.messageState.currOldestMessageId = action.currOldestMessageId;
                }

                state.messageState.messageLoading = false;
                break;
            }

            case FetchMessagesFailureAction _: {
                state.messageState.messageLoading = false;
                break;
            }

            case StartSendMessageAction _: {
                state.messageState.sendMessageLoading = true;
                break;
            }

            case SendMessageSuccessAction action: {
                var channelMessageList = state.messageState.channelMessageList;
                var channelMessageDict = state.messageState.channelMessageDict;
                var messageIds         = new List <string>();
                if (channelMessageList.ContainsKey(action.channelId))
                {
                    messageIds = channelMessageList[action.channelId];
                }

                var messageDict = new Dictionary <string, Message>();
                if (channelMessageDict.ContainsKey(action.channelId))
                {
                    messageDict = channelMessageDict[action.channelId];
                }

                messageIds.Insert(0, action.nonce);
                if (channelMessageList.ContainsKey(action.channelId))
                {
                    channelMessageList[action.channelId] = messageIds;
                }
                else
                {
                    channelMessageList.Add(action.channelId, messageIds);
                }

                var previewMsg = new Message {
                    id      = action.nonce,
                    content = action.content,
                    author  = new User {
                        id       = state.loginState.loginInfo.userId,
                        fullName = state.loginState.loginInfo.userFullName
                    }
                };
                _nonce.Add(action.nonce);
                if (messageDict.ContainsKey(action.nonce))
                {
                    messageDict[action.nonce] = previewMsg;
                }
                else
                {
                    messageDict.Add(action.nonce, previewMsg);
                }

                state.messageState.channelMessageList = channelMessageList;
                state.messageState.channelMessageDict = channelMessageDict;
                state.messageState.sendMessageLoading = false;
                break;
            }

            case SendMessageFailureAction _: {
                state.messageState.sendMessageLoading = false;
                break;
            }

            case UserMapAction action: {
                var userDict = state.userState.userDict;
                foreach (var keyValuePair in action.userMap)
                {
                    if (userDict.ContainsKey(keyValuePair.Key))
                    {
                        userDict[keyValuePair.Key] = keyValuePair.Value;
                    }
                    else
                    {
                        userDict.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }

                state.userState.userDict = userDict;
                break;
            }

            case TeamMapAction action: {
                var teamDict = state.teamState.teamDict;
                foreach (var keyValuePair in action.teamMap)
                {
                    if (teamDict.ContainsKey(keyValuePair.Key))
                    {
                        teamDict[keyValuePair.Key] = keyValuePair.Value;
                    }
                    else
                    {
                        teamDict.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }

                state.teamState.teamDict = teamDict;
                break;
            }

            case PlaceMapAction action: {
                var placeDict = state.placeState.placeDict;
                foreach (var keyValuePair in action.placeMap)
                {
                    if (placeDict.ContainsKey(keyValuePair.Key))
                    {
                        placeDict[keyValuePair.Key] = keyValuePair.Value;
                    }
                    else
                    {
                        placeDict.Add(keyValuePair.Key, keyValuePair.Value);
                    }
                }

                state.placeState.placeDict = placeDict;
                break;
            }

            case PopularSearchSuccessAction action: {
                state.popularSearchState.popularSearchs = action.popularSearch;
                break;
            }

            case StartSearchArticleAction _: {
                state.searchState.loading = true;
                break;
            }

            case SearchArticleSuccessAction action: {
                state.searchState.loading     = false;
                state.searchState.keyword     = action.keyword;
                state.searchState.currentPage = action.searchResponse.currentPage;
                state.searchState.pages       = action.searchResponse.pages;
                if (action.pageNumber == 0)
                {
                    state.searchState.searchArticles = action.searchResponse.projects;
                }
                else
                {
                    var searchArticles = state.searchState.searchArticles;
                    searchArticles.AddRange(action.searchResponse.projects);
                    state.searchState.searchArticles = searchArticles;
                }

                break;
            }

            case SearchArticleFailureAction action: {
                state.searchState.loading = false;
                state.searchState.keyword = action.keyword;
                break;
            }

            case ClearSearchArticleResultAction action: {
                state.searchState.keyword        = "";
                state.searchState.searchArticles = new List <Article>();
                break;
            }

            case SaveSearchHistoryAction action: {
                var searchHistoryList = HistoryManager.saveSearchHistoryList(action.keyword,
                                                                             state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.searchState.searchHistoryList = searchHistoryList;
                break;
            }

            case DeleteSearchHistoryAction action: {
                var searchHistoryList = HistoryManager.deleteSearchHistoryList(action.keyword,
                                                                               state.loginState.isLoggedIn ? state.loginState.loginInfo.userId : null);
                state.searchState.searchHistoryList = searchHistoryList;
                break;
            }

            case DeleteAllSearchHistoryAction action: {
                state.searchState.searchHistoryList = new List <string>();
                HistoryManager.deleteAllSearchHistory(state.loginState.isLoggedIn
                        ? state.loginState.loginInfo.userId
                        : null);
                break;
            }

            case MainNavigatorPushToArticleDetailAction action: {
                if (action.articleId != null)
                {
                    Router.navigator.push(new PageRouteBuilder(
                                              pageBuilder: (context, animation, secondaryAnimation) =>
                                              new ArticleDetailScreenConnector(action.articleId),
                                              transitionsBuilder: (context1, animation, secondaryAnimation, child) =>
                                              new PushPageTransition(
                                                  routeAnimation: animation,
                                                  child: child
                                                  ))
                                          );
                }

                break;
            }

            case MainNavigatorPushToEventDetailAction action: {
                if (action.eventId != null)
                {
                    Router.navigator.push(new PageRouteBuilder(
                                              pageBuilder: (context, animation, secondaryAnimation) => {
                            if (action.eventType == EventType.offline)
                            {
                                return(new EventOfflineDetailScreenConnector(action.eventId));
                            }

                            return(new EventOnlineDetailScreenConnector(action.eventId));
                        },
                                              transitionsBuilder: (context1, animation, secondaryAnimation, child) =>
                                              new PushPageTransition(
                                                  routeAnimation: animation,
                                                  child: child
                                                  ))
                                          );
                }

                break;
            }

            case MainNavigatorPushToReportAction action: {
                Router.navigator.push(new PageRouteBuilder(
                                          pageBuilder: (context, animation, secondaryAnimation) =>
                                          new ReportScreenConnector(action.reportId, action.reportType),
                                          transitionsBuilder: (context1, animation, secondaryAnimation, child) =>
                                          new PushPageTransition(
                                              routeAnimation: animation,
                                              child: child
                                              )
                                          )
                                      );

                break;
            }

            case MainNavigatorPushToAction action: {
                Router.navigator.pushNamed(action.routeName);
                break;
            }

            case MainNavigatorPushToRouteAction action: {
                Router.navigator.push(action.route);
                break;
            }

            case MainNavigatorPopAction action: {
                for (var i = 0; i < action.index; i++)
                {
                    if (Router.navigator.canPop())
                    {
                        Router.navigator.pop();
                    }
                }

                break;
            }

            case LoginNavigatorPushToBindUnityAction _: {
                LoginScreen.navigator.push(new PageRouteBuilder(
                                               pageBuilder: (context, animation, secondaryAnimation) =>
                                               new BindUnityScreenConnector(FromPage.login),
                                               transitionsBuilder: (context1, animation, secondaryAnimation, child) => new PushPageTransition(
                                                   routeAnimation: animation,
                                                   child: child
                                                   ))
                                           );
                break;
            }

            case LoginNavigatorPushToAction action: {
                LoginScreen.navigator.pushNamed(action.routeName);
                break;
            }

            case LoginNavigatorPopAction action: {
                for (var i = 0; i < action.index; i++)
                {
                    if (LoginScreen.navigator.canPop())
                    {
                        LoginScreen.navigator.pop();
                    }
                }

                break;
            }

            case OpenUrlAction action: {
                if (action.url != null || action.url.Length > 0)
                {
                    Application.OpenURL(action.url);
                }

                break;
            }

            case CopyTextAction action: {
                Clipboard.setData(new ClipboardData(action.text));
                break;
            }

            case MainNavigatorPushToWebViewAction action: {
                if (action.url != null)
                {
                    Router.navigator.push(new PageRouteBuilder(
                                              pageBuilder: (context, animation, secondaryAnimation) =>
                                              new WebViewScreen(action.url),
                                              transitionsBuilder: (context1, animation, secondaryAnimation, child) =>
                                              new PushPageTransition(
                                                  routeAnimation: animation,
                                                  child: child
                                                  ))
                                          );
                }

                break;
            }

            case PlayVideoAction action: {
                if (action.url != null)
                {
                    Router.navigator.push(new PageRouteBuilder(
                                              pageBuilder: (context, animation, secondaryAnimation) =>
                                              new VideoViewScreen(action.url),
                                              transitionsBuilder: (context1, animation, secondaryAnimation, child) =>
                                              new PushPageTransition(
                                                  routeAnimation: animation,
                                                  child: child
                                                  ))
                                          );
                }

                break;
            }

            case FetchReviewUrlSuccessAction action: {
                state.settingState.reviewUrl    = action.url;
                state.settingState.hasReviewUrl = action.url.isNotEmpty();
                break;
            }

            case FetchReviewUrlFailureAction _: {
                state.settingState.reviewUrl    = "";
                state.settingState.hasReviewUrl = false;
                break;
            }

            case SettingClearCacheAction _: {
                state.articleState.articleHistory   = new List <Article>();
                state.eventState.eventHistory       = new List <IEvent>();
                state.searchState.searchHistoryList = new List <string>();
                HistoryManager.deleteAllArticleHistory(state.loginState.isLoggedIn
                        ? state.loginState.loginInfo.userId
                        : null);
                HistoryManager.deleteAllEventHistory(state.loginState.isLoggedIn
                        ? state.loginState.loginInfo.userId
                        : null);
                HistoryManager.deleteAllSearchHistory(state.loginState.isLoggedIn
                        ? state.loginState.loginInfo.userId
                        : null);
                break;
            }
            }

            return(state);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            StreamReader reader  = new StreamReader(Request.InputStream);
            String       xmlData = reader.ReadToEnd();
            var          sPara   = GetRequestPostByXml(xmlData);

            if (sPara.Count <= 0)
            {
                throw new ArgumentNullException();
            }

            if (sPara["return_code"] == "SUCCESS" && sPara["result_code"] == "SUCCESS")
            {
                var sign = sPara["sign"];

                Dictionary <string, string> sPara2 = new Dictionary <string, string>();
                foreach (var item in sPara)
                {
                    if (item.Key != "sign")
                    {
                        sPara2.Add(item.Key, item.Value);
                    }
                }

                var  signValue = WxPayAPI.Sign(sPara2, WxConfig.PartnerKey);
                bool isVerify  = sign == signValue;
                if (isVerify)
                {
                    var out_trade_no   = sPara["out_trade_no"];
                    var transaction_id = sPara["transaction_id"];
                    var total_fee      = sPara["total_fee"];

                    decimal pay_money = decimal.Parse(total_fee) / 100;
                    Logger.Info(string.Format("用户充值,微信公众号支付通知,订单号{0},支付单号{1},支付金额{2}", out_trade_no, transaction_id, pay_money));

                    UserInfoManager      uim           = new UserInfoManager();
                    UserFinancialManager ufm           = new UserFinancialManager();
                    DataTable            userfinancial = ufm.GetUserFinancialInfoByPayId(out_trade_no);
                    if (userfinancial != null && userfinancial.Rows.Count == 1)
                    {
                        Hashtable hashufdb = DataTableHelper.DataRowToHashTable(userfinancial.Rows[0]);
                        Hashtable hashuf   = new Hashtable();
                        hashuf["ID"]       = SiteHelper.GetHashTableValueByKey(hashufdb, "ID");
                        hashuf["UserID"]   = SiteHelper.GetHashTableValueByKey(hashufdb, "UserID");
                        hashuf["State"]    = UserFinancialState.Effect.GetHashCode();
                        hashuf["TradeNo"]  = transaction_id;
                        hashuf["TotalFee"] = pay_money;
                        hashuf["PayWay"]   = UserFinancialOperatorWay.WeixinPubPay;
                        decimal changesAmount = 0.00m;
                        decimal.TryParse(SiteHelper.GetHashTableValueByKey(hashufdb, "ChangesAmount"), out changesAmount);
                        bool isSuccess = false;
                        if (Math.Abs(changesAmount) == pay_money)
                        {
                            isSuccess = uim.RechargeCallBack(hashuf);
                        }
                        if (isSuccess)
                        {
                            sb.Append("<xml>");
                            sb.Append("<return_code>SUCCESS</return_code>");
                            sb.Append("<return_msg></return_msg>");
                            sb.Append("</xml>");
                        }
                        else
                        {
                            sb.Append("<xml>");
                            sb.Append("<return_code>FAIL</return_code>");
                            sb.Append("<return_msg>error</return_msg>");
                            sb.Append("</xml>");
                        }
                    }
                }
                else
                {
                    sb.Append("<xml>");
                    sb.Append("<return_code>FAIL</return_code>");
                    sb.Append("<return_msg>error</return_msg>");
                    sb.Append("</xml>");
                }
            }
            else
            {
                sb.Append("<xml>");
                sb.Append("<return_code>FAIL</return_code>");
                sb.Append("<return_msg>error</return_msg>");
                sb.Append("</xml>");
            }

            Response.Write(sb);
        }
Beispiel #14
0
        public static AppState initialState()
        {
            var loginInfo = UserInfoManager.initUserInfo();
            var isLogin   = UserInfoManager.isLogin();

            return(new AppState {
                loginState = new LoginState {
                    email = "",
                    password = "",
                    loginInfo = loginInfo,
                    isLoggedIn = isLogin,
                    loading = false
                },
                serviceConfigState = new ServiceConfigState {
                    showFirstEgg = false,
                    scanEnabled = false,
                    nationalDayEnabled = false,
                },
                articleState = new ArticleState {
                    recommendArticleIds = new List <string>(),
                    followArticleIdDict = new Dictionary <string, List <string> >(),
                    hotArticleIdDict = new Dictionary <string, List <string> >(),
                    articleDict = new Dictionary <string, Article>(),
                    articlesLoading = false,
                    followArticlesLoading = false,
                    articleDetailLoading = false,
                    hottestHasMore = true,
                    feedHasNew = false,
                    feedIsFirst = false,
                    followArticleHasMore = false,
                    hotArticleHasMore = false,
                    hotArticlePage = 0,
                    beforeTime = "",
                    afterTime = "",
                    articleHistory = HistoryManager.articleHistoryList(isLogin ? loginInfo.userId : null),
                    blockArticleList = HistoryManager.blockArticleList(isLogin ? loginInfo.userId : null)
                },
                eventState = new EventState {
                    ongoingEvents = new List <string>(),
                    eventsDict = new Dictionary <string, IEvent>(),
                    ongoingEventTotal = 0,
                    completedEvents = new List <string>(),
                    completedEventTotal = 0,
                    pageNumber = 1,
                    completedPageNumber = 1,
                    eventsOngoingLoading = false,
                    eventsCompletedLoading = false,
                    eventHistory = HistoryManager.eventHistoryList(isLogin ? loginInfo.userId : null),
                    channelId = ""
                },
                popularSearchState = new PopularSearchState {
                    popularSearchArticles = new List <PopularSearch>(),
                    popularSearchUsers = new List <PopularSearch>()
                },
                searchState = new SearchState {
                    searchArticleLoading = false,
                    searchUserLoading = false,
                    searchTeamLoading = false,
                    searchFollowingLoading = false,
                    keyword = "",
                    searchFollowingKeyword = "",
                    searchArticleIdDict = new Dictionary <string, List <string> >(),
                    searchUserIdDict = new Dictionary <string, List <string> >(),
                    searchTeamIdDict = new Dictionary <string, List <string> >(),
                    searchFollowings = new List <User>(),
                    searchArticleCurrentPage = 0,
                    searchArticlePages = new List <int>(),
                    searchUserHasMore = false,
                    searchTeamHasMore = false,
                    searchFollowingHasMore = false,
                    searchArticleHistoryList =
                        HistoryManager.searchArticleHistoryList(isLogin ? loginInfo.userId : null)
                },
                notificationState = new NotificationState {
                    loading = false,
                    page = 1,
                    pageTotal = 1,
                    notifications = new List <Notification>(),
                    mentions = new List <User>()
                },
                userState = new UserState {
                    userLoading = false,
                    userArticleLoading = false,
                    followingLoading = false,
                    followingUserLoading = false,
                    followingTeamLoading = false,
                    followerLoading = false,
                    userDict = UserInfoManager.initUserDict(),
                    slugDict = new Dictionary <string, string>(),
                    userLicenseDict = new Dictionary <string, UserLicense>(),
                    fullName = "",
                    title = "",
                    jobRole = new JobRole(),
                    place = ""
                },
                teamState = new TeamState {
                    teamLoading = false,
                    teamArticleLoading = false,
                    followerLoading = false,
                    memberLoading = false,
                    teamDict = new Dictionary <string, Team>(),
                    slugDict = new Dictionary <string, string>()
                },
                placeState = new PlaceState {
                    placeDict = new Dictionary <string, Place>()
                },
                followState = new FollowState {
                    followDict = new Dictionary <string, Dictionary <string, bool> >()
                },
                likeState = new LikeState {
                    likeDict = new Dictionary <string, Dictionary <string, bool> >()
                },
                mineState = new MineState {
                    futureEventsList = new List <IEvent>(),
                    pastEventsList = new List <IEvent>(),
                    futureListLoading = false,
                    pastListLoading = false,
                    futureEventTotal = 0,
                    pastEventTotal = 0
                },
                messageState = new MessageState {
                    channelMessageDict = new Dictionary <string, Dictionary <string, Message> >(),
                    channelMessageList = new Dictionary <string, List <string> >()
                },
                settingState = new SettingState {
                    hasReviewUrl = false,
                    vibrate = true,
                    reviewUrl = ""
                },
                reportState = new ReportState {
                    loading = false
                },
                feedbackState = new FeedbackState {
                    feedbackType = FeedbackType.Advice,
                    loading = false
                },
                channelState = new ChannelState {
                    channelLoading = false,
                    publicChannels = new List <string>(),
                    joinedChannels = new List <string>(),
                    createChannelFilterIds = new List <string>(),
                    discoverPage = 1,
                    discoverHasMore = true,
                    messageLoading = false,
                    totalUnread = 0,
                    totalMention = 0,
                    channelDict = new Dictionary <string, ChannelView>(),
                    messageDict = new Dictionary <string, ChannelMessageView>(),
                    localMessageDict = new Dictionary <string, ChannelMessageView>(),
                    channelTop = new Dictionary <string, bool>(),
                    socketConnected = true,
                    mentionSuggestions = new Dictionary <string, Dictionary <string, ChannelMember> >(),
                    newNotifications = isLogin
                        ? NewNotificationManager.getNewNotification(loginInfo.userId)
                        : null,
                    lastMentionQuery = null
                },
                tabBarState = new TabBarState {
                    currentTabIndex = 0
                },
                favoriteState = new FavoriteState {
                    favoriteTagLoading = false,
                    favoriteDetailLoading = false,
                    favoriteTagIdDict = new Dictionary <string, List <string> >(),
                    favoriteDetailArticleIdDict = new Dictionary <string, List <string> >(),
                    favoriteTagHasMore = false,
                    favoriteDetailHasMore = false,
                    favoriteTagDict = new Dictionary <string, FavoriteTag>()
                },
                networkState = new NetworkState {
                    networkConnected = true,
                    dismissNoNetworkBanner = true
                }
            });
        }
Beispiel #15
0
        public override Widget build(BuildContext context)
        {
            var child = new Container(
                color: CColors.White,
                child: new CustomSafeArea(
                    top: false,
                    bottom: false,
                    child: new CustomTabBar(
                        new List <Widget> {
                new ArticlesScreenConnector(),
                new EventsScreen(),
                new NotificationScreenConnector(),
                new PersonalScreenConnector()
            },
                        new List <CustomTabBarItem> {
                new CustomTabBarItem(
                    0,
                    Icons.UnityTabIcon,
                    Icons.UnityTabIcon,
                    "首页"
                    ),
                new CustomTabBarItem(
                    1,
                    Icons.outline_event,
                    Icons.eventIcon,
                    "活动"
                    ),
                new CustomTabBarItem(
                    2,
                    Icons.outline_notification,
                    Icons.notification,
                    "通知"
                    ),
                new CustomTabBarItem(
                    3,
                    Icons.mood,
                    Icons.mood,
                    "我的"
                    )
            },
                        backgroundColor: CColors.TabBarBg,
                        (fromIndex, toIndex) => {
                AnalyticsManager.ClickHomeTab(fromIndex: fromIndex, toIndex: toIndex);

                if (toIndex != 2 || StoreProvider.store.getState().loginState.isLoggedIn)
                {
                    StatusBarManager.statusBarStyle(toIndex == 3 && UserInfoManager.isLogin());
                    StoreProvider.store.dispatcher.dispatch(new SwitchTabBarIndexAction {
                        index = toIndex
                    });
                    return(true);
                }

                Router.navigator.pushNamed(routeName: MainNavigatorRoutes.Login);
                return(false);
            }
                        )
                    )
                );

            return(new VersionUpdater(
                       child: child
                       ));
        }
Beispiel #16
0
 public AccountController(UserInfoManager userManager,
                          IUnitOfWorkInt unitOfWork)
 {
     this.userManager = userManager;
     this.unitOfWork  = unitOfWork;
 }
Beispiel #17
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null || res["Mobile"].ToString().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号码为空"));
            }
            if (res["LoginCode"] == null || res["LoginCode"].ToString().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "图形码为空"));
            }
            string          mobile      = res["Mobile"].ToString().Trim();
            UserInfoManager uim         = new UserInfoManager();
            DataTable       blackMobile = uim.GetBlackMobileByMobile(mobile);

            if (blackMobile != null && blackMobile.Rows.Count > 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号被禁用,请联系客服"));
            }
            string code = res["LoginCode"].ToString().Trim();

            code = code.ToLower();
            ICache cache        = CacheFactory.GetCache();
            string loginCodeKey = "login_code_" + mobile;
            string code_value   = cache.Get <string>(loginCodeKey);

            Logger.Debug("mobile:" + mobile + ",code:" + code + ",redis_code_value:" + code_value);

            /*if(string.IsNullOrEmpty(code_value))
             * {
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "图形码超时");
             * }
             * if (!code_value.Equals(code))
             * {
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "图形码错误");
             * }*/

            if (!ValidateUtil.IsMobilePhone(mobile))
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机格式不正确"));
            }

            SmsInfoManager sim = new SmsInfoManager();
            //判断用户是否禁用状态
            DataTable user = uim.GetUserInfoByBindPhone(mobile);

            if (user != null)
            {
                if (user.Rows.Count > 0)
                {
                    Hashtable hashuser = DataTableHelper.DataRowToHashTable(user.Rows[0]);
                    if (SiteHelper.GetHashTableValueByKey(hashuser, "UserState").Trim() == UserState.Disable.GetHashCode().ToString())
                    {
                        if (cache != null)
                        {
                            cache.Dispose();
                        }
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "用户被禁用,无法收取验证码"));
                    }
                }
            }

            /*string span_key_id = "sms_send_time_span@" + mobile;
             * if (string.IsNullOrEmpty(Cache.Get<string>(span_key_id)))
             * {
             *  DateTime dt = DateTime.Now.AddSeconds(60);
             *  Cache.Set(span_key_id, mobile, dt - DateTime.Now);
             * }
             * else
             * {
             *  Cache.Dispose();
             *  Logger.Error("发送短信,Mobile:" + mobile + "60秒内");
             *  return SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败,请稍后再试");
             * }*/

            string keyid          = "sms_send_times@" + mobile;
            int    sms_send_times = 0;

            if (string.IsNullOrEmpty(cache.Get <string>(keyid)))
            {
                DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                cache.Set(keyid, sms_send_times, dt - DateTime.Now);
            }
            else
            {
                string tims = cache.Get <string>(keyid);
                int.TryParse(tims, out sms_send_times);
            }
            if (sms_send_times >= MaxSendTimes)
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败,短信发送已超过当天最大次数"));
            }

            bool sendResult = sim.SendVerificationCode(mobile);

            if (sendResult)
            {
                sms_send_times += 1;
                DateTime dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59);
                cache.Set(keyid, sms_send_times, dt - DateTime.Now);
                cache.Dispose();
                return(SiteHelper.GetJsonFromHashTable(null, "success", "短信发送成功"));
            }
            else
            {
                if (cache != null)
                {
                    cache.Dispose();
                }
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "短信发送失败"));
            }
        }
Beispiel #18
0
 /// <summary>
 /// reper绑定
 /// </summary>
 void ReperBind()
 {
     this.Repeater1.DataSource = UserInfoManager.SelectUserStopAll();
     this.Repeater1.DataBind();
 }
Beispiel #19
0
        private void Initialize()
        {
            gameObject.SetActive(true);

            diceLevel = 0;
            int diceCount = 0;

            // RandomWarsResource.Data.TDataDiceInfo dataDiceInfo;
            // if (TableManager.Get().DiceInfo.GetData(data.id, out dataDiceInfo) == false)
            // {
            //     return;
            // }

            image_Character.sprite = FileHelper.GetIcon(data.illustName);

            if (UserInfoManager.Get().GetUserInfo().dicGettedDice.ContainsKey(data.id))
            {
                diceLevel = UserInfoManager.Get().GetUserInfo().dicGettedDice[data.id][0];
                diceCount = UserInfoManager.Get().GetUserInfo().dicGettedDice[data.id][1];
                btn_Use.gameObject.SetActive(true);
                btn_Upgrade.gameObject.SetActive(true);
            }
            else
            {
                diceLevel = 1;
                diceCount = 0;
                btn_Use.gameObject.SetActive(false);
                btn_Upgrade.gameObject.SetActive(false);
            }

            int bonusTowerHp = 0;

            if (data.isGuardian == false)
            {
                RandomWarsResource.Data.TDataDiceUpgrade dataDiceCurrentUpgrade;
                RandomWarsResource.Data.TDataDiceUpgrade dataDiceUpgrade;
                if (TableManager.Get().DiceUpgrade.GetData(x => x.diceLv == diceLevel && x.diceGrade == (int)data.grade, out dataDiceCurrentUpgrade) == false)
                {
                    return;
                }
                if (TableManager.Get().DiceUpgrade.GetData(x => x.diceLv == diceLevel + 1 && x.diceGrade == (int)data.grade, out dataDiceUpgrade) == false)
                {
                    return;
                }
                needGold       = dataDiceUpgrade.needGold;
                needDiceCount  = dataDiceUpgrade.needCard;
                bonusTowerHp   = dataDiceCurrentUpgrade.getTowerHp;
                upgradeTowerHp = dataDiceUpgrade.getTowerHp;
            }

            ui_getted_dice.Initialize(data, diceLevel, diceCount);

            text_Name.text        = LocalizationManager.GetLangDesc((int)LANG_ENUM.DICE_NAME + data.id);
            text_Discription.text = LocalizationManager.GetLangDesc((int)LANG_ENUM.DICE_DESC + data.id);
            text_UpgradeGold.text = needGold.ToString();

            btn_Use.interactable = diceLevel > 0;
            btn_Upgrade.gameObject.SetActive(diceLevel > 0 && diceCount >= needDiceCount);
            var images = btn_Upgrade.GetComponentsInChildren <Image>();

            for (int i = 1; i < images.Length; ++i)
            {
                images[i].color = btn_Upgrade.interactable ? Color.white : Color.gray;
            }

            var interactable = btn_Upgrade.interactable;

            text_Upgrade.color     = interactable ? Color.white : Color.gray;
            text_UpgradeGold.color = interactable ? Color.white : Color.gray;

            images = btn_Use.GetComponentsInChildren <Image>();
            for (int i = 1; i < images.Length; ++i)
            {
                images[i].color = btn_Use.interactable ? Color.white : Color.gray;
            }
            text_Use.color = btn_Use.interactable ? Color.white : Color.gray;

            if (data.isGuardian == false)
            {
                text_TowerHP.text        = $"타워 HP {bonusTowerHp}";
                text_TowerHPUpgrade.text = string.Empty;
            }

            SetUnitGrade();
            SetInfoDesc();

            btn_Upgrade.gameObject.SetActive(btn_Upgrade.gameObject.activeSelf && !data.isGuardian);
            btn_ShowUpgrade.gameObject.SetActive(!data.isGuardian);
            btn_ShowLevelUp.gameObject.SetActive(!data.isGuardian);
            text_TowerHP.gameObject.SetActive(!data.isGuardian);

            SoundManager.instance.Play(clip_Open);
        }
Beispiel #20
0
 public UserController()
 {
     _userInfoManger     = new UserInfoManager();
     _designationManager = new DesignationManager();
 }