浏览代码

添加小程序接口

lcl 1 年之前
父节点
当前提交
0df4676ed2
共有 5 个文件被更改,包括 44 次插入137 次删除
  1. 14 132
      AppStart/Alipay/AlipayFunction.cs
  2. 27 2
      Areas/Api/Controllers/AlipayController.cs
  3. 1 1
      Program.cs
  4. 1 1
      Properties/launchSettings.json
  5. 1 1
      Views/Home/Index.cshtml

+ 14 - 132
AppStart/Alipay/AlipayFunction.cs

@@ -417,164 +417,46 @@ namespace MySystem
 
         #region 小程序提审
 
-        public string MiniProgramApply()
+        public string MiniProgramApply(string AppVersion, string VersionDesc)
         {
             string result = "";
             try
             {
                 IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", MiniAppId, MiniPrivateKey, "json", "1.0", "RSA2", MiniAlipayPublicKey, "UTF-8", false);
-                string imageBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAEUlEQVR42mP4TyRgGFVIX4UAI/uOgGWVNeQAAAAASUVORK5CYII=";
                 AlipayOpenMiniVersionAuditApplyRequest request = new AlipayOpenMiniVersionAuditApplyRequest();
-                // request.AppSlogan = "专注潮流女装20年";
-                // FileItem firstLicensePic = new FileItem("firstLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstLicensePic = firstLicensePic;
-                // FileItem secondScreenShot = new FileItem("secondScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondScreenShot = secondScreenShot;
-                // FileItem fourthLicensePic = new FileItem("fourthLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FourthLicensePic = fourthLicensePic;
-                // request.TestPassword = "12121";
-                // List<RegionInfo> serviceRegionInfo = new List<RegionInfo>();
-                // RegionInfo serviceRegionInfo0 = new RegionInfo();
-                // serviceRegionInfo0.ProvinceName = "浙江省";
-                // serviceRegionInfo0.AreaCode = "311100";
-                // serviceRegionInfo0.CityCode = "310000";
-                // serviceRegionInfo0.ProvinceCode = "310000";
-                // serviceRegionInfo0.AreaName = "余杭区";
-                // serviceRegionInfo0.CityName = "杭州市";
-                // serviceRegionInfo.Add(serviceRegionInfo0);
-                // request.ServiceRegionInfo = serviceRegionInfo;
-                // FileItem secondSpecialLicensePic = new FileItem("secondSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondSpecialLicensePic = secondSpecialLicensePic;
-                // FileItem thirdSpecialLicensePic = new FileItem("thirdSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdSpecialLicensePic = thirdSpecialLicensePic;
-                // request.LicenseNo = "licenseNo";
-                // FileItem appLogo = new FileItem("appLogo.jpg",Convert.FromBase64String(imageBase64));
-                // request.AppLogo = appLogo;
-                // FileItem fifthScreenShot = new FileItem("fifthScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FifthScreenShot = fifthScreenShot;
-                // request.VersionDesc = "本次版本更新优化了3项功能,修复了5个BUG";
-                // FileItem testFileName = new FileItem("testFileName.jpg",Convert.FromBase64String(imageBase64));
-                // request.TestFileName = testFileName;
-                // request.AutoOnline = "true";
-                // request.AppVersion = "0.0.1";
-                // request.RegionType = "CHINA";
-                // FileItem thirdScreenShot = new FileItem("thirdScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdScreenShot = thirdScreenShot;
-                // request.Memo = "小程序示例";
-                // request.LicenseName = "营业执照名称";
-                // FileItem fifthLicensePic = new FileItem("fifthLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FifthLicensePic = fifthLicensePic;
-                // FileItem outDoorPic = new FileItem("outDoorPic.jpg",Convert.FromBase64String(imageBase64));
-                // request.OutDoorPic = outDoorPic;
-                // request.MiniCategoryIds = "XS1001_XS2001_XS3002;XS1011_XS2089;XS1002_XS2008_XS3024";
-                // FileItem secondLicensePic = new FileItem("secondLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondLicensePic = secondLicensePic;
-                // request.AppName = "杭州支小宝潮流女装店";
-                // request.TestAccout = "12122";
-                // request.BundleId = "com.alipay.alipaywallet";
-                // request.ServicePhone = "13110101010";
-                // FileItem firstSpecialLicensePic = new FileItem("firstSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstSpecialLicensePic = firstSpecialLicensePic;
-                // FileItem thirdLicensePic = new FileItem("thirdLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdLicensePic = thirdLicensePic;
-                // request.SpeedUp = "true";
-                // FileItem fourthScreenShot = new FileItem("fourthScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FourthScreenShot = fourthScreenShot;
-                // request.AppDesc = "一家专注做潮流女装的店铺,带给消费者价格便宜、质量上乘的衣服";
-                // request.AuditRule = "BASE_PROMOTE";
-                // FileItem firstScreenShot = new FileItem("firstScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstScreenShot = firstScreenShot;
-                // request.ServiceEmail = "example@mail.com";
-                // request.LicenseValidDate = "9999-12-31";
-                AlipayOpenMiniVersionAuditApplyResponse response = client.Execute(request);
+                request.VersionDesc = ""; //小程序版本描述,30-500个字符。
+                request.AppVersion = ""; //小程序版本号,请选择开发版本执行提交审核操作。
+                AlipayOpenMiniVersionAuditApplyResponse response = client.Execute(request, null, "202306BBdf295279800a428ea07f5574bb73eX31");
                 result = response.Body;
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
+                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝小程序提审异常");
             }
             return result;
         }
 
         #endregion
 
