コード例 #1
0
        /// <summary>
        /// 获取一条任务
        /// </summary>
        private void GetTask()
        {
            string msg      = "";
            string platform = GameRequest.GetQueryString("platform");

            if (string.IsNullOrEmpty(platform))
            {
                msg = "{\"status\":\"error\",\"msg\":\"error03\"}";
            }
            else if (platform != "Android" && platform != "iOS")
            {
                msg = "{\"status\":\"error\",\"msg\":\"error03\"}";
            }
            else
            {
                if (platform == "Android")
                {
                    Message umsg = aideNativeWebFacade.GetGainTask(platform);
                    if (umsg.Success)
                    {
                        GainTask gt = umsg.EntityList[0] as GainTask;
                        if (gt.RecID == 0)
                        {
                            msg = "{\"status\":\"success\",\"msg\":\"no data now\",\"data\":null}";
                        }
                        else
                        {
                            string recid = gt.RecID.ToString();

                            try
                            {
                                CheckManifest(gt);
                            }
                            catch (Exception ex)
                            {
                                msg = "{\"status\":\"error99\",\"msg\":\"" + Server.UrlEncode(ex.Message) + "\",\"data\":null}"; Response.Write(msg);
                                PrintLog(recid, platform, msg);
                                PrintServerLog(recid, platform, "Manifest:" + msg);
                                string sql = string.Format(@"update {1} set PackageTaskStatus=4,FinishDatetime=getdate() where recid={0} and (PackageTaskStatus=2 or PackageTaskStatus=0)", recid, platform == "Android" ? "[sdk_NewPackageCreateTask]" : "[sdk_NewPackageCreateTask_IOS]");
                                aideNativeWebFacade.ExecuteSql(sql);
                                return;
                            }


                            //string urlHead = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/";

                            string gameid             = gt.GameID;
                            string gamename           = gt.GameName;
                            string platFormName       = gt.PlatFormName;
                            string gameVersion        = gt.GameVersion;
                            string strCollectDatetime = gt.StrCollectDatetime;
                            string strIconPath        = gt.IconPath;
                            string strCreateTaskID    = gt.CreateTaskID;
                            string strmyversion       = gt.MyVersion;
                            string strChannelVersion  = gt.ChannelVersion;
                            string strIsEncryption    = gt.IsEncryption;
                            string strAdID            = gt.AdID;
                            int    strPlugInID        = gt.PlugInID;
                            string strPlugInVersion   = gt.PlugInVersion;
                            string strCompileMode     = gt.CompileMode;
                            string strKeyname         = gt.KeyName;

                            msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName + "\",\"GameID\":\"" + gameid + "\",\"ChannelVersion\":\"" + strChannelVersion + "\",\"GameVersion\":\"" + gameVersion + "_" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"IsEncrypt\":\"" + strIsEncryption + "\",\"AdID\":\"" + strAdID + "\",\"PluginID\":\"" + strPlugInID + "\",\"PluginVersion\":\"" + strPlugInVersion + "\",\"CompileMode\":\"" + strCompileMode + "\",\"SignKey\":\"" + strKeyname + "\"}]}";

                            PrintLog(recid, platform, msg);
                        }
                    }
                    else
                    {
                        msg = "{\"status\":\"error\",\"msg\":\"error02\"}";
                    }
                }
                else
                {
                    Message umsg = aideNativeWebFacade.GetGainTask(platform);
                    if (umsg.Success)
                    {
                        GainTask gt = umsg.EntityList[0] as GainTask;
                        if (gt.RecID == 0)
                        {
                            msg = "{\"status\":\"success\",\"msg\":\"no data now\",\"data\":null}";
                        }
                        else
                        {
                            string urlHead            = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/";
                            string recid              = gt.RecID.ToString();
                            string gameid             = gt.GameID;
                            string gamename           = gt.GameName;
                            string platFormName       = gt.PlatFormName;
                            string gameVersion        = gt.GameVersion;
                            string strCollectDatetime = gt.StrCollectDatetime;
                            string strIconPath        = gt.IconPath;
                            string strCreateTaskID    = gt.CreateTaskID;
                            string strmyversion       = gt.MyVersion;
                            string strChannelVersion  = gt.ChannelVersion;
                            string strgamenamespell   = gt.GameNameSpell;
                            string strunityver        = gt.UnityVer;
                            string strproductname     = gt.ProductName;

                            //msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName.ToLower() + "\",\"GameID\":\"" + strgamenamespell + "\",\"GameVersion\":\"" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"GameFileName\":\"" + gameVersion + "\",\"UnityVer\":\"" + strunityver + "\",\"ProductName\":\"" + strproductname + "\"}]}";
                            msg = "{\"status\":\"success\",\"msg\":\"gainTask_OK\",\"data\":[{\"TaskID\":\"" + recid + "\",\"Channel\":\"" + platFormName + "\",\"GameID\":\"" + gameid + "\",\"ChannelVersion\":\"" + strChannelVersion + "\",\"GameVersion\":\"" + gameVersion + "\",\"CreateTime\":\"" + strCollectDatetime + "\",\"IconID\":\"" + strIconPath + "\",\"BatchNo\":\"" + strCreateTaskID + "\",\"SdkVer\":\"" + strmyversion + "\",\"GameFileName\":\"" + gamename + "\",\"UnityVer\":\"" + strunityver + "\",\"ProductName\":\"" + strproductname + "\"}]}";

                            PrintLog(recid, platform, msg);
                        }
                    }
                    else
                    {
                        msg = "{\"status\":\"error\",\"msg\":\"error02_2\"}";
                    }
                }
            }
            Response.Write(msg);
        }