lejianwen 1 год назад
Родитель
Сommit
ef0410a8b9

+ 353 - 1
docs/admin/admin_docs.go

@@ -2019,6 +2019,144 @@ const docTemplateadmin = `{
2019 2019
                 }
2020 2020
             }
2021 2021
         },
2022
+        "/admin/my/share_record/batchDelete": {
2023
+            "post": {
2024
+                "security": [
2025
+                    {
2026
+                        "token": []
2027
+                    }
2028
+                ],
2029
+                "description": "批量删除我的分享记录",
2030
+                "consumes": [
2031
+                    "application/json"
2032
+                ],
2033
+                "produces": [
2034
+                    "application/json"
2035
+                ],
2036
+                "tags": [
2037
+                    "我的"
2038
+                ],
2039
+                "summary": "批量删除我的分享记录",
2040
+                "parameters": [
2041
+                    {
2042
+                        "description": "id",
2043
+                        "name": "body",
2044
+                        "in": "body",
2045
+                        "required": true,
2046
+                        "schema": {
2047
+                            "$ref": "#/definitions/admin.PeerShareRecordBatchDeleteForm"
2048
+                        }
2049
+                    }
2050
+                ],
2051
+                "responses": {
2052
+                    "200": {
2053
+                        "description": "OK",
2054
+                        "schema": {
2055
+                            "$ref": "#/definitions/response.Response"
2056
+                        }
2057
+                    },
2058
+                    "500": {
2059
+                        "description": "Internal Server Error",
2060
+                        "schema": {
2061
+                            "$ref": "#/definitions/response.Response"
2062
+                        }
2063
+                    }
2064
+                }
2065
+            }
2066
+        },
2067
+        "/admin/my/share_record/delete": {
2068
+            "post": {
2069
+                "security": [
2070
+                    {
2071
+                        "token": []
2072
+                    }
2073
+                ],
2074
+                "description": "分享记录删除",
2075
+                "consumes": [
2076
+                    "application/json"
2077
+                ],
2078
+                "produces": [
2079
+                    "application/json"
2080
+                ],
2081
+                "tags": [
2082
+                    "我的"
2083
+                ],
2084
+                "summary": "分享记录删除",
2085
+                "parameters": [
2086
+                    {
2087
+                        "description": "分享记录信息",
2088
+                        "name": "body",
2089
+                        "in": "body",
2090
+                        "required": true,
2091
+                        "schema": {
2092
+                            "$ref": "#/definitions/admin.ShareRecordForm"
2093
+                        }
2094
+                    }
2095
+                ],
2096
+                "responses": {
2097
+                    "200": {
2098
+                        "description": "OK",
2099
+                        "schema": {
2100
+                            "$ref": "#/definitions/response.Response"
2101
+                        }
2102
+                    },
2103
+                    "500": {
2104
+                        "description": "Internal Server Error",
2105
+                        "schema": {
2106
+                            "$ref": "#/definitions/response.Response"
2107
+                        }
2108
+                    }
2109
+                }
2110
+            }
2111
+        },
2112
+        "/admin/my/share_record/list": {
2113
+            "get": {
2114
+                "security": [
2115
+                    {
2116
+                        "token": []
2117
+                    }
2118
+                ],
2119
+                "description": "分享记录列表",
2120
+                "consumes": [
2121
+                    "application/json"
2122
+                ],
2123
+                "produces": [
2124
+                    "application/json"
2125
+                ],
2126
+                "tags": [
2127
+                    "我的"
2128
+                ],
2129
+                "summary": "分享记录列表",
2130
+                "parameters": [
2131
+                    {
2132
+                        "type": "integer",
2133
+                        "description": "页码",
2134
+                        "name": "page",
2135
+                        "in": "query"
2136
+                    },
2137
+                    {
2138
+                        "type": "integer",
2139
+                        "description": "页大小",
2140
+                        "name": "page_size",
2141
+                        "in": "query"
2142
+                    }
2143
+                ],
2144
+                "responses": {
2145
+                    "200": {
2146
+                        "description": "OK",
2147
+                        "schema": {
2148
+                            "$ref": "#/definitions/response.Response"
2149
+                        }
2150
+                    },
2151
+                    "500": {
2152
+                        "description": "Internal Server Error",
2153
+                        "schema": {
2154
+                            "$ref": "#/definitions/response.Response"
2155
+                        }
2156
+                    }
2157
+                }
2158
+            }
2159
+        },
2022 2160
         "/admin/oauth/create": {
2023 2161
             "post": {
2024 2162
                 "security": [
@@ -2727,6 +2865,150 @@ const docTemplateadmin = `{
2727 2865
                 }
2728 2866
             }
2729 2867
         },
