黄贺彬 5 years ago
parent
commit
f9972d0f6e

+ 161 - 0
TEAMModelOS.SDK/Context/Constant/ContentTypeDict.cs

@@ -6,6 +6,167 @@ namespace TEAMModelOS.SDK.Context.Constant
 {
     public static class ContentTypeDict
     {
+        public static readonly Dictionary<string, string> extdict = new Dictionary<string, string> {
+            {"video/3gpp",".3g2"},
+{"audio/mp4",".aac"},
+{"audio/ac3",".ac3"},
+{"text/x-adasrc",".adb"},
+{"image/x-applix-graphics",".ag"},
+{"audio/amr",".amr"},
+{"audio/x-ape",".ape"},
+{"image/x-sony-arw",".arw"},
+{"text/plain",".asc"},
+{"video/x-ms-asf",".asf"},
+{"text/x-ssa",".ass"},
+{"video/x-msvideo",".avi"},
+{"text/x-bibtex",".bib"},
+{"image/bmp",".bmp"},
+{"text/x-csrc",".c"},
+{"text/x-c++src",".c++"},
+{"image/cgm",".cgm"},
+{"text/x-tex",".cls"},
+{"text/x-cmake",".cmake"},
+{"image/x-canon-cr2",".cr2"},
+{"image/x-canon-crw",".crw"},
+{"text/x-csharp",".cs"},
+{"text/css",".css"},
+{"text/csv",".csv"},
+{"image/x-win-bitmap",".cur"},
+{"text/x-dsrc",".d"},
+{"text/x-dcl",".dcl"},
+{"image/x-kodak-dcr",".dcr"},
+{"image/x-dds",".dds"},
+{"text/x-patch",".diff"},
+{"image/vnd.djvu",".djv"},
+{"image/x-adobe-dng",".dng"},
+{"text/vnd.graphviz",".dot"},
+{"text/x-dsl",".dsl"},
+{"image/vnd.dwg",".dwg"},
+{"image/vnd.dxf",".dxf"},
+{"text/x-eiffel",".e"},
+{"text/x-emacs-lisp",".el"},
+{"image/x-emf",".emf"},
+{"image/x-eps",".eps"},
+{"image/x-bzeps",".eps.bz2"},
+{"image/x-gzeps",".eps.gz"},
+{"text/x-erlang",".erl"},
+{"text/x-setext",".etx"},
+{"image/x-exr",".exr"},
+{"text/x-fortran",".f"},
+{"image/x-xfig",".fig"},
+{"image/fits",".fits"},
+{"video/x-flv",".flv"},
+{"text/x-xslfo",".fo"},
+{"image/fax-g3",".g3"},
+{"text/directory",".gcrd"},
+{"image/gif",".gif"},
+{"text/x-google-video-pointer",".gvp"},
+{"text/x-chdr",".h"},
+{"text/x-c++hdr",".h++"},
+{"text/x-haskell",".hs"},
+{"text/html",".htm"},
+{"image/x-tga",".icb"},
+{"image/x-icns",".icns"},
+{"image/x-icon",".ico"},
+{"text/calendar",".ics"},
+{"text/x-idl",".idl"},
+{"image/ief",".ief"},
+{"image/x-iff",".iff"},
+{"image/x-ilbm",".ilbm"},
+{"text/x-imelody",".ime"},
+{"text/x-iptables",".iptables"},
+{"image/jp2",".j2k"},
+{"text/vnd.sun.j2me.app-descriptor",".jad"},
+{"text/x-java",".java"},
+{"image/x-jng",".jng"},
+{"image/jpeg",".jpe"},
+{"application/javascript",".js"},
+{"application/json",".json"},
+{"application/jsonp",".jsonp"},
+{"image/x-kodak-k25",".k25"},
+{"image/x-kodak-kdc",".kdc"},
+{"text/x-ldif",".ldif"},
+{"text/x-literate-haskell",".lhs"},
+{"text/x-log",".log"},
+{"text/x-lua",".lua"},
+{"image/x-lwo",".lwo"},
+{"image/x-lws",".lws"},
+{"text/x-lilypond",".ly"},
+{"text/x-matlab",".m"},
+{"video/mpeg",".m2t"},
+{"audio/x-mpegurl",".m3u"},
+{"application/vnd.apple.mpegurl",".m3u8"},
+{"text/x-troff-me",".me"},
+{"video/x-matroska",".mkv"},
+{"text/x-ocaml",".ml"},
+{"text/x-troff-mm",".mm"},
+{"text/mathml",".mml"},
+{"text/x-moc",".moc"},
+{"text/x-mof",".mof"},
+{"audio/mpeg",".mp3"},
+{"video/mp4",".mp4"},
+{"text/x-mrml",".mrl"},
+{"image/x-minolta-mrw",".mrw"},
+{"text/x-troff-ms",".ms"},
+{"image/x-msod",".msod"},
+{"text/x-mup",".mup"},
+{"image/x-nikon-nef",".nef"},
+{"text/x-nfo",".nfo"},
+{"text/x-ocl",".ocl"},
+{"text/x-opml+xml",".opml"},
+{"image/openraster",".ora"},
+{"image/x-olympus-orf",".orf"},
+{"text/x-pascal",".p"},
+{"image/x-portable-bitmap",".pbm"},
+{"image/x-photo-cd",".pcd"},
+{"image/x-pcx",".pcx"},
+{"application/pdf",".pdf"},
+{"image/x-pentax-pef",".pef"},
+{"image/x-portable-graymap",".pgm"},
+{"image/x-pict",".pict"},
+{"image/png",".png"},
+{"image/x-portable-anymap",".pnm"},
+{"image/x-macpaint",".pntg"},
+{"text/x-gettext-translation",".po"},
+{"text/x-gettext-translation-template",".pot"},
+{"text/x-python",".py"},
+{"image/x-quicktime",".qif"},
+{"image/x-fuji-raf",".raf"},
+{"image/x-cmu-raster",".ras"},
+{"image/x-panasonic-raw",".raw"},
+{"text/x-ms-regedit",".reg"},
+{"image/x-rgb",".rgb"},
+{"image/rle",".rle"},
+{"text/troff",".roff"},
+{"image/vnd.rn-realpix",".rp"},
+{"text/vnd.rn-realtext",".rt"},
+{"text/richtext",".rtx"},
+{"text/x-scheme",".scm"},
+{"image/x-sgi",".sgi"},
+{"text/sgml",".sgm"},
+{"image/x-skencil",".sk"},
+{"text/spreadsheet",".slk"},
+{"text/x-rpm-spec",".spec"},
+{"text/x-sql",".sql"},
+{"image/x-sony-sr2",".sr2"},
+{"image/x-sony-srf",".srf"},
+{"text/x-subviewer",".sub"},
+{"image/x-sun-raster",".sun"},
+{"image/svg+xml",".svg"},
+{"image/svg+xml-compressed",".svgz"},
+{"text/x-txt2tags",".t2t"},
+{"text/x-tcl",".tcl"},
+{"text/x-texinfo",".texi"},
+{"image/tiff",".tif"},
+{"audio/x-voc",".voc"},
+{"image/x-wmf",".wmf"},
+{"text/vnd.wap.wml",".wml"},
+{"text/vnd.wap.wmlscript",".wmls"},
+{"video/x-ms-wmv",".wmv"},
+{"application/xhtml+xml",".xhtml"},
+{"application/xml",".xml"}
+        };
+
         public static readonly  Dictionary<string, string> dict = new Dictionary<string, string> {
             {".3g2", "video/3gpp"},
             {".3ga", "video/3gpp"},

+ 1 - 1
TEAMModelOS.SDK/Extension/JwtAuth/JwtHelper/JwtHelper.cs

@@ -43,7 +43,7 @@ namespace TEAMModelOS.SDK.Extension.JwtAuth.JwtHelper
             claims.Add(new Claim(JwtClaimTypes.Issuer, setting.Issuer));
             claims.Add(new Claim(JwtClaimTypes.Scope, claimModel.Scope));
             claims.Add(new Claim(JwtClaimTypes.JwtId, Guid.NewGuid().ToString()));
-           //claims.AddRange(claimModel.Roles.Select(s=>new Claim(JwtClaimTypes.Role, s)));
+            //claims.AddRange(claimModel.Roles.Select(s=>new Claim(JwtClaimTypes.Role, s)));
             //claims.AddRange(claimModel.Claims.Select(s => new Claim(ClaimTypes.Role, s)));
             string path = BaseConfigModel.ContentRootPath;
             RSACryptoServiceProvider provider = RsaHelper.LoadCertificateFile(path + "/JwtRsaFile/private.pem");

+ 396 - 0
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorConverter.cs

@@ -0,0 +1,396 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Drawing;
+
+namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
+{
+    public class ColorConverter
+    {
+        public string SetLuminanceMod(string s, double luminance)
+        {
+
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetLuminanceMod(c, luminance);
+        }
+        public string SetLuminanceOff(string s, double luminance)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetLuminanceOff(c, luminance);
+        }
+        public string SetTint(string s, double tint)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetTint(c, tint);
+        }
+        public string SetShade(string s, double shade)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetShade(c, shade);
+        }
+        public string SetSaturationMod(string s, double saturation)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetSaturationMod(c, saturation);
+        }
+        public string SetSaturationOff(string s, double saturation)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetSaturationOff(c, saturation);
+        }
+        public string SetBrightness(string s, double luminance)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetBrightness(c, luminance);
+        }
+        public string SetHueMod(string s, double hueMod)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetHueMod(c, hueMod);
+        }
+        public string SetHueOff(string s, double hueOff)
+        {
+            Color c = ColorTranslator.FromHtml("#" + s);
+
+            return SetHueOff(c, hueOff);
+        }
+        private double RGB_to_linearRGB(double val)
+        {
+
+            if (val < 0.0)
+                return 0.0;
+            if (val <= 0.04045)
+                return val / 12.92;
+            if (val <= 1.0)
+                return (double)Math.Pow(((val + 0.055) / 1.055), 2.4);
+
+            return 1.0;
+        }
+        private double linearRGB_to_RGB(double val)
+        {
+
+            if (val < 0.0)
+                return 0.0;
+            if (val <= 0.0031308)
+                return val * 12.92;
+            if (val < 1.0)
+                return (1.055 * Math.Pow(val, (1.0 / 2.4))) - 0.055;
+
+            return 1.0;
+            /*
+            Public Function linearRGB_to_sRGB(ByVal value As Double) As Double
+                If value < 0.0# Then Return 0.0#
+                If value <= 0.0031308# Then Return value * 12.92
+                If value < 1.0# Then Return 1.055 * (value ^ (1.0# / 2.4)) - 0.055
+                Return 1.0#
+            End Function
+            */
+
+        }
+        public string SetShade(Color c, double shade)
+        {
+            //Console.WriteLine("Shade: " + shade);
+
+            double convShade = (shade / 1000) * 0.01;
+
+            double r = (double)c.R / 255;
+            double g = (double)c.G / 255;
+            double b = (double)c.B / 255;
+
+            double rLin = RGB_to_linearRGB(r);
+            double gLin = RGB_to_linearRGB(g);
+            double bLin = RGB_to_linearRGB(b);
+
+            //Console.WriteLine("Linear R: " + rLin + "\nLinear G: " + gLin + "\nLinear B: " + bLin);
+
+            //SHADE 
+            if ((rLin * convShade) < 0)
+                rLin = 0;
+            if ((rLin * convShade) > 1)
+                rLin = 0;
+            else
+                rLin *= convShade;
+
+            if ((gLin * convShade) < 0)
+                gLin = 0;
+            if ((gLin * convShade) > 1)
+                gLin = 0;
+            else
+                gLin *= convShade;
+
+            if ((bLin * convShade) < 0)
+                bLin = 0;
+            if ((bLin * convShade) > 1)
+                bLin = 0;
+            else
+                bLin *= convShade;
+
+            //SHADEEND
+
+            r = linearRGB_to_RGB(rLin);
+            g = linearRGB_to_RGB(gLin);
+            b = linearRGB_to_RGB(bLin);
+
+            Color outColor = Color.FromArgb((int)Math.Round(r * 255), (int)Math.Round(g * 255), (int)Math.Round(b * 255));
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+        public string SetTint(Color c, double tint)
+        {
+
+            double tintConv = (tint / 1000) * 0.01;
+
+            double r = (double)c.R / 255;
+            double g = (double)c.G / 255;
+            double b = (double)c.B / 255;
+
+            double rLin = RGB_to_linearRGB(r);
+            double gLin = RGB_to_linearRGB(g);
+            double bLin = RGB_to_linearRGB(b);
+
+            /**TINT**/
+
+            if (tintConv > 0)
+                rLin = (rLin * tintConv) + (1 - tintConv);
+            else
+                rLin = rLin * (1 + tintConv);
+
+            if (tintConv > 0)
+                gLin = (gLin * tintConv) + (1 - tintConv);
+            else
+                gLin = gLin * (1 + tintConv);
+
+            if (tintConv > 0)
+                bLin = (bLin * tintConv) + (1 - tintConv);
+            else
+                bLin = bLin * (1 + tintConv);
+
+            r = linearRGB_to_RGB(rLin);
+            g = linearRGB_to_RGB(gLin);
+            b = linearRGB_to_RGB(bLin);
+
+            Color outColor = Color.FromArgb((int)Math.Round(r * 255), (int)Math.Round(g * 255), (int)Math.Round(b * 255));
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetSaturationMod(Color c, double saturation)
+        {
+            double satMod = (saturation / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.S *= satMod;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetSaturationOff(Color c, double saturation)
+        {
+            double satOff = (saturation / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.S += satOff;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetBrightness(Color c, double brightness)
+        {
+
+            double convBrightness = brightness / 100000;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+
+            hsl.L *= convBrightness;
+            c = HSL_to_RGB(hsl);
+
+            return c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
+        }
+        public string SetLuminanceMod(Color c, double luminance)
+        {
+            double lumMod = (luminance / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.L *= lumMod;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetLuminanceOff(Color c, double luminance)
+        {
+            double lumModOff = (luminance / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.L += lumModOff;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+        }
+        public string SetHueMod(Color c, double hue)
+        {
+
+            double hueMod = (hue / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.H *= hueMod;
+            Color outColor = HSL_to_RGB(hsl);
+
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+        public string SetHueOff(Color c, double hue)
+        {
+
+            double hueMod = (hue / 1000) * 0.01;
+
+            ColorHSL hsl = RGB_to_HSL(c);
+            hsl.H += hueMod;
+            Color outColor = HSL_to_RGB(hsl);
+            return outColor.R.ToString("X2") + outColor.G.ToString("X2") + outColor.B.ToString("X2");
+
+        }
+
+        private ColorHSL RGB_to_HSL(Color c)
+        {
+            ColorHSL hsl = new ColorHSL();
+
+            hsl.H = c.GetHue() / 360.0;
+            hsl.L = c.GetBrightness();
+            hsl.S = c.GetSaturation();
+
+            return hsl;
+        }
+        private ColorHSL CreateHSL(int r, int g, int b)
+        {
+            ColorHSL hsl = new ColorHSL();
+ 
+            double R = (double)r / 255;
+            double G = (double)g / 255;
+            double B = (double)b / 255;
+            double max = 0, min = 0;
+            double H = 0, S = 0, L = 0;
+            bool rBool = false, gBool = false, bBool = false;
+
+            //find max
+            if ((R > G) && (R > B))
+            {
+                max = R;
+                rBool = true;
+            }
+            else if ((G > R) && (G > B))
+            {
+                max = G;
+                gBool = true;
+            }
+            else if ((B > G) && (B > R))
+            {
+                max = B;
+                bBool = true;
+            }
+
+            if ((R < G) && (R < B))
+                min = R;
+            else if ((G < R) && (G < B))
+                min = G;
+            else if ((B < G) && (B < R))
+                min = B;
+
+            //set Luminance
+            hsl.L = (min + max) / 2;
+
+            if (min == max)
+            {
+                hsl.S = 0;
+                hsl.H = 0;
+            }
+
+            //set saturation
+            if (hsl.L < 0.5)
+                hsl.S = (max - min) / (max + min);
+            else if (hsl.L > 0.5)
+                hsl.S = (max - min) / (2.0 - max - min);
+
+            if (rBool)
+            {
+                H = ((G - B) / (max - min)) * 60.0;
+                Console.WriteLine("red");
+            }
+            if (gBool)
+            {
+                H = ((2.0 + ((B - R) / (max - min))) * 60.0);
+                Console.WriteLine("green");
+            }
+            if (bBool)
+            {
+                H = (4.0 + (R - G) / (max - min)) * 60.0;
+                Console.WriteLine("blue");
+            }
+
+            if (H < 0)
+                H += 360;
+
+            H = Math.Round(H);
+            H = H / 360;
+
+            hsl.H = H;
+
+            return hsl;
+        }
+        private Color HSL_to_RGB(ColorHSL hslColor)
+        {
+
+            double r = 0, g = 0, b = 0;
+            double temp1, temp2;
+
+
+            if (hslColor.L == 0)
+                r = g = b = 0;
+            else
+            {
+                if (hslColor.S == 0)
+                {
+                    r = g = b = hslColor.L;
+                }
+                else
+                {
+                    temp2 = ((hslColor.L <= 0.5) ? hslColor.L * (1.0 + hslColor.S) : hslColor.L + hslColor.S - (hslColor.L * hslColor.S));
+                    temp1 = 2.0 * hslColor.L - temp2;
+
+                    double[] t3 = new double[] { hslColor.H + 1.0 / 3.0, hslColor.H, hslColor.H - 1.0 / 3.0 };
+                    double[] clr = new double[] { 0, 0, 0 };
+                    for (int i = 0; i < 3; i++)
+                    {
+                        if (t3[i] < 0)
+                            t3[i] += 1.0;
+                        if (t3[i] > 1)
+                            t3[i] -= 1.0;
+
+                        if (6.0 * t3[i] < 1.0)
+                            clr[i] = temp1 + (temp2 - temp1) * t3[i] * 6.0;
+                        else if (2.0 * t3[i] < 1.0)
+                            clr[i] = temp2;
+                        else if (3.0 * t3[i] < 2.0)
+                            clr[i] = (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - t3[i]) * 6.0);
+                        else
+                            clr[i] = temp1;
+                    }
+                    r = clr[0];
+                    g = clr[1];
+                    b = clr[2];
+                }
+            }
+
+            return Color.FromArgb((int)(255 * r), (int)(255 * g), (int)(255 * b));
+
+        }
+
+    }
+}

+ 7 - 18
TEAMModelOS.SDK/Helper/Common/ColorHelper/ColorHelper.cs

@@ -205,12 +205,12 @@ namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
         /// <param name="lumMod"></param>
         /// <param name="lumOff"></param>
         /// <returns></returns>
-        public static Color GetColorLumModAndLumOff(Color color, int lumMod = 0, int lumOff = 0)
+        public static string GetColorLumModAndLumOff(Color color, int lumMod = 0, int lumOff = 0)
         {
             ColorHSL colorHSL = RgbToHsl(new ColorRGB(color.R, color.G, color.B));
             colorHSL.L = colorHSL.L * lumMod / 100_000.0 + lumOff / 100_000.0;
             ColorRGB colorRGB = HslToRgb(colorHSL);
-            return Color.FromArgb(colorRGB.R, colorRGB.G, colorRGB.B);
+            return ColorTranslator.ToHtml(Color.FromArgb(colorRGB.R, colorRGB.G, colorRGB.B)).Replace("#","");
         }
 
         /// <summary>
@@ -220,29 +220,18 @@ namespace TEAMModelOS.SDK.Helper.Common.ColorHelper
         /// <param name="pa">混合原色占百分比/100% </param>
         /// <param name="Type">Shade 与黑色混合  Tint与白色混合</param>
         /// <returns></returns>
-        public static Color GetShadeOrTintColor(Color color, double pa, string Type)
+        public static string  GetShadeOrTintColor(Color color, double val, string Type)
         {
-            double rw = 0, gw = 0, bw = 0;
-            int ra = color.R, ga = color.G, ba = color.B;
+            ColorConverter converter = new ColorConverter();
             if (Type.Equals("Shade"))
             {
-                rw = 0; gw = 0; bw = 0;
-                double rn = rw * (1 - pa) + ra * (1 + pa);
-                double gn = gw * (1 - pa) + ga * (1 + pa);
-                double bn = bw * (1 - pa) + ba * (1 + pa);
-                return Color.FromArgb(int.Parse(Math.Round(rn, 0) + ""), int.Parse(Math.Round(gn, 0) + ""), int.Parse(Math.Round(bn, 0) + ""));
+                return converter.SetShade(color, val);
             }
             else if (Type.Equals("Tint"))
             {
-                rw = 255; gw = 255; bw = 255;
-                double rn = rw * (1 - pa) + ra * (1 + pa);
-                double gn = gw * (1 - pa) + ga * (1 + pa);
-                double bn = bw * (1 - pa) + ba * (1 + pa);
-                return Color.FromArgb(int.Parse(Math.Round(rn, 0) + ""), int.Parse(Math.Round(gn, 0) + ""), int.Parse(Math.Round(bn,0) + ""));
+                return converter.SetTint(color, val);
             }
-            else { return color; }
-            //double pw = 1 - pa;
-           
+            else { return ColorTranslator.ToHtml(color).Replace("#",""); }
         }
 
     }

+ 22 - 0
TEAMModelOS.SDK/Helper/Common/StringHelper/StringHelper.cs

@@ -95,5 +95,27 @@ namespace TEAMModelOS.SDK.Helper.Common.StringHelper
             }
             return list;
         }
+
+        /// <summary>
+        /// 截取两个字符串中间的字符串
+        /// </summary>
+        /// <param name="sourse"></param>
+        /// <param name="startstr"></param>
+        /// <param name="endstr"></param>
+        /// <returns></returns>
+        public static string SubMidString(string sourse, string startstr, string endstr)
+        {
+            string result = string.Empty;
+            int startindex, endindex;
+            startindex = sourse.IndexOf(startstr);
+            if (startindex == -1)
+                return result;
+            string tmpstr = sourse.Substring(startindex + startstr.Length);
+            endindex = tmpstr.IndexOf(endstr);
+            if (endindex == -1)
+                return result;
+            result = tmpstr.Remove(endindex);
+            return result;
+        }
     }
 }

+ 18 - 0
TEAMModelOS.SDK/Module/AzureBlob/Container/AzureBlobModel.cs

@@ -72,6 +72,24 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Container
             Extension = fileName.Substring(fileName.LastIndexOf(".") + 1, (fileName.Length - fileName.LastIndexOf(".") - 1)); //扩展名
             Timestamp = DateTimeHelper.ConvertToDateTime(time);
         }
+        public AzureBlobModel(string fileName, string Container, string groupName, string newName,string sha1Code, string contentType, long length)
+        {
+            long time = DateTime.Now.ToUniversalTime().Ticks - 621355968000000000;
+            ContentType = contentType;
+            ContentDisposition = "form-data; name=\"file\"; filename=\"" + fileName + "\"";
+            FileName = fileName;
+            // Headers = f.Headers.Values;
+            Sha1Code = sha1Code;
+            RealName = groupName + "/" + newName;
+            Folder = groupName;
+            Length = length;
+            Name = "file";
+            UploadTime = time;
+            PartitionKey = Container;
+            RowKey = Guid.NewGuid().ToString();
+            Extension = fileName.Substring(fileName.LastIndexOf(".") + 1, (fileName.Length - fileName.LastIndexOf(".") - 1)); //扩展名
+            Timestamp = DateTimeHelper.ConvertToDateTime(time);
+        }
         [Required(ErrorMessage = "{0} 必须填写")]
         public string Folder { get; set; }
         [Required(ErrorMessage = "{0} 必须填写")]

+ 82 - 0
TEAMModelOS.SDK/Module/AzureBlob/Implements/AzureBlobDBRepository.cs

@@ -341,5 +341,87 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Implements
             };
             return model;
         }
