Browse Source

feat: 修复nswag toJson时间格式由0时区改为本地时区 #99

pull/126/head 7.2.2.13
wangjun 3 years ago
parent
commit
08665324a2
  1. 1
      .gitignore
  2. 1008
      templates/abp-vnext-pro-nuget-all/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs/logs-20230617.txt
  3. 189
      templates/abp-vnext-pro-nuget-all/vben28/nswag/templates/Class.liquid
  4. 3
      templates/abp-vnext-pro-nuget-all/vben28/package.json
  5. 74
      templates/abp-vnext-pro-nuget-all/vben28/src/services/ServiceProxies.ts
  6. 12404
      templates/abp-vnext-pro-nuget-all/vben28/yarn.lock
  7. 1385
      templates/abp-vnext-pro-nuget-simplify/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs/logs-20230706.txt
  8. 2
      templates/abp-vnext-pro-nuget-simplify/vben28/nswag/nswag.json
  9. 189
      templates/abp-vnext-pro-nuget-simplify/vben28/nswag/templates/Class.liquid
  10. 1219
      templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxies.ts
  11. 87
      templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxyBase.ts
  12. 12404
      templates/abp-vnext-pro-nuget-simplify/vben28/yarn.lock
  13. 189
      vben28/nswag/templates/Class.liquid
  14. 29797
      vben28/src/services/ServiceProxies.ts

1
.gitignore

@ -265,3 +265,4 @@ aspnet-core/services/host/Lion.AbpPro.Web.Blazor.Server/Logs/logs.txt
/aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Logs /aspnet-core/modules/LanguageManagement/host/Lion.AbpPro.LanguageManagement.HttpApi.Host/Logs
/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Logs /aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Logs
/aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/wwwroot/libs /aspnet-core/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/wwwroot/libs
/templates/abp-vnext-pro-nuget-all/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs

1008
templates/abp-vnext-pro-nuget-all/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs/logs-20230617.txt

File diff suppressed because it is too large

189
templates/abp-vnext-pro-nuget-all/vben28/nswag/templates/Class.liquid

