Пример #1
0
        public ActionResult ActivityPage(string token, string appid, string platform, string version)
        {
            /*
             * 1、随机生成金额分配给对应用户,金额区间26.5~28.2
             * 2、生成用户和任务的关联信息,用于校验任务的状态(一个用户同时接受多个任务  并对任务进行编号)
             */
            dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfoByToken(token);

            if (!dm_UserEntity.IsEmpty())
            {
                dm_activity_manageEntity dm_Activity_ManageEntity = dm_Activity_ManageIBLL.GetActivityInfo();

                if (!dm_Activity_ManageEntity.IsEmpty())
                {
                    ViewBag.ActivityRemark = dm_Activity_ManageEntity.ActivityRemark;

                    dm_activity_recordEntity dm_Activity_RecordEntity = dm_Activity_RecordIBLL.GetEntityByUserID((int)dm_UserEntity.id, dm_Activity_ManageEntity.f_id);

                    if (!dm_Activity_RecordEntity.IsEmpty())
                    {
                        dm_UserEntity = dM_UserIBLL.GetEntity(dm_UserEntity.id);
                    }
                    else
                    {
                        dm_UserEntity            = dM_UserIBLL.JoinActivity((int)dm_UserEntity.id);
                        dm_Activity_RecordEntity = new dm_activity_recordEntity();
                    }

                    ViewBag.ActivityPrice = dm_UserEntity.activityprice;

                    ViewBag.MyActivityInfo = dm_Activity_RecordEntity;
                }
            }
            else
            {
                ViewBag.MyActivityInfo = new dm_activity_recordEntity();
            }


            ViewBag.Token    = token;
            ViewBag.AppID    = appid;
            ViewBag.Platform = platform;
            ViewBag.Version  = version;

            return(View());
        }
Пример #2
0
        public ActionResult GetCommonSetting()
        {
            try
            {
                string appid = CheckAPPID(); string token = base.Request.Headers["token"];
                string platform = CheckPlaform();

                string            cacheKey          = Md5Helper.Hash("CommonSettingInfo" + appid + token + platform);
                CommonSettingInfo commonSettingInfo = redisCache.Read <CommonSettingInfo>(cacheKey, 7);

                if (commonSettingInfo.IsEmpty())
                {
                    dm_basesettingEntity dm_BasesettingEntity = dm_BaseSettingIBLL.GetEntityByCache(appid);
                    int Status = 0;
                    if (dm_BasesettingEntity.openchecked == "1")
                    { //开启审核模式
                        string version = CheckVersion();
                        if ((platform == "ios" && version == dm_BasesettingEntity.previewversion) || (platform == "android" && version == dm_BasesettingEntity.previewversionandroid))
                        {
                            Status = 1;
                        }
                    }

                    #region 活动配置校验
                    bool JoinActivity = false;
                    dm_activity_manageEntity dm_Activity_ManageEntity = new dm_activity_manageEntity();

                    dm_Activity_ManageEntity = dm_Activity_ManageIBLL.GetActivityInfo();
                    if (dm_Activity_ManageEntity.IsEmpty())
                    {
                        dm_Activity_ManageEntity = new dm_activity_manageEntity {
                            ActivityStatus = 0
                        }
                    }
                    ;
                    else
                    {
                        if (!token.IsEmpty())
                        {
                            dm_userEntity dm_UserEntity = CacheHelper.ReadUserInfoByToken(token);
                            if (!dm_UserEntity.IsEmpty())
                            {
                                dm_activity_recordEntity dm_Activity_RecordEntity = dm_Activity_RecordIBLL.GetEntityByUserID((int)dm_UserEntity.id, dm_Activity_ManageEntity.f_id);
                                if (!dm_Activity_RecordEntity.IsEmpty())
                                {
                                    JoinActivity = true;
                                }
                            }
                        }
                    }
                    #endregion

                    if (platform != "android")
                    {
                        JoinActivity = false;
                    }

                    commonSettingInfo = new CommonSettingInfo
                    {
                        //isAppStorePreview = ((base.Request.Headers["version"].ToString() == dm_BasesettingEntity.previewversion) ? 1 : 0)
                        //previewversion = dm_BasesettingEntity.previewversion,
                        ischecked                = Status, //dm_BasesettingEntity.openchecked,
                        welcomenewperson         = dm_BasesettingEntity.welcomenewperson,
                        showcommission           = dm_BasesettingEntity.showcommission,
                        miquan_remark            = dm_BasesettingEntity.miquan_remark,
                        task_remark              = "http://dlaimi.cn/dm_appmanage/dm_article/lookarticle?id=16",
                        task_submit_remark_title = "任务提交小建议",
                        task_submit_remark       = dm_BasesettingEntity.task_submit_remark,
                        nodatatip                = CommonConfig.NoDataTip,
                        sign_rule                = dm_BasesettingEntity.sign_rule,
                        cashrecord_fee           = dm_BasesettingEntity.cashrecord_fee,
                        cashrecord_remark        = dm_BasesettingEntity.cashrecord_remark,
                        activitysetting          = dm_Activity_ManageEntity,
                        JoinActivity             = JoinActivity ? 1 : 0
                    };

                    redisCache.Write <CommonSettingInfo>(cacheKey, commonSettingInfo, DateTime.Now.AddMinutes(1), 7);
                }

                return(Success("获取成功", commonSettingInfo));
            }
            catch (Exception ex)
            {
                return(FailException(ex));
            }
        }