+        public async Task<AzureBlobModel> UploadFileByFolder(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true)
+        {
+            
+            string groupName = fileSpace + "/" + folder;
+          //  string newFileName = sha1Code;
+            // await InitializeBlob(DateTime.Now.ToString("yyyyMMdd"));
+            blobContainer = blobClient.GetContainerReference(groupName);
+            StorageUri url = blobContainer.StorageUri;
+            string[] names = fileName.Split(".");
+          //  string name ;
+            //for (int i = 0; i < names.Length - 1; i++)
+            //{
+            //    name = name + names[i];
+            //}
+            //if (names.Length <= 1)
+            //{
+            //    name =  newFileName;
+            //}
+            //else
+            //{
+            //    name = newFileName + "." + names[names.Length - 1];
+            //}
+            //var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
+            //var filename = Path.Combine(parsedContentDisposition.FileName.Trim('"'));
+            var blockBlob = blobContainer.GetBlockBlobReference(fileName);
+            string fileext = fileName.Substring(fileName.LastIndexOf(".") > 0 ? fileName.LastIndexOf(".") : 0);
+            if (!contentTypeDefault)
+            {
+                ContentTypeDict.dict.TryGetValue(fileext, out string content_type);
+                if (!string.IsNullOrEmpty(content_type))
+                {
+                    blockBlob.Properties.ContentType = content_type;
+                }
+                else {
+                    blockBlob.Properties.ContentType = "application/octet-stream";
+                }
+            }
+            await blockBlob.UploadFromStreamAsync(fileSteam);
+            AzureBlobModel model = new AzureBlobModel(fileName, _options.Container, groupName, fileName, folder, blockBlob.Properties.ContentType , fileSteam.Length)
+            {
+                BlobUrl = url.PrimaryUri.ToString().Split("?")[0] + "/" + fileName
+            };
+            return model;
+        }
+
+
+        public async Task<AzureBlobModel> UploadTextByFolder(string text, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true)
+        {
+            string groupName = fileSpace + "/" + folder;
+            blobContainer = blobClient.GetContainerReference(groupName);
+            StorageUri url = blobContainer.StorageUri;
+        
+            var blockBlob = blobContainer.GetBlockBlobReference(fileName);
+            string fileext = fileName.Substring(fileName.LastIndexOf(".") > 0 ? fileName.LastIndexOf(".") : 0);
+            string content_type = "application/octet-stream";
+            if (!contentTypeDefault)
+            {
+                ContentTypeDict.dict.TryGetValue(fileext, out string contenttype);
+                if (!string.IsNullOrEmpty(contenttype))
+                {
+                    blockBlob.Properties.ContentType = contenttype;
+                    content_type = contenttype;
+                }
+                else
+                {
+                    blockBlob.Properties.ContentType = content_type;
+                }
+            }
+            else
+            {
+                blockBlob.Properties.ContentType = content_type;
+            }
+
+            long length = System.Text.Encoding.Default.GetBytes(text).Length;
+            await blockBlob.UploadTextAsync(text);
+            AzureBlobModel model = new AzureBlobModel(fileName, _options.Container, groupName, fileName, folder, blockBlob.Properties.ContentType, length)
+            {
+                BlobUrl = url.PrimaryUri.ToString().Split("?")[0] + "/" + fileName
+            };
+            return model;
+        }
+
     }
 }

