diff --git a/axios/service/address/types.ts b/axios/service/address/types.ts index d5a5a96..6678785 100644 --- a/axios/service/address/types.ts +++ b/axios/service/address/types.ts @@ -28,7 +28,7 @@ export interface AddressAddRequest { export interface FetchRequest { page_no?: number; // 页数 page_size?: number; // 每页记录数 - params?: ParamsEntry[]; // 条件参数,key=val,eg key:category_id=?,vlaue=11 + params?: { [key in string]: any}; // 条件参数,key=val,eg key:category_id=?,vlaue=11 } @@ -52,5 +52,5 @@ export interface AddressListReply { export interface AddressDelRequest { - id?: number; // ID + id?: number[]; // ID } \ No newline at end of file diff --git a/axios/service/cloud/types.ts b/axios/service/cloud/types.ts index 52520b9..d476b5b 100644 --- a/axios/service/cloud/types.ts +++ b/axios/service/cloud/types.ts @@ -4,9 +4,7 @@ export interface Empty { } - authorization_identity 用户识别identity 由上下文传递 - user_identity 用于鉴权 - + // authorization_identity 用户识别identity 由上下文传递 user_identity 用于鉴权 export interface ListRequest { identity?: string; // 文件夹唯一标识,获取顶级的不传 name?: string; // 根据文件名称模糊查找,当该字段不为空时identity的限定失效 @@ -29,7 +27,7 @@ export interface DirTreeResponse { export interface DownloadRequest { - list?: string; // identity列表,必传 + list?: string[]; // identity列表,必传 } @@ -37,8 +35,8 @@ export interface UserFile { identity?: string; // 唯一标识 name?: string; // 文件/文件夹名称 ext?: string; // 后缀,文件夹时为空 - parent?: string; // 父级文件夹序列,按文件名称查询时候生效 - file?: TYPE_MESSAGE; // 文件信息 + parent?: string[]; // 父级文件夹序列,按文件名称查询时候生效 + file?: File; // 文件信息 created_at?: string; updated_at?: string; children?: UserFile[]; // 子文件夹 @@ -66,8 +64,7 @@ export interface MakeResponse { identity?: string; } - 同级下,名称必须唯一 - + // 同级下,名称必须唯一 export interface RenameRequest { identity?: string; // 必传 name?: string; // 文件/文件夹名称,必传 @@ -76,24 +73,24 @@ export interface RenameRequest { export interface RemoveRequest { - list?: string; // identity列表 + list?: string[]; // identity列表 } export interface MoveRequest { - list?: string; // identity列表 + list?: string[]; // identity列表 target_identity?: string; // 目标文件夹标识,如果是顶级则不填 } export interface CopyRequest { - list?: string; // identity列表 + list?: string[]; // identity列表 target_identity?: string; // 目标文件夹标识,如果是顶级则不填 } export interface ShareRequest { - list?: string; // identity列表 + list?: string[]; // identity列表 days?: number; // 有效天数,默认永久 } diff --git a/axios/service/company/types.ts b/axios/service/company/types.ts index 5e6619e..de7cf47 100644 --- a/axios/service/company/types.ts +++ b/axios/service/company/types.ts @@ -18,14 +18,14 @@ export interface CompanyListRequest { relation_genre?: number; // 关联关系类型: 1 成员企业、2 分销企业、3 供货企业 registered_start_at?: string; // 注册时间-开始,格式:2006-01-02 15:04:05 registered_end_at?: string; // 注册时间-结束格式:2006-01-02 15:04:05 - with_statistics?: TYPE_BOOL; // 是否需要查询统计信息 + with_statistics?: bool; // 是否需要查询统计信息 } export interface CompanyListReply { list?: CompanyItem[]; count?: number; - statistics?: TYPE_MESSAGE; + statistics?: CompanyStatisticsData; } @@ -83,7 +83,7 @@ export interface DeliveryAddressItem { province_identity?: string; // 省级identity city_identity?: string; // 市级identity district_identity?: string; // 区级identity - is_default?: TYPE_BOOL; + is_default?: bool; created_at?: string; } @@ -100,12 +100,12 @@ export interface CollectionInformationItem { export interface RoleRequest { - company_identity?: string; // 企业identity,如果不传具体的identity就查询所有的 + company_identity?: string[]; // 企业identity,如果不传具体的identity就查询所有的 } export interface RoleReply { - kv?: KvEntry[]; // key:company_identity + kv?: { [key in string]: any}; // key:company_identity } @@ -131,7 +131,7 @@ export interface StaffListRequest { status?: number; registered_start_at?: string; // 注册时间-开始,格式:2006-01-02 15:04:05 registered_end_at?: string; // 注册时间-结束格式:2006-01-02 15:04:05 - with_statistics?: TYPE_BOOL; // 是否需要查询统计信息 + with_statistics?: bool; // 是否需要查询统计信息 staff_identity?: string; } @@ -139,7 +139,7 @@ export interface StaffListRequest { export interface StaffListReply { list?: StaffItem[]; count?: number; - statistics?: TYPE_MESSAGE; + statistics?: StaffStatisticsData; } diff --git a/axios/service/feedback/types.ts b/axios/service/feedback/types.ts index 557958d..5672dc0 100644 --- a/axios/service/feedback/types.ts +++ b/axios/service/feedback/types.ts @@ -44,8 +44,8 @@ export interface GetRequest { export interface GetReply { - record?: TYPE_MESSAGE; - exists?: TYPE_BOOL; + record?: FeedbackItem; + exists?: bool; } diff --git a/axios/service/mall/types.ts b/axios/service/mall/types.ts index 782b56e..bc4950e 100644 --- a/axios/service/mall/types.ts +++ b/axios/service/mall/types.ts @@ -20,14 +20,12 @@ export interface StoreBasic { created_at?: string; // 创建时间 } - 店铺唯一KEY - + // 店铺唯一KEY export interface UniqueIndex { store_key?: string; // 店铺唯一KEY } - 产品分类数据列表 - + // 产品分类数据列表 export interface CategoryReply { data?: CategoryItem[]; } @@ -114,7 +112,7 @@ export interface GetRequest { export interface GetReply { - detail?: TYPE_MESSAGE; // 商品详情数据 + detail?: ProductItem; // 商品详情数据 attr?: AttrItem[]; // 商品属性数据 photos?: PhotosItem[]; // 商品相册数据 } diff --git a/axios/service/notify/types.ts b/axios/service/notify/types.ts index 3ed3870..544926d 100644 --- a/axios/service/notify/types.ts +++ b/axios/service/notify/types.ts @@ -1,6 +1,5 @@ - sms module - + // sms module export interface MailSendRequest { sign_name?: string; // 必传项 } @@ -10,19 +9,18 @@ export interface MailSendResponse { request_id?: string; } - sms module - + // sms module export interface SmsSendRequest { sign_name?: string; // 必传项 template_code?: string; // 必传项 phone?: string; // 必传项 - paramters?: ParamtersEntry[]; - generate_code?: TYPE_BOOL; // 验证码相关 是否生成验证码 + paramters?: { [key in string]: any}; + generate_code?: bool; // 验证码相关 是否生成验证码 expire_interval?: number; // 验证码缓存时间,单位:分钟,仅generate_code为true时会缓存,默认5分钟 code_width?: number; // 验证码长度,默认 4 code_key?: string; // template_code 模板中验证码的标识,默认code - has_black_list_filter?: TYPE_BOOL; // 是否黑单过滤,默认不过滤 - wihout_limit?: TYPE_BOOL; // 忽略每天短信条数上线限制,默认不忽略 + has_black_list_filter?: bool; // 是否黑单过滤,默认不过滤 + wihout_limit?: bool; // 忽略每天短信条数上线限制,默认不忽略 } @@ -38,5 +36,5 @@ export interface SmsVerifyRequest { export interface PassResponse { - pass?: TYPE_BOOL; + pass?: bool; } \ No newline at end of file diff --git a/axios/service/order/types.ts b/axios/service/order/types.ts index 590f5ec..ea27d38 100644 --- a/axios/service/order/types.ts +++ b/axios/service/order/types.ts @@ -8,7 +8,7 @@ export interface Empty { export interface FetchRequest { page_no?: number; // 页数 page_size?: number; // 每页记录数 - params?: ParamsEntry[]; // 条件参数,key=val,eg key:category_id=?,vlaue=11 + params?: { [key in string]: any}; // 条件参数,key=val,eg key:category_id=?,vlaue=11 } @@ -67,7 +67,7 @@ export interface CartSetRequest { export interface CartDelRequest { - id?: number; // 购物车ID + id?: number[]; // 购物车ID } @@ -108,7 +108,7 @@ export interface FetchReply { export interface CancelPlanRequest { - id?: number; + id?: number[]; } @@ -132,14 +132,14 @@ export interface QuickCreateByTokenRequest { export interface SubmitRequest { - id?: string; // 购物车的ID数据,以逗号分开 + id?: string[]; // 购物车的ID数据,以逗号分开 partner_id?: number; // 合伙人ID address_id?: number; // 地址ID } export interface SummaryGetReply { - summary?: TYPE_MESSAGE; // 订单概要详情 + summary?: OrderSummary; // 订单概要详情 details?: OrderDetails[]; // 订单商品详情 } diff --git a/axios/service/passport/types.ts b/axios/service/passport/types.ts index 3bc0ab0..f7e79e4 100644 --- a/axios/service/passport/types.ts +++ b/axios/service/passport/types.ts @@ -3,7 +3,7 @@ export interface FetchRequest { page_no?: number; // 页数 page_size?: number; // 每页记录数 - params?: ParamsEntry[]; // 条件参数,key=val,eg key:category_id=?,vlaue=11 + params?: { [key in string]: any}; // 条件参数,key=val,eg key:category_id=?,vlaue=11 } @@ -52,7 +52,7 @@ export interface ForgetReply { identity?: string; // 用户唯一码 data_bind?: string; // 数据绑定的相关说明,PASS通过,NOPHONE没有绑定手机号,NOPWD没有设置密码,NOBIND没有手机号同时没有密码 token?: string; // 用户凭证 - extend?: ExtendEntry[]; // 扩展字段 + extend?: { [key in string]: any}; // 扩展字段 } @@ -99,12 +99,12 @@ export interface SetPasswordRequest { export interface StatisticsRequest { - field?: string; // 要获取的统计数据字段。 + field?: string[]; // 要获取的统计数据字段。 } export interface StatisticsReply { - Data?: DataEntry[]; // 数据以Map格式输出 + Data?: { [key in string]: any}; // 数据以Map格式输出 } @@ -175,7 +175,7 @@ export interface LoginReply { identity?: string; // 用户唯一码 data_bind?: string; // 数据绑定的相关说明,PASS通过,NOPHONE没有绑定手机号,NOPWD没有设置密码,NOBIND没有手机号同时没有密码 token?: string; // 用户凭证 - extend?: ExtendEntry[]; // 扩展字段 + extend?: { [key in string]: any}; // 扩展字段 } @@ -201,5 +201,5 @@ export interface RegisterReply { identity?: string; // 用户唯一码 data_bind?: string; // 数据绑定的相关说明,PASS通过,NOPHONE没有绑定手机号,NOPWD没有设置密码,NOBIND没有手机号同时没有密码 token?: string; // 用户Header所需Token - extend?: ExtendEntry[]; // 扩展字段 + extend?: { [key in string]: any}; // 扩展字段 } \ No newline at end of file diff --git a/cli/main.go b/cli/main.go index d72668c..a986328 100644 --- a/cli/main.go +++ b/cli/main.go @@ -180,7 +180,15 @@ export interface {{Name}} { if msgItem.GetSourceInfo().GetLeadingComments() != "" { commit = msgItem.GetSourceInfo().GetLeadingComments() } - msgBody = strings.ReplaceAll(msgBody, "{{Commit}}", commit) + commit = strings.ReplaceAll(commit, "\r\n", " ") + commit = strings.ReplaceAll(commit, "\n", " ") + + if commit == "" { + msgBody = strings.ReplaceAll(msgBody, "{{Commit}}", "") + } else { + msgBody = strings.ReplaceAll(msgBody, "{{Commit}}", " // "+commit) + } + msgBody = strings.ReplaceAll(msgBody, "{{Name}}", msgItem.GetName()) msgBody = strings.ReplaceAll(msgBody, "{{Data}}", strings.Join(data, "\r\n")) @@ -219,25 +227,41 @@ func dispFields(fd *desc.FieldDescriptor) string { tpl = strings.ReplaceAll(tpl, "{{Commit}}", " // "+commit) } - var fdType string = "" - switch fd.GetType().String() { - case "TYPE_STRING": - fdType = "string" - case "TYPE_INT64", "TYPE_INT32", "TYPE_FLOAT32", "TYPE_FLOAT64": - fdType = "number" - case "bool": - fdType = "TYPE_BOOL" - default: - if fd.GetLabel().String() == "LABEL_REPEATED" { - fdType = fd.GetMessageType().GetName() + "[]" - } else { - fdType = fd.GetType().String() - } - } - - tpl = strings.ReplaceAll(tpl, "{{Type}}", fdType) + tpl = strings.ReplaceAll(tpl, "{{Type}}", getFdType(fd)) tpl = strings.ReplaceAll(tpl, "\r\n", "") return tpl } + +func getFdType(fd *desc.FieldDescriptor) string { + + if fd.IsMap() { + return "{ [key in string]: any}" + } + + if fd.IsRepeated() { + switch fd.GetType().String() { + case "TYPE_STRING": + return "string[]" + case "TYPE_INT64", "TYPE_INT32", "TYPE_FLOAT32", "TYPE_FLOAT64": + return "number[]" + case "TYPE_MESSAGE": + return fd.GetMessageType().GetName() + "[]" + } + + } + + switch fd.GetType().String() { + case "TYPE_STRING": + return "string" + case "TYPE_INT64", "TYPE_INT32", "TYPE_FLOAT32", "TYPE_FLOAT64": + return "number" + case "TYPE_BOOL": + return "bool" + case "TYPE_MESSAGE": + return fd.GetMessageType().GetName() + default: + return fd.GetType().String() + } +}