|
@@ -130,12 +130,10 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
{
|
|
{
|
|
company.RowKey = Guid.NewGuid().ToString();
|
|
company.RowKey = Guid.NewGuid().ToString();
|
|
company.PartitionKey = "BusinessConfig";
|
|
company.PartitionKey = "BusinessConfig";
|
|
- company.salt = salt;
|
|
|
|
- company.pwd = string.IsNullOrWhiteSpace(company.pwd) ? Utils.HashedPassword("123456", salt) : Utils.HashedPassword(company.pwd, salt);//Password,若梦没有则是默认密码:123456
|
|
|
|
company.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
company.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
- company.jti = Guid.NewGuid().ToString();
|
|
|
|
- company.token = JwtAuth.CreateBusinessJwtKeyBI(_option.Location, _option.JwtSecretKey, company.RowKey, company.jti);
|
|
|
|
-
|
|
|
|
|
|
+ var auth_token = JwtAuthExtension.CreateBusinessApiToken(_option.Location, company.RowKey, _option.JwtSecretKey, "business");
|
|
|
|
+ company.jti = auth_token.jti;
|
|
|
|
+ company.token = auth_token.jwt;
|
|
company = await table.SaveOrUpdate<BusinessConfig>(company);
|
|
company = await table.SaveOrUpdate<BusinessConfig>(company);
|
|
companys.Add(company);
|
|
companys.Add(company);
|
|
strMsg.Append($"{company.name}【{company.RowKey}】新增企业基础信息。");
|
|
strMsg.Append($"{company.name}【{company.RowKey}】新增企业基础信息。");
|
|
@@ -169,12 +167,10 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
{
|
|
{
|
|
company.RowKey = Guid.NewGuid().ToString();
|
|
company.RowKey = Guid.NewGuid().ToString();
|
|
company.PartitionKey = "BusinessConfig";
|
|
company.PartitionKey = "BusinessConfig";
|
|
- company.salt = salt;
|
|
|
|
- company.pwd = string.IsNullOrWhiteSpace(company.pwd) ? Utils.HashedPassword("123456", salt) : Utils.HashedPassword(company.pwd, salt);//Password,若梦没有则是默认密码:123456
|
|
|
|
- company.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
- company.jti = Guid.NewGuid().ToString();
|
|
|
|
- company.token = JwtAuth.CreateBusinessJwtKeyBI(_option.Location, _option.JwtSecretKey, company.RowKey, company.jti);
|
|
|
|
-
|
|
|
|
|
|
+ company.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
+ var auth_token = JwtAuthExtension.CreateBusinessApiToken(_option.Location, company.RowKey, _option.JwtSecretKey, "business");
|
|
|
|
+ company.jti = auth_token.jti;
|
|
|
|
+ company.token = auth_token.jwt;
|
|
company = await table.SaveOrUpdate<BusinessConfig>(company);
|
|
company = await table.SaveOrUpdate<BusinessConfig>(company);
|
|
companys.Add(company);
|
|
companys.Add(company);
|
|
strMsg.Append($"{company.name}【{company.RowKey}】新增企业基础信息:{company}。");
|
|
strMsg.Append($"{company.name}【{company.RowKey}】新增企业基础信息:{company}。");
|
|
@@ -182,40 +178,7 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- ////存储在CosmosDB表
|
|
|
|
- ////新增企业信息
|
|
|
|
- //if (string.IsNullOrEmpty(company.id))
|
|
|
|
- //{
|
|
|
|
- // company.id = Guid.NewGuid().ToString();
|
|
|
|
- // company.code = "Company";
|
|
|
|
- // company.salt = salt;
|
|
|
|
- // company.password = string.IsNullOrWhiteSpace(company.password) ? Utils.HashedPassword("123456", salt) : Utils.HashedPassword(company.password, salt);//Password,若梦没有则是默认密码:123456
|
|
|
|
- // company.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
- // company.jti = Guid.NewGuid().ToString();
|
|
|
|
- // company.secretKey = JwtAuth.CreateBusinessJwtKeyBI(_option.Location, _option.JwtSecretKey, company.id, company.jti);
|
|
|
|
- // await cosmosClient.GetContainer("TEAMModelOS", "Normal").CreateItemAsync<Company>(company, new PartitionKey(company.code));
|
|
|
|
- // strMsg.Append($"{company.name}【{company.id}】新增企业基础信息。");
|
|
|
|
- // type = "business-add";
|
|
|
|
- //}
|
|
|
|
- ////修改企业信息
|
|
|
|
- //else
|
|
|
|
- //{
|
|
|
|
- // var respone = await cosmosClient.GetContainer("TEAMModelOS", "Normal").ReadItemStreamAsync(company.id, new PartitionKey($""));
|
|
|
|
- // if (respone.Status == 200)
|
|
|
|
- // {
|
|
|
|
- // company.pk = "Company";
|
|
|
|
- // company.code = "Company";
|
|
|
|
- // company.ttl = -1;
|
|
|
|
- // company.salt = salt;
|
|
|
|
- // company.password = string.IsNullOrWhiteSpace(company.password) ? Utils.HashedPassword("123456", salt) : Utils.HashedPassword(company.password, salt);//Password,若梦没有则是默认密码:123456
|
|
|
|
-
|
|
|
|
- // company = await cosmosClient.GetContainer("TEAMModelOS", "Normal").ReplaceItemAsync<Company>(company, company.id, new PartitionKey(company.code));
|
|
|
|
- // strMsg.Append($"{company.name}【{company.id}】修改企业基础信息。");
|
|
|
|
- // type = "business-update";
|
|
|
|
- // }
|
|
|
|
- // else return Ok(new { state = 404, msg = "未找到该id相关的企业信息" });
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
|
|
+
|
|
//保存操作记录
|
|
//保存操作记录
|
|
//await _azureStorage.SaveBILog(type, strMsg.ToString(), _dingDing, httpContext: HttpContext);
|
|
//await _azureStorage.SaveBILog(type, strMsg.ToString(), _dingDing, httpContext: HttpContext);
|
|
await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, type, strMsg.ToString(), _dingDing, httpContext: HttpContext);
|
|
await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, type, strMsg.ToString(), _dingDing, httpContext: HttpContext);
|
|
@@ -406,14 +369,13 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
if ($"{resetType}".Equals("pwd"))
|
|
if ($"{resetType}".Equals("pwd"))
|
|
{
|
|
{
|
|
string salt = Utils.CreatSaltString(8);
|
|
string salt = Utils.CreatSaltString(8);
|
|
- busConfig.salt = salt;
|
|
|
|
- busConfig.pwd = Utils.HashedPassword("123456", salt);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if ($"{resetType}".Equals("token"))
|
|
if ($"{resetType}".Equals("token"))
|
|
{
|
|
{
|
|
- busConfig.jti = Guid.NewGuid().ToString();
|
|
|
|
- busConfig.token = JwtAuth.CreateBusinessJwtKeyBI(_option.Location, _option.JwtSecretKey, busConfig.RowKey, busConfig.jti);
|
|
|
|
|
|
+ var auth_token = JwtAuthExtension.CreateBusinessApiToken(_option.Location, busConfig.RowKey, _option.JwtSecretKey, "business");
|
|
|
|
+ busConfig.jti = auth_token.jti;
|
|
|
|
+ busConfig.token = auth_token.jwt;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ($"{resetType}".Equals("pwd") || $"{resetType}".Equals("token"))
|
|
if ($"{resetType}".Equals("pwd") || $"{resetType}".Equals("token"))
|