+ 3 - 0
TEAMModelOS.SDK/Module/AzureBlob/Interfaces/IAzureBlobDBRepository.cs

@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Http;
 using System.Collections.Generic;
 using System.Threading.Tasks;
+using System.IO;
 
 namespace TEAMModelOS.SDK.Module.AzureBlob.Interfaces
 {
@@ -12,6 +13,8 @@ namespace TEAMModelOS.SDK.Module.AzureBlob.Interfaces
         Task<AzureBlobModel> UploadPath(string path, string fileSpace = "common", bool contentTypeDefault = false);
         Task<AzureBlobModel> UploadObject(string fileName, object obj, string fileSpace = "common", bool contentTypeDefault = true);
         Task<AzureBlobModel> UploadText(string fileName, string text, string fileSpace = "common", bool contentTypeDefault = true);
+        Task<AzureBlobModel> UploadFileByFolder(Stream fileSteam, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true);
+        Task<AzureBlobModel> UploadTextByFolder(string text, string folder, string fileName, string fileSpace = "pptx", bool contentTypeDefault = true);
 
 
     }

+ 0 - 6
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXSlide.cs

@@ -13,12 +13,6 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
         }
         //public int Width { get; set; }
         //public int Height { get; set; }
-        [XmlElement(typeof(PPTXChart))]
-        [XmlElement(typeof(PPTXConnector))]
-        [XmlElement(typeof(PPTXContainer))]
-        [XmlElement(typeof(PPTXPicture))]
-        [XmlElement(typeof(PPTXPosition))]
-        [XmlElement(typeof(PPTXTable))]
         public List<PPTXElement> Elements { get; set; }
 
 

