Преглед изворни кода

Merge branch 'dev' of http://123.60.180.165:4647/ZZYDOP/DOPCore into dev

tangdi пре 3 година
родитељ
комит
4b2c9d9d98

+ 13 - 2
MicroServices/Business/Business.HttpApi/Controllers/SnowFlakeController.cs

@@ -2,6 +2,7 @@
 using Business.ResourceExamineManagement;
 using Business.ResourceExamineManagement.Dto;
 using Microsoft.AspNetCore.Mvc;
+using MongoDB.Bson.IO;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -9,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Volo.Abp;
 using Volo.Abp.AspNetCore.Mvc;
+using Newtonsoft.Json;
 
 namespace Business.Controllers
 {
@@ -25,10 +27,19 @@ namespace Business.Controllers
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public long CreatePrimaryKey()
+        public string CreatePrimaryKey(int count)
         {
+            //雪花算法帮助类
             SnowFlake snow = new SnowFlake();
-            return snow.NextId();
+            //返回值
+            List<long> ids = new List<long>();
+            for (int i = 0; i < count;i++)
+            {
+                //雪花算法生成id
+                ids.Add(snow.NextId());
+            }
+            var json = Newtonsoft.Json.JsonConvert.SerializeObject(ids);
+            return json;
         }
     }
 }