-        #region 小程序退回
+        #region 查询小程序版本状态和详情
 
-        public string MiniProgramBack()
+        public string MiniProgramQuery(string AppVersion)
         {
             string result = "";
             try
             {
                 IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", MiniAppId, MiniPrivateKey, "json", "1.0", "RSA2", MiniAlipayPublicKey, "UTF-8", false);
-                string imageBase64 = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAEUlEQVR42mP4TyRgGFVIX4UAI/uOgGWVNeQAAAAASUVORK5CYII=";
-                AlipayOpenMiniVersionAuditApplyRequest request = new AlipayOpenMiniVersionAuditApplyRequest();
-                // request.AppSlogan = "专注潮流女装20年";
-                // FileItem firstLicensePic = new FileItem("firstLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstLicensePic = firstLicensePic;
-                // FileItem secondScreenShot = new FileItem("secondScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondScreenShot = secondScreenShot;
-                // FileItem fourthLicensePic = new FileItem("fourthLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FourthLicensePic = fourthLicensePic;
-                // request.TestPassword = "12121";
-                // List<RegionInfo> serviceRegionInfo = new List<RegionInfo>();
-                // RegionInfo serviceRegionInfo0 = new RegionInfo();
-                // serviceRegionInfo0.ProvinceName = "浙江省";
-                // serviceRegionInfo0.AreaCode = "311100";
-                // serviceRegionInfo0.CityCode = "310000";
-                // serviceRegionInfo0.ProvinceCode = "310000";
-                // serviceRegionInfo0.AreaName = "余杭区";
-                // serviceRegionInfo0.CityName = "杭州市";
-                // serviceRegionInfo.Add(serviceRegionInfo0);
-                // request.ServiceRegionInfo = serviceRegionInfo;
-                // FileItem secondSpecialLicensePic = new FileItem("secondSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondSpecialLicensePic = secondSpecialLicensePic;
-                // FileItem thirdSpecialLicensePic = new FileItem("thirdSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdSpecialLicensePic = thirdSpecialLicensePic;
-                // request.LicenseNo = "licenseNo";
-                // FileItem appLogo = new FileItem("appLogo.jpg",Convert.FromBase64String(imageBase64));
-                // request.AppLogo = appLogo;
-                // FileItem fifthScreenShot = new FileItem("fifthScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FifthScreenShot = fifthScreenShot;
-                // request.VersionDesc = "本次版本更新优化了3项功能,修复了5个BUG";
-                // FileItem testFileName = new FileItem("testFileName.jpg",Convert.FromBase64String(imageBase64));
-                // request.TestFileName = testFileName;
-                // request.AutoOnline = "true";
-                // request.AppVersion = "0.0.1";
-                // request.RegionType = "CHINA";
-                // FileItem thirdScreenShot = new FileItem("thirdScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdScreenShot = thirdScreenShot;
-                // request.Memo = "小程序示例";
-                // request.LicenseName = "营业执照名称";
-                // FileItem fifthLicensePic = new FileItem("fifthLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FifthLicensePic = fifthLicensePic;
-                // FileItem outDoorPic = new FileItem("outDoorPic.jpg",Convert.FromBase64String(imageBase64));
-                // request.OutDoorPic = outDoorPic;
-                // request.MiniCategoryIds = "XS1001_XS2001_XS3002;XS1011_XS2089;XS1002_XS2008_XS3024";
-                // FileItem secondLicensePic = new FileItem("secondLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.SecondLicensePic = secondLicensePic;
-                // request.AppName = "杭州支小宝潮流女装店";
-                // request.TestAccout = "12122";
-                // request.BundleId = "com.alipay.alipaywallet";
-                // request.ServicePhone = "13110101010";
-                // FileItem firstSpecialLicensePic = new FileItem("firstSpecialLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstSpecialLicensePic = firstSpecialLicensePic;
-                // FileItem thirdLicensePic = new FileItem("thirdLicensePic.jpg",Convert.FromBase64String(imageBase64));
-                // request.ThirdLicensePic = thirdLicensePic;
-                // request.SpeedUp = "true";
-                // FileItem fourthScreenShot = new FileItem("fourthScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FourthScreenShot = fourthScreenShot;
-                // request.AppDesc = "一家专注做潮流女装的店铺,带给消费者价格便宜、质量上乘的衣服";
-                // request.AuditRule = "BASE_PROMOTE";
-                // FileItem firstScreenShot = new FileItem("firstScreenShot.jpg",Convert.FromBase64String(imageBase64));
-                // request.FirstScreenShot = firstScreenShot;
-                // request.ServiceEmail = "example@mail.com";
-                // request.LicenseValidDate = "9999-12-31";
-                AlipayOpenMiniVersionAuditApplyResponse response = client.Execute(request);
+                AlipayOpenMiniVersionDetailQueryRequest request = new AlipayOpenMiniVersionDetailQueryRequest();
+                request.BizContent = "{" +
+                "\"app_version\":\"" + AppVersion + "\"" +
+                "}" +
+                "}";
+                AlipayOpenMiniVersionDetailQueryResponse response = client.Execute(request, null, "202306BBdf295279800a428ea07f5574bb73eX31");
                 result = response.Body;
             }
             catch (Exception ex)
             {
-                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "支付宝授权报错日志");
+                function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "查询小程序版本状态和详情异常");
             }
             return result;
         }