+ 0 - 1
TEAMModelOS.SDK/Module/PowerPointX/Model/PPTXText.cs

@@ -62,6 +62,5 @@ namespace TEAMModelOS.SDK.Module.PowerPointX.Model
             Words	1	
             文本下划线枚举 (字)。 当项目作为 xml 序列出时,其值为"单词"。
          */
-
     }
 }

+ 3 - 5
TEAMModelOS.SDK/Module/PowerPointX/PresentationConvert.cs

@@ -922,17 +922,15 @@ namespace TEAMModelOS.SDK.Module.PowerPointX
             if (lumModVal > 0 || lumOffVal > 0)
             {
                 Color color = ColorTranslator.FromHtml("#" + schemeColor);
-                color = ColorHelper.GetColorLumModAndLumOff(color, lumModVal, lumOffVal);
-                schemeColor = ColorTranslator.ToHtml(color).Replace("#", "");
+                schemeColor = ColorHelper.GetColorLumModAndLumOff(color, lumModVal, lumOffVal);
             }
             if (tintVal > 0)
             {
-                schemeColor = ColorTranslator.ToHtml(ColorHelper.GetShadeOrTintColor(ColorTranslator.FromHtml("#" + schemeColor), tintVal / 100000.0000, "Tint")).Replace("#", "");
+                schemeColor = ColorHelper.GetShadeOrTintColor(ColorTranslator.FromHtml("#" + schemeColor), tintVal, "Tint");
             }
             if (shadeVal > 0)
             {
-
-                schemeColor = ColorTranslator.ToHtml(ColorHelper.GetShadeOrTintColor(ColorTranslator.FromHtml("#" + schemeColor), shadeVal / 100000.0000, "Shade")).Replace("#", "");
+                schemeColor = ColorHelper.GetShadeOrTintColor(ColorTranslator.FromHtml("#" + schemeColor), shadeVal, "Shade");
             }
 
             return schemeColor;

