Compare commits

..

No commits in common. "d153a6544b36ae1de85edfdaaacff448df65ab5d" and "8008fd4ddb6e5236284a8b9e43c431f8f591ab6e" have entirely different histories.

9 changed files with 47 additions and 317 deletions

View File

@ -30,6 +30,7 @@ func AutoGrpcInit(obj any) {
for i := 0; i < value.NumField(); i++ {
v := value.Field(i)
if v.IsValid() {
_namingClient, ok := v.Interface().(naming_client.INamingClient)
if ok {
@ -41,6 +42,7 @@ func AutoGrpcInit(obj any) {
{{range .ClientParams}}
func Auto{{.ClientName}}Client(ctx context.Context) {{.ClientName}}Client {
if namingClient == nil {
log.Println("nameClient must be init. call")
@ -52,54 +54,52 @@ func Auto{{.ClientName}}Client(ctx context.Context) {{.ClientName}}Client {
GroupName: groupName,
}
for i := 0; i < 3; i++ {
for i := 0; i < 10; i++ {
insService, err := namingClient.SelectOneHealthyInstance(sel)
if err != nil {
log.Println(err)
continue
return nil
}
if insService.Enable && insService.Healthy {
conn, err := grpc.DialContext(ctx, fmt.Sprintf("%s:%d", insService.Ip, insService.Port), grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Println(err)
continue
return nil
}
return New{{.ClientName}}Client(conn)
}
}
log.Println(fmt.Errorf("no healthy with times 3"))
return nil
}
func Auto{{.ClientName}}ClientEx(ctx context.Context, opts ...grpc.DialOption) ({{.ClientName}}Client,error) {
if namingClient == nil {
return nil, fmt.Errorf("nameClient must be init. call")
}
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
sel := vo.SelectOneHealthInstanceParam{
ServiceName: "{{.GrpcServiceName}}",
GroupName: groupName,
}
for i := 0; i < 3; i++ {
for i := 0; i < 10; i++ {
insService, err := namingClient.SelectOneHealthyInstance(sel)
if err != nil {
log.Println(err)
continue
return nil, err
}
if insService.Enable && insService.Healthy {
conn, err := grpc.DialContext(ctx, fmt.Sprintf("%s:%d", insService.Ip, insService.Port), opts...)
if err != nil {
log.Println(err)
continue
return nil, err
}
return New{{.ClientName}}Client(conn), nil
}
}
return nil, fmt.Errorf("no healthy with times 3")
return nil, fmt.Errorf("no healthy with times 10")
}
{{end}}

View File

@ -5,10 +5,8 @@ import (
"context"
"sync"
"fmt"
"runtime/debug"
"fusen-basic/env"
"fusen-basic/utils/log"
"{{.ProjectName}}/gen/go/service"
"{{.ProjectName}}/server/config"
@ -55,7 +53,6 @@ func (lgrpc *{{.StructName}}Grpc) {{.MethodName}}({{range $index, $param := .Par
if _recoverErr := recover(); _recoverErr != nil {
_resp = nil
_err = fmt.Errorf("%v", _recoverErr)
log.Printf("recovered from panic: %v\n%s", _err, string(debug.Stack()))
}
}()
return New{{.StructName}}(ctx).{{.MethodName}}Logic({{range $index, $param := .ParamsName}}{{if $index}}, {{end}}{{$param}}{{end}})
@ -67,7 +64,6 @@ func (lgrpc *{{.StructName}}Grpc) {{.MethodName}}(stream {{range $index, $param
defer func() {
if _recoverErr := recover(); _recoverErr != nil {
_err = fmt.Errorf("%v", _recoverErr)
log.Printf("recovered from panic: %v\n%s", _err, string(debug.Stack()))
}
}()
return New{{.StructName}}(stream.Context()).{{.MethodName}}Logic(stream)

View File

@ -1,38 +1,25 @@
#! /bin/env bash
#! /bin/bash
input_string=$(cat go.mod)
# 使用sed命令提取参数并替换输出格式
output=$(echo "$input_string" | sed -nE 's/[[:space:]]{0,}(replace[[:space:]]+)?([[:alnum:]-]+)[[:space:]]+([[:alnum:].-]+)[[:space:]]+=>[[:space:]]+([[:alnum:]/.-]+)[[:space:]]+([[:alnum:].-]+)/\2 \3 \4 \5/p')
# echo $output
ischange="no"
IFS=$'\n' # 设置分隔符为换行符
for out in $output; do
IFS=$' '
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
if [ "$fsname" != "fusen-basic" ]; then
continue
fi
laster_master=`echo $(GOPROXY=direct go get $fsfullname@master 2>&1) | grep -oE '@v[^:"]+'`
if [ "@$fslatest_master" == "$laster_master" ]; then
continue
fi
echo "go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master"
go mod edit -replace $fsname@$fsversion=$fsfullname$laster_master
echo "当前 $fsname $fsfullname $fslatest_master (更新)-> $laster_master"
go get $fsname@$fsversion
ischange="yes"
done
if [ "$ischange" == "yes" ]; then
echo "go tidy and vendor"
go mod tidy
go mod vendor
else
echo "$fsname $fslatest_master 当前最新"
fi
IFS=$'\n' # 设置分隔符为换行符
for out in $output; do
IFS=$' '
read -r fsname fsversion fsfullname fslatest_master <<< "$out"
go get $fsname@$fsversion
done
go mod tidy
go mod vendor

View File

@ -10,7 +10,7 @@ import "service/basic.proto";
//
service auth {
//
//
rpc ValidToken(ValidTokenRequest) returns (ValidTokenResponse) {}
// Cookie

View File

@ -27,41 +27,12 @@ message ResourceInfo{
string bucket_name = 8;
string source = 9;
string uploaded_at = 10;
bytes metadata = 11;
string trace_id = 12;
google.protobuf.Struct metadata = 11;
}
message Meta {
int64 total_count =1; //
int64 page_count=2; //
int64 current_page=3; //
int64 per_page=4; //
}
//
message FsUser {
int64 user_id = 7;//ID
string email = 1; //
string first_name = 2; //
string last_name = 3; //
string username = 4; //
string company = 5; //
string mobile = 6; //
}
message LdapUser {
int64 user_id = 1; //id
string user_dn = 2; //dn
string user_name = 3; //
string email = 4; //
string mobile = 5; //
string avatar = 6; //
int64 employee_type = 7; // 1 2 3
int64 gender = 8; // 1 2 3
string birthday = 9; //
repeated string belong_organizations = 10 ;//
repeated string manage_organizations = 11 ;//
int64 status = 12 ; // 10
int64 group_id = 13; //id
int64 total_count =1;
int64 page_count=2;
int64 current_page=3;
int64 per_page=4;
}

View File

@ -26,12 +26,8 @@ service ldap {
rpc UpdateLdapUserPwd(UpdateLdapUserPwdReq) returns(basic.Response){}
//ldap用户帐号
rpc DisableLdapUser(DisableLdapUserReq) returns(basic.Response){}
//ldap用户帐号
rpc DeleteLdapUser(DeleteLdapUserReq) returns(basic.Response){}
//
rpc GetLdapUserInfo(GetLdapUserInfoReq) returns(GetLdapUserInfoRsp){}
//--
rpc GetLdapUsersByUserIds(GetLdapUsersByUserIdsReq) returns(GetLdapUsersRsp){}
//ldap部门添加成员
rpc AddLdapOrganizationMember(AddLdapOrganizationMemberReq) returns(basic.Response){}
//ldap部门移除成员
@ -59,21 +55,7 @@ service ldap {
rpc SetLdapGroupAuth(SetLdapGroupAuthReq) returns (SetLdapGroupAuthRsp);
//--
rpc RemoveLdapGroupAuth(RemoveLdapGroupAuthReq) returns (RemoveLdapGroupAuthRsp);
//
rpc VerifyAuthorityGroup(VerifyAuthorityGroupReq) returns (VerifyAuthorityGroupRsp);
}
message VerifyAuthorityGroupReq {
string path = 1;
string method = 2;
string category = 3;
int64 group_id = 4;
}
message VerifyAuthorityGroupRsp {
}
message GetLdapGroupsReq {
LdapGroupFilter filter = 1;
@ -91,7 +73,6 @@ message GetLdapGroupDetailReq {
}
message GetLdapGroupDetailRsp {
LdapGroup info = 1;
repeated int64 apis =2;
}
message SaveLdapGroupReq {
@ -228,25 +209,10 @@ message UpdateLdapUserPwdReq{
message DisableLdapUserReq{
string user_dn = 1;//dn
}
//ldap用户帐号
message DeleteLdapUserReq{
string user_dn = 1;//dn
}
//
message GetLdapUserInfoReq{
string user_dn = 1;//dn
}
//--
message GetLdapUsersByUserIdsReq{
repeated int64 user_ids = 1;//ID
}
//--
message GetLdapUsersByUserIdsRsp{
repeated GetLdapUsersItem list = 1;
string paging_cookie = 2;
}
message GetLdapUserInfoRsp{
int64 user_id = 1; //id
string user_dn = 2; //dn
@ -336,12 +302,4 @@ message LdapParseTokenRsp{
string UserDn = 1;
int64 UserId = 2;
string UserEmail = 3;
int64 group_id = 4;
int64 gender = 5;//
string birthday = 6;//
repeated string belong_to_organizations = 7;//DN集合
repeated string belong_to_organization_names = 8;//
repeated string manage_organizations = 9;//dn集合
repeated string manage_organization_names = 10;//
int64 status = 11; // 10
}

View File

@ -12,10 +12,10 @@ import "google/protobuf/timestamp.proto";
service notify {
//
rpc Ping( basic.Request) returns (basic.Response) {}
rpc Ping(basic.Request) returns (basic.Response) {}
//
rpc EmailSend( EmailSendReq) returns (EmailSendResp) {}
rpc EmailSend(EmailSendReq) returns (EmailSendRes) {}
//
rpc EmailRegisterConfirm( EmailRegisterReq) returns ( EmailRegisterResp) {}
@ -64,13 +64,12 @@ message EmailNotifyBasic {
optional string notify_id = 1; // , 256, uuid
string sender = 2; //
string target_email = 3; // email
string subject_title = 4; //
}
// type email
message EmailSendReq {
EmailNotifyBasic basic_email = 1; //
EmailNotifyBasic basic_email = 1;
string title = 2; //
string content = 3; //
Operator operator = 4; //
@ -81,9 +80,10 @@ message EmailSendReq {
enum NotifyType {
email = 0; // email
feishu = 1; //
// wechat = 2; //
wechat = 2; //
}
//
enum EmailStatus {
ok = 0; //
@ -93,14 +93,16 @@ enum EmailStatus {
finish = 4; //
}
message EmailSendResp {
EmailStatus status = 1; //
string msg = 2; //
message EmailSendRes {
EmailStatus status = 1;
string msg = 2;
}
message EmailRegisterReq {
EmailNotifyBasic basic_email = 1; //
string confirmation_link = 2; //
EmailNotifyBasic basic_email = 1;
string confirmation_link = 2;
}
message EmailRegisterResp {
@ -110,8 +112,8 @@ message EmailRegisterResp {
message EmailResetHtmlReq {
EmailNotifyBasic basic_email = 1; //
string confirmation_link = 2; //
EmailNotifyBasic basic_email = 1;
string confirmation_link = 4;
}
message EmailResetHtmlResp {
@ -119,7 +121,6 @@ message EmailResetHtmlResp {
string notify_id = 2; // id
}
// rpc服务里
message EmailResetConfirmReq {
string reset_password_link = 1;
string reset_token = 2;
@ -132,8 +133,8 @@ message EmailResetConfirmResp {
message OrderPaymentDetailsReq {
EmailNotifyBasic basic_email = 1; //
string payment_details_link = 2; //
EmailNotifyBasic basic_email = 1;
string payment_details_link = 2;
}
message OrderPaymentDetailsResp {
@ -142,11 +143,10 @@ message OrderPaymentDetailsResp {
}
message OrderStatusTransitionReq {
EmailNotifyBasic basic_email = 1; //
EmailNotifyBasic basic_email = 1;
string last_status = 2; //
string current_status = 3; //
string check_status_link = 4; //
bool is_show_click_text = 5; //
}
message OrderStatusTransitionResp {
@ -156,7 +156,7 @@ message OrderStatusTransitionResp {
message OrderPayArrearsReq {
EmailNotifyBasic basic_email = 1; //
EmailNotifyBasic basic_email = 1;
string pay_arrears_link = 2; //
}

View File

@ -1,141 +0,0 @@
syntax = "proto3"; //使v3版本
package order;
option go_package = "gitlab.fusenpack.com/backend/order;service";
// google/api/annotations.proto
import "google/api/annotations.proto";
import "service/basic.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/any.proto";
//
service order {
//
rpc OrderSave(OrderSaveReq) returns (OrderSaveRes) {}
//
rpc OrderInfo(OrderInfoReq) returns (OrderInfoRes) {}
//
rpc OrderList(OrderListReq) returns (OrderListRes) {}
//
rpc DetailHandler(DetailHandlerReq) returns (DetailHandlerRes) {}
}
/* 详情处理 */
message DetailHandlerReq{
bytes order_db = 1;//
int64 handle_type = 2; // 0=1=
int64 channle_type = 3; // 0=1=
}
message DetailHandlerRes{
bytes order_detail = 1; //
}
/* 详情处理 */
/* 更新详情 */
message OrderSaveReq{
OrderFilter filter = 1; //
OrderDetailDb save = 2; //
}
message OrderSaveRes{
OrderInfo info = 1; //
}
/* 更新详情 */
/* 获取详情 */
message OrderInfoReq{
OrderFilter filter = 1;//
int64 handle_type = 2; // 0=1=
int64 channle_type = 3; // 0=1=
repeated int64 related = 4; // 1=2=
}
message OrderInfoRes{
OrderInfo info = 1; //
}
/* 获取详情 */
/* 获取列表 */
message OrderListReq{
OrderFilter filter = 1; //
int64 handle_type = 2; // 0=1=
int64 channle_type = 3; // 0=1=
repeated int64 related = 4; // 1=2=3=4=5=
bool select_whole = 100; // false= true=
int64 current_page = 101; //
int64 per_page = 102; //
string order_by = 103; // id desc,ctime desc
string select_fields = 104; //
}
message OrderListRes{
repeated OrderInfo list = 1;//
basic.Meta meta = 2; //
}
/* 获取列表 */
/* 过滤条件 */
message OrderFilter {
optional int64 id = 1;// ID
optional int64 user_id = 2; // ID
optional int64 delivery_method = 3; //
optional string order_sn = 4; //
optional string order_source = 5; //
optional int64 status = 6; //
optional int64 is_del = 7; // 0=1=
optional int64 pay_status = 8; //
optional int64 sale_gerent_id = 9; //
optional int64 design_gerent_id = 10; //
optional string ctime = 11; //
optional string utime = 12; //
optional bytes other_filter = 101; //
repeated int64 ids = 102; // IDS
}
/* 详情数据 */
message OrderInfo {
OrderDetailDb order_detail_db = 1; //
bytes order_detail = 2; //
basic.FsUser user_info = 3; //
basic.LdapUser sale_info = 4; //
basic.LdapUser design_info = 5; //
OrderScm scm_info = 6;
}
message OrderScm {
repeated basic.LdapUser scm_info = 1; //
repeated int64 scm_ids = 2; //
}
/* 数据库 */
message OrderDetailDb {
int64 id = 1; // ID
optional int64 user_id = 2; // ID
optional int64 delivery_method = 3; //
optional string order_sn = 4; //
optional string order_source = 5; //
optional int64 status = 6; //
optional bytes metadata = 7; //
optional string ctime = 8; //
optional string utime = 9; //
optional int64 is_del = 10; // 0 = 1 =
optional int64 pay_status = 11; //
optional bytes status_link = 12; //
optional bytes order_product = 13; //
optional bytes order_address = 14; //
optional bytes order_amount = 15; //
optional bytes pay_status_link = 16; //
optional bytes shopping_cart_snapshot = 17; //
optional bytes shopping_product_snapshot = 18; //
optional int64 sale_gerent_id = 19; //
optional int64 design_gerent_id = 20; //
optional bytes scm = 21; //
optional int64 order_type = 22; // 1=2=线
optional string pay_deposit_ctime = 23; // --
optional string pay_final_ctime = 24; // --
}

View File

@ -45,47 +45,7 @@ service resource {
// logo
rpc SetExampleLogo(SetExampleLogoReq) returns (SetExampleLogoRes) {}
// --CSV
rpc ExportCsv(ExportCsvReq) returns (ExportCsvRes) {}
// --Excel
rpc ExportExcel(ExportExcelReq) returns (ExportExcelRes) {}
// --zip
rpc ExportZip(ExportZipReq) returns (ExportZipRes) {}
}
message ExportData {
repeated string child = 1;
}
message ExportCsvReq {
repeated ExportData file_data = 1; //
string file_name = 2;//
int64 total = 3; //
}
message ExportCsvRes {
string export_file_path = 1; //
}
message ExportExcelReq {
repeated ExportData file_data = 1; //
string file_name = 2;//
}
message ExportExcelRes {
string export_file_path = 1; //
}
message ExportZipReq {
string file_type = 1;//
string file_name = 2;//
bytes file_bytes = 3;//
}
message ExportZipRes {
string export_file_path = 1; //
}
/* 设置示例logo */
message SetExampleLogoReq {
int64 is_example = 1;
@ -344,5 +304,4 @@ message ResourceIds {
repeated string resource_ids = 1;
}
/* 获取资源详情 */
/* 获取资源详情 */