2868
+        "/admin/share_record/batchDelete": {
2869
+            "post": {
2870
+                "security": [
2871
+                    {
2872
+                        "token": []
2873
+                    }
2874
+                ],
2875
+                "description": "批量分享记录",
2876
+                "consumes": [
2877
+                    "application/json"
2878
+                ],
2879
+                "produces": [
2880
+                    "application/json"
2881
+                ],
2882
+                "tags": [
2883
+                    "分享记录"
2884
+                ],
2885
+                "summary": "批量分享记录",
2886
+                "parameters": [
2887
+                    {
2888
+                        "description": "id",
2889
+                        "name": "body",
2890
+                        "in": "body",
2891
+                        "required": true,
2892
+                        "schema": {
2893
+                            "$ref": "#/definitions/admin.PeerShareRecordBatchDeleteForm"
2894
+                        }
2895
+                    }
2896
+                ],
2897
+                "responses": {
2898
+                    "200": {
2899
+                        "description": "OK",
2900
+                        "schema": {
2901
+                            "$ref": "#/definitions/response.Response"
2902
+                        }
2903
+                    },
2904
+                    "500": {
2905
+                        "description": "Internal Server Error",
2906
+                        "schema": {
2907
+                            "$ref": "#/definitions/response.Response"
2908
+                        }
2909
+                    }
2910
+                }
2911
+            }
2912
+        },
2913
+        "/admin/share_record/delete": {
2914
+            "post": {
2915
+                "security": [
2916
+                    {
2917
+                        "token": []
2918
+                    }
2919
+                ],
2920
+                "description": "分享记录删除",
2921
+                "consumes": [
2922
+                    "application/json"
2923
+                ],
2924
+                "produces": [
2925
+                    "application/json"
2926
+                ],
2927
+                "tags": [
2928
+                    "分享记录"
2929
+                ],
2930
+                "summary": "分享记录删除",
2931
+                "parameters": [
2932
+                    {
2933
+                        "description": "分享记录信息",
2934
+                        "name": "body",
2935
+                        "in": "body",
2936
+                        "required": true,
2937
+                        "schema": {
2938
+                            "$ref": "#/definitions/admin.ShareRecordForm"
2939
+                        }
2940
+                    }
2941
+                ],
2942
+                "responses": {
2943
+                    "200": {
2944
+                        "description": "OK",
2945
+                        "schema": {
2946
+                            "$ref": "#/definitions/response.Response"
2947
+                        }
2948
+                    },
2949
+                    "500": {
2950
+                        "description": "Internal Server Error",
2951
+                        "schema": {
2952
+                            "$ref": "#/definitions/response.Response"
2953
+                        }
2954
+                    }
2955
+                }
2956
+            }
2957
+        },
2958
+        "/admin/share_record/list": {
2959
+            "get": {
2960
+                "security": [
2961
+                    {
2962
+                        "token": []
2963
+                    }
2964
+                ],
2965
+                "description": "分享记录列表",
2966
+                "consumes": [
2967
+                    "application/json"
2968
+                ],
2969
+                "produces": [
2970
+                    "application/json"
2971
+                ],
2972
+                "tags": [
2973
+                    "分享记录"
2974
+                ],
2975
+                "summary": "分享记录列表",
2976
+                "parameters": [
2977
+                    {
2978
+                        "type": "integer",
2979
+                        "description": "用户ID",
2980
+                        "name": "user_id",
2981
+                        "in": "query"
2982
+                    },
2983
+                    {
2984
+                        "type": "integer",
2985
+                        "description": "页码",
2986
+                        "name": "page",
2987
+                        "in": "query"
2988
+                    },
2989
+                    {
2990
+                        "type": "integer",
2991
+                        "description": "页大小",
2992
+                        "name": "page_size",
2993
+                        "in": "query"
2994
+                    }
2995
+                ],
2996
+                "responses": {
2997
+                    "200": {
2998
+                        "description": "OK",
2999
+                        "schema": {
3000
+                            "$ref": "#/definitions/response.Response"
3001
+                        }
3002
+                    },
3003
+                    "500": {
3004
+                        "description": "Internal Server Error",
3005
+                        "schema": {
3006
+                            "$ref": "#/definitions/response.Response"
3007
+                        }
3008
+                    }
3009
+                }
3010
+            }
3011
+        },
2730 3012
         "/admin/tag/create": {
2731 3013
             "post": {
2732 3014
                 "security": [
@@ -3562,7 +3844,7 @@ const docTemplateadmin = `{
3562 3844
                 }
3563 3845
             }
3564 3846
         },
3565
-        "/admin/user_token/delete": {
3847
+        "/admin/user_token/batchDelete": {
3566 3848
             "post": {
3567 3849
                 "security": [
3568 3850
                     {
@@ -3607,6 +3889,51 @@ const docTemplateadmin = `{
3607 3889
                 }
3608 3890
             }
3609 3891
         },
3892
+        "/admin/user_token/delete": {
3893
+            "post": {
3894
+                "security": [
3895
+                    {
3896
+                        "token": []
3897
+                    }
3898
+                ],
3899
+                "description": "登录凭证删除",
3900
+                "consumes": [
3901
+                    "application/json"
3902
+                ],
3903
+                "produces": [
3904
+                    "application/json"
3905
+                ],
3906
+                "tags": [
3907
+                    "登录凭证"
3908
+                ],
3909
+                "summary": "登录凭证删除",
3910
+                "parameters": [
3911
+                    {
3912
+                        "description": "登录凭证信息",
3913
+                        "name": "body",
3914
+                        "in": "body",
3915
+                        "required": true,
3916
+                        "schema": {
3917
+                            "$ref": "#/definitions/model.UserToken"
3918
+                        }
3919
+                    }
3920
+                ],
3921
+                "responses": {
3922
+                    "200": {
3923
+                        "description": "OK",
3924
+                        "schema": {
3925
+                            "$ref": "#/definitions/response.Response"
3926
+                        }
3927
+                    },
3928
+                    "500": {
3929
+                        "description": "Internal Server Error",
3930
+                        "schema": {
3931
+                            "$ref": "#/definitions/response.Response"
3932
+                        }
3933
+                    }
3934
+                }
3935
+            }
3936
+        },
3610 3937
         "/admin/user_token/list": {
3611 3938
             "get": {
3612 3939
                 "security": [
@@ -3949,6 +4276,20 @@ const docTemplateadmin = `{
3949 4276
                 }
3950 4277
             }
3951 4278
         },
4279
+        "admin.PeerShareRecordBatchDeleteForm": {
4280
+            "type": "object",
4281
+            "required": [
4282
+                "ids"
4283
+            ],
4284
+            "properties": {
4285
+                "ids": {
4286
+                    "type": "array",
4287
+                    "items": {
4288
+                        "type": "integer"
4289
+                    }
4290
+                }
4291
+            }
4292
+        },
3952 4293
         "admin.ShareByWebClientForm": {
3953 4294
             "type": "object",
3954 4295
             "required": [
@@ -3976,6 +4317,17 @@ const docTemplateadmin = `{
3976 4317
                 }
3977 4318
             }
3978 4319
         },
4320
+        "admin.ShareRecordForm": {
4321
+            "type": "object",
4322
+            "properties": {
4323
+                "id": {
4324
+                    "type": "integer"
4325
+                },
4326
+                "user_id": {
4327
+                    "type": "integer"
4328
+                }
4329
+            }
4330
+        },
3979 4331
         "admin.TagForm": {
3980 4332
             "type": "object",
3981 4333
             "required": [

+ 353 - 1
docs/admin/admin_swagger.json

@@ -2012,6 +2012,144 @@
2012 2012
                 }
2013 2013
             }
2014 2014
         },
2015
+        "/admin/my/share_record/batchDelete": {
2016
+            "post": {
2017
+                "security": [
2018
+                    {
2019
+                        "token": []
2020
+                    }
2021
+                ],
2022
+                "description": "批量删除我的分享记录",
2023
+                "consumes": [
2024
+                    "application/json"
2025
+                ],
2026
+                "produces": [
2027
+                    "application/json"
2028
+                ],
2029
+                "tags": [
2030
+                    "我的"
2031
+                ],
2032
+                "summary": "批量删除我的分享记录",
2033
+                "parameters": [
2034
+                    {
2035
+                        "description": "id",
2036
+                        "name": "body",
2037
+                        "in": "body",
2038
+                        "required": true,
2039
+                        "schema": {
2040
+                            "$ref": "#/definitions/admin.PeerShareRecordBatchDeleteForm"
2041
+                        }
2042
+                    }
2043
+                ],
2044
+                "responses": {
2045
+                    "200": {
2046
+                        "description": "OK",
2047
+                        "schema": {
2048
+                            "$ref": "#/definitions/response.Response"
2049
+                        }
2050
+                    },
2051
+                    "500": {
2052
+                        "description": "Internal Server Error",
2053
+                        "schema": {
2054
+                            "$ref": "#/definitions/response.Response"
2055
+                        }
2056
+                    }
2057
+                }
2058
+            }
2059
+        },
2060
+        "/admin/my/share_record/delete": {
2061
+            "post": {
2062
+                "security": [
2063
+                    {
2064
+                        "token": []
2065
+                    }
2066
+                ],
2067
+                "description": "分享记录删除",
2068
+                "consumes": [
2069
+                    "application/json"
2070
+                ],
2071
+                "produces": [
2072
+                    "application/json"
2073
+                ],
2074
+                "tags": [
2075
+                    "我的"
2076
+                ],
2077
+                "summary": "分享记录删除",
2078
+                "parameters": [
2079
+                    {
2080
+                        "description": "分享记录信息",
2081
+                        "name": "body",
2082
+                        "in": "body",
2083
+                        "required": true,
2084
+                        "schema": {
2085
+                            "$ref": "#/definitions/admin.ShareRecordForm"
2086
+                        }
2087
+                    }
2088
+                ],
2089
+                "responses": {
2090
+                    "200": {
2091
+                        "description": "OK",
2092
+                        "schema": {
2093
+                            "$ref": "#/definitions/response.Response"
2094
+                        }
2095
+                    },
2096
+                    "500": {
2097
+                        "description": "Internal Server Error",
2098
+                        "schema": {
2099
+                            "$ref": "#/definitions/response.Response"
2100
+                        }
2101
+                    }
2102
+                }
2103
+            }
2104
+        },
2105
+        "/admin/my/share_record/list": {
2106
+            "get": {
2107
+                "security": [
2108
+                    {
2109
+                        "token": []
2110
+                    }
2111
+                ],
2112
+                "description": "分享记录列表",
2113
+                "consumes": [
2114
+                    "application/json"
2115
+                ],
2116
+                "produces": [
2117
+                    "application/json"
2118
+                ],
2119
+                "tags": [
2120
+                    "我的"
2121
+                ],
2122
+                "summary": "分享记录列表",
2123
+                "parameters": [
2124
+                    {
2125
+                        "type": "integer",
2126
+                        "description": "页码",
2127
+                        "name": "page",
2128
+                        "in": "query"
2129
+                    },
2130
+                    {
2131
+                        "type": "integer",
2132
+                        "description": "页大小",
2133
+                        "name": "page_size",
2134
+                        "in": "query"
2135
+                    }
2136
+                ],
2137
+                "responses": {
2138
+                    "200": {
2139
+                        "description": "OK",
2140
+                        "schema": {
2141
+                            "$ref": "#/definitions/response.Response"
2142
+                        }
2143
+                    },
2144
+                    "500": {
2145
+                        "description": "Internal Server Error",
2146
+                        "schema": {
2147
+                            "$ref": "#/definitions/response.Response"
2148
+                        }
2149
+                    }
2150
+                }
2151
+            }
2152
+        },
2015 2153
         "/admin/oauth/create": {
2016 2154
             "post": {
2017 2155
                 "security": [
@@ -2720,6 +2858,150 @@
2720 2858
                 }
2721 2859
             }
2722 2860
         },
2861
+        "/admin/share_record/batchDelete": {
2862
+            "post": {
2863
+                "security": [
2864
+                    {
2865
+                        "token": []
2866
+                    }
2867
+                ],
2868
+                "description": "批量分享记录",
2869
+                "consumes": [
2870
+                    "application/json"
2871
+                ],
2872
+                "produces": [
2873
+                    "application/json"
2874
+                ],
2875
+                "tags": [
2876
+                    "分享记录"
2877
+                ],
2878
+                "summary": "批量分享记录",
2879
+                "parameters": [
2880
+                    {
2881
+                        "description": "id",
2882
+                        "name": "body",
2883
+                        "in": "body",
2884
+                        "required": true,
2885
+                        "schema": {
2886
+                            "$ref": "#/definitions/admin.PeerShareRecordBatchDeleteForm"
2887
+                        }
2888
+                    }
2889
+                ],
2890
+                "responses": {
2891
+                    "200": {
2892
+                        "description": "OK",
2893
+                        "schema": {
2894
+                            "$ref": "#/definitions/response.Response"
2895
+                        }
2896
+                    },
2897
+                    "500": {
2898
+                        "description": "Internal Server Error",
2899
+                        "schema": {
2900
+                            "$ref": "#/definitions/response.Response"
2901
+                        }
2902
+                    }
2903
+                }
2904
+            }
2905
+        },
2906
+        "/admin/share_record/delete": {
2907
+            "post": {
2908
+                "security": [
2909
+                    {
2910
+                        "token": []
2911
+                    }
2912
+                ],
2913
+                "description": "分享记录删除",
2914
+                "consumes": [
2915
+                    "application/json"
2916
+                ],
2917
+                "produces": [
2918
+                    "application/json"
2919
+                ],
2920
+                "tags": [
2921
+                    "分享记录"
2922
+                ],
2923
+                "summary": "分享记录删除",
2924
+                "parameters": [
2925
+                    {
2926
+                        "description": "分享记录信息",
2927
+                        "name": "body",
2928
+                        "in": "body",
2929
+                        "required": true,
2930
+                        "schema": {
2931
+                            "$ref": "#/definitions/admin.ShareRecordForm"
2932
+                        }
2933
+                    }
2934
+                ],
2935
+                "responses": {
2936
+                    "200": {
2937
+                        "description": "OK",
2938
+                        "schema": {
2939
+                            "$ref": "#/definitions/response.Response"
2940
+                        }
2941
+                    },
2942
+                    "500": {
2943
+                        "description": "Internal Server Error",
2944
+                        "schema": {
2945
+                            "$ref": "#/definitions/response.Response"
2946
+                        }
2947
+                    }
2948
+                }
2949
+            }
2950
+        },
2951
+        "/admin/share_record/list": {
2952
+            "get": {
2953
+                "security": [
2954
+                    {
2955
+                        "token": []
2956
+                    }
2957
+                ],
2958
+                "description": "分享记录列表",
2959
+                "consumes": [
2960
+                    "application/json"
2961
+                ],
2962
+                "produces": [
2963
+                    "application/json"
2964
+                ],
2965
+                "tags": [
2966
+                    "分享记录"
2967
+                ],
2968
+                "summary": "分享记录列表",
2969
+                "parameters": [
2970
+                    {
2971
+                        "type": "integer",
2972
+                        "description": "用户ID",
2973
+                        "name": "user_id",
2974
+                        "in": "query"
2975
+                    },
2976
+                    {
2977
+                        "type": "integer",
2978
+                        "description": "页码",
2979
+                        "name": "page",
2980
+                        "in": "query"
2981
+                    },
2982
+                    {
2983
+                        "type": "integer",
2984
+                        "description": "页大小",
2985
+                        "name": "page_size",
2986
+                        "in": "query"
2987
+                    }
2988
+                ],
2989
+                "responses": {
2990
+                    "200": {
2991
+                        "description": "OK",
2992
+                        "schema": {
2993
+                            "$ref": "#/definitions/response.Response"
2994
+                        }
2995
+                    },
2996
+                    "500": {
2997
+                        "description": "Internal Server Error",
2998
+                        "schema": {
2999
+                            "$ref": "#/definitions/response.Response"
3000
+                        }
3001
+                    }
3002
+                }
3003
+            }
3004
+        },
2723 3005
         "/admin/tag/create": {
2724 3006
             "post": {
2725 3007
                 "security": [
@@ -3555,7 +3837,7 @@
3555 3837
                 }
3556 3838
             }
3557 3839
         },
3558
-        "/admin/user_token/delete": {
3840
+        "/admin/user_token/batchDelete": {
3559 3841
             "post": {
3560 3842
                 "security": [
3561 3843
                     {
@@ -3600,6 +3882,51 @@
3600 3882
                 }
3601 3883
             }
3602 3884
         },
3885
+        "/admin/user_token/delete": {
3886
+            "post": {
3887
+                "security": [
3888
+                    {
3889
+                        "token": []
3890
+                    }
3891
+                ],
3892
+                "description": "登录凭证删除",
3893
+                "consumes": [
3894
+                    "application/json"
3895
+                ],
3896
+                "produces": [
3897
+                    "application/json"
3898
+                ],
3899
+                "tags": [
3900
+                    "登录凭证"
3901
+                ],
3902
+                "summary": "登录凭证删除",
3903
+                "parameters": [
3904
+                    {
3905
+                        "description": "登录凭证信息",
3906
+                        "name": "body",
3907
+                        "in": "body",
3908
+                        "required": true,
3909
+                        "schema": {
3910
+                            "$ref": "#/definitions/model.UserToken"
3911
+                        }
3912
+                    }
3913
+                ],
3914
+                "responses": {
3915
+                    "200": {
3916
+                        "description": "OK",
3917
+                        "schema": {
3918
+                            "$ref": "#/definitions/response.Response"
3919
+                        }
3920
+                    },
3921
+                    "500": {
3922
+                        "description": "Internal Server Error",
3923
+                        "schema": {
3924
+                            "$ref": "#/definitions/response.Response"
3925
+                        }
3926
+                    }
3927
+                }
3928
+            }
3929
+        },
3603 3930
         "/admin/user_token/list": {
3604 3931
             "get": {
3605 3932
                 "security": [
@@ -3942,6 +4269,20 @@
3942 4269
                 }
3943 4270
             }
3944 4271
         },
4272
+        "admin.PeerShareRecordBatchDeleteForm": {
4273
+            "type": "object",
4274
+            "required": [
4275
+                "ids"
4276
+            ],
4277
+            "properties": {
4278
+                "ids": {
4279
+                    "type": "array",
4280
+                    "items": {
4281
+                        "type": "integer"
4282
+                    }
4283
+                }
4284
+            }
4285
+        },
3945 4286
         "admin.ShareByWebClientForm": {
3946 4287
             "type": "object",
3947 4288
             "required": [
@@ -3969,6 +4310,17 @@
3969 4310
                 }
3970 4311
             }
3971 4312
         },
4313
+        "admin.ShareRecordForm": {
4314
+            "type": "object",
4315
+            "properties": {
4316
+                "id": {
4317
+                    "type": "integer"
4318
+                },
4319
+                "user_id": {
4320
+                    "type": "integer"
4321
+                }
4322
+            }
4323
+        },
3972 4324
         "admin.TagForm": {
3973 4325
             "type": "object",
3974 4326
             "required": [

+ 221 - 1
docs/admin/admin_swagger.yaml

@@ -182,6 +182,15 @@ definitions:
182 182
       version:
183 183
         type: string
184 184
     type: object
185
+  admin.PeerShareRecordBatchDeleteForm:
186
+    properties:
187
+      ids:
188
+        items:
189
+          type: integer
190
+        type: array
191
+    required:
192
+    - ids
193
+    type: object
185 194
   admin.ShareByWebClientForm:
186 195
     properties:
187 196
       expire:
@@ -201,6 +210,13 @@ definitions:
201 210
     - password
202 211
     - password_type
203 212
     type: object
213
+  admin.ShareRecordForm:
214
+    properties:
215
+      id:
216
+        type: integer
217
+      user_id:
218
+        type: integer
219
+    type: object
204 220
   admin.TagForm:
205 221
     properties:
206 222
       collection_id:
@@ -1959,6 +1975,92 @@ paths:
1959 1975
       summary: 登出
1960 1976
       tags:
1961 1977
       - 登录
1978
+  /admin/my/share_record/batchDelete:
1979
+    post:
1980
+      consumes:
1981
+      - application/json
1982
+      description: 批量删除我的分享记录
1983
+      parameters:
1984
+      - description: id
1985
+        in: body
1986
+        name: body
1987
+        required: true
1988
+        schema:
1989
+          $ref: '#/definitions/admin.PeerShareRecordBatchDeleteForm'
1990
+      produces:
1991
+      - application/json
1992
+      responses:
1993
+        "200":
1994
+          description: OK
1995
+          schema:
1996
+            $ref: '#/definitions/response.Response'
1997
+        "500":
1998
+          description: Internal Server Error
1999
+          schema:
2000
+            $ref: '#/definitions/response.Response'
2001
+      security:
2002
+      - token: []
2003
+      summary: 批量删除我的分享记录
2004
+      tags:
2005
+      - 我的
2006
+  /admin/my/share_record/delete:
2007
+    post:
2008
+      consumes:
2009
+      - application/json
2010
+      description: 分享记录删除
2011
+      parameters:
2012
+      - description: 分享记录信息
2013
+        in: body
2014
+        name: body
2015
+        required: true
2016
+        schema:
2017
+          $ref: '#/definitions/admin.ShareRecordForm'
2018
+      produces:
2019
+      - application/json
2020
+      responses:
2021
+        "200":
2022
+          description: OK
2023
+          schema:
2024
+            $ref: '#/definitions/response.Response'
2025
+        "500":
2026
+          description: Internal Server Error
2027
+          schema:
2028
+            $ref: '#/definitions/response.Response'
2029
+      security:
2030
+      - token: []
2031
+      summary: 分享记录删除
2032
+      tags:
2033
+      - 我的
2034
+  /admin/my/share_record/list:
2035
+    get:
2036
+      consumes:
2037
+      - application/json
2038
+      description: 分享记录列表
2039
+      parameters:
2040
+      - description: 页码
2041
+        in: query
2042
+        name: page
2043
+        type: integer
2044
+      - description: 页大小
2045
+        in: query
2046
+        name: page_size
2047
+        type: integer
2048
+      produces:
2049
+      - application/json
2050
+      responses:
2051
+        "200":
2052
+          description: OK
2053
+          schema:
2054
+            $ref: '#/definitions/response.Response'
2055
+        "500":
2056
+          description: Internal Server Error
2057
+          schema:
2058
+            $ref: '#/definitions/response.Response'
2059
+      security:
2060
+      - token: []
2061
+      summary: 分享记录列表
2062
+      tags:
2063
+      - 我的
1962 2064
   /admin/oauth/create:
1963 2065
     post:
1964 2066
       consumes:
@@ -2381,6 +2483,96 @@ paths:
2381 2483
       summary: RUSTDESK服务配置
2382 2484
       tags:
2383 2485
       - ADMIN
2486
+  /admin/share_record/batchDelete:
2487
+    post:
2488
+      consumes:
2489
+      - application/json
2490
+      description: 批量分享记录
2491
+      parameters:
2492
+      - description: id
2493
+        in: body
2494
+        name: body
2495
+        required: true
2496
+        schema:
2497
+          $ref: '#/definitions/admin.PeerShareRecordBatchDeleteForm'
2498
+      produces:
2499
+      - application/json
2500
+      responses:
2501
+        "200":
2502
+          description: OK
2503
+          schema:
2504
+            $ref: '#/definitions/response.Response'
2505
+        "500":
2506
+          description: Internal Server Error
2507
+          schema:
2508
+            $ref: '#/definitions/response.Response'
2509
+      security:
2510
+      - token: []
2511
+      summary: 批量分享记录
2512
+      tags:
2513
+      - 分享记录
2514
+  /admin/share_record/delete:
2515
+    post:
2516
+      consumes:
2517
+      - application/json
2518
+      description: 分享记录删除
2519
+      parameters:
2520
+      - description: 分享记录信息
2521
+        in: body
2522
+        name: body
2523
+        required: true
2524
+        schema:
2525
+          $ref: '#/definitions/admin.ShareRecordForm'
2526
+      produces:
2527
+      - application/json
2528
+      responses:
2529
+        "200":
2530
+          description: OK
2531
+          schema:
2532
+            $ref: '#/definitions/response.Response'
2533
+        "500":
2534
+          description: Internal Server Error
2535
+          schema:
2536
+            $ref: '#/definitions/response.Response'
2537
+      security:
2538
+      - token: []
2539
+      summary: 分享记录删除
2540
+      tags:
2541
+      - 分享记录
2542
+  /admin/share_record/list:
2543
+    get:
2544
+      consumes:
2545
+      - application/json
2546
+      description: 分享记录列表
2547
+      parameters:
2548
+      - description: 用户ID
2549
+        in: query
2550
+        name: user_id
2551
+        type: integer
2552
+      - description: 页码
2553
+        in: query
2554
+        name: page
2555
+        type: integer
2556
+      - description: 页大小
2557
+        in: query
2558
+        name: page_size
2559
+        type: integer
2560
+      produces:
2561
+      - application/json
2562
+      responses:
2563
+        "200":
2564
+          description: OK
2565
+          schema:
2566
+            $ref: '#/definitions/response.Response'
2567
+        "500":
2568
+          description: Internal Server Error
2569
+          schema:
2570
+            $ref: '#/definitions/response.Response'
2571
+      security:
2572
+      - token: []
2573
+      summary: 分享记录列表
2574
+      tags:
2575
+      - 分享记录
2384 2576
   /admin/tag/create:
2385 2577
     post:
2386 2578
       consumes:
@@ -2876,7 +3068,7 @@ paths:
2876 3068
       summary: 修改密码
2877 3069
       tags:
2878 3070
       - 用户
2879
-  /admin/user_token/delete:
3071
+  /admin/user_token/batchDelete:
2880 3072
     post:
2881 3073
       consumes:
2882 3074
       - application/json
@@ -2904,6 +3096,34 @@ paths:
2904 3096
       summary: 登录凭证批量删除
2905 3097
       tags:
2906 3098
       - 登录凭证
3099
+  /admin/user_token/delete:
3100
+    post:
3101
+      consumes:
3102
+      - application/json
3103
+      description: 登录凭证删除
3104
+      parameters:
3105
+      - description: 登录凭证信息
3106
+        in: body
3107
+        name: body
3108
+        required: true
3109
+        schema:
3110
+          $ref: '#/definitions/model.UserToken'
3111
+      produces:
3112
+      - application/json
3113
+      responses:
3114
+        "200":
3115
+          description: OK
3116
+          schema:
3117
+            $ref: '#/definitions/response.Response'
3118
+        "500":
3119
+          description: Internal Server Error
3120
+          schema:
3121
+            $ref: '#/definitions/response.Response'
3122
+      security:
3123
+      - token: []
3124
+      summary: 登录凭证删除
3125
+      tags:
3126
+      - 登录凭证
2907 3127
   /admin/user_token/list:
2908 3128
     get:
2909 3129
       consumes:

+ 34 - 0
docs/api/api_docs.go

@@ -1042,6 +1042,40 @@ const docTemplateapi = `{
1042 1042
             }
1043 1043
         },
1044 1044
         "/server-config": {
1045
+            "get": {
1046
+                "security": [
1047
+                    {
1048
+                        "token": []
1049
+                    }
1050
+                ],
1051
+                "description": "服务配置,给webclient提供api-server",
1052
+                "consumes": [
1053
+                    "application/json"
1054
+                ],
1055
+                "produces": [
1056
+                    "application/json"
1057
+                ],
1058
+                "tags": [
1059
+                    "WEBCLIENT"
1060
+                ],
1061
+                "summary": "服务配置",
1062
+                "responses": {
1063
+                    "200": {
1064
+                        "description": "OK",
1065
+                        "schema": {
1066
+                            "$ref": "#/definitions/response.Response"
1067
+                        }
1068
+                    },
1069
+                    "500": {
1070
+                        "description": "Internal Server Error",
1071
+                        "schema": {
1072
+                            "$ref": "#/definitions/response.Response"
1073
+                        }
1074
+                    }
1075
+                }
1076
+            }
1077
+        },
1078
+        "/server-config-v2": {
1045 1079
             "get": {
1046 1080
                 "security": [
1047 1081
                     {

+ 34 - 0
docs/api/api_swagger.json

@@ -1035,6 +1035,40 @@
1035 1035
             }
1036 1036
         },
1037 1037
         "/server-config": {
1038
+            "get": {
1039
+                "security": [
1040
+                    {
1041
+                        "token": []
1042
+                    }
1043
+                ],
1044
+                "description": "服务配置,给webclient提供api-server",
1045
+                "consumes": [
1046
+                    "application/json"
1047
+                ],
1048
+                "produces": [
1049
+                    "application/json"
1050
+                ],
1051
+                "tags": [
1052
+                    "WEBCLIENT"
1053
+                ],
1054
+                "summary": "服务配置",
1055
+                "responses": {
1056
+                    "200": {
1057
+                        "description": "OK",
1058
+                        "schema": {
1059
+                            "$ref": "#/definitions/response.Response"
1060
+                        }
1061
+                    },
1062
+                    "500": {
1063
+                        "description": "Internal Server Error",
1064
+                        "schema": {
1065
+                            "$ref": "#/definitions/response.Response"
1066
+                        }
1067
+                    }
1068
+                }
1069
+            }
1070
+        },
1071
+        "/server-config-v2": {
1038 1072
             "get": {
1039 1073
                 "security": [
1040 1074
                     {

+ 21 - 0
docs/api/api_swagger.yaml

@@ -850,6 +850,27 @@ paths:
850 850
       tags:
851 851
       - 群组
852 852
   /server-config:
853
+    get:
854
+      consumes:
855
+      - application/json
856
+      description: 服务配置,给webclient提供api-server
857
+      produces:
858
+      - application/json
859
+      responses:
860
+        "200":
861
+          description: OK
862
+          schema:
863
+            $ref: '#/definitions/response.Response'
864
+        "500":
865
+          description: Internal Server Error
866
+          schema:
867
+            $ref: '#/definitions/response.Response'
868
+      security:
869
+      - token: []
870
+      summary: 服务配置
871
+      tags:
872
+      - WEBCLIENT
873
+  /server-config-v2:
853 874
     get:
854 875
       consumes:
855 876
       - application/json

+ 119 - 0
http/controller/admin/my/shareRecord.go

@@ -0,0 +1,119 @@
1
+package my
2
+
3
+import (
4
+	"Gwen/global"
5
+	"Gwen/http/request/admin"
6
+	"Gwen/http/response"
7
+	"Gwen/service"
8
+	"github.com/gin-gonic/gin"
9
+	"gorm.io/gorm"
10
+)
11
+
12
+type ShareRecord struct {
13
+}
14
+
15
+// List 分享记录列表
16
+// @Tags 我的
17
+// @Summary 分享记录列表
18
+// @Description 分享记录列表
19
+// @Accept  json
20
+// @Produce  json
21
+// @Param page query int false "页码"
22
+// @Param page_size query int false "页大小"
23
+// @Success 200 {object} response.Response
24
+// @Failure 500 {object} response.Response
25
+// @Router /admin/my/share_record/list [get]
26
+// @Security token
27
+func (sr *ShareRecord) List(c *gin.Context) {
28
+	query := &admin.PageQuery{}
29
+	if err := c.ShouldBindQuery(query); err != nil {
30
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
31
+		return
32
+	}
33
+	u := service.AllService.UserService.CurUser(c)
34
+	res := service.AllService.ShareRecordService.List(query.Page, query.PageSize, func(tx *gorm.DB) {
35
+		tx.Where("user_id = ?", u.Id)
36
+	})
37
+	response.Success(c, res)
38
+}
39
+
40
+// Delete 分享记录删除
41
+// @Tags 我的
42
+// @Summary 分享记录删除
43
+// @Description 分享记录删除
44
+// @Accept  json
45
+// @Produce  json
46
+// @Param body body admin.ShareRecordForm true "分享记录信息"
47
+// @Success 200 {object} response.Response
48
+// @Failure 500 {object} response.Response
49
+// @Router /admin/my/share_record/delete [post]
50
+// @Security token
51
+func (sr *ShareRecord) Delete(c *gin.Context) {
52
+	f := &admin.ShareRecordForm{}
53
+	if err := c.ShouldBindJSON(f); err != nil {
54
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
55
+		return
56
+	}
57
+	id := f.Id
58
+	errList := global.Validator.ValidVar(c, id, "required,gt=0")
59
+	if len(errList) > 0 {
60
+		response.Fail(c, 101, errList[0])
61
+		return
62
+	}
63
+	u := service.AllService.UserService.CurUser(c)
64
+	i := service.AllService.ShareRecordService.InfoById(f.Id)
65
+	if i.UserId != u.Id {
66
+		response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
67
+		return
68
+	}
69
+	if i.Id == 0 {
70
+		response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
71
+		return
72
+	}
73
+	err := service.AllService.ShareRecordService.Delete(i)
74
+	if err == nil {
75
+		response.Success(c, nil)
76
+		return
77
+	}
78
+	response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
79
+}
80
+
81
+// BatchDelete 批量删除我的分享记录
82
+// @Tags 我的
83
+// @Summary 批量删除我的分享记录
84
+// @Description 批量删除我的分享记录
85
+// @Accept  json
86
+// @Produce  json
87
+// @Param body body admin.PeerShareRecordBatchDeleteForm true "id"
88
+// @Success 200 {object} response.Response
89
+// @Failure 500 {object} response.Response
90
+// @Router /admin/my/share_record/batchDelete [post]
91
+// @Security token
92
+func (sr *ShareRecord) BatchDelete(c *gin.Context) {
93
+	f := &admin.PeerShareRecordBatchDeleteForm{}
94
+	if err := c.ShouldBindJSON(f); err != nil {
95
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
96
+		return
97
+	}
98
+	if len(f.Ids) == 0 {
99
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError"))
100
+		return
101
+	}
102
+	u := service.AllService.UserService.CurUser(c)
103
+	var l int64
104
+	l = int64(len(f.Ids))
105
+	res := service.AllService.ShareRecordService.List(1, uint(l), func(tx *gorm.DB) {
106
+		tx.Where("user_id = ?", u.Id)
107
+		tx.Where("id in ?", f.Ids)
108
+	})
109
+	if res.Total != l {
110
+		response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
111
+		return
112
+	}
113
+	err := service.AllService.ShareRecordService.BatchDelete(f.Ids)
114
+	if err != nil {
115
+		response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
116
+		return
117
+	}
118
+	response.Success(c, nil)
119
+}

+ 105 - 0
http/controller/admin/shareRecord.go

@@ -0,0 +1,105 @@
1
+package admin
2
+
3
+import (
4
+	"Gwen/global"
5
+	"Gwen/http/request/admin"
6
+	"Gwen/http/response"
7
+	"Gwen/service"
8
+	"github.com/gin-gonic/gin"
9
+	"gorm.io/gorm"
10
+)
11
+
12
+type ShareRecord struct {
13
+}
14
+
15
+// List 列表
16
+// @Tags 分享记录
17
+// @Summary 分享记录列表
18
+// @Description 分享记录列表
19
+// @Accept  json
20
+// @Produce  json
21
+// @Param user_id query int false "用户ID"
22
+// @Param page query int false "页码"
23
+// @Param page_size query int false "页大小"
24
+// @Success 200 {object} response.Response
25
+// @Failure 500 {object} response.Response
26
+// @Router /admin/share_record/list [get]
27
+// @Security token
28
+func (sr *ShareRecord) List(c *gin.Context) {
29
+	query := &admin.ShareRecordQuery{}
30
+	if err := c.ShouldBindQuery(query); err != nil {
31
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
32
+		return
33
+	}
34
+	res := service.AllService.ShareRecordService.List(query.Page, query.PageSize, func(tx *gorm.DB) {
35
+		if query.UserId > 0 {
36
+			tx.Where("user_id = ?", query.UserId)
37
+		}
38
+	})
39
+	response.Success(c, res)
40
+}
41
+
42
+// Delete 删除
43
+// @Tags 分享记录
44
+// @Summary 分享记录删除
45
+// @Description 分享记录删除
46
+// @Accept  json
47
+// @Produce  json
48
+// @Param body body admin.ShareRecordForm true "分享记录信息"
49
+// @Success 200 {object} response.Response
50
+// @Failure 500 {object} response.Response
51
+// @Router /admin/share_record/delete [post]
52
+// @Security token
53
+func (sr *ShareRecord) Delete(c *gin.Context) {
54
+	f := &admin.ShareRecordForm{}
55
+	if err := c.ShouldBindJSON(f); err != nil {
56
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
57
+		return
58
+	}
59
+	id := f.Id
60
+	errList := global.Validator.ValidVar(c, id, "required,gt=0")
61
+	if len(errList) > 0 {
62
+		response.Fail(c, 101, errList[0])
63
+		return
64
+	}
65
+	i := service.AllService.ShareRecordService.InfoById(f.Id)
66
+	if i.Id > 0 {
67
+		err := service.AllService.ShareRecordService.Delete(i)
68
+		if err == nil {
69
+			response.Success(c, nil)
70
+			return
71
+		}
72
+		response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
73
+		return
74
+	}
75
+	response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
76
+}
77
+
78
+// BatchDelete 批量删除
79
+// @Tags 分享记录
80
+// @Summary 批量分享记录
81
+// @Description 批量分享记录
82
+// @Accept  json
83
+// @Produce  json
84
+// @Param body body admin.PeerShareRecordBatchDeleteForm true "id"
85
+// @Success 200 {object} response.Response
86
+// @Failure 500 {object} response.Response
87
+// @Router /admin/share_record/batchDelete [post]
88
+// @Security token
89
+func (sr *ShareRecord) BatchDelete(c *gin.Context) {
90
+	f := &admin.PeerShareRecordBatchDeleteForm{}
91
+	if err := c.ShouldBindJSON(f); err != nil {
92
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
93
+		return
94
+	}
95
+	if len(f.Ids) == 0 {
96
+		response.Fail(c, 101, response.TranslateMsg(c, "ParamsError"))
97
+		return
98
+	}
99
+	err := service.AllService.ShareRecordService.BatchDelete(f.Ids)
100
+	if err != nil {
101
+		response.Fail(c, 101, response.TranslateMsg(c, "OperationFailed")+err.Error())
102
+		return
103
+	}
104
+	response.Success(c, nil)
105
+}

+ 1 - 1
http/controller/admin/userToken.go

@@ -91,7 +91,7 @@ func (ct *UserToken) Delete(c *gin.Context) {
91 91
 // @Param body body admin.UserTokenBatchDeleteForm true "登录凭证信息"
92 92
 // @Success 200 {object} response.Response
93 93
 // @Failure 500 {object} response.Response
94
-// @Router /admin/user_token/delete [post]
94
+// @Router /admin/user_token/batchDelete [post]
95 95
 // @Security token
96 96
 func (ct *UserToken) BatchDelete(c *gin.Context) {
97 97
 	f := &admin.UserTokenBatchDeleteForm{}

+ 15 - 0
http/request/admin/shareRecord.go

@@ -0,0 +1,15 @@
1
+package admin
2
+
3
+type ShareRecordQuery struct {
4
+	UserId uint `json:"user_id" form:"user_id"`
5
+	PageQuery
6
+}
7
+
8
+type ShareRecordForm struct {
9
+	Id     uint `json:"id" form:"id"`
10
+	UserId uint `json:"user_id" form:"user_id"`
11
+}
12
+
13
+type PeerShareRecordBatchDeleteForm struct {
14
+	Ids []uint `json:"ids" validate:"required"`
15
+}

+ 5 - 5
http/response/admin/user.go

@@ -4,8 +4,8 @@ import "Gwen/model"
4 4
 
5 5
 type LoginPayload struct {
6 6
 	Username   string   `json:"username"`
7
-	Email	   string   `json:"email"`
8
-	Avatar	   string   `json:"avatar"`
7
+	Email      string   `json:"email"`
8
+	Avatar     string   `json:"avatar"`
9 9
 	Token      string   `json:"token"`
10 10
 	RouteNames []string `json:"route_names"`
11 11
 	Nickname   string   `json:"nickname"`
@@ -19,13 +19,13 @@ func (lp *LoginPayload) FromUser(user *model.User) {
19 19
 }
20 20
 
21 21
 var UserRouteNames = []string{
22
-	"MyTagList", "MyAddressBookList", "MyInfo", "MyAddressBookCollection", "MyPeer",
22
+	"MyTagList", "MyAddressBookList", "MyInfo", "MyAddressBookCollection", "MyPeer", "MyShareRecordList",
23 23
 }
24 24
 var AdminRouteNames = []string{"*"}
25 25
 
26 26
 type UserOauthItem struct {
27
-	Op 			string `json:"op"`
28
-	Status    	int    `json:"status"`
27
+	Op     string `json:"op"`
28
+	Status int    `json:"status"`
29 29
 }
30 30
 
31 31
 type GroupUsersPayload struct {

+ 27 - 3
http/router/admin.go

@@ -3,6 +3,7 @@ package router
3 3
 import (
4 4
 	_ "Gwen/docs/admin"
5 5
 	"Gwen/http/controller/admin"
6
+	"Gwen/http/controller/admin/my"
6 7
 	"Gwen/http/middleware"
7 8
 	"github.com/gin-gonic/gin"
8 9
 	swaggerFiles "github.com/swaggo/files"
@@ -34,11 +35,14 @@ func Init(g *gin.Engine) {
34 35
 	ConfigBind(adg)
35 36
 
36 37
 	//deprecated by ConfigBind
37
-	rs := &admin.Rustdesk{}
38
-	adg.GET("/server-config", rs.ServerConfig)
39
-	adg.GET("/app-config", rs.AppConfig)
38
+	//rs := &admin.Rustdesk{}
39
+	//adg.GET("/server-config", rs.ServerConfig)
40
+	//adg.GET("/app-config", rs.AppConfig)
40 41
 	//deprecated end
41 42
 
43
+	ShareRecordBind(adg)
44
+	MyBind(adg)
45
+
42 46
 	//访问静态文件
43 47
 	//g.StaticFS("/upload", http.Dir(global.Config.Gin.ResourcesPath+"/upload"))
44 48
 }
@@ -220,3 +224,23 @@ func FileBind(rg *gin.RouterGroup) {
220 224
 		aR.POST("/upload", cont.Upload)
221 225
 	}
222 226
 }*/
227
+
228
+func MyBind(rg *gin.RouterGroup) {
229
+	{
230
+		sr := &my.ShareRecord{}
231
+		rg.GET("/my/share_record/list", sr.List)
232
+		rg.POST("/my/share_record/delete", sr.Delete)
233
+		rg.POST("/my/share_record/batchDelete", sr.BatchDelete)
234
+	}
235
+}
236
+
237
+func ShareRecordBind(rg *gin.RouterGroup) {
238
+	aR := rg.Group("/share_record").Use(middleware.AdminPrivilege())
239
+	{
240
+		cont := &admin.ShareRecord{}
241
+		aR.GET("/list", cont.List)
242
+		aR.POST("/delete", cont.Delete)
243
+		aR.POST("/batchDelete", cont.BatchDelete)
244
+	}
245
+
246
+}

+ 6 - 0
model/shareRecord.go

@@ -10,3 +10,9 @@ type ShareRecord struct {
10 10
 	Expire       int64  `json:"expire" gorm:"default:0;not null;"`
11 11
 	TimeModel
12 12
 }
13
+
14
+// ShareRecordList 分享记录列表
15
+type ShareRecordList struct {
16
+	ShareRecords []*ShareRecord `json:"list,omitempty"`
17
+	Pagination
18
+}

+ 1 - 0
service/service.go

@@ -16,6 +16,7 @@ type Service struct {
16 16
 	*OauthService
17 17
 	*LoginLogService
18 18
 	*AuditService
19
+	*ShareRecordService
19 20
 }
20 21
 
21 22
 func New() *Service {

+ 49 - 0
service/shareRecord.go

@@ -0,0 +1,49 @@
1
+package service
2
+
3
+import (
4
+	"Gwen/global"
5
+	"Gwen/model"
6
+	"gorm.io/gorm"
7
+)
8
+
9
+type ShareRecordService struct {
10
+}
11
+
12
+// InfoById 根据用户id取用户信息
13
+func (srs *ShareRecordService) InfoById(id uint) *model.ShareRecord {
14
+	u := &model.ShareRecord{}
15
+	global.DB.Where("id = ?", id).First(u)
16
+	return u
17
+}
18
+
19
+func (srs *ShareRecordService) List(page, pageSize uint, where func(tx *gorm.DB)) (res *model.ShareRecordList) {
20
+	res = &model.ShareRecordList{}
21
+	res.Page = int64(page)
22
+	res.PageSize = int64(pageSize)
23
+	tx := global.DB.Model(&model.ShareRecord{})
24
+	if where != nil {
25
+		where(tx)
26
+	}
27
+	tx.Count(&res.Total)
28
+	tx.Scopes(Paginate(page, pageSize))
29
+	tx.Find(&res.ShareRecords)
30
+	return
31
+}
32
+
33
+// Create 创建
34
+func (srs *ShareRecordService) Create(u *model.ShareRecord) error {
35
+	res := global.DB.Create(u).Error
36
+	return res
37
+}
38
+func (srs *ShareRecordService) Delete(u *model.ShareRecord) error {
39
+	return global.DB.Delete(u).Error
40
+}
41
+
42
+// Update 更新
43
+func (srs *ShareRecordService) Update(u *model.ShareRecord) error {
44
+	return global.DB.Model(u).Updates(u).Error
45
+}
46
+
47
+func (srs *ShareRecordService) BatchDelete(ids []uint) error {
48
+	return global.DB.Where("id in (?)", ids).Delete(&model.ShareRecord{}).Error
49
+}