+ 2 - 2
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -4,8 +4,8 @@
     <TargetFramework>netcoreapp2.2</TargetFramework>
     <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
     <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
-    <Version>1.0.7</Version>
-    <PackageReleaseNotes>更新跨域组件的问题</PackageReleaseNotes>
+    <Version>1.0.14</Version>
+    <PackageReleaseNotes>增加两个字符串截取及文件类型获得扩展名</PackageReleaseNotes>
   </PropertyGroup>
 
   <ItemGroup>

+ 8 - 1
TEAMModelOS.sln

@@ -29,7 +29,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelOS.Test.OfficeDoc"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamModelOS.OfficeDoc.Test", "TeamModelOS.OfficeDoc.Test\TeamModelOS.OfficeDoc.Test.csproj", "{E5E2E853-AAE9-45D8-A59B-BC054434F9AD}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TEAMModelOS.Test.PPTX", "TEAMModelOS.Test.PPTX\TEAMModelOS.Test.PPTX.csproj", "{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelOS.Test.PPTX", "TEAMModelOS.Test.PPTX\TEAMModelOS.Test.PPTX.csproj", "{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PPTXMLParser", "PPTXMLParser\PPTXMLParser.csproj", "{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -73,6 +75,10 @@ Global
 		{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -87,6 +93,7 @@ Global
 		{98D55090-23B0-4362-872D-A184D95085C6} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
 		{E5E2E853-AAE9-45D8-A59B-BC054434F9AD} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
 		{7A537ADF-61AC-42D6-AF49-A0AAF57E3B5C} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
+		{E66B53C5-B0AA-462C-8D2B-8A5D00B4CE90} = {CFBC5D78-72A7-4330-B779-F6826194F48A}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {5C55F286-63D0-4235-BDE0-D7AD32B0EDEB}

+ 10 - 1
TEAMModelOS/Controllers/Core/FileController.cs

@@ -107,7 +107,16 @@ namespace TEAMModelOS.Controllers.Core
             await _azureBlobModelService.SaveAll<AzureBlobModel>(list);
             return new Dictionary<string, object> { { "errno", 0 }, { "data", list.Select(x=>x.BlobUrl)}};
         }
