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. 189
      templates/abp-vnext-pro-nuget-simplify/vben28/nswag/templates/Class.liquid
  9. 1219
      templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxies.ts
  10. 87
      templates/abp-vnext-pro-nuget-simplify/vben28/src/services/ServiceProxyBase.ts
  11. 12404
      templates/abp-vnext-pro-nuget-simplify/vben28/yarn.lock
  12. 189
      vben28/nswag/templates/Class.liquid
  13. 8347
      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/frameworks/test/Lion.AbpPro.EntityFrameworkCore.Mysql.Tests/Logs
/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",
"@logicflow/core": "^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/shared": "^3.2.33",
"@vueuse/core": "^8.3.0",
@ -112,7 +112,6 @@
"eslint-plugin-vue": "^8.6.0",
"esno": "^0.14.1",
"fs-extra": "^10.1.0",
"inquirer": "^8.2.2",
"less": "^4.1.2",
"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 {
id!: string;
code!: string;
displayText!: string;
code!: string | undefined;
displayText!: string | undefined;
description!: string | undefined;
order!: number;
@ -7221,15 +7221,15 @@ export class CreateDataDictinaryDetailInput implements ICreateDataDictinaryDetai
export interface ICreateDataDictinaryDetailInput {
id: string;
code: string;
displayText: string;
code: string | undefined;
displayText: string | undefined;
description: string | undefined;
order: number;
}
export class CreateDataDictinaryInput implements ICreateDataDictinaryInput {
code!: string;
displayText!: string;
code!: string | undefined;
displayText!: string | undefined;
description!: string | undefined;
constructor(data?: ICreateDataDictinaryInput) {
@ -7266,13 +7266,13 @@ export class CreateDataDictinaryInput implements ICreateDataDictinaryInput {
}
export interface ICreateDataDictinaryInput {
code: string;
displayText: string;
code: string | undefined;
displayText: string | undefined;
description: string | undefined;
}
export class CreateOrganizationUnitInput implements ICreateOrganizationUnitInput {
displayName!: string;
displayName!: string | undefined;
parentId!: string | undefined;
constructor(data?: ICreateOrganizationUnitInput) {
@ -7307,7 +7307,7 @@ export class CreateOrganizationUnitInput implements ICreateOrganizationUnitInput
}
export interface ICreateOrganizationUnitInput {
displayName: string;
displayName: string | undefined;
parentId: string | undefined;
}
@ -9654,8 +9654,8 @@ export interface IGetOrganizationUnitUserOutputPagedResultDto {
}
export class GetPermissionInput implements IGetPermissionInput {
providerName!: string;
providerKey!: string;
providerName!: string | undefined;
providerKey!: string | undefined;
constructor(data?: IGetPermissionInput) {
if (data) {
@ -9689,8 +9689,8 @@ export class GetPermissionInput implements IGetPermissionInput {
}
export interface IGetPermissionInput {
providerName: string;
providerKey: string;
providerName: string | undefined;
providerKey: string | undefined;
}
export class GetUnAddRoleInput implements IGetUnAddRoleInput {
@ -10588,13 +10588,13 @@ export class IdentityUserDto implements IIdentityUserDto {
}
}
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["lastModificationTime"] = this.lastModificationTime ? this.lastModificationTime.toISOString() : <any>undefined;
data["lastModificationTime"] = this.lastModificationTime ? this.lastModificationTime.toLocaleString() : <any>undefined;
data["lastModifierId"] = this.lastModifierId;
data["isDeleted"] = this.isDeleted;
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["userName"] = this.userName;
data["name"] = this.name;
@ -10605,7 +10605,7 @@ export class IdentityUserDto implements IIdentityUserDto {
data["phoneNumberConfirmed"] = this.phoneNumberConfirmed;
data["isActive"] = this.isActive;
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["entityVersion"] = this.entityVersion;
return data;
@ -11567,8 +11567,8 @@ export class PagingAuditLogInput implements IPagingAuditLogInput {
data["pageSize"] = this.pageSize;
data["skipCount"] = this.skipCount;
data["sorting"] = this.sorting;
data["startTime"] = this.startTime ? this.startTime.toISOString() : <any>undefined;
data["endTime"] = this.endTime ? this.endTime.toISOString() : <any>undefined;
data["startTime"] = this.startTime ? this.startTime.toLocaleString() : <any>undefined;
data["endTime"] = this.endTime ? this.endTime.toLocaleString() : <any>undefined;
data["httpMethod"] = this.httpMethod;
data["url"] = this.url;
data["userId"] = this.userId;
@ -12398,7 +12398,7 @@ export class PagingNotificationListOutput implements IPagingNotificationListOutp
data["messageLevel"] = this.messageLevel;
data["messageLevelDescription"] = this.messageLevelDescription;
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;
return data;
}
@ -13868,7 +13868,7 @@ export interface ITypeApiDescriptionModel {
export class UpdateConnectionStringInput implements IUpdateConnectionStringInput {
id!: string;
connectionString!: string;
connectionString!: string | undefined;
constructor(data?: IUpdateConnectionStringInput) {
if (data) {
@ -13903,13 +13903,13 @@ export class UpdateConnectionStringInput implements IUpdateConnectionStringInput
export interface IUpdateConnectionStringInput {
id: string;
connectionString: string;
connectionString: string | undefined;
}
export class UpdateDataDictinaryInput implements IUpdateDataDictinaryInput {
id!: string;
code!: string;
displayText!: string;
code!: string | undefined;
displayText!: string | undefined;
description!: string | undefined;
constructor(data?: IUpdateDataDictinaryInput) {
@ -13949,15 +13949,15 @@ export class UpdateDataDictinaryInput implements IUpdateDataDictinaryInput {
export interface IUpdateDataDictinaryInput {
id: string;
code: string;
displayText: string;
code: string | undefined;
displayText: string | undefined;
description: string | undefined;
}
export class UpdateDetailInput implements IUpdateDetailInput {
dataDictionaryId!: string;
id!: string;
displayText!: string;
displayText!: string | undefined;
description!: string | undefined;
order!: number;
@ -14001,13 +14001,13 @@ export class UpdateDetailInput implements IUpdateDetailInput {
export interface IUpdateDetailInput {
dataDictionaryId: string;
id: string;
displayText: string;
displayText: string | undefined;
description: string | undefined;
order: number;
}
export class UpdateOrganizationUnitInput implements IUpdateOrganizationUnitInput {
displayName!: string;
displayName!: string | undefined;
id!: string;
constructor(data?: IUpdateOrganizationUnitInput) {
@ -14042,7 +14042,7 @@ export class UpdateOrganizationUnitInput implements IUpdateOrganizationUnitInput
}
export interface IUpdateOrganizationUnitInput {
displayName: string;
displayName: string | undefined;
id: string;
}
@ -14171,8 +14171,8 @@ export interface IUpdateRoleInput {
}
export class UpdateRolePermissionsInput implements IUpdateRolePermissionsInput {
providerName!: string;
providerKey!: string;
providerName!: string | undefined;
providerKey!: string | undefined;
updatePermissionsDto!: UpdatePermissionsDto;
constructor(data?: IUpdateRolePermissionsInput) {
@ -14209,8 +14209,8 @@ export class UpdateRolePermissionsInput implements IUpdateRolePermissionsInput {
}
export interface IUpdateRolePermissionsInput {
providerName: string;
providerKey: string;
providerName: string | undefined;
providerKey: string | undefined;
updatePermissionsDto: UpdatePermissionsDto;
}
@ -14264,7 +14264,7 @@ export interface IUpdateSettingInput {
export class UpdateTenantInput implements IUpdateTenantInput {
id!: string;
name!: string;
name!: string | undefined;
constructor(data?: IUpdateTenantInput) {
if (data) {
@ -14299,7 +14299,7 @@ export class UpdateTenantInput implements IUpdateTenantInput {
export interface IUpdateTenantInput {
id: string;
name: string;
name: string | undefined;
}
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

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 -%}

8347
vben28/src/services/ServiceProxies.ts

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