lqq лет назад: 8
Родитель
Сommit
2b95444dc2

+ 1 - 3
Winsoft.GOV.XF.WebApi.WXCore/Models/Bundle.cs

@@ -55,9 +55,7 @@ namespace Winsoft.GOV.XF.WebApi.WXCore.Models
 
         public override string ToString()
         {
-            string s = "advice={0};type={1};name={2};phone={3};is_public={4};content={5};title={6};county_id={7};unit_id={8};sswz=8;ly=2; user_id={9}";
-            s = String.Format(s, Advice, Type.ToString(), Name, Mobile, IsPublic.ToString(), Describe, Title, County_id, Unit_id, OpenID);
-            return s;
+            
         }
     }
     //丽水市 331100000000

+ 39 - 0
Winsoft.GOV.XF.WebApi.WXCore/Services/BundlesService.cs

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
 using Winsoft.GOV.XF.WebApi.WXCore.Data;
 using Winsoft.GOV.XF.WebApi.WXCore.Models;
 using Winsoft.GOV.XF.WebApi.WXCore.Helpers;
+using Newtonsoft.Json;
 
 namespace Winsoft.GOV.XF.WebApi.WXCore.Services
 {
@@ -63,5 +64,43 @@ namespace Winsoft.GOV.XF.WebApi.WXCore.Services
             }
             return String.Empty;
         }
+
+        public void Update(Bundle b)
+        {
+            if (b != null)
+            {
+                _context.Bundles.Update(b);
+            }
+        }
+
+        public string GenerateBaseURL(Bundle b)
+        {
+            BundleAccessToken a = new BundleAccessToken()
+            {
+                Expire = -1,
+                BundleId = b.Id
+            };
+            string multimediaURL = string.Format("{0}://{1}/multimedia?bundleId={2}&ciphertext={3}",
+                _httpContext.Request.Scheme,
+                _httpContext.Request.Host.Value, b.Id, JsonConvert.SerializeObject(a).AESEncrypt(b.Key));
+            return multimediaURL;
+        }
+
+        public string GenerateShareURL(Bundle b, string ciphertext)
+        {
+            string data = ciphertext.AESDecrypt(b.Key);
+            BundleAccessToken a = JsonConvert.DeserializeObject<BundleAccessToken>(data);
+            if (a == null)
+                return 
+            if (a.Expire != -1)
+            {
+                a.Expire = DateTime.Now.AddDays(1).ToTimeStamp();
+                string multimediaURL = string.Format("{0}://{1}/multimedia?bundleId={2}&data={3}",
+                    Request.Scheme,
+                    Request.Host.Value, b.Id, JsonConvert.SerializeObject(a).AESEncrypt(b.Key));
+                return Ok(multimediaURL);
+            }
+            return BadRequest("已过期");
+        }
     }
 }

+ 8 - 4
Winsoft.GOV.XF.WebApi.WXCore/Services/XFApiService.cs

@@ -16,10 +16,10 @@ namespace Winsoft.GOV.XF.WebApi.WXCore.Services
     public class XFApiService : BaseService
     {
         public delegate void OnFails(string message);
-        XFDbContext _context;
-        public XFApiService(XFDbContext context, ILoggerFactory loggerFactory):base(context, loggerFactory)
+        BundlesService _bundlesService;
+        public XFApiService(BundlesService bundlesService, ILoggerFactory loggerFactory):base(context, loggerFactory)
         {
-            _context = context;
+            _bundlesService = bundlesService;
         }
         /// <summary>
         /// 提交信件
@@ -29,6 +29,10 @@ namespace Winsoft.GOV.XF.WebApi.WXCore.Services
         /// <returns></returns>
         public async Task<bool> PostLetter(Bundle b, OnFails onFails)
         {
+            string s = "advice={0};type={1};name={2};phone={3};is_public={4};content={5};title={6};county_id={7};unit_id={8};sswz=8;ly=2; user_id={9}";
+            s = String.Format(s, b.Advice, b.Type.ToString(), b.Name, b.Mobile, b.IsPublic.ToString(), b.Describe, b.Title, b.County_id, b.Unit_id, b.OpenID);
+            return s;
+
             XFApiResult rObj = await HttpPostAsync<XFApiResult>("http://118.178.118.50/test1/letter/submitLetter;", b.ToString(), onFails);
 
             if (rObj == null)
@@ -40,7 +44,7 @@ namespace Winsoft.GOV.XF.WebApi.WXCore.Services
                 return false;
             }
             b.SearchCode = rObj.Data.Data;
-            _context.Bundles.Update(b);
+            _bundlesService.Update(b);
             return true;
             //if (rObj != null)
             //{

Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/web12345-pageView/app-3253a7cec3.css → Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/multimedia/app-3253a7cec3.css


Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/web12345-pageView/app-b14501bfa8.js → Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/multimedia/app-b14501bfa8.js


Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/web12345-pageView/app-ec4f7f143b.js → Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/multimedia/app-ec4f7f143b.js


Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/web12345-pageView/index.html → Winsoft.GOV.XF.WebApi.WXCore/wwwroot/dist/multimedia/index.html