-
+        [HttpPost("uptest")]
+        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
+        public async Task<Dictionary<string, Object>> uptest([FromForm] IFormFile file)
+        {
+            //IFormFileCollection s =  Request.Form.Files;
+            JsonRPCResponseBuilder responseBuilder = new JsonRPCResponseBuilder();
+            AzureBlobModel list = await _azureBlobDBRepository.UploadFileByFolder(file.OpenReadStream(),"aaaaa",file.FileName,"pptx",false);
+            return new Dictionary<string, object> { { "errno", 0 }, { "data", list } };
+        }
+        
         //[HttpPost("uploadWord")]
         //[RequestSizeLimit(102_400_000_00)] //最大10000m左右
         //public async Task<BaseJosnRPCResponse> uploadWord([FromForm] IFormFile file)

+ 2 - 2
TEAMModelOS/Controllers/Core/GradeController.cs

@@ -25,7 +25,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindGradesByDict")]
         public async Task<BaseJosnRPCResponse> FindGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+            //request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Grade> Grades = await _GradeSeservice.FindListByDictHasAll<Grade>(request.@params);
             return builder.Data(Grades).build();
@@ -33,7 +33,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSchoolGradesByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolGradesByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolGrade> Grades = await _GradeSeservice.FindListByDict<SchoolGrade>(request.@params);
             return builder.Data(Grades).build();

+ 3 - 3
TEAMModelOS/Controllers/Core/PeriodController.cs

@@ -32,7 +32,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             int count  = await _periodService.DeleteAll<Period>(request.@params);
             return builder.Data(count).build();
@@ -41,7 +41,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindPeriodsByDict")]
         public async Task<BaseJosnRPCResponse> FindPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Period> data = await _periodService.FindListByDictHasAll<Period>(request.@params);
             return builder.Data(data).build();
@@ -50,7 +50,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSchoolPeriodsByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolPeriodsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolPeriod> data = await _periodService.FindListByDict<SchoolPeriod>(request.@params);
             return builder.Data(data).build();

+ 10 - 4
TEAMModelOS/Controllers/Core/RoleController.cs

@@ -30,7 +30,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindRoleByDict")]
         public async Task<BaseJosnRPCResponse> FindRoleByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Role> roles = await _roleSeservice.FindListByDictHasAll<Role>(request.@params);
             return builder.Data(roles).build();