+ 27 - 2
Areas/Api/Controllers/AlipayController.cs

@@ -24,8 +24,6 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
 
 
-
-
         #region 支付宝服务平台支付回调
         public string Notice()
         {
@@ -106,5 +104,32 @@ namespace MySystem.Areas.Api.Controllers.v1
         }
         #endregion
         
+
+        #region 提交审核小程序
+
+        public string MiniProgramApply(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string Detail = data["Detail"].ToString();
+            string Version = data["Version"].ToString();
+            return new AlipayFunction().MiniProgramApply(Version, Detail);
+        }
+
+        #endregion
+
+        #region 查询小程序版本状态和详情
+
+        public string MiniProgramQuery(string value)
+        {
+            value = DesDecrypt(value);
+            JsonData data = JsonMapper.ToObject(value);
+            string Version = data["Version"].ToString();
+            return new AlipayFunction().MiniProgramQuery(Version);
+        }
+
+        #endregion
+
+
     }
 }

+ 1 - 1
Program.cs

@@ -22,7 +22,7 @@ namespace MySystem
                 .ConfigureWebHostDefaults(webBuilder =>
                 {
                     webBuilder
-                    .UseUrls("http://*:5301")
+                    .UseUrls("http://*:5311")
                     .UseKestrel()
                     .UseContentRoot(Directory.GetCurrentDirectory())
                     .UseIISIntegration()

+ 1 - 1
Properties/launchSettings.json

@@ -21,7 +21,7 @@
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
-      "applicationUrl": "http://127.0.0.1:5301"
+      "applicationUrl": "http://127.0.0.1:5311"
     }
   }
 }

+ 1 - 1
Views/Home/Index.cshtml

@@ -1 +1 @@
-<h2>客小爽AP1</h2>
+<h2>来客吧channel1</h2>