Browse Source

相册协议修改

zhaoyang 2 years ago
parent
commit
d84f163a93

+ 0 - 22
GameClient/Assets/Game/HotUpdate/ServerProxy/PictureStorageHelper.cs

@@ -14,29 +14,7 @@ namespace GFGGame
 {
     public static class PictureStorageHelper
     {
-        //获取图片的临时上传地址协议
-        public static async ETTask<string[]> ReqTempPictureUrl(int pictureType)
-        {
-            ViewManager.Show<ModalStatusView>("上传中...");
-
-            S2C_GetTempPictureUrl response = null;
-            response = (S2C_GetTempPictureUrl)await MessageHelper.SendToServer(new C2S_GetTempPictureUrl() { PictureType = pictureType });
-
-            if (response != null)
-            {
-                if (response.Error == ErrorCode.ERR_Success)
-                {
-                    return new string[] { response.TempPictureUrl, response.PictureObjectPath };
-                }
-            }
-            else
-            {
-                ViewManager.Hide<ModalStatusView>();
-                PromptController.Instance.ShowFloatTextPrompt("获取上传地址失败");
-            }
 
-            return null;
-        }
 
         //将图片上传到华为云
         public static async Task<bool> PushToHWCloud(string signUrl, byte[] buffer)

+ 26 - 3
GameClient/Assets/Game/HotUpdate/ServerProxy/PoemPhotoSProxy.cs

@@ -56,12 +56,35 @@ namespace GFGGame
             return false;
         }
 
+        //获取图片的临时上传地址协议
+        public static async ETTask<object[]> ReqTempPictureUrl()
+        {
+            ViewManager.Show<ModalStatusView>("上传中...");
+
+            S2C_GetTempPictureUrl response = null;
+            response = (S2C_GetTempPictureUrl)await MessageHelper.SendToServer(new C2S_GetTempPictureUrl() { PictureType = (int)PictureType.jpg });
+
+            if (response != null)
+            {
+                if (response.Error == ErrorCode.ERR_Success)
+                {
+                    return new object[] { response.TempPictureUrl, response.PictureId };
+                }
+            }
+            else
+            {
+                ViewManager.Hide<ModalStatusView>();
+                PromptController.Instance.ShowFloatTextPrompt("获取上传地址失败");
+            }
+
+            return null;
+        }
         //保存成功后,添加图片至相册
-        public static async ETTask<long> ReqAddTophoto(string pictureObjectPath, int sourceType)
+        public static async ETTask<long> ReqAddTophoto(long pictureId)
         {
 
             S2C_AddPicture response = null;
-            response = (S2C_AddPicture)await MessageHelper.SendToServer(new C2S_AddPicture() { PictureObjectPath = pictureObjectPath, SourceType = sourceType });
+            response = (S2C_AddPicture)await MessageHelper.SendToServer(new C2S_AddPicture() { PictureId = pictureId });
 
             ViewManager.Hide<ModalStatusView>();
 
@@ -75,7 +98,7 @@ namespace GFGGame
                     photoData.ToppingStatus = response.PictureInfo.ToppingStatus;
                     photoData.LockingStatus = response.PictureInfo.LockingStatus;
                     photoData.PictureTempUrl = response.PictureInfo.PictureTempUrl;
-                    PoemPhotoDataManager.Instance.Add(photoData, sourceType);
+                    PoemPhotoDataManager.Instance.Add(photoData, (int)PictureSourceType.PersonalAlbum);
                     EventAgent.DispatchEvent(ConstMessage.POEM_PHOTO_INFOS_CHANGE);
                     PromptController.Instance.ShowFloatTextPrompt("已保存至相册");
 

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographSaveView.cs

@@ -80,15 +80,15 @@ namespace GFGGame
             }
 
 
-            string[] rsp = await PictureStorageHelper.ReqTempPictureUrl((int)PictureType.jpg);
+            object[] rsp = await PoemPhotoSProxy.ReqTempPictureUrl();
             if (rsp == null) return;
 
 
-            bool pushResult = await PictureStorageHelper.PushToHWCloud(rsp[0], bytes);
+            bool pushResult = await PictureStorageHelper.PushToHWCloud(rsp[0].ToString(), bytes);
             if (!pushResult) return;
 
 
-            long addResult = await PoemPhotoSProxy.ReqAddTophoto(rsp[1], (int)PictureSourceType.PersonalAlbum);
+            long addResult = await PoemPhotoSProxy.ReqAddTophoto((long)rsp[1]);
             if (addResult > 0)
             {
                 List<PoemPhotoData> list = PoemPhotoDataManager.Instance.PersonalPhotoInfos;