@@ -48,7 +48,8 @@ namespace TEAMModelOS.Controllers.Core
                     if (role != null && !string.IsNullOrEmpty(role.RowKey))
                     {
                         List<RoleIdentityClaim> identityClaims = await _roleSeservice.FindListByDict<RoleIdentityClaim>(new Dictionary<string, object> {
-                            {"PartitionKey",request.lang },{"RoleCode",role.RowKey },{"RoleLevel",role.Level }
+                          //  {"PartitionKey",request.lang },
+                            { "RoleCode",role.RowKey },{"RoleLevel",role.Level }
                         });
                         roles.Add(role);
                     }
@@ -70,7 +71,10 @@ namespace TEAMModelOS.Controllers.Core
                 foreach (string code in rolecodes)
                 {
                     List<RoleIdentityClaimValue> claimValues=  await _roleSeservice.FindListByDict<RoleIdentityClaimValue>(
-                    new Dictionary<string, object> { { "RoleCode", code },{ "TeamModelId", Id[0]}, { "PartitionKey", request.lang} });
+                    new Dictionary<string, object> { { "RoleCode", code },{ "TeamModelId", Id[0]}
+                        //  ,  { "PartitionKey", request.lang}
+                    }
+                    );
                     List<string> keys = new List<string>();
                     List<Dictionary<string, object>> claims = new List<Dictionary<string, object>>();
                     foreach (IGrouping<string, RoleIdentityClaimValue> group in claimValues.GroupBy(c =>c.GroupKey))
@@ -88,7 +92,9 @@ namespace TEAMModelOS.Controllers.Core
                     Dictionary<string, object> roleClaim = new Dictionary<string, object>
                     {
                         { "roleClaim", claims },
-                        { "role", await _roleSeservice.FindOneByDict<Role>(new Dictionary<string, object> { { "RowKey", code }, { "PartitionKey", request.lang } }) }
+                        { "role", await _roleSeservice.FindOneByDict<Role>(new Dictionary<string, object> { { "RowKey", code },
+                            //{ "PartitionKey", request.lang }
+                        }) }
                     };
                     roleClaims.Add(roleClaim);
                 }

+ 3 - 3
TEAMModelOS/Controllers/Core/SubjectController.cs

@@ -40,7 +40,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+            //request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             int count = await _subjectService.DeleteAll<Subject>(request.@params);
             return builder.Data(count).build();