@ -0,0 +1,189 @@
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}{% if IsAbstract %}abstract {% endif %}class {{ ClassName }}{{ Inheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{% if property.IsReadOnly %}readonly {% endif %}{{ property.PropertyName }}{% if property.IsOptional %}?{% elsif RequiresStrictPropertyInitialization %}!{% endif %}: {{ property.Type }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
{% if HasDiscriminator -%}
protected _discriminator: string;
{% endif -%}
{% assign condition_temp = HasInheritance == false or ConvertConstructorInterfaceData -%}
{% if GenerateConstructorInterface or HasBaseDiscriminator -%}
constructor({% if GenerateConstructorInterface %}data?: I{{ ClassName }}{% endif %}) {
{% if HasInheritance -%}
super({% if GenerateConstructorInterface %}data{% endif %});
{% endif -%}
{% if GenerateConstructorInterface and condition_temp -%}
if (data) {
{% if HasInheritance == false -%}
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
{% endif -%}
{% if ConvertConstructorInterfaceData -%}
{% for property in Properties -%}
{% if property.SupportsConstructorConversion -%}
{% if property.IsArray -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = [];
for (let i = 0; i < data.{{ property.PropertyName }}.length; i++) {
let item = data.{{ property.PropertyName }}[i];
this.{{ property.PropertyName }}[i] = item && !(<any>item).toJSON ? new {{ property.ArrayItemType }}(item) : <{{ property.ArrayItemType }}>item;
}
}
{% elsif property.IsDictionary -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = {};
for (let key in data.{{ property.PropertyName }}) {
if (data.{{ property.PropertyName }}.hasOwnProperty(key)) {
let item = data.{{ property.PropertyName }}[key];
this.{{ property.PropertyName }}[key] = item && !(<any>item).toJSON ? new {{ property.DictionaryItemType }}(item) : <{{ property.DictionaryItemType }}>item;
}
}
}
{% else -%}
this.{{ property.PropertyName }} = data.{{ property.PropertyName }} && !(<any>data.{{ property.PropertyName }}).toJSON ? new {{ property.Type }}(data.{{ property.PropertyName }}) : <{{ property.Type }}>this.{{ property.PropertyName }};
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
}
{% endif -%}
{% if HasDefaultValues -%}
{% if GenerateConstructorInterface %}if (!data) {% endif %}{
{% for property in Properties -%}
{% if property.HasDefaultValue -%}
this.{{ property.PropertyName }} = {{ property.DefaultValue }};
{% endif -%}
{% endfor -%}
}
{% endif -%}
{% if HasBaseDiscriminator -%}
this._discriminator = "{{ DiscriminatorName }}";
{% endif -%}
}
{% endif -%}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}init(_data?: any{% if HandleReferences %}, _mappings?: any{% endif %}) {
{% if HasInheritance -%}
super.init(_data);
{% endif -%}
{% if HasIndexerProperty or HasProperties -%}
if (_data) {
{% if HasIndexerProperty -%}
for (var property in _data) {
if (_data.hasOwnProperty(property))
this[property] = _data[property];
}
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToClassCode | strip | tab }}
{% endfor -%}
}
{% endif -%}
}
static {% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}fromJS(data: any{% if HandleReferences %}, _mappings?: any{% endif %}): {{ ClassName }}{% if HandleReferences %} | null{% endif %} {
data = typeof data === 'object' ? data : {};
{% if HandleReferences -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}")
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ derivedClass.ClassName }}>(data, _mappings, {{ derivedClass.ClassName }});
{% endif -%}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ ClassName }}>(data, _mappings, {{ ClassName }});
{% endif -%}
{% else -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}") {
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ derivedClass.ClassName }}();
result.init(data);
return result;
{% endif -%}
}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ ClassName }}();
result.init(data);
return result;
{% endif -%}
{% endif -%}
}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
{% if HasIndexerProperty -%}
for (var property in this) {
if (this.hasOwnProperty(property))
data[property] = this[property];
}
{% endif -%}
{% if HasDiscriminator -%}
data["{{ BaseDiscriminator }}"] = this._discriminator;
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToJavaScriptCode | replace: "toISOString","toLocaleString" | tab }}
{% endfor -%}
{% if HasInheritance -%}
super.toJSON(data);
{% endif -%}
return data;
}
{% if GenerateCloneMethod -%}
clone(): {{ ClassName }} {
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
const json = this.toJSON();
let result = new {{ ClassName }}();
result.init(json);
return result;
{% endif -%}
}
{% endif -%}
}
{% if GenerateConstructorInterface -%}
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}interface I{{ ClassName }}{{ InterfaceInheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{{ property.PropertyName }}{% if property.IsOptional %}?{% endif %}: {{ property.ConstructorInterfaceType }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
}
{% endif -%}

3
templates/abp-vnext-pro-nuget-all/vben28/package.json

@ -37,7 +37,7 @@
"@iconify/iconify": "^2.2.1", "@iconify/iconify": "^2.2.1",
"@logicflow/core": "^1.1.13", "@logicflow/core": "^1.1.13",
"@logicflow/extension": "^1.1.13", "@logicflow/extension": "^1.1.13",
"@microsoft/signalr": "^6.0.6", "@microsoft/signalr": "^7.0.2",
"@vue/runtime-core": "^3.2.33", "@vue/runtime-core": "^3.2.33",
"@vue/shared": "^3.2.33", "@vue/shared": "^3.2.33",
"@vueuse/core": "^8.3.0", "@vueuse/core": "^8.3.0",
@ -112,7 +112,6 @@
"eslint-plugin-vue": "^8.6.0", "eslint-plugin-vue": "^8.6.0",
"esno": "^0.14.1", "esno": "^0.14.1",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"inquirer": "^8.2.2", "inquirer": "^8.2.2",
"less": "^4.1.2", "less": "^4.1.2",
"lint-staged": "12.3.7", "lint-staged": "12.3.7",

74
templates/abp-vnext-pro-nuget-all/vben28/src/services/ServiceProxies.ts

@ -7177,8 +7177,8 @@ export interface IControllerInterfaceApiDescriptionModel {
export class CreateDataDictinaryDetailInput implements ICreateDataDictinaryDetailInput { export class CreateDataDictinaryDetailInput implements ICreateDataDictinaryDetailInput {
id!: string; id!: string;
code!: string; code!: string | undefined;
displayText!: string; displayText!: string | undefined;
description!: string | undefined; description!: string | undefined;
order!: number; order!: number;
@ -7221,15 +7221,15 @@ export class CreateDataDictinaryDetailInput implements ICreateDataDictinaryDetai
export interface ICreateDataDictinaryDetailInput { export interface ICreateDataDictinaryDetailInput {
id: string; id: string;
code: string; code: string | undefined;
displayText: string; displayText: string | undefined;
description: string | undefined; description: string | undefined;
order: number; order: number;
} }
export class CreateDataDictinaryInput implements ICreateDataDictinaryInput { export class CreateDataDictinaryInput implements ICreateDataDictinaryInput {
code!: string; code!: string | undefined;
displayText!: string; displayText!: string | undefined;
description!: string | undefined; description!: string | undefined;
constructor(data?: ICreateDataDictinaryInput) { constructor(data?: ICreateDataDictinaryInput) {
@ -7266,13 +7266,13 @@ export class CreateDataDictinaryInput implements ICreateDataDictinaryInput {
} }
export interface ICreateDataDictinaryInput { export interface ICreateDataDictinaryInput {
code: string; code: string | undefined;
displayText: string; displayText: string | undefined;
description: string | undefined; description: string | undefined;
} }
export class CreateOrganizationUnitInput implements ICreateOrganizationUnitInput { export class CreateOrganizationUnitInput implements ICreateOrganizationUnitInput {
displayName!: string; displayName!: string | undefined;
parentId!: string | undefined; parentId!: string | undefined;
constructor(data?: ICreateOrganizationUnitInput) { constructor(data?: ICreateOrganizationUnitInput) {
@ -7307,7 +7307,7 @@ export class CreateOrganizationUnitInput implements ICreateOrganizationUnitInput
} }
export interface ICreateOrganizationUnitInput { export interface ICreateOrganizationUnitInput {
displayName: string; displayName: string | undefined;
parentId: string | undefined; parentId: string | undefined;
} }
@ -9654,8 +9654,8 @@ export interface IGetOrganizationUnitUserOutputPagedResultDto {
} }
export class GetPermissionInput implements IGetPermissionInput { export class GetPermissionInput implements IGetPermissionInput {
providerName!: string; providerName!: string | undefined;
providerKey!: string; providerKey!: string | undefined;
constructor(data?: IGetPermissionInput) { constructor(data?: IGetPermissionInput) {
if (data) { if (data) {
@ -9689,8 +9689,8 @@ export class GetPermissionInput implements IGetPermissionInput {
} }
export interface IGetPermissionInput { export interface IGetPermissionInput {
providerName: string; providerName: string | undefined;
providerKey: string; providerKey: string | undefined;
} }
export class GetUnAddRoleInput implements IGetUnAddRoleInput { export class GetUnAddRoleInput implements IGetUnAddRoleInput {
@ -10588,13 +10588,13 @@ export class IdentityUserDto implements IIdentityUserDto {
} }
} }
data["id"] = this.id; data["id"] = this.id;
data["creationTime"] = this.creationTime ? this.creationTime.toISOString() : <any>undefined; data["creationTime"] = this.creationTime ? this.creationTime.toLocaleString() : <any>undefined;
data["creatorId"] = this.creatorId; data["creatorId"] = this.creatorId;
data["lastModificationTime"] = this.lastModificationTime ? this.lastModificationTime.toISOString() : <any>undefined; data["lastModificationTime"] = this.lastModificationTime ? this.lastModificationTime.toLocaleString() : <any>undefined;
data["lastModifierId"] = this.lastModifierId; data["lastModifierId"] = this.lastModifierId;
data["isDeleted"] = this.isDeleted; data["isDeleted"] = this.isDeleted;
data["deleterId"] = this.deleterId; data["deleterId"] = this.deleterId;
data["deletionTime"] = this.deletionTime ? this.deletionTime.toISOString() : <any>undefined; data["deletionTime"] = this.deletionTime ? this.deletionTime.toLocaleString() : <any>undefined;
data["tenantId"] = this.tenantId; data["tenantId"] = this.tenantId;
data["userName"] = this.userName; data["userName"] = this.userName;
data["name"] = this.name; data["name"] = this.name;
@ -10605,7 +10605,7 @@ export class IdentityUserDto implements IIdentityUserDto {
data["phoneNumberConfirmed"] = this.phoneNumberConfirmed; data["phoneNumberConfirmed"] = this.phoneNumberConfirmed;
data["isActive"] = this.isActive; data["isActive"] = this.isActive;
data["lockoutEnabled"] = this.lockoutEnabled; data["lockoutEnabled"] = this.lockoutEnabled;
data["lockoutEnd"] = this.lockoutEnd ? this.lockoutEnd.toISOString() : <any>undefined; data["lockoutEnd"] = this.lockoutEnd ? this.lockoutEnd.toLocaleString() : <any>undefined;
data["concurrencyStamp"] = this.concurrencyStamp; data["concurrencyStamp"] = this.concurrencyStamp;
data["entityVersion"] = this.entityVersion; data["entityVersion"] = this.entityVersion;
return data; return data;
@ -11567,8 +11567,8 @@ export class PagingAuditLogInput implements IPagingAuditLogInput {
data["pageSize"] = this.pageSize; data["pageSize"] = this.pageSize;
data["skipCount"] = this.skipCount; data["skipCount"] = this.skipCount;
data["sorting"] = this.sorting; data["sorting"] = this.sorting;
data["startTime"] = this.startTime ? this.startTime.toISOString() : <any>undefined; data["startTime"] = this.startTime ? this.startTime.toLocaleString() : <any>undefined;
data["endTime"] = this.endTime ? this.endTime.toISOString() : <any>undefined; data["endTime"] = this.endTime ? this.endTime.toLocaleString() : <any>undefined;
data["httpMethod"] = this.httpMethod; data["httpMethod"] = this.httpMethod;
data["url"] = this.url; data["url"] = this.url;
data["userId"] = this.userId; data["userId"] = this.userId;
@ -12398,7 +12398,7 @@ export class PagingNotificationListOutput implements IPagingNotificationListOutp
data["messageLevel"] = this.messageLevel; data["messageLevel"] = this.messageLevel;
data["messageLevelDescription"] = this.messageLevelDescription; data["messageLevelDescription"] = this.messageLevelDescription;
data["senderId"] = this.senderId; data["senderId"] = this.senderId;
data["creationTime"] = this.creationTime ? this.creationTime.toISOString() : <any>undefined; data["creationTime"] = this.creationTime ? this.creationTime.toLocaleString() : <any>undefined;
data["read"] = this.read; data["read"] = this.read;
return data; return data;
} }
@ -13868,7 +13868,7 @@ export interface ITypeApiDescriptionModel {
export class UpdateConnectionStringInput implements IUpdateConnectionStringInput { export class UpdateConnectionStringInput implements IUpdateConnectionStringInput {
id!: string; id!: string;
connectionString!: string; connectionString!: string | undefined;
constructor(data?: IUpdateConnectionStringInput) { constructor(data?: IUpdateConnectionStringInput) {
if (data) { if (data) {
@ -13903,13 +13903,13 @@ export class UpdateConnectionStringInput implements IUpdateConnectionStringInput
export interface IUpdateConnectionStringInput { export interface IUpdateConnectionStringInput {
id: string; id: string;
connectionString: string; connectionString: string | undefined;
} }
export class UpdateDataDictinaryInput implements IUpdateDataDictinaryInput { export class UpdateDataDictinaryInput implements IUpdateDataDictinaryInput {
id!: string; id!: string;
code!: string; code!: string | undefined;
displayText!: string; displayText!: string | undefined;
description!: string | undefined; description!: string | undefined;
constructor(data?: IUpdateDataDictinaryInput) { constructor(data?: IUpdateDataDictinaryInput) {
@ -13949,15 +13949,15 @@ export class UpdateDataDictinaryInput implements IUpdateDataDictinaryInput {
export interface IUpdateDataDictinaryInput { export interface IUpdateDataDictinaryInput {
id: string; id: string;
code: string; code: string | undefined;
displayText: string; displayText: string | undefined;
description: string | undefined; description: string | undefined;
} }
export class UpdateDetailInput implements IUpdateDetailInput { export class UpdateDetailInput implements IUpdateDetailInput {
dataDictionaryId!: string; dataDictionaryId!: string;
id!: string; id!: string;
displayText!: string; displayText!: string | undefined;
description!: string | undefined; description!: string | undefined;
order!: number; order!: number;
@ -14001,13 +14001,13 @@ export class UpdateDetailInput implements IUpdateDetailInput {
export interface IUpdateDetailInput { export interface IUpdateDetailInput {
dataDictionaryId: string; dataDictionaryId: string;
id: string; id: string;
displayText: string; displayText: string | undefined;
description: string | undefined; description: string | undefined;
order: number; order: number;
} }
export class UpdateOrganizationUnitInput implements IUpdateOrganizationUnitInput { export class UpdateOrganizationUnitInput implements IUpdateOrganizationUnitInput {
displayName!: string; displayName!: string | undefined;
id!: string; id!: string;
constructor(data?: IUpdateOrganizationUnitInput) { constructor(data?: IUpdateOrganizationUnitInput) {
@ -14042,7 +14042,7 @@ export class UpdateOrganizationUnitInput implements IUpdateOrganizationUnitInput
} }
export interface IUpdateOrganizationUnitInput { export interface IUpdateOrganizationUnitInput {
displayName: string; displayName: string | undefined;
id: string; id: string;
} }
@ -14171,8 +14171,8 @@ export interface IUpdateRoleInput {
} }
export class UpdateRolePermissionsInput implements IUpdateRolePermissionsInput { export class UpdateRolePermissionsInput implements IUpdateRolePermissionsInput {
providerName!: string; providerName!: string | undefined;
providerKey!: string; providerKey!: string | undefined;
updatePermissionsDto!: UpdatePermissionsDto; updatePermissionsDto!: UpdatePermissionsDto;
constructor(data?: IUpdateRolePermissionsInput) { constructor(data?: IUpdateRolePermissionsInput) {
@ -14209,8 +14209,8 @@ export class UpdateRolePermissionsInput implements IUpdateRolePermissionsInput {
} }
export interface IUpdateRolePermissionsInput { export interface IUpdateRolePermissionsInput {
providerName: string; providerName: string | undefined;
providerKey: string; providerKey: string | undefined;
updatePermissionsDto: UpdatePermissionsDto; updatePermissionsDto: UpdatePermissionsDto;
} }
@ -14264,7 +14264,7 @@ export interface IUpdateSettingInput {
export class UpdateTenantInput implements IUpdateTenantInput { export class UpdateTenantInput implements IUpdateTenantInput {
id!: string; id!: string;
name!: string; name!: string | undefined;
constructor(data?: IUpdateTenantInput) { constructor(data?: IUpdateTenantInput) {
if (data) { if (data) {
@ -14299,7 +14299,7 @@ export class UpdateTenantInput implements IUpdateTenantInput {
export interface IUpdateTenantInput { export interface IUpdateTenantInput {
id: string; id: string;
name: string; name: string | undefined;
} }
export class UpdateUserInput implements IUpdateUserInput { export class UpdateUserInput implements IUpdateUserInput {

12404
templates/abp-vnext-pro-nuget-all/vben28/yarn.lock

File diff suppressed because it is too large

1385
templates/abp-vnext-pro-nuget-simplify/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/logs/logs-20230706.txt

File diff suppressed because it is too large

2
templates/abp-vnext-pro-nuget-simplify/vben28/nswag/nswag.json

@ -71,4 +71,4 @@
"newLineBehavior": "Auto" "newLineBehavior": "Auto"
} }
} }
} }

189
templates/abp-vnext-pro-nuget-simplify/vben28/nswag/templates/Class.liquid

@ -0,0 +1,189 @@
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}{% if IsAbstract %}abstract {% endif %}class {{ ClassName }}{{ Inheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{% if property.IsReadOnly %}readonly {% endif %}{{ property.PropertyName }}{% if property.IsOptional %}?{% elsif RequiresStrictPropertyInitialization %}!{% endif %}: {{ property.Type }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
{% if HasDiscriminator -%}
protected _discriminator: string;
{% endif -%}
{% assign condition_temp = HasInheritance == false or ConvertConstructorInterfaceData -%}
{% if GenerateConstructorInterface or HasBaseDiscriminator -%}
constructor({% if GenerateConstructorInterface %}data?: I{{ ClassName }}{% endif %}) {
{% if HasInheritance -%}
super({% if GenerateConstructorInterface %}data{% endif %});
{% endif -%}
{% if GenerateConstructorInterface and condition_temp -%}
if (data) {
{% if HasInheritance == false -%}
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
{% endif -%}
{% if ConvertConstructorInterfaceData -%}
{% for property in Properties -%}
{% if property.SupportsConstructorConversion -%}
{% if property.IsArray -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = [];
for (let i = 0; i < data.{{ property.PropertyName }}.length; i++) {
let item = data.{{ property.PropertyName }}[i];
this.{{ property.PropertyName }}[i] = item && !(<any>item).toJSON ? new {{ property.ArrayItemType }}(item) : <{{ property.ArrayItemType }}>item;
}
}
{% elsif property.IsDictionary -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = {};
for (let key in data.{{ property.PropertyName }}) {
if (data.{{ property.PropertyName }}.hasOwnProperty(key)) {
let item = data.{{ property.PropertyName }}[key];
this.{{ property.PropertyName }}[key] = item && !(<any>item).toJSON ? new {{ property.DictionaryItemType }}(item) : <{{ property.DictionaryItemType }}>item;
}
}
}
{% else -%}
this.{{ property.PropertyName }} = data.{{ property.PropertyName }} && !(<any>data.{{ property.PropertyName }}).toJSON ? new {{ property.Type }}(data.{{ property.PropertyName }}) : <{{ property.Type }}>this.{{ property.PropertyName }};
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
}
{% endif -%}
{% if HasDefaultValues -%}
{% if GenerateConstructorInterface %}if (!data) {% endif %}{
{% for property in Properties -%}
{% if property.HasDefaultValue -%}
this.{{ property.PropertyName }} = {{ property.DefaultValue }};
{% endif -%}
{% endfor -%}
}
{% endif -%}
{% if HasBaseDiscriminator -%}
this._discriminator = "{{ DiscriminatorName }}";
{% endif -%}
}
{% endif -%}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}init(_data?: any{% if HandleReferences %}, _mappings?: any{% endif %}) {
{% if HasInheritance -%}
super.init(_data);
{% endif -%}
{% if HasIndexerProperty or HasProperties -%}
if (_data) {
{% if HasIndexerProperty -%}
for (var property in _data) {
if (_data.hasOwnProperty(property))
this[property] = _data[property];
}
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToClassCode | strip | tab }}
{% endfor -%}
}
{% endif -%}
}
static {% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}fromJS(data: any{% if HandleReferences %}, _mappings?: any{% endif %}): {{ ClassName }}{% if HandleReferences %} | null{% endif %} {
data = typeof data === 'object' ? data : {};
{% if HandleReferences -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}")
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ derivedClass.ClassName }}>(data, _mappings, {{ derivedClass.ClassName }});
{% endif -%}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ ClassName }}>(data, _mappings, {{ ClassName }});
{% endif -%}
{% else -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}") {
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ derivedClass.ClassName }}();
result.init(data);
return result;
{% endif -%}
}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ ClassName }}();
result.init(data);
return result;
{% endif -%}
{% endif -%}
}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
{% if HasIndexerProperty -%}
for (var property in this) {
if (this.hasOwnProperty(property))
data[property] = this[property];
}
{% endif -%}
{% if HasDiscriminator -%}
data["{{ BaseDiscriminator }}"] = this._discriminator;
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToJavaScriptCode | replace: "toISOString","toLocaleString" | tab }}
{% endfor -%}
{% if HasInheritance -%}
super.toJSON(data);
{% endif -%}
return data;
}
{% if GenerateCloneMethod -%}
clone(): {{ ClassName }} {
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
const json = this.toJSON();
let result = new {{ ClassName }}();
result.init(json);
return result;
{% endif -%}
}
{% endif -%}
}
{% if GenerateConstructorInterface -%}
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}interface I{{ ClassName }}{{ InterfaceInheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{{ property.PropertyName }}{% if property.IsOptional %}?{% endif %}: {{ property.ConstructorInterfaceType }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
}
{% endif -%}

1219
templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxies.ts

File diff suppressed because it is too large

87
templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxyBase.ts

@ -85,90 +85,3 @@ export class ServiceProxyBase {
}; };
} }
} }
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { message } from 'ant-design-vue';
import { useUserStoreWithOut } from '/@/store/modules/user';
import { router } from '/@/router';
import { PageEnum } from '/@/enums/pageEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import { Modal } from 'ant-design-vue';
import { useLocale } from '/@/locales/useLocale';
export class ServiceProxyBase {
protected transformOptions(options: AxiosRequestConfig) {
options.baseURL = import.meta.env.VITE_API_URL as string;
const guard: boolean = this.urlGuard(options.url as string);
const userStore = useUserStoreWithOut();
const { token, language } = this.buildRequestMessage();
if (!guard) {
if (userStore.checkUserLoginExpire) {
router.replace(PageEnum.BASE_LOGIN);
} else {
// 添加header
options.headers = {
'accept-language': language,
'Content-Type': 'application/json',
Authorization: 'Bearer ' + token,
__tenant: userStore.tenantId,
};
}
} else {
options.headers = {
'Content-Type': 'application/json',
__tenant: userStore.tenantId,
'accept-language': language,
};
}
return Promise.resolve(options);
}
protected transformResult(
_url: string,
response: AxiosResponse,
processor: (response: AxiosResponse) => Promise<any>,
): Promise<any> {
const { t } = useI18n();
if (response.status == 401) {
message.error(t('common.authorityText'));
router.replace(PageEnum.BASE_LOGIN);
} else if (response.status == 403) {
message.error(t('common.permissionDenied'));
} else if (response.status == 400) {
Modal.error({
title: t('common.parameterValidationFailure'),
content: response.data.error.validationErrors[0].message,
});
} else if (response.status >= 500) {
Modal.error({
title: t('common.systemErrorText'),
content: response.data.error.message,
});
}
return processor(response);
}
//判决接口是否需要拦截
private urlGuard(url: string): boolean {
if (url == '/Tenants/find') {
return true;
}
if (url.startsWith('/api/app/account')) {
return true;
}
return false;
}
private buildRequestMessage(): any {
const userStore = useUserStoreWithOut();
const token = userStore.getToken;
const { getLocale } = useLocale();
const language = getLocale.value == 'en' ? getLocale.value : 'zh-Hans';
return {
token,
language,
};
}
}

12404
templates/abp-vnext-pro-nuget-simplify/vben28/yarn.lock

File diff suppressed because it is too large

189
vben28/nswag/templates/Class.liquid

@ -0,0 +1,189 @@
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}{% if IsAbstract %}abstract {% endif %}class {{ ClassName }}{{ Inheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{% if property.IsReadOnly %}readonly {% endif %}{{ property.PropertyName }}{% if property.IsOptional %}?{% elsif RequiresStrictPropertyInitialization %}!{% endif %}: {{ property.Type }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
{% if HasDiscriminator -%}
protected _discriminator: string;
{% endif -%}
{% assign condition_temp = HasInheritance == false or ConvertConstructorInterfaceData -%}
{% if GenerateConstructorInterface or HasBaseDiscriminator -%}
constructor({% if GenerateConstructorInterface %}data?: I{{ ClassName }}{% endif %}) {
{% if HasInheritance -%}
super({% if GenerateConstructorInterface %}data{% endif %});
{% endif -%}
{% if GenerateConstructorInterface and condition_temp -%}
if (data) {
{% if HasInheritance == false -%}
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
{% endif -%}
{% if ConvertConstructorInterfaceData -%}
{% for property in Properties -%}
{% if property.SupportsConstructorConversion -%}
{% if property.IsArray -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = [];
for (let i = 0; i < data.{{ property.PropertyName }}.length; i++) {
let item = data.{{ property.PropertyName }}[i];
this.{{ property.PropertyName }}[i] = item && !(<any>item).toJSON ? new {{ property.ArrayItemType }}(item) : <{{ property.ArrayItemType }}>item;
}
}
{% elsif property.IsDictionary -%}
if (data.{{ property.PropertyName }}) {
this.{{ property.PropertyName }} = {};
for (let key in data.{{ property.PropertyName }}) {
if (data.{{ property.PropertyName }}.hasOwnProperty(key)) {
let item = data.{{ property.PropertyName }}[key];
this.{{ property.PropertyName }}[key] = item && !(<any>item).toJSON ? new {{ property.DictionaryItemType }}(item) : <{{ property.DictionaryItemType }}>item;
}
}
}
{% else -%}
this.{{ property.PropertyName }} = data.{{ property.PropertyName }} && !(<any>data.{{ property.PropertyName }}).toJSON ? new {{ property.Type }}(data.{{ property.PropertyName }}) : <{{ property.Type }}>this.{{ property.PropertyName }};
{% endif -%}
{% endif -%}
{% endfor -%}
{% endif -%}
}
{% endif -%}
{% if HasDefaultValues -%}
{% if GenerateConstructorInterface %}if (!data) {% endif %}{
{% for property in Properties -%}
{% if property.HasDefaultValue -%}
this.{{ property.PropertyName }} = {{ property.DefaultValue }};
{% endif -%}
{% endfor -%}
}
{% endif -%}
{% if HasBaseDiscriminator -%}
this._discriminator = "{{ DiscriminatorName }}";
{% endif -%}
}
{% endif -%}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}init(_data?: any{% if HandleReferences %}, _mappings?: any{% endif %}) {
{% if HasInheritance -%}
super.init(_data);
{% endif -%}
{% if HasIndexerProperty or HasProperties -%}
if (_data) {
{% if HasIndexerProperty -%}
for (var property in _data) {
if (_data.hasOwnProperty(property))
this[property] = _data[property];
}
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToClassCode | strip | tab }}
{% endfor -%}
}
{% endif -%}
}
static {% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}fromJS(data: any{% if HandleReferences %}, _mappings?: any{% endif %}): {{ ClassName }}{% if HandleReferences %} | null{% endif %} {
data = typeof data === 'object' ? data : {};
{% if HandleReferences -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}")
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ derivedClass.ClassName }}>(data, _mappings, {{ derivedClass.ClassName }});
{% endif -%}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
return createInstance<{{ ClassName }}>(data, _mappings, {{ ClassName }});
{% endif -%}
{% else -%}
{% if HasBaseDiscriminator -%}
{% for derivedClass in DerivedClasses -%}
if (data["{{ BaseDiscriminator }}"] === "{{ derivedClass.Discriminator }}") {
{% if derivedClass.IsAbstract -%}
throw new Error("The abstract class '{{ derivedClass.ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ derivedClass.ClassName }}();
result.init(data);
return result;
{% endif -%}
}
{% endfor -%}
{% endif -%}
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
let result = new {{ ClassName }}();
result.init(data);
return result;
{% endif -%}
{% endif -%}
}
{% if HasInheritance and SupportsOverrideKeyword %}override {% endif %}toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
{% if HasIndexerProperty -%}
for (var property in this) {
if (this.hasOwnProperty(property))
data[property] = this[property];
}
{% endif -%}
{% if HasDiscriminator -%}
data["{{ BaseDiscriminator }}"] = this._discriminator;
{% endif -%}
{% for property in Properties -%}
{{ property.ConvertToJavaScriptCode | replace: "toISOString","toLocaleString" | tab }}
{% endfor -%}
{% if HasInheritance -%}
super.toJSON(data);
{% endif -%}
return data;
}
{% if GenerateCloneMethod -%}
clone(): {{ ClassName }} {
{% if IsAbstract -%}
throw new Error("The abstract class '{{ ClassName }}' cannot be instantiated.");
{% else -%}
const json = this.toJSON();
let result = new {{ ClassName }}();
result.init(json);
return result;
{% endif -%}
}
{% endif -%}
}
{% if GenerateConstructorInterface -%}
{% if HasDescription -%}
/** {{ Description }} */
{% endif -%}
{% if ExportTypes %}export {% endif %}interface I{{ ClassName }}{{ InterfaceInheritance }} {
{% for property in Properties -%}
{% if property.HasDescription -%}
/** {{ property.Description }} */
{% endif -%}
{{ property.PropertyName }}{% if property.IsOptional %}?{% endif %}: {{ property.ConstructorInterfaceType }}{{ property.TypePostfix }};
{% endfor -%}
{% if HasIndexerProperty -%}
[key: string]: {{ IndexerPropertyValueType }};
{% endif -%}
}
{% endif -%}

29797
vben28/src/services/ServiceProxies.ts

File diff suppressed because it is too large
Loading…
Cancel
Save