@@ -49,7 +49,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSubjectsByDict")]
         public async Task<BaseJosnRPCResponse> FindList(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+            //request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<Subject> data = await _subjectService.FindListByDictHasAll<Subject>(request.@params);
             return builder.Data(data).build();
@@ -58,7 +58,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSchoolSubjectsByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolSubjectsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolSubject> Grades = await _subjectService.FindListByDict<SchoolSubject>(request.@params);
             return builder.Data(Grades).build();

+ 2 - 2
TEAMModelOS/Controllers/Core/TermController.cs

@@ -33,7 +33,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           //request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             int count = await _termService.DeleteAll<SchoolTerm>(request.@params);
             return builder.Data(count).build();
@@ -44,7 +44,7 @@ namespace TEAMModelOS.Controllers.Core
         [HttpPost("FindSchoolTermsByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolTermsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolTerm> Grades = await _termService.FindListByDict<SchoolTerm>(request.@params);
             return builder.Data(Grades).build();

+ 20 - 11
TEAMModelOS/Controllers/Syllabus/KnowledgeController.cs

@@ -42,7 +42,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("FindKnowledgePointByDict")]
         public async Task<BaseJosnRPCResponse> FindKnowledgePointByDict(JosnRPCRequest<KnowledgeDto> request)
         {
-            request.@params.PointParams.TryAdd("PartitionKey", request.lang);
+           // request.@params.PointParams.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<KnowledgePoint> data = new List<KnowledgePoint>();
             if (request.@params != null && request.@params.PointParams.TryGetValue("SubjectCode", out _))
@@ -62,7 +62,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("FindKnowledgeBlockAndPointByDict")]
         public async Task<BaseJosnRPCResponse> FindKnowledgeBlockAndPointByDict(JosnRPCRequest<KnowledgeDto> request)
         {
-            request.@params.PointParams.TryAdd("PartitionKey", request.lang);
+           //request.@params.PointParams.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<BlockPointDto> data = new List<BlockPointDto>();
             if (request.@params != null && request.@params.PointParams.TryGetValue("SubjectCode", out _))
@@ -83,7 +83,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("FindSchoolPointByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolPointByDict(JosnRPCRequest<Dictionary<string,object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+        // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolPoint> data = new List<SchoolPoint>();
             if (request.@params != null && request.@params.TryGetValue("SubjectCode", out _) && request.@params.TryGetValue("SchoolCode", out _))
@@ -104,7 +104,10 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("FindSchoolBlockAndPointByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolBlockAndPointByDict(JosnRPCRequest<KnowledgeDto> request)
         {
-            request.@params.PointParams.TryAdd("PartitionKey", request.lang);
+
+            //request.@params.PartitionKey = "zh-CN";
+           //request.@params.PointParams.TryAdd("PartitionKey", request.lang);
+            request.@params.PointParams.TryAdd("PartitionKey", "zh-CN");
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolKnowledgeDto> data = new List<SchoolKnowledgeDto>(); 
             if (request.@params != null && request.@params.PointParams.TryGetValue("SubjectCode", out _) && request.@params.PointParams.TryGetValue("SchoolCode", out _))
@@ -124,7 +127,8 @@ namespace TEAMModelOS.Controllers.Syllabus
         /// <returns></returns>
         [HttpPost("SaveOrUpdateSchoolKnowledgeAsStdKnowledge")]
         public async Task<BaseJosnRPCResponse> SaveOrUpdateSchoolBlockAsKnowledgeBlock(JosnRPCRequest<Dictionary<string ,object>> request) {
-            request.@params.TryAdd("PartitionKey", request.lang);
+            //request.@params.TryAdd("PartitionKey", request.lang);
+            request.@params.TryAdd("PartitionKey", "zh-CN");
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolKnowledgeDto> data = new List<SchoolKnowledgeDto>();
             if (request.@params != null && request.@params.TryGetValue("KnowledgeId", out _)
@@ -151,7 +155,8 @@ namespace TEAMModelOS.Controllers.Syllabus
             {
                 SchoolBlock m = request.@params;
                 m.RowKey = m.RowKey = m.SchoolCode + "-" + m.SubjectCode + "-" + m.KnowledgeId.Replace("-", ""); 
-                m.PartitionKey = request.lang;
+              // m.PartitionKey = request.lang;
+                m.PartitionKey = "zh-CN";
                 m.Type = 0;
                 SchoolBlock data = await knowledgeService.SaveOrUpdate<SchoolBlock>(request.@params);
                 builder.Data(data);
@@ -171,7 +176,8 @@ namespace TEAMModelOS.Controllers.Syllabus
                 List<SchoolPoint> schoolPoints = new List<SchoolPoint>();
                 request.@params.ForEach(m => {
                     m.RowKey = m.SchoolCode + "-" + m.SubjectCode + "-" + m.KnowledgeId.Replace("-", "")+"-"+m.Pid.Replace("-","") ; 
-                    m.PartitionKey = request.lang;
+                    //m.PartitionKey = request.lang;
+                    m.PartitionKey = "zh-CN";
                     m.Type = 1;
                     schoolPoints.Add(new SchoolPoint {
                         RowKey =m.SchoolCode+"-"+m.SubjectCode+"-"+m.KnowledgeId.Replace("-",""),
@@ -204,7 +210,8 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("SaveOrUpdateAllSchoolPoint")]
         public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<SchoolPoint> request)
         {
-            request.@params.PartitionKey = request.lang;
+            request.@params.PartitionKey = "zh-CN";
+           // request.@params.PartitionKey = request.lang;
             request.@params.RowKey = request.@params.SchoolCode + "-" + request.@params.SubjectCode + "-" + request.@params.KnowledgeId.Replace("-", "") ;
             request.@params.Source = 1;
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
@@ -220,7 +227,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         public async Task<BaseJosnRPCResponse> RemoveSchoolBlockPoint(JosnRPCRequest<Dictionary<string,object>> request)
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            request.@params.TryAdd("PartitionKey", request.lang);
+          //  request.@params.TryAdd("PartitionKey", request.lang);
             if (request.@params != null &&
                 request.@params.TryGetValue("SubjectCode", out _) &&
                 request.@params.TryGetValue("SchoolCode", out _)&&
@@ -248,7 +255,8 @@ namespace TEAMModelOS.Controllers.Syllabus
             if (request.@params.IsNotEmpty()) {
                 request.@params.ForEach(m=> {
                     m.RowKey = m.SubjectCode + "-" + m.TagId.Replace("-", "").Substring(0, 16) + "-" + m.KnowledgeId.Replace("-", "").Substring(0, 16)+m.TagType;
-                    m.PartitionKey = request.lang;
+                   // m.PartitionKey = request.lang;
+                    m.PartitionKey = "zh-CN";
                 });
             }
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
@@ -267,7 +275,8 @@ namespace TEAMModelOS.Controllers.Syllabus
             {
                 request.@params.ForEach(m => {
                     m.RowKey =  m.SubjectCode + "-" + m.TagId.Replace("-","").Substring(0,16) + "-" +m.KnowledgeId.Replace("-","").Substring(0,16) + m.TagType;
-                    m.PartitionKey = request.lang;
+                    //m.PartitionKey = request.lang;
+                    m.PartitionKey = "zh-CN";
                 });
             }
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();

+ 8 - 2
TEAMModelOS/Controllers/Syllabus/SyllabusController.cs

@@ -30,14 +30,20 @@ namespace TEAMModelOS.Controllers.Syllabus
         public async Task<BaseJosnRPCResponse> SaveOrUpdateAll(JosnRPCRequest<List<SyllabusTree>> request )
         {
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
-            List<SyllabusTree> data = await syllabusService.SaveOrUpdateAll(request.@params , request.lang);
+            List<SyllabusTree> data = await syllabusService.SaveOrUpdateAll(request.@params ,
+                "zh-CN"
+                //  request.lang
+
+                );
             return builder.Data(data).build(); 
         }
         [HttpPost("SaveOrUpdate")]
         public async Task<BaseJosnRPCResponse> SaveOrUpdate(JosnRPCRequest<SyllabusNode> request)
         {
             if (request.@params != null) {
-                request.@params.PartitionKey = request.lang;
+                // request.@params.PartitionKey = request.lang;
+
+                request.@params.PartitionKey = "zh-CN";
                 if (string.IsNullOrEmpty(request.@params.RowKey)) {
                     request.@params.RowKey = Guid.NewGuid().ToString();
                 }

+ 2 - 2
TEAMModelOS/Controllers/Syllabus/VolumeController.cs

@@ -37,7 +37,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("DeleteInfo")]
         public async Task<BaseJosnRPCResponse> Delete(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             int count = await _volumeService.DeleteAll<SchoolTerm>(request.@params);
             return builder.Data(count).build();
@@ -46,7 +46,7 @@ namespace TEAMModelOS.Controllers.Syllabus
         [HttpPost("FindSchoolVolumesByDict")]
         public async Task<BaseJosnRPCResponse> FindSchoolTermsByDict(JosnRPCRequest<Dictionary<string, object>> request)
         {
-            request.@params.TryAdd("PartitionKey", request.lang);
+           // request.@params.TryAdd("PartitionKey", request.lang);
             JsonRPCResponseBuilder builder = JsonRPCResponseBuilder.custom();
             List<SchoolVolume> Grades = await _volumeService.FindListByDict<SchoolVolume>(request.@params);
             return builder.Data(Grades).build();