Compare commits
13 Commits
54bbea8a32
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 30864dbc40 | |||
| 7eae358996 | |||
| ecd8650e0a | |||
| 30ba2e8994 | |||
| 4aa48a822e | |||
| 83d722d2f1 | |||
| da26f9bbc9 | |||
| b34e628c2c | |||
| fb97cb9e2a | |||
| 1d5bc97cdd | |||
| 43ca340d54 | |||
| 6bc9f18199 | |||
| 63c8fb678c |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.idea
|
||||
777
Proto/RpcServer/gen/api.swagger.json
Normal file
777
Proto/RpcServer/gen/api.swagger.json
Normal file
@@ -0,0 +1,777 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "rs_common.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Gateway"
|
||||
},
|
||||
{
|
||||
"name": "Qgdzs"
|
||||
},
|
||||
{
|
||||
"name": "Scene"
|
||||
},
|
||||
{
|
||||
"name": "User"
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/qgdzs/auth/generate_question": {
|
||||
"post": {
|
||||
"summary": "生成题目",
|
||||
"operationId": "Qgdzs_GenerateQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenerateQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GenerateQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/auth/get_record": {
|
||||
"post": {
|
||||
"summary": "---------- 答题记录 ----------\n获取答题记录",
|
||||
"operationId": "Qgdzs_GetRecord",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetRecordResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetRecordReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/category/answer": {
|
||||
"post": {
|
||||
"summary": "回答题目",
|
||||
"operationId": "Qgdzs_CategoryAnswerQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CategoryAnswerQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CategoryAnswerQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/category/get_category": {
|
||||
"post": {
|
||||
"summary": "---------- 类目答题 ----------\n获取所有类目",
|
||||
"operationId": "Qgdzs_GetAllCategory",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetAllCategoryResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetAllCategoryReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/category/question": {
|
||||
"post": {
|
||||
"summary": "获取题目",
|
||||
"operationId": "Qgdzs_CategoryGetQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CategoryGetQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CategoryGetQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/get_question_info": {
|
||||
"post": {
|
||||
"summary": "获取具体的题目",
|
||||
"operationId": "Qgdzs_GetQuestionInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetQuestionInfoResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetQuestionInfoReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/quickly/answer": {
|
||||
"post": {
|
||||
"summary": "回答题目",
|
||||
"operationId": "Qgdzs_QuicklyAnswerQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/QuicklyAnswerQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/QuicklyAnswerQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/quickly/question": {
|
||||
"post": {
|
||||
"summary": "---------- 快速答题 ----------\n获取题目",
|
||||
"operationId": "Qgdzs_QuicklyGetQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/QuicklyGetQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/QuicklyGetQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/random/answer": {
|
||||
"post": {
|
||||
"summary": "回答题目",
|
||||
"operationId": "Qgdzs_RandomAnswerQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RandomAnswerQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RandomAnswerQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/qgdzs/open/random/question": {
|
||||
"post": {
|
||||
"summary": "---------- 随机答题 ----------\n获取题目",
|
||||
"operationId": "Qgdzs_RandomGetQuestion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RandomGetQuestionResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RandomGetQuestionReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"Qgdzs"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/user/auth/info": {
|
||||
"post": {
|
||||
"summary": "获取用户信息",
|
||||
"operationId": "User_GetUserInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetUserInfoResp"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetUserInfoReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"ActionResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"CategoryAnswerQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
}
|
||||
},
|
||||
"title": "---------- CategoryAnswerQuestion ----------"
|
||||
},
|
||||
"CategoryAnswerQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
},
|
||||
"explanation": {
|
||||
"type": "string",
|
||||
"title": "解析"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CategoryGetQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"category_sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "类目唯一标识"
|
||||
}
|
||||
},
|
||||
"title": "---------- CategoryGetQuestion ----------"
|
||||
},
|
||||
"CategoryGetQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "题干"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "选项"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "题目类型"
|
||||
},
|
||||
"difficulty": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "难度"
|
||||
}
|
||||
}
|
||||
},
|
||||
"EnterResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"SceneSID": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "场景服务ID"
|
||||
},
|
||||
"UniqueNo": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "副本唯一编号"
|
||||
},
|
||||
"MessageID": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "发送给客户端的消息ID"
|
||||
},
|
||||
"Payload": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"title": "消息负载"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GenerateQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"num": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "生成数量"
|
||||
}
|
||||
},
|
||||
"title": "---------- GenerateQuestion ----------"
|
||||
},
|
||||
"GenerateQuestionResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"GetAllCategoryItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "唯一标识"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "类目"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetAllCategoryReq": {
|
||||
"type": "object",
|
||||
"title": "---------- GetAllCategory ----------"
|
||||
},
|
||||
"GetAllCategoryResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/GetAllCategoryItem"
|
||||
},
|
||||
"title": "类目"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetQuestionInfoReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question_sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
}
|
||||
},
|
||||
"title": "---------- GetQuestionInfo ----------"
|
||||
},
|
||||
"GetQuestionInfoResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "题干"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "选项"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "类目"
|
||||
},
|
||||
"difficulty": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "难度"
|
||||
},
|
||||
"explanation": {
|
||||
"type": "string",
|
||||
"title": "解析"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetRecordItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question_sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "题干"
|
||||
},
|
||||
"difficulty": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "难度"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "题目类型"
|
||||
},
|
||||
"question_answer": {
|
||||
"type": "string",
|
||||
"title": "题目答案"
|
||||
},
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "用户答案"
|
||||
},
|
||||
"create_time": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "创建时间"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetRecordReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"page": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"page_size": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"title": "---------- GetRecord ----------"
|
||||
},
|
||||
"GetRecordResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "总数"
|
||||
},
|
||||
"records": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/GetRecordItem"
|
||||
},
|
||||
"title": "记录"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetUserInfoReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
}
|
||||
},
|
||||
"title": "---------- GetUserInfo ----------"
|
||||
},
|
||||
"GetUserInfoResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"KickUserResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"LeaveResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"PhoneLoginResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "用户ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "用户名"
|
||||
}
|
||||
}
|
||||
},
|
||||
"QuicklyAnswerQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
}
|
||||
},
|
||||
"title": "---------- QuicklyAnswerQuestion ----------"
|
||||
},
|
||||
"QuicklyAnswerQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
},
|
||||
"explanation": {
|
||||
"type": "string",
|
||||
"title": "解析"
|
||||
}
|
||||
}
|
||||
},
|
||||
"QuicklyGetQuestionReq": {
|
||||
"type": "object",
|
||||
"title": "---------- QuicklyGetQuestion ----------"
|
||||
},
|
||||
"QuicklyGetQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "题干"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "选项"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "题目类型"
|
||||
},
|
||||
"difficulty": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "难度"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RandomAnswerQuestionReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
}
|
||||
},
|
||||
"title": "---------- RandomAnswerQuestion ----------"
|
||||
},
|
||||
"RandomAnswerQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "答案"
|
||||
},
|
||||
"explanation": {
|
||||
"type": "string",
|
||||
"title": "解析"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RandomGetQuestionReq": {
|
||||
"type": "object",
|
||||
"title": "---------- RandomGetQuestion ----------"
|
||||
},
|
||||
"RandomGetQuestionResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"sn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "题目唯一标识"
|
||||
},
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "题干"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": "选项"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"title": "题目类型"
|
||||
},
|
||||
"difficulty": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "难度"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ToClientResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"WxMiniLoginResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "用户ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "用户名"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/ss/ss_common"
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -211,7 +211,7 @@ var File_service_gateway_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_gateway_proto_rawDesc = []byte{
|
||||
0x0a, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61,
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x0b, 0x54, 0x6f, 0x43, 0x6c,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x55, 0x53, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73,
|
||||
@@ -228,9 +228,11 @@ var file_service_gateway_proto_rawDesc = []byte{
|
||||
0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69,
|
||||
0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52,
|
||||
0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
||||
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,721 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: service_qgdzs.proto
|
||||
|
||||
/*
|
||||
Package grpc_pb is a reverse proxy.
|
||||
|
||||
It translates gRPC into RESTful JSON APIs.
|
||||
*/
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
var (
|
||||
_ codes.Code
|
||||
_ io.Reader
|
||||
_ status.Status
|
||||
_ = errors.New
|
||||
_ = runtime.String
|
||||
_ = utilities.NewDoubleArray
|
||||
_ = metadata.Join
|
||||
)
|
||||
|
||||
func request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GenerateQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GenerateQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GenerateQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RandomGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.RandomGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_RandomGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RandomGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.RandomGetQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_RandomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RandomAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.RandomAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_RandomAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq RandomAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.RandomAnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_GetAllCategory_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetAllCategoryReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetAllCategory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GetAllCategory_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetAllCategoryReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetAllCategory(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_CategoryGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CategoryGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.CategoryGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_CategoryGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CategoryGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.CategoryGetQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_CategoryAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CategoryAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.CategoryAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_CategoryAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq CategoryAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.CategoryAnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_QuicklyGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq QuicklyGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.QuicklyGetQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_QuicklyGetQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq QuicklyGetQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.QuicklyGetQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_QuicklyAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq QuicklyAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.QuicklyAnswerQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_QuicklyAnswerQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq QuicklyAnswerQuestionReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.QuicklyAnswerQuestion(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetRecordReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetRecord(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GetRecord_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetRecordReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetRecord(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QgdzsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionInfoReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := client.GetQuestionInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
func local_request_Qgdzs_GetQuestionInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QgdzsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var (
|
||||
protoReq GetQuestionInfoReq
|
||||
metadata runtime.ServerMetadata
|
||||
)
|
||||
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
msg, err := server.GetQuestionInfo(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerServer registers the http handlers for service Qgdzs to "mux".
|
||||
// UnaryRPC :call QgdzsServer directly.
|
||||
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
|
||||
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQgdzsHandlerFromEndpoint instead.
|
||||
// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
|
||||
func RegisterQgdzsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QgdzsServer) error {
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GenerateQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GenerateQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/RandomGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_RandomGetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_RandomGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/RandomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_RandomAnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_RandomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetAllCategory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/category/get_category"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GetAllCategory_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetAllCategory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/CategoryGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_CategoryGetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_CategoryGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/CategoryAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_CategoryAnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_CategoryAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/QuicklyGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_QuicklyGetQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_QuicklyGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/QuicklyAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_QuicklyAnswerQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_QuicklyAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetRecord", runtime.WithHTTPPathPattern("/qgdzs/auth/get_record"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GetRecord_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.Qgdzs/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Qgdzs_GetQuestionInfo_0(annotatedContext, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerFromEndpoint is same as RegisterQgdzsHandler but
|
||||
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
|
||||
func RegisterQgdzsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
|
||||
conn, err := grpc.NewClient(endpoint, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
if cerr := conn.Close(); cerr != nil {
|
||||
grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
|
||||
}
|
||||
}()
|
||||
}()
|
||||
return RegisterQgdzsHandler(ctx, mux, conn)
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandler registers the http handlers for service Qgdzs to "mux".
|
||||
// The handlers forward requests to the grpc endpoint over "conn".
|
||||
func RegisterQgdzsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
|
||||
return RegisterQgdzsHandlerClient(ctx, mux, NewQgdzsClient(conn))
|
||||
}
|
||||
|
||||
// RegisterQgdzsHandlerClient registers the http handlers for service Qgdzs
|
||||
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QgdzsClient".
|
||||
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QgdzsClient"
|
||||
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
|
||||
// "QgdzsClient" to call the correct interceptors. This client ignores the HTTP middlewares.
|
||||
func RegisterQgdzsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QgdzsClient) error {
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GenerateQuestion", runtime.WithHTTPPathPattern("/qgdzs/auth/generate_question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GenerateQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/RandomGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_RandomGetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_RandomGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_RandomAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/RandomAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/random/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_RandomAnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_RandomAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetAllCategory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetAllCategory", runtime.WithHTTPPathPattern("/qgdzs/open/category/get_category"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GetAllCategory_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetAllCategory_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/CategoryGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_CategoryGetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_CategoryGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_CategoryAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/CategoryAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/category/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_CategoryAnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_CategoryAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyGetQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/QuicklyGetQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/question"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_QuicklyGetQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_QuicklyGetQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_QuicklyAnswerQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/QuicklyAnswerQuestion", runtime.WithHTTPPathPattern("/qgdzs/open/quickly/answer"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_QuicklyAnswerQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_QuicklyAnswerQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetRecord_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetRecord", runtime.WithHTTPPathPattern("/qgdzs/auth/get_record"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GetRecord_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetRecord_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
mux.Handle(http.MethodPost, pattern_Qgdzs_GetQuestionInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.Qgdzs/GetQuestionInfo", runtime.WithHTTPPathPattern("/qgdzs/open/get_question_info"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_Qgdzs_GetQuestionInfo_0(annotatedContext, inboundMarshaler, client, req, pathParams)
|
||||
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
forward_Qgdzs_GetQuestionInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Qgdzs_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "generate_question"}, ""))
|
||||
pattern_Qgdzs_RandomGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "question"}, ""))
|
||||
pattern_Qgdzs_RandomAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "random", "answer"}, ""))
|
||||
pattern_Qgdzs_GetAllCategory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "get_category"}, ""))
|
||||
pattern_Qgdzs_CategoryGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "question"}, ""))
|
||||
pattern_Qgdzs_CategoryAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "category", "answer"}, ""))
|
||||
pattern_Qgdzs_QuicklyGetQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "question"}, ""))
|
||||
pattern_Qgdzs_QuicklyAnswerQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"qgdzs", "open", "quickly", "answer"}, ""))
|
||||
pattern_Qgdzs_GetRecord_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "auth", "get_record"}, ""))
|
||||
pattern_Qgdzs_GetQuestionInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qgdzs", "open", "get_question_info"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
forward_Qgdzs_GenerateQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_RandomGetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_RandomAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_GetAllCategory_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_CategoryGetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_CategoryAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_QuicklyGetQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_QuicklyAnswerQuestion_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_GetRecord_0 = runtime.ForwardResponseMessage
|
||||
forward_Qgdzs_GetQuestionInfo_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
@@ -0,0 +1,457 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v4.25.1
|
||||
// source: service_qgdzs.proto
|
||||
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// QgdzsClient is the client API for Qgdzs service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type QgdzsClient interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error)
|
||||
// 回答题目
|
||||
RandomAnswerQuestion(ctx context.Context, in *RandomAnswerQuestionReq, opts ...grpc.CallOption) (*RandomAnswerQuestionResp, error)
|
||||
// ---------- 类目答题 ----------
|
||||
// 获取所有类目
|
||||
GetAllCategory(ctx context.Context, in *GetAllCategoryReq, opts ...grpc.CallOption) (*GetAllCategoryResp, error)
|
||||
// 获取题目
|
||||
CategoryGetQuestion(ctx context.Context, in *CategoryGetQuestionReq, opts ...grpc.CallOption) (*CategoryGetQuestionResp, error)
|
||||
// 回答题目
|
||||
CategoryAnswerQuestion(ctx context.Context, in *CategoryAnswerQuestionReq, opts ...grpc.CallOption) (*CategoryAnswerQuestionResp, error)
|
||||
// ---------- 快速答题 ----------
|
||||
// 获取题目
|
||||
QuicklyGetQuestion(ctx context.Context, in *QuicklyGetQuestionReq, opts ...grpc.CallOption) (*QuicklyGetQuestionResp, error)
|
||||
// 回答题目
|
||||
QuicklyAnswerQuestion(ctx context.Context, in *QuicklyAnswerQuestionReq, opts ...grpc.CallOption) (*QuicklyAnswerQuestionResp, error)
|
||||
// ---------- 答题记录 ----------
|
||||
// 获取答题记录
|
||||
GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error)
|
||||
// 获取具体的题目
|
||||
GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error)
|
||||
}
|
||||
|
||||
type qgdzsClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewQgdzsClient(cc grpc.ClientConnInterface) QgdzsClient {
|
||||
return &qgdzsClient{cc}
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) {
|
||||
out := new(GenerateQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GenerateQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) RandomGetQuestion(ctx context.Context, in *RandomGetQuestionReq, opts ...grpc.CallOption) (*RandomGetQuestionResp, error) {
|
||||
out := new(RandomGetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/RandomGetQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) RandomAnswerQuestion(ctx context.Context, in *RandomAnswerQuestionReq, opts ...grpc.CallOption) (*RandomAnswerQuestionResp, error) {
|
||||
out := new(RandomAnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/RandomAnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GetAllCategory(ctx context.Context, in *GetAllCategoryReq, opts ...grpc.CallOption) (*GetAllCategoryResp, error) {
|
||||
out := new(GetAllCategoryResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GetAllCategory", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) CategoryGetQuestion(ctx context.Context, in *CategoryGetQuestionReq, opts ...grpc.CallOption) (*CategoryGetQuestionResp, error) {
|
||||
out := new(CategoryGetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/CategoryGetQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) CategoryAnswerQuestion(ctx context.Context, in *CategoryAnswerQuestionReq, opts ...grpc.CallOption) (*CategoryAnswerQuestionResp, error) {
|
||||
out := new(CategoryAnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/CategoryAnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) QuicklyGetQuestion(ctx context.Context, in *QuicklyGetQuestionReq, opts ...grpc.CallOption) (*QuicklyGetQuestionResp, error) {
|
||||
out := new(QuicklyGetQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/QuicklyGetQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) QuicklyAnswerQuestion(ctx context.Context, in *QuicklyAnswerQuestionReq, opts ...grpc.CallOption) (*QuicklyAnswerQuestionResp, error) {
|
||||
out := new(QuicklyAnswerQuestionResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/QuicklyAnswerQuestion", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GetRecord(ctx context.Context, in *GetRecordReq, opts ...grpc.CallOption) (*GetRecordResp, error) {
|
||||
out := new(GetRecordResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GetRecord", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *qgdzsClient) GetQuestionInfo(ctx context.Context, in *GetQuestionInfoReq, opts ...grpc.CallOption) (*GetQuestionInfoResp, error) {
|
||||
out := new(GetQuestionInfoResp)
|
||||
err := c.cc.Invoke(ctx, "/Qgdzs/GetQuestionInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QgdzsServer is the server API for Qgdzs service.
|
||||
// All implementations must embed UnimplementedQgdzsServer
|
||||
// for forward compatibility
|
||||
type QgdzsServer interface {
|
||||
// 生成题目
|
||||
GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error)
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error)
|
||||
// 回答题目
|
||||
RandomAnswerQuestion(context.Context, *RandomAnswerQuestionReq) (*RandomAnswerQuestionResp, error)
|
||||
// ---------- 类目答题 ----------
|
||||
// 获取所有类目
|
||||
GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error)
|
||||
// 获取题目
|
||||
CategoryGetQuestion(context.Context, *CategoryGetQuestionReq) (*CategoryGetQuestionResp, error)
|
||||
// 回答题目
|
||||
CategoryAnswerQuestion(context.Context, *CategoryAnswerQuestionReq) (*CategoryAnswerQuestionResp, error)
|
||||
// ---------- 快速答题 ----------
|
||||
// 获取题目
|
||||
QuicklyGetQuestion(context.Context, *QuicklyGetQuestionReq) (*QuicklyGetQuestionResp, error)
|
||||
// 回答题目
|
||||
QuicklyAnswerQuestion(context.Context, *QuicklyAnswerQuestionReq) (*QuicklyAnswerQuestionResp, error)
|
||||
// ---------- 答题记录 ----------
|
||||
// 获取答题记录
|
||||
GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error)
|
||||
// 获取具体的题目
|
||||
GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error)
|
||||
mustEmbedUnimplementedQgdzsServer()
|
||||
}
|
||||
|
||||
// UnimplementedQgdzsServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedQgdzsServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedQgdzsServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) RandomGetQuestion(context.Context, *RandomGetQuestionReq) (*RandomGetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RandomGetQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) RandomAnswerQuestion(context.Context, *RandomAnswerQuestionReq) (*RandomAnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RandomAnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) GetAllCategory(context.Context, *GetAllCategoryReq) (*GetAllCategoryResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetAllCategory not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) CategoryGetQuestion(context.Context, *CategoryGetQuestionReq) (*CategoryGetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CategoryGetQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) CategoryAnswerQuestion(context.Context, *CategoryAnswerQuestionReq) (*CategoryAnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CategoryAnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) QuicklyGetQuestion(context.Context, *QuicklyGetQuestionReq) (*QuicklyGetQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QuicklyGetQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) QuicklyAnswerQuestion(context.Context, *QuicklyAnswerQuestionReq) (*QuicklyAnswerQuestionResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method QuicklyAnswerQuestion not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) GetRecord(context.Context, *GetRecordReq) (*GetRecordResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRecord not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) GetQuestionInfo(context.Context, *GetQuestionInfoReq) (*GetQuestionInfoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetQuestionInfo not implemented")
|
||||
}
|
||||
func (UnimplementedQgdzsServer) mustEmbedUnimplementedQgdzsServer() {}
|
||||
|
||||
// UnsafeQgdzsServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to QgdzsServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeQgdzsServer interface {
|
||||
mustEmbedUnimplementedQgdzsServer()
|
||||
}
|
||||
|
||||
func RegisterQgdzsServer(s grpc.ServiceRegistrar, srv QgdzsServer) {
|
||||
s.RegisterService(&Qgdzs_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Qgdzs_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GenerateQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GenerateQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GenerateQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GenerateQuestion(ctx, req.(*GenerateQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_RandomGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RandomGetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).RandomGetQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/RandomGetQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).RandomGetQuestion(ctx, req.(*RandomGetQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_RandomAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RandomAnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).RandomAnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/RandomAnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).RandomAnswerQuestion(ctx, req.(*RandomAnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_GetAllCategory_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetAllCategoryReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GetAllCategory(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GetAllCategory",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GetAllCategory(ctx, req.(*GetAllCategoryReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_CategoryGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CategoryGetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).CategoryGetQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/CategoryGetQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).CategoryGetQuestion(ctx, req.(*CategoryGetQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_CategoryAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CategoryAnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).CategoryAnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/CategoryAnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).CategoryAnswerQuestion(ctx, req.(*CategoryAnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_QuicklyGetQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QuicklyGetQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).QuicklyGetQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/QuicklyGetQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).QuicklyGetQuestion(ctx, req.(*QuicklyGetQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_QuicklyAnswerQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QuicklyAnswerQuestionReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).QuicklyAnswerQuestion(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/QuicklyAnswerQuestion",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).QuicklyAnswerQuestion(ctx, req.(*QuicklyAnswerQuestionReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_GetRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetRecordReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GetRecord(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GetRecord",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GetRecord(ctx, req.(*GetRecordReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Qgdzs_GetQuestionInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetQuestionInfoReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QgdzsServer).GetQuestionInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Qgdzs/GetQuestionInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QgdzsServer).GetQuestionInfo(ctx, req.(*GetQuestionInfoReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Qgdzs_ServiceDesc is the grpc.ServiceDesc for Qgdzs service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Qgdzs_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Qgdzs",
|
||||
HandlerType: (*QgdzsServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GenerateQuestion",
|
||||
Handler: _Qgdzs_GenerateQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RandomGetQuestion",
|
||||
Handler: _Qgdzs_RandomGetQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RandomAnswerQuestion",
|
||||
Handler: _Qgdzs_RandomAnswerQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetAllCategory",
|
||||
Handler: _Qgdzs_GetAllCategory_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CategoryGetQuestion",
|
||||
Handler: _Qgdzs_CategoryGetQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CategoryAnswerQuestion",
|
||||
Handler: _Qgdzs_CategoryAnswerQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QuicklyGetQuestion",
|
||||
Handler: _Qgdzs_QuicklyGetQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QuicklyAnswerQuestion",
|
||||
Handler: _Qgdzs_QuicklyAnswerQuestion_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRecord",
|
||||
Handler: _Qgdzs_GetRecord_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetQuestionInfo",
|
||||
Handler: _Qgdzs_GetQuestionInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "service_qgdzs.proto",
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/ss/ss_common"
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -377,7 +377,7 @@ var File_service_scene_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_scene_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5c, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x03, 0x55, 0x53, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53,
|
||||
@@ -414,9 +414,10 @@ var file_service_scene_proto_rawDesc = []byte{
|
||||
0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a,
|
||||
0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01,
|
||||
0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69,
|
||||
0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73,
|
||||
0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -0,0 +1,518 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: service_user.proto
|
||||
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// ---------- PhoneLogin ----------
|
||||
type PhoneLoginReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Phone string `protobuf:"bytes,1,opt,name=Phone,json=phone,proto3" json:"Phone,omitempty"` // 手机号
|
||||
Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码
|
||||
}
|
||||
|
||||
func (x *PhoneLoginReq) Reset() {
|
||||
*x = PhoneLoginReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PhoneLoginReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PhoneLoginReq) ProtoMessage() {}
|
||||
|
||||
func (x *PhoneLoginReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PhoneLoginReq.ProtoReflect.Descriptor instead.
|
||||
func (*PhoneLoginReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PhoneLoginReq) GetPhone() string {
|
||||
if x != nil {
|
||||
return x.Phone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PhoneLoginReq) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type PhoneLoginResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) Reset() {
|
||||
*x = PhoneLoginResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PhoneLoginResp) ProtoMessage() {}
|
||||
|
||||
func (x *PhoneLoginResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use PhoneLoginResp.ProtoReflect.Descriptor instead.
|
||||
func (*PhoneLoginResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PhoneLoginResp) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ---------- WxMiniLogin ----------
|
||||
type WxMiniLoginReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Code string `protobuf:"bytes,1,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 微信小程序登录凭证
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginReq) Reset() {
|
||||
*x = WxMiniLoginReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WxMiniLoginReq) ProtoMessage() {}
|
||||
|
||||
func (x *WxMiniLoginReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WxMiniLoginReq.ProtoReflect.Descriptor instead.
|
||||
func (*WxMiniLoginReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginReq) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type WxMiniLoginResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) Reset() {
|
||||
*x = WxMiniLoginResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WxMiniLoginResp) ProtoMessage() {}
|
||||
|
||||
func (x *WxMiniLoginResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WxMiniLoginResp.ProtoReflect.Descriptor instead.
|
||||
func (*WxMiniLoginResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *WxMiniLoginResp) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ---------- GetUserInfo ----------
|
||||
type GetUserInfoReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) Reset() {
|
||||
*x = GetUserInfoReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserInfoReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserInfoReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetUserInfoResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) Reset() {
|
||||
*x = GetUserInfoResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserInfoResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserInfoResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_service_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_user_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x36,
|
||||
0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75,
|
||||
0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x0e, 0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69,
|
||||
0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x37, 0x0a, 0x0f,
|
||||
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73,
|
||||
0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74,
|
||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x32, 0xb9, 0x01, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x0a, 0x50,
|
||||
0x68, 0x6f, 0x6e, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
|
||||
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x50, 0x68, 0x6f, 0x6e,
|
||||
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0b,
|
||||
0x57, 0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x0f, 0x2e, 0x57, 0x78,
|
||||
0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x57,
|
||||
0x78, 0x4d, 0x69, 0x6e, 0x69, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
|
||||
0x12, 0x4c, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12,
|
||||
0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71,
|
||||
0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
|
||||
0x73, 0x70, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x3a, 0x01, 0x2a, 0x22, 0x0f, 0x2f,
|
||||
0x75, 0x73, 0x65, 0x72, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x36,
|
||||
0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f,
|
||||
0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x67,
|
||||
0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_user_proto_rawDescOnce sync.Once
|
||||
file_service_user_proto_rawDescData = file_service_user_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_user_proto_rawDescGZIP() []byte {
|
||||
file_service_user_proto_rawDescOnce.Do(func() {
|
||||
file_service_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_user_proto_rawDescData)
|
||||
})
|
||||
return file_service_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_service_user_proto_goTypes = []interface{}{
|
||||
(*PhoneLoginReq)(nil), // 0: PhoneLoginReq
|
||||
(*PhoneLoginResp)(nil), // 1: PhoneLoginResp
|
||||
(*WxMiniLoginReq)(nil), // 2: WxMiniLoginReq
|
||||
(*WxMiniLoginResp)(nil), // 3: WxMiniLoginResp
|
||||
(*GetUserInfoReq)(nil), // 4: GetUserInfoReq
|
||||
(*GetUserInfoResp)(nil), // 5: GetUserInfoResp
|
||||
}
|
||||
var file_service_user_proto_depIdxs = []int32{
|
||||
0, // 0: User.PhoneLogin:input_type -> PhoneLoginReq
|
||||
2, // 1: User.WxMiniLogin:input_type -> WxMiniLoginReq
|
||||
4, // 2: User.GetUserInfo:input_type -> GetUserInfoReq
|
||||
1, // 3: User.PhoneLogin:output_type -> PhoneLoginResp
|
||||
3, // 4: User.WxMiniLogin:output_type -> WxMiniLoginResp
|
||||
5, // 5: User.GetUserInfo:output_type -> GetUserInfoResp
|
||||
3, // [3:6] is the sub-list for method output_type
|
||||
0, // [0:3] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_user_proto_init() }
|
||||
func file_service_user_proto_init() {
|
||||
if File_service_user_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PhoneLoginReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PhoneLoginResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*WxMiniLoginReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*WxMiniLoginResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetUserInfoReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetUserInfoResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_user_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_user_proto_goTypes,
|
||||
DependencyIndexes: file_service_user_proto_depIdxs,
|
||||
MessageInfos: file_service_user_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_user_proto = out.File
|
||||
file_service_user_proto_rawDesc = nil
|
||||
file_service_user_proto_goTypes = nil
|
||||
file_service_user_proto_depIdxs = nil
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info"))
|
||||
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/auth/info"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -129,7 +129,7 @@ func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/info"))
|
||||
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GetUserInfo", runtime.WithHTTPPathPattern("/user/auth/info"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -146,7 +146,7 @@ func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, ""))
|
||||
pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"user", "auth", "info"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -22,7 +22,9 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type UserClient interface {
|
||||
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error)
|
||||
PhoneLogin(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*PhoneLoginResp, error)
|
||||
WxMiniLogin(ctx context.Context, in *WxMiniLoginReq, opts ...grpc.CallOption) (*WxMiniLoginResp, error)
|
||||
// 获取用户信息
|
||||
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
|
||||
}
|
||||
|
||||
@@ -34,9 +36,18 @@ func NewUserClient(cc grpc.ClientConnInterface) UserClient {
|
||||
return &userClient{cc}
|
||||
}
|
||||
|
||||
func (c *userClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) {
|
||||
out := new(LoginResp)
|
||||
err := c.cc.Invoke(ctx, "/User/Login", in, out, opts...)
|
||||
func (c *userClient) PhoneLogin(ctx context.Context, in *PhoneLoginReq, opts ...grpc.CallOption) (*PhoneLoginResp, error) {
|
||||
out := new(PhoneLoginResp)
|
||||
err := c.cc.Invoke(ctx, "/User/PhoneLogin", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userClient) WxMiniLogin(ctx context.Context, in *WxMiniLoginReq, opts ...grpc.CallOption) (*WxMiniLoginResp, error) {
|
||||
out := new(WxMiniLoginResp)
|
||||
err := c.cc.Invoke(ctx, "/User/WxMiniLogin", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -56,7 +67,9 @@ func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts .
|
||||
// All implementations must embed UnimplementedUserServer
|
||||
// for forward compatibility
|
||||
type UserServer interface {
|
||||
Login(context.Context, *LoginReq) (*LoginResp, error)
|
||||
PhoneLogin(context.Context, *PhoneLoginReq) (*PhoneLoginResp, error)
|
||||
WxMiniLogin(context.Context, *WxMiniLoginReq) (*WxMiniLoginResp, error)
|
||||
// 获取用户信息
|
||||
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
|
||||
mustEmbedUnimplementedUserServer()
|
||||
}
|
||||
@@ -65,8 +78,11 @@ type UserServer interface {
|
||||
type UnimplementedUserServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
|
||||
func (UnimplementedUserServer) PhoneLogin(context.Context, *PhoneLoginReq) (*PhoneLoginResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PhoneLogin not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) WxMiniLogin(context.Context, *WxMiniLoginReq) (*WxMiniLoginResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method WxMiniLogin not implemented")
|
||||
}
|
||||
func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
|
||||
@@ -84,20 +100,38 @@ func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
|
||||
s.RegisterService(&User_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _User_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LoginReq)
|
||||
func _User_PhoneLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(PhoneLoginReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).Login(ctx, in)
|
||||
return srv.(UserServer).PhoneLogin(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/User/Login",
|
||||
FullMethod: "/User/PhoneLogin",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).Login(ctx, req.(*LoginReq))
|
||||
return srv.(UserServer).PhoneLogin(ctx, req.(*PhoneLoginReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _User_WxMiniLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(WxMiniLoginReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserServer).WxMiniLogin(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/User/WxMiniLogin",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserServer).WxMiniLogin(ctx, req.(*WxMiniLoginReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -128,8 +162,12 @@ var User_ServiceDesc = grpc.ServiceDesc{
|
||||
HandlerType: (*UserServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Login",
|
||||
Handler: _User_Login_Handler,
|
||||
MethodName: "PhoneLogin",
|
||||
Handler: _User_PhoneLogin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "WxMiniLogin",
|
||||
Handler: _User_WxMiniLogin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserInfo",
|
||||
@@ -2,9 +2,9 @@
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: ss_common.proto
|
||||
// source: rs_common.proto
|
||||
|
||||
package ss_common
|
||||
package rs_common
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -32,7 +32,7 @@ type ErrorInfo struct {
|
||||
func (x *ErrorInfo) Reset() {
|
||||
*x = ErrorInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ss_common_proto_msgTypes[0]
|
||||
mi := &file_rs_common_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -45,7 +45,7 @@ func (x *ErrorInfo) String() string {
|
||||
func (*ErrorInfo) ProtoMessage() {}
|
||||
|
||||
func (x *ErrorInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ss_common_proto_msgTypes[0]
|
||||
mi := &file_rs_common_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -58,7 +58,7 @@ func (x *ErrorInfo) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ErrorInfo.ProtoReflect.Descriptor instead.
|
||||
func (*ErrorInfo) Descriptor() ([]byte, []int) {
|
||||
return file_ss_common_proto_rawDescGZIP(), []int{0}
|
||||
return file_rs_common_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ErrorInfo) GetCode() int32 {
|
||||
@@ -75,35 +75,37 @@ func (x *ErrorInfo) GetMsg() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_ss_common_proto protoreflect.FileDescriptor
|
||||
var File_rs_common_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ss_common_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
var file_rs_common_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x22, 0x31, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x4d, 0x73, 0x67, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
|
||||
0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x03, 0x4d, 0x73, 0x67, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71,
|
||||
0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2f, 0x72, 0x73, 0x2f, 0x72, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_ss_common_proto_rawDescOnce sync.Once
|
||||
file_ss_common_proto_rawDescData = file_ss_common_proto_rawDesc
|
||||
file_rs_common_proto_rawDescOnce sync.Once
|
||||
file_rs_common_proto_rawDescData = file_rs_common_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_ss_common_proto_rawDescGZIP() []byte {
|
||||
file_ss_common_proto_rawDescOnce.Do(func() {
|
||||
file_ss_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_ss_common_proto_rawDescData)
|
||||
func file_rs_common_proto_rawDescGZIP() []byte {
|
||||
file_rs_common_proto_rawDescOnce.Do(func() {
|
||||
file_rs_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_rs_common_proto_rawDescData)
|
||||
})
|
||||
return file_ss_common_proto_rawDescData
|
||||
return file_rs_common_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_ss_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_ss_common_proto_goTypes = []interface{}{
|
||||
var file_rs_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_rs_common_proto_goTypes = []interface{}{
|
||||
(*ErrorInfo)(nil), // 0: ErrorInfo
|
||||
}
|
||||
var file_ss_common_proto_depIdxs = []int32{
|
||||
var file_rs_common_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
@@ -111,13 +113,13 @@ var file_ss_common_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ss_common_proto_init() }
|
||||
func file_ss_common_proto_init() {
|
||||
if File_ss_common_proto != nil {
|
||||
func init() { file_rs_common_proto_init() }
|
||||
func file_rs_common_proto_init() {
|
||||
if File_rs_common_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_ss_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_rs_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ErrorInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -134,18 +136,18 @@ func file_ss_common_proto_init() {
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ss_common_proto_rawDesc,
|
||||
RawDescriptor: file_rs_common_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_ss_common_proto_goTypes,
|
||||
DependencyIndexes: file_ss_common_proto_depIdxs,
|
||||
MessageInfos: file_ss_common_proto_msgTypes,
|
||||
GoTypes: file_rs_common_proto_goTypes,
|
||||
DependencyIndexes: file_rs_common_proto_depIdxs,
|
||||
MessageInfos: file_rs_common_proto_msgTypes,
|
||||
}.Build()
|
||||
File_ss_common_proto = out.File
|
||||
file_ss_common_proto_rawDesc = nil
|
||||
file_ss_common_proto_goTypes = nil
|
||||
file_ss_common_proto_depIdxs = nil
|
||||
File_rs_common_proto = out.File
|
||||
file_rs_common_proto_rawDesc = nil
|
||||
file_rs_common_proto_goTypes = nil
|
||||
file_rs_common_proto_depIdxs = nil
|
||||
}
|
||||
13
Proto/RpcServer/gen_proto.ps1
Normal file
13
Proto/RpcServer/gen_proto.ps1
Normal file
@@ -0,0 +1,13 @@
|
||||
$gen = "gen"
|
||||
if (!(Test-Path $gen)) { mkdir $gen | Out-Null }
|
||||
|
||||
$files = Get-ChildItem sources/*.proto | ForEach-Object { $_.Name }
|
||||
|
||||
protoc `
|
||||
--proto_path=sources `
|
||||
--go_out=$gen `
|
||||
--go-grpc_out=$gen `
|
||||
--grpc-gateway_out=$gen `
|
||||
--openapiv2_out=$gen `
|
||||
--openapiv2_opt=allow_merge=true,merge_file_name=api,disable_default_errors=true `
|
||||
$files
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/ss/ss_common";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/rs_common";
|
||||
|
||||
message ErrorInfo {
|
||||
int32 Code = 1;
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/ss/grpc_pb";
|
||||
import "ss_common.proto";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb";
|
||||
import "rs_common.proto";
|
||||
|
||||
service Gateway {
|
||||
// 发送消息到客户端
|
||||
153
Proto/RpcServer/sources/service_qgdzs.proto
Normal file
153
Proto/RpcServer/sources/service_qgdzs.proto
Normal file
@@ -0,0 +1,153 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb";
|
||||
import "rs_common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service Qgdzs {
|
||||
// 生成题目
|
||||
rpc GenerateQuestion(GenerateQuestionReq) returns (GenerateQuestionResp) {option (google.api.http) = {post: "/qgdzs/auth/generate_question" body: "*"};}
|
||||
|
||||
// ---------- 随机答题 ----------
|
||||
// 获取题目
|
||||
rpc RandomGetQuestion(RandomGetQuestionReq) returns (RandomGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/random/question" body: "*"};}
|
||||
// 回答题目
|
||||
rpc RandomAnswerQuestion(RandomAnswerQuestionReq) returns (RandomAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/random/answer" body: "*"};}
|
||||
|
||||
// ---------- 类目答题 ----------
|
||||
// 获取所有类目
|
||||
rpc GetAllCategory(GetAllCategoryReq) returns (GetAllCategoryResp) {option (google.api.http) = {post: "/qgdzs/open/category/get_category" body: "*"};}
|
||||
// 获取题目
|
||||
rpc CategoryGetQuestion(CategoryGetQuestionReq) returns (CategoryGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/category/question" body: "*"};}
|
||||
// 回答题目
|
||||
rpc CategoryAnswerQuestion(CategoryAnswerQuestionReq) returns (CategoryAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/category/answer" body: "*"};}
|
||||
|
||||
// ---------- 快速答题 ----------
|
||||
// 获取题目
|
||||
rpc QuicklyGetQuestion(QuicklyGetQuestionReq) returns (QuicklyGetQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/quickly/question" body: "*"};}
|
||||
// 回答题目
|
||||
rpc QuicklyAnswerQuestion(QuicklyAnswerQuestionReq) returns (QuicklyAnswerQuestionResp) {option (google.api.http) = {post: "/qgdzs/open/quickly/answer" body: "*"};}
|
||||
|
||||
// ---------- 答题记录 ----------
|
||||
// 获取答题记录
|
||||
rpc GetRecord(GetRecordReq) returns (GetRecordResp) {option (google.api.http) = {post: "/qgdzs/auth/get_record" body: "*"};}
|
||||
// 获取具体的题目
|
||||
rpc GetQuestionInfo(GetQuestionInfoReq) returns (GetQuestionInfoResp) {option (google.api.http) = {post: "/qgdzs/open/get_question_info" body: "*"};}
|
||||
}
|
||||
|
||||
// ---------- GenerateQuestion ----------
|
||||
message GenerateQuestionReq {
|
||||
int32 Num = 1 [json_name = "num"]; // 生成数量
|
||||
}
|
||||
message GenerateQuestionResp {
|
||||
}
|
||||
|
||||
// ---------- RandomGetQuestion ----------
|
||||
message RandomGetQuestionReq {
|
||||
}
|
||||
message RandomGetQuestionResp {
|
||||
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
|
||||
string Question = 2 [json_name = "question"]; // 题干
|
||||
repeated string Options = 3 [json_name = "options"]; // 选项
|
||||
string Category = 4 [json_name = "category"]; // 题目类型
|
||||
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
|
||||
}
|
||||
|
||||
// ---------- RandomAnswerQuestion ----------
|
||||
message RandomAnswerQuestionReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
|
||||
string Answer = 3 [json_name = "answer"]; // 答案
|
||||
}
|
||||
message RandomAnswerQuestionResp {
|
||||
string Answer = 1 [json_name = "answer"]; // 答案
|
||||
string Explanation = 2 [json_name = "explanation"]; // 解析
|
||||
}
|
||||
|
||||
// ---------- GetAllCategory ----------
|
||||
message GetAllCategoryReq {
|
||||
}
|
||||
message GetAllCategoryResp {
|
||||
repeated GetAllCategoryItem Categories = 1 [json_name = "categories"]; // 类目
|
||||
}
|
||||
message GetAllCategoryItem {
|
||||
int64 Sn = 1 [json_name = "sn"]; // 唯一标识
|
||||
string Category = 2 [json_name = "category"]; // 类目
|
||||
}
|
||||
|
||||
// ---------- CategoryGetQuestion ----------
|
||||
message CategoryGetQuestionReq {
|
||||
int64 CategorySn = 1 [json_name = "category_sn"]; // 类目唯一标识
|
||||
}
|
||||
message CategoryGetQuestionResp {
|
||||
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
|
||||
string Question = 2 [json_name = "question"]; // 题干
|
||||
repeated string Options = 3 [json_name = "options"]; // 选项
|
||||
string Category = 4 [json_name = "category"]; // 题目类型
|
||||
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
|
||||
}
|
||||
|
||||
// ---------- CategoryAnswerQuestion ----------
|
||||
message CategoryAnswerQuestionReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
|
||||
string Answer = 3 [json_name = "answer"]; // 答案
|
||||
}
|
||||
message CategoryAnswerQuestionResp {
|
||||
string Answer = 1 [json_name = "answer"]; // 答案
|
||||
string Explanation = 2 [json_name = "explanation"]; // 解析
|
||||
}
|
||||
|
||||
// ---------- QuicklyGetQuestion ----------
|
||||
message QuicklyGetQuestionReq {
|
||||
}
|
||||
message QuicklyGetQuestionResp {
|
||||
int64 Sn = 1 [json_name = "sn"]; // 题目唯一标识
|
||||
string Question = 2 [json_name = "question"]; // 题干
|
||||
repeated string Options = 3 [json_name = "options"]; // 选项
|
||||
string Category = 4 [json_name = "category"]; // 题目类型
|
||||
int32 Difficulty = 5 [json_name = "difficulty"]; // 难度
|
||||
}
|
||||
|
||||
// ---------- QuicklyAnswerQuestion ----------
|
||||
message QuicklyAnswerQuestionReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
int64 Sn = 2 [json_name = "sn"]; // 题目唯一标识
|
||||
string Answer = 3 [json_name = "answer"]; // 答案
|
||||
}
|
||||
message QuicklyAnswerQuestionResp {
|
||||
string Answer = 1 [json_name = "answer"]; // 答案
|
||||
string Explanation = 2 [json_name = "explanation"]; // 解析
|
||||
}
|
||||
|
||||
// ---------- GetRecord ----------
|
||||
message GetRecordReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
int32 Page = 2 [json_name = "page"];
|
||||
int32 PageSize = 3 [json_name = "page_size"];
|
||||
}
|
||||
message GetRecordResp {
|
||||
int32 Count = 1 [json_name = "count"]; // 总数
|
||||
repeated GetRecordItem Records = 2 [json_name = "records"]; // 记录
|
||||
}
|
||||
message GetRecordItem {
|
||||
int64 QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
|
||||
string Question = 2 [json_name = "question"]; // 题干
|
||||
int32 Difficulty = 3 [json_name = "difficulty"]; // 难度
|
||||
string Category = 4 [json_name = "category"]; // 题目类型
|
||||
string QuestionAnswer = 5 [json_name = "question_answer"]; // 题目答案
|
||||
string Answer = 6 [json_name = "answer"]; // 用户答案
|
||||
int64 CreateTime = 7 [json_name = "create_time"]; // 创建时间
|
||||
}
|
||||
|
||||
// ---------- GetQuestionInfo ----------
|
||||
message GetQuestionInfoReq {
|
||||
int64 QuestionSn = 1 [json_name = "question_sn"]; // 题目唯一标识
|
||||
}
|
||||
message GetQuestionInfoResp {
|
||||
string Question = 1 [json_name = "question"]; // 题干
|
||||
repeated string Options = 2 [json_name = "options"]; // 选项
|
||||
string Category = 3 [json_name = "category"]; // 类目
|
||||
int32 Difficulty = 4 [json_name = "difficulty"]; // 难度
|
||||
string Explanation = 5 [json_name = "explanation"]; // 解析
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/ss/grpc_pb";
|
||||
import "ss_common.proto";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb";
|
||||
import "rs_common.proto";
|
||||
|
||||
service Scene {
|
||||
rpc Enter(EnterReq) returns (EnterResp) {}
|
||||
40
Proto/RpcServer/sources/service_user.proto
Normal file
40
Proto/RpcServer/sources/service_user.proto
Normal file
@@ -0,0 +1,40 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/rs/grpc_pb";
|
||||
import "rs_common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service User {
|
||||
rpc PhoneLogin(PhoneLoginReq) returns (PhoneLoginResp) {}
|
||||
rpc WxMiniLogin(WxMiniLoginReq) returns (WxMiniLoginResp) {}
|
||||
// 获取用户信息
|
||||
rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp) {option (google.api.http) = {post: "/user/auth/info" body: "*"};}
|
||||
}
|
||||
|
||||
// ---------- PhoneLogin ----------
|
||||
message PhoneLoginReq {
|
||||
string Phone = 1 [json_name = "phone"]; // 手机号
|
||||
string Code = 2 [json_name = "code"]; // 验证码
|
||||
}
|
||||
message PhoneLoginResp {
|
||||
int64 USN = 1 [json_name = "usn"]; // 用户ID
|
||||
string Name = 2 [json_name = "name"]; // 用户名
|
||||
}
|
||||
|
||||
// ---------- WxMiniLogin ----------
|
||||
message WxMiniLoginReq {
|
||||
string Code = 1 [json_name = "code"]; // 微信小程序登录凭证
|
||||
}
|
||||
message WxMiniLoginResp {
|
||||
int64 USN = 1 [json_name = "usn"]; // 用户ID
|
||||
string Name = 2 [json_name = "name"]; // 用户名
|
||||
}
|
||||
|
||||
// ---------- GetUserInfo ----------
|
||||
message GetUserInfoReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
}
|
||||
message GetUserInfoResp {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
string Name = 2 [json_name = "name"];
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: sc_common.proto
|
||||
|
||||
package sc_common
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
var File_sc_common_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_sc_common_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x42, 0x1b, 0x5a, 0x19, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_sc_common_proto_goTypes = []interface{}{}
|
||||
var file_sc_common_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_sc_common_proto_init() }
|
||||
func file_sc_common_proto_init() {
|
||||
if File_sc_common_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_sc_common_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_sc_common_proto_goTypes,
|
||||
DependencyIndexes: file_sc_common_proto_depIdxs,
|
||||
}.Build()
|
||||
File_sc_common_proto = out.File
|
||||
file_sc_common_proto_rawDesc = nil
|
||||
file_sc_common_proto_goTypes = nil
|
||||
file_sc_common_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
|
||||
if not exist "./gen" (
|
||||
mkdir "./gen"
|
||||
)
|
||||
|
||||
protoc --proto_path=./sources --go_out=./gen ./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
|
||||
if not exist "./gen/client" (
|
||||
mkdir "./gen/client"
|
||||
)
|
||||
protoc --proto_path=./sources --csharp_out=./gen/client ./sources/*.proto
|
||||
@REM xcopy "./gen/client" "../../../Client/Point/Assets/Scripts/Proto" /E /I /Y /Q
|
||||
@@ -1,3 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/sc/sc_common";
|
||||
@@ -1,372 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: service_user.proto
|
||||
|
||||
package grpc_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/ss/ss_common"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type LoginReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Phone string `protobuf:"bytes,1,opt,name=Phone,json=phone,proto3" json:"Phone,omitempty"` // 手机号
|
||||
Code string `protobuf:"bytes,2,opt,name=Code,json=code,proto3" json:"Code,omitempty"` // 验证码
|
||||
}
|
||||
|
||||
func (x *LoginReq) Reset() {
|
||||
*x = LoginReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *LoginReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LoginReq) ProtoMessage() {}
|
||||
|
||||
func (x *LoginReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.
|
||||
func (*LoginReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *LoginReq) GetPhone() string {
|
||||
if x != nil {
|
||||
return x.Phone
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *LoginReq) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type LoginResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"` // 用户ID
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"` // 用户名
|
||||
}
|
||||
|
||||
func (x *LoginResp) Reset() {
|
||||
*x = LoginResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *LoginResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LoginResp) ProtoMessage() {}
|
||||
|
||||
func (x *LoginResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LoginResp.ProtoReflect.Descriptor instead.
|
||||
func (*LoginResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *LoginResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *LoginResp) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetUserInfoReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) Reset() {
|
||||
*x = GetUserInfoReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserInfoReq) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserInfoReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserInfoReq.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserInfoReq) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoReq) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetUserInfoResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
USN int64 `protobuf:"varint,1,opt,name=USN,json=usn,proto3" json:"USN,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=Name,json=name,proto3" json:"Name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) Reset() {
|
||||
*x = GetUserInfoResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_service_user_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserInfoResp) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserInfoResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_service_user_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetUserInfoResp.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserInfoResp) Descriptor() ([]byte, []int) {
|
||||
return file_service_user_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetUSN() int64 {
|
||||
if x != nil {
|
||||
return x.USN
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetUserInfoResp) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_service_user_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_user_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x31, 0x0a, 0x09, 0x4c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x22, 0x0a, 0x0e,
|
||||
0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e,
|
||||
0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
||||
0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65,
|
||||
0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67,
|
||||
0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a,
|
||||
0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x19, 0x5a, 0x17,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f,
|
||||
0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_service_user_proto_rawDescOnce sync.Once
|
||||
file_service_user_proto_rawDescData = file_service_user_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_service_user_proto_rawDescGZIP() []byte {
|
||||
file_service_user_proto_rawDescOnce.Do(func() {
|
||||
file_service_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_user_proto_rawDescData)
|
||||
})
|
||||
return file_service_user_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_service_user_proto_goTypes = []interface{}{
|
||||
(*LoginReq)(nil), // 0: LoginReq
|
||||
(*LoginResp)(nil), // 1: LoginResp
|
||||
(*GetUserInfoReq)(nil), // 2: GetUserInfoReq
|
||||
(*GetUserInfoResp)(nil), // 3: GetUserInfoResp
|
||||
}
|
||||
var file_service_user_proto_depIdxs = []int32{
|
||||
0, // 0: User.Login:input_type -> LoginReq
|
||||
2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq
|
||||
1, // 2: User.Login:output_type -> LoginResp
|
||||
3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_service_user_proto_init() }
|
||||
func file_service_user_proto_init() {
|
||||
if File_service_user_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_service_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LoginReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LoginResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetUserInfoReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_service_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetUserInfoResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_service_user_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_service_user_proto_goTypes,
|
||||
DependencyIndexes: file_service_user_proto_depIdxs,
|
||||
MessageInfos: file_service_user_proto_msgTypes,
|
||||
}.Build()
|
||||
File_service_user_proto = out.File
|
||||
file_service_user_proto_rawDesc = nil
|
||||
file_service_user_proto_goTypes = nil
|
||||
file_service_user_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "service_gateway.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Gateway"
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {},
|
||||
"definitions": {
|
||||
"KickUserResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"ToClientResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "service_scene.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Scene"
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {},
|
||||
"definitions": {
|
||||
"ActionResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"EnterResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"SceneSID": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "场景服务ID"
|
||||
},
|
||||
"UniqueNo": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "副本唯一编号"
|
||||
},
|
||||
"MessageID": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"title": "发送给客户端的消息ID"
|
||||
},
|
||||
"Payload": {
|
||||
"type": "string",
|
||||
"format": "byte",
|
||||
"title": "消息负载"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LeaveResp": {
|
||||
"type": "object"
|
||||
},
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "service_user.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "User"
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {
|
||||
"/user/info": {
|
||||
"post": {
|
||||
"operationId": "User_GetUserInfo",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetUserInfoResp"
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GetUserInfoReq"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"User"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"GetUserInfoReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
},
|
||||
"GetUserInfoResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LoginResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"usn": {
|
||||
"type": "string",
|
||||
"format": "int64",
|
||||
"title": "用户ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"title": "用户名"
|
||||
}
|
||||
}
|
||||
},
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "ss_common.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"paths": {},
|
||||
"definitions": {
|
||||
"protobufAny": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"@type": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {}
|
||||
},
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"details": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/protobufAny"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
|
||||
if not exist "./gen" (
|
||||
mkdir "./gen"
|
||||
)
|
||||
|
||||
protoc ^
|
||||
--proto_path=./sources ^
|
||||
--go_out=./gen ^
|
||||
--go-grpc_out=./gen ^
|
||||
--grpc-gateway_out=./gen ^
|
||||
--openapiv2_out=./gen ^
|
||||
./sources/*.proto
|
||||
@REM xcopy "./gen/common" "../../../Server/common" /E /I /Y /Q
|
||||
@@ -1,34 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/ss/grpc_pb";
|
||||
import "ss_common.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
service User {
|
||||
rpc Login(LoginReq) returns (LoginResp) {}
|
||||
rpc GetUserInfo(GetUserInfoReq) returns (GetUserInfoResp) {
|
||||
option (google.api.http) = {
|
||||
post: "/user/info"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message LoginReq {
|
||||
string Phone = 1 [json_name = "phone"]; // 手机号
|
||||
string Code = 2 [json_name = "code"]; // 验证码
|
||||
}
|
||||
|
||||
message LoginResp {
|
||||
int64 USN = 1 [json_name = "usn"]; // 用户ID
|
||||
string Name = 2 [json_name = "name"]; // 用户名
|
||||
}
|
||||
|
||||
message GetUserInfoReq {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
}
|
||||
|
||||
message GetUserInfoResp {
|
||||
int64 USN = 1 [json_name = "usn"];
|
||||
string Name = 2 [json_name = "name"];
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public static partial class ActionReflection {
|
||||
static ActionReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CgxhY3Rpb24ucHJvdG8aD3NjX2NvbW1vbi5wcm90byInChFDMlNfRW50ZXJJ",
|
||||
"CgxhY3Rpb24ucHJvdG8aD3NzX2NvbW1vbi5wcm90byInChFDMlNfRW50ZXJJ",
|
||||
"bnN0YW5jZRISCgpJbnN0YW5jZUlEGAEgASgFIjAKEVMyQ19FbnRlckluc3Rh",
|
||||
"bmNlEhsKBEluZm8YASABKAsyDS5Qb3NpdGlvbkluZm8ieQoKQzJTX0FjdGlv",
|
||||
"bhIQCghTZXF1ZW5jZRgBIAEoDRIRCglUaW1lc3RhbXAYAiABKAMSGQoGQWN0",
|
||||
@@ -31,10 +31,10 @@ public static partial class ActionReflection {
|
||||
"IAEoAxIJCgFYGAIgASgREgkKAVkYAyABKBEiKwoMUzJDX1Bvc2l0aW9uEhsK",
|
||||
"BEluZm8YASADKAsyDS5Qb3NpdGlvbkluZm8qSwoIQWN0aW9uSUQSFQoRQUNU",
|
||||
"SU9OX0lEX0lOVkFMSUQQABISCg5BQ1RJT05fSURfTU9WRRABEhQKEEFDVElP",
|
||||
"Tl9JRF9BVFRBQ0sQAkIXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3Rv",
|
||||
"Mw=="));
|
||||
"Tl9JRF9BVFRBQ0sQAkI0WjJnaXQuaGxzcS5hc2lhL21tb3JwZy9zZXJ2aWNl",
|
||||
"LWNvbW1vbi9wcm90by9zcy9zc19wYmIGcHJvdG8z"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, },
|
||||
new pbr::FileDescriptor[] { global::SsCommonReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ActionID), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::C2S_EnterInstance), global::C2S_EnterInstance.Parser, new[]{ "InstanceID" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::S2C_EnterInstance), global::S2C_EnterInstance.Parser, new[]{ "Info" }, null, null, null, null),
|
||||
@@ -22,15 +22,16 @@ public static partial class DefineReflection {
|
||||
static DefineReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"CgxkZWZpbmUucHJvdG8aD3NjX2NvbW1vbi5wcm90byIyCgdNZXNzYWdlEhYK",
|
||||
"CgxkZWZpbmUucHJvdG8aD3NzX2NvbW1vbi5wcm90byIyCgdNZXNzYWdlEhYK",
|
||||
"AklEGAEgASgOMgouTWVzc2FnZUlEEg8KB1BheWxvYWQYAiABKAwqwgEKCU1l",
|
||||
"c3NhZ2VJRBIWChJNRVNTQUdFX0lEX0lOVkFMSUQQABIXChNNRVNTQUdFX0lE",
|
||||
"X0tJQ0tfT1VUEAESFwoTTUVTU0FHRV9JRF9RVUVVRV9VUBACEhwKGE1FU1NB",
|
||||
"R0VfSURfTE9HSU5fU1VDQ0VTUxADEh0KGU1FU1NBR0VfSURfRU5URVJfSU5T",
|
||||
"VEFOQ0UQZRIVChFNRVNTQUdFX0lEX0FDVElPThBmEhcKE01FU1NBR0VfSURf",
|
||||
"UE9TSVRJT04QZ0IXWhVjb21tb24vcHJvdG8vc2Mvc2NfcGJiBnByb3RvMw=="));
|
||||
"UE9TSVRJT04QZ0I0WjJnaXQuaGxzcS5hc2lhL21tb3JwZy9zZXJ2aWNlLWNv",
|
||||
"bW1vbi9wcm90by9zcy9zc19wYmIGcHJvdG8z"));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, },
|
||||
new pbr::FileDescriptor[] { global::SsCommonReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MessageID), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Message), global::Message.Parser, new[]{ "ID", "Payload" }, null, null, null, null)
|
||||
}));
|
||||
@@ -22,17 +22,17 @@ public static partial class ServiceReflection {
|
||||
static ServiceReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"Cg1zZXJ2aWNlLnByb3RvGg9zY19jb21tb24ucHJvdG8iJQoLUzJDX0tpY2tP",
|
||||
"Cg1zZXJ2aWNlLnByb3RvGg9zc19jb21tb24ucHJvdG8iJQoLUzJDX0tpY2tP",
|
||||
"dXQSFgoCSUQYASABKA4yCi5LaWNrT3V0SUQiIwoLUzJDX1F1ZXVlVXASFAoM",
|
||||
"UXVldWVVcENvdW50GAEgASgFIiYKEFMyQ19Mb2dpblN1Y2Nlc3MSEgoKSW5z",
|
||||
"dGFuY2VJRBgBIAEoBSq+AQoJS2lja091dElEEhcKE0tJQ0tfT1VUX0lEX0lO",
|
||||
"VkFMSUQQABIfChtLSUNLX09VVF9JRF9EVVBMSUNBVEVfTE9HSU4QARIbChdL",
|
||||
"SUNLX09VVF9JRF9TRVJWRVJfQlVTWRACEhwKGEtJQ0tfT1VUX0lEX1NFUlZF",
|
||||
"Ul9DTE9TRRADEh0KGUtJQ0tfT1VUX0lEX1FVRVVFX1VQX0ZVTEwQBBIdChlL",
|
||||
"SUNLX09VVF9JRF9UT0tFTl9JTlZBTElEEAVCF1oVY29tbW9uL3Byb3RvL3Nj",
|
||||
"L3NjX3BiYgZwcm90bzM="));
|
||||
"SUNLX09VVF9JRF9UT0tFTl9JTlZBTElEEAVCNFoyZ2l0Lmhsc3EuYXNpYS9t",
|
||||
"bW9ycGcvc2VydmljZS1jb21tb24vcHJvdG8vc3Mvc3NfcGJiBnByb3RvMw=="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { global::ScCommonReflection.Descriptor, },
|
||||
new pbr::FileDescriptor[] { global::SsCommonReflection.Descriptor, },
|
||||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::KickOutID), }, null, new pbr::GeneratedClrTypeInfo[] {
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::S2C_KickOut), global::S2C_KickOut.Parser, new[]{ "ID" }, null, null, null, null),
|
||||
new pbr::GeneratedClrTypeInfo(typeof(global::S2C_QueueUp), global::S2C_QueueUp.Parser, new[]{ "QueueUpCount" }, null, null, null, null),
|
||||
@@ -1,6 +1,6 @@
|
||||
// <auto-generated>
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: sc_common.proto
|
||||
// source: ss_common.proto
|
||||
// </auto-generated>
|
||||
#pragma warning disable 1591, 0612, 3021, 8981
|
||||
#region Designer generated code
|
||||
@@ -9,21 +9,21 @@ using pb = global::Google.Protobuf;
|
||||
using pbc = global::Google.Protobuf.Collections;
|
||||
using pbr = global::Google.Protobuf.Reflection;
|
||||
using scg = global::System.Collections.Generic;
|
||||
/// <summary>Holder for reflection information generated from sc_common.proto</summary>
|
||||
public static partial class ScCommonReflection {
|
||||
/// <summary>Holder for reflection information generated from ss_common.proto</summary>
|
||||
public static partial class SsCommonReflection {
|
||||
|
||||
#region Descriptor
|
||||
/// <summary>File descriptor for sc_common.proto</summary>
|
||||
/// <summary>File descriptor for ss_common.proto</summary>
|
||||
public static pbr::FileDescriptor Descriptor {
|
||||
get { return descriptor; }
|
||||
}
|
||||
private static pbr::FileDescriptor descriptor;
|
||||
|
||||
static ScCommonReflection() {
|
||||
static SsCommonReflection() {
|
||||
byte[] descriptorData = global::System.Convert.FromBase64String(
|
||||
string.Concat(
|
||||
"Cg9zY19jb21tb24ucHJvdG9CG1oZY29tbW9uL3Byb3RvL3NjL3NjX2NvbW1v",
|
||||
"bmIGcHJvdG8z"));
|
||||
"Cg9zc19jb21tb24ucHJvdG9COFo2Z2l0Lmhsc3EuYXNpYS9tbW9ycGcvc2Vy",
|
||||
"dmljZS1jb21tb24vcHJvdG8vc3Mvc3NfY29tbW9uYgZwcm90bzM="));
|
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
|
||||
new pbr::FileDescriptor[] { },
|
||||
new pbr::GeneratedClrTypeInfo(null, null, null));
|
||||
@@ -0,0 +1,64 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.32.0
|
||||
// protoc v4.25.1
|
||||
// source: ss_common.proto
|
||||
|
||||
package ss_common
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
var File_ss_common_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ss_common_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73,
|
||||
0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73,
|
||||
0x73, 0x2f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_ss_common_proto_goTypes = []interface{}{}
|
||||
var file_ss_common_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ss_common_proto_init() }
|
||||
func file_ss_common_proto_init() {
|
||||
if File_ss_common_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ss_common_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_ss_common_proto_goTypes,
|
||||
DependencyIndexes: file_ss_common_proto_depIdxs,
|
||||
}.Build()
|
||||
File_ss_common_proto = out.File
|
||||
file_ss_common_proto_rawDesc = nil
|
||||
file_ss_common_proto_goTypes = nil
|
||||
file_ss_common_proto_depIdxs = nil
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
// protoc v4.25.1
|
||||
// source: action.proto
|
||||
|
||||
package sc_pb
|
||||
package ss_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/sc/sc_common"
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -368,7 +368,7 @@ var File_action_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_action_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f,
|
||||
0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x33, 0x0a, 0x11, 0x43, 0x32, 0x53, 0x5f, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6e, 0x63, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65,
|
||||
0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e,
|
||||
@@ -398,9 +398,11 @@ var file_action_proto_rawDesc = []byte{
|
||||
0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x10, 0x00, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f, 0x4d, 0x4f, 0x56, 0x45,
|
||||
0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x49, 0x44, 0x5f,
|
||||
0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70,
|
||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x41, 0x54, 0x54, 0x41, 0x43, 0x4b, 0x10, 0x02, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e,
|
||||
0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67,
|
||||
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -4,10 +4,10 @@
|
||||
// protoc v4.25.1
|
||||
// source: define.proto
|
||||
|
||||
package sc_pb
|
||||
package ss_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/sc/sc_common"
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -141,7 +141,7 @@ var File_define_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_define_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f,
|
||||
0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x3f, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x02, 0x49, 0x44,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x49, 0x44, 0x52, 0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||
@@ -158,9 +158,11 @@ var file_define_proto_rawDesc = []byte{
|
||||
0x4e, 0x43, 0x45, 0x10, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45,
|
||||
0x5f, 0x49, 0x44, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x66, 0x12, 0x17, 0x0a, 0x13,
|
||||
0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x49, 0x44, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54,
|
||||
0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x49, 0x4f, 0x4e, 0x10, 0x67, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73,
|
||||
0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -4,10 +4,10 @@
|
||||
// protoc v4.25.1
|
||||
// source: service.proto
|
||||
|
||||
package sc_pb
|
||||
package ss_pb
|
||||
|
||||
import (
|
||||
_ "common/proto/sc/sc_common"
|
||||
_ "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -227,7 +227,7 @@ var File_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x0f, 0x73, 0x63, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x0f, 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x22, 0x29, 0x0a, 0x0b, 0x53, 0x32, 0x43, 0x5f, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x12,
|
||||
0x1a, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x4b, 0x69,
|
||||
0x63, 0x6b, 0x4f, 0x75, 0x74, 0x49, 0x44, 0x52, 0x02, 0x49, 0x44, 0x22, 0x31, 0x0a, 0x0b, 0x53,
|
||||
@@ -249,9 +249,11 @@ var file_service_proto_rawDesc = []byte{
|
||||
0x54, 0x5f, 0x49, 0x44, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x5f, 0x55, 0x50, 0x5f, 0x46, 0x55,
|
||||
0x4c, 0x4c, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x4b, 0x49, 0x43, 0x4b, 0x5f, 0x4f, 0x55, 0x54,
|
||||
0x5f, 0x49, 0x44, 0x5f, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49,
|
||||
0x44, 0x10, 0x05, 0x42, 0x17, 0x5a, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x63, 0x2f, 0x73, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x44, 0x10, 0x05, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e,
|
||||
0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x73, 0x73, 0x2f, 0x73, 0x73, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
17
Proto/SocketServer/gen_proto.ps1
Normal file
17
Proto/SocketServer/gen_proto.ps1
Normal file
@@ -0,0 +1,17 @@
|
||||
$gen = "gen"
|
||||
if (!(Test-Path $gen)) { mkdir $gen | Out-Null }
|
||||
|
||||
$files = Get-ChildItem sources/*.proto | ForEach-Object { $_.Name }
|
||||
|
||||
protoc `
|
||||
--proto_path=sources `
|
||||
--go_out=$gen `
|
||||
$files
|
||||
|
||||
$clientDir = "$gen/client"
|
||||
if (!(Test-Path $clientDir)) { mkdir $clientDir | Out-Null }
|
||||
|
||||
protoc `
|
||||
--proto_path=sources `
|
||||
--csharp_out=$clientDir `
|
||||
$files
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/sc/sc_pb";
|
||||
import "sc_common.proto";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb";
|
||||
import "ss_common.proto";
|
||||
|
||||
// MESSAGE_ID_ENTER_INSTANCE
|
||||
message C2S_EnterInstance {
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/sc/sc_pb";
|
||||
import "sc_common.proto";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb";
|
||||
import "ss_common.proto";
|
||||
|
||||
enum MessageID {
|
||||
MESSAGE_ID_INVALID = 0;
|
||||
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "common/proto/sc/sc_pb";
|
||||
import "sc_common.proto";
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_pb";
|
||||
import "ss_common.proto";
|
||||
|
||||
// MESSAGE_ID_KICK_OUT
|
||||
enum KickOutID {
|
||||
3
Proto/SocketServer/sources/ss_common.proto
Normal file
3
Proto/SocketServer/sources/ss_common.proto
Normal file
@@ -0,0 +1,3 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "git.hlsq.asia/mmorpg/service-common/proto/ss/ss_common";
|
||||
@@ -43,6 +43,7 @@ sudo chown -R 1000:1000 jenkins/
|
||||
sudo chown -R 472:472 grafana/
|
||||
sudo chown -R 65534:65534 prometheus/
|
||||
sudo chown -R 1000:1000 gitea/
|
||||
sudo chown -R 1000:1000 kafka/
|
||||
|
||||
nginx auth:
|
||||
nginx验证:printf "admin:$(openssl passwd -crypt uF8uY4eM0nS9dA4iZ1bV4hE6)\n" >>./prometheus_passwd
|
||||
@@ -52,13 +53,61 @@ registry验证:htpasswd -Bbn admin pD4hC1jY1bB0pY4kF4tC > ./registry_passwd
|
||||
Jenkins账密:admin 4f848ffe54ef45eda56eebd62bc90ea0
|
||||
Grafana账密:admin pT1rA0yL0mK3iA8tJ4kE
|
||||
|
||||
|
||||
etcd通道
|
||||
ssh -L 2379:localhost:2379 root@47.108.184.184 yT1vU8fH5mP0rQ6h
|
||||
|
||||
|
||||
registry命令:
|
||||
curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/_catalog
|
||||
curl -XGET -u admin:pD4hC1jY1bB0pY4kF4tC http://127.0.0.1:5000/v2/server-gateway/tags/list
|
||||
|
||||
生成ssh
|
||||
ssh-keygen -t rsa -b 4096 -C "jenkins-to-aliyun" -f ~/.ssh/jenkins -N ""
|
||||
ssh-copy-id root@47.108.184.184
|
||||
|
||||
mockgen -source ./proto/ss/grpc_pb/service_user_grpc.pb.go -destination ./proto/ss/grpc_pb/mocks/service_user_grpc.pb.go -package mocks
|
||||
生成mock代码
|
||||
mockgen -source ./proto/rs/grpc_pb/service_user_grpc.pb.go -destination ./proto/rs/grpc_pb/mocks/service_user_grpc.pb.go -package mocks
|
||||
|
||||
交叉编译:
|
||||
sudo docker run --rm --privileged tonistiigi/binfmt --install all
|
||||
sudo docker buildx create --name multi-arch-builder --use --bootstrap
|
||||
查看构建器列表:sudo docker buildx ls
|
||||
让构建器重新扫描QUEM文件:sudo docker buildx inspect --bootstrap
|
||||
|
||||
|
||||
客户端VPN设置
|
||||
iptables -t nat -A POSTROUTING -s 172.18.0.0/24 -o eth0 -j MASQUERADE
|
||||
iptables -t nat -A POSTROUTING -s 172.18.0.0/24 -o peer1 -j MASQUERADE
|
||||
iptables -A FORWARD -i eth0 -o peer1 -j ACCEPT
|
||||
iptables -A FORWARD -i peer1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
docker exec wireguard-client /bin/bash -c '
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
HOST_IP=$(ip route | awk "/default/ {print \$3}")
|
||||
iptables -t nat -A PREROUTING -d 192.168.30.2 -j DNAT --to-destination $HOST_IP
|
||||
iptables -t nat -A POSTROUTING -s $HOST_IP -j SNAT --to-source 192.168.30.2
|
||||
iptables -P FORWARD ACCEPT
|
||||
'
|
||||
|
||||
PostUp = sysctl -w net.ipv4.ip_forward=1
|
||||
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
|
||||
PostUp = iptables -A FORWARD -i wg0 -o eth0 -j ACCEPT
|
||||
PostUp = iptables -A FORWARD -i eth0 -o wg0 -j ACCEPT
|
||||
PostUp = iptables -A INPUT -i wg0 -j ACCEPT
|
||||
|
||||
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
|
||||
PostDown = iptables -D FORWARD -i wg0 -o eth0 -j ACCEPT
|
||||
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
|
||||
PostDown = iptables -D INPUT -i wg0 -j ACCEPT
|
||||
|
||||
服务端VPN设置
|
||||
iptables -t nat -A POSTROUTING -s 10.255.12.0/24 -o eth0 -j MASQUERADE
|
||||
iptables -t nat -A POSTROUTING -s 10.255.12.0/24 -o wg0 -j MASQUERADE
|
||||
iptables -A FORWARD -i eth0 -o wg0 -j ACCEPT
|
||||
iptables -A FORWARD -i wg0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
|
||||
docker exec wireguard-service /bin/bash -c '
|
||||
echo 1 > /proc/sys/net/ipv4/ip_forward
|
||||
HOST_IP=$(ip route | awk "/default/ {print \$3}")
|
||||
iptables -t nat -A PREROUTING -d 192.168.30.1 -j DNAT --to-destination $HOST_IP
|
||||
iptables -t nat -A POSTROUTING -s $HOST_IP -j SNAT --to-source 192.168.30.1
|
||||
iptables -P FORWARD ACCEPT
|
||||
'
|
||||
|
||||
sudo ip route add 192.168.30.0/24 via 10.255.12.6
|
||||
11
Publish/docker-compose-clash.yml
Normal file
11
Publish/docker-compose-clash.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
services:
|
||||
# yacd.haishan.me
|
||||
mihomo:
|
||||
image: metacubex/mihomo:v1.19.19
|
||||
container_name: mihomo
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "7890:7890"
|
||||
- "9094:9090"
|
||||
volumes:
|
||||
- ./clash:/root/.config/mihomo
|
||||
10
Publish/docker-compose-dns.yml
Normal file
10
Publish/docker-compose-dns.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
dnsmasq:
|
||||
image: 4km3/dnsmasq:2.90-r3-alpine-3.22.2
|
||||
container_name: dnsmasq
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "53:53/udp"
|
||||
- "53:53/tcp"
|
||||
volumes:
|
||||
- ./dnsmasq/dnsmasq.conf:/etc/dnsmasq.conf
|
||||
9
Publish/docker-compose-jaeger.yml
Normal file
9
Publish/docker-compose-jaeger.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
services:
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:1.76.0
|
||||
container_name: jaeger
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "4317:4317"
|
||||
- "5778:5778"
|
||||
34
Publish/docker-compose-kafka.yml
Normal file
34
Publish/docker-compose-kafka.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
services:
|
||||
kafka:
|
||||
image: confluentinc/cp-kafka:7.7.7
|
||||
container_name: kafka
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '9092:9092'
|
||||
- '9095:9095'
|
||||
- '9096:9096'
|
||||
environment:
|
||||
CLUSTER_ID: "NB2XQ2LBN5UGK2I="
|
||||
KAFKA_NODE_ID: 1
|
||||
KAFKA_PROCESS_ROLES: "controller,broker"
|
||||
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:9093"
|
||||
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
|
||||
KAFKA_LISTENERS: "PLAINTEXT://:9092,CONTROLLER://:9093,LOCAL://:9095,UI://:9096"
|
||||
KAFKA_ADVERTISED_LISTENERS: "PLAINTEXT://127.0.0.1:9092,LOCAL://172.18.28.0:9095,UI://192.168.31.10:9096"
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT,LOCAL:PLAINTEXT,UI:PLAINTEXT"
|
||||
KAFKA_CONTROLLER_LOG_DIRS: "/var/lib/kafka/data/controller-logs"
|
||||
KAFKA_LOG_DIRS: "/var/lib/kafka/data/logs"
|
||||
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
||||
volumes:
|
||||
- './kafka:/var/lib/kafka/data'
|
||||
|
||||
kafka-ui:
|
||||
image: provectuslabs/kafka-ui:v0.7.2
|
||||
container_name: kafka-ui
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '8082:8080'
|
||||
environment:
|
||||
DYNAMIC_CONFIG_ENABLED: 'true'
|
||||
@@ -16,6 +16,7 @@ services:
|
||||
container_name: node_exporter
|
||||
command:
|
||||
- '--path.rootfs=/host'
|
||||
- '--web.listen-address=:9101'
|
||||
network_mode: host
|
||||
pid: host
|
||||
restart: unless-stopped
|
||||
|
||||
46
Publish/docker-compose-vpn.yml
Normal file
46
Publish/docker-compose-vpn.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
services:
|
||||
wireguard-service:
|
||||
image: linuxserver/wireguard:1.0.20250521
|
||||
container_name: wireguard-service
|
||||
restart: unless-stopped
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- SYS_MODULE
|
||||
environment:
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
TZ: "Etc/UTC"
|
||||
SERVERURL: "www.hlsq.asia"
|
||||
SERVERPORT: "51820"
|
||||
PEERS: 2
|
||||
PEERDNS: "auto"
|
||||
INTERNAL_SUBNET: "192.168.30.0"
|
||||
ALLOWEDIPS: "0.0.0.0/0"
|
||||
volumes:
|
||||
- ./wireguard-service:/config
|
||||
- /lib/modules:/lib/modules:ro
|
||||
ports:
|
||||
- "51820:51820/udp"
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
- net.ipv4.conf.all.src_valid_mark=1
|
||||
|
||||
wireguard-client:
|
||||
image: linuxserver/wireguard:1.0.20250521
|
||||
container_name: wireguard-client
|
||||
restart: unless-stopped
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- SYS_MODULE
|
||||
environment:
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
TZ: "Etc/UTC"
|
||||
CLIENT: 1
|
||||
CONFIG_FILE: "/config/wg_confs/peer1.conf"
|
||||
volumes:
|
||||
- ./wireguard-client:/config
|
||||
- /lib/modules:/lib/modules:ro
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
- net.ipv4.conf.all.src_valid_mark=1
|
||||
34
Publish/prometheus-service.json
Normal file
34
Publish/prometheus-service.json
Normal file
@@ -0,0 +1,34 @@
|
||||
[
|
||||
{
|
||||
"targets": [
|
||||
"192.168.31.10:18504"
|
||||
],
|
||||
"labels": {
|
||||
"job": "server-gateway"
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [
|
||||
"192.168.31.10:18801"
|
||||
],
|
||||
"labels": {
|
||||
"job": "server-user"
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [
|
||||
"192.168.31.10:18701"
|
||||
],
|
||||
"labels": {
|
||||
"job": "server-scene"
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [
|
||||
"192.168.31.10:18601"
|
||||
],
|
||||
"labels": {
|
||||
"job": "server-qgdzs"
|
||||
}
|
||||
}
|
||||
]
|
||||
12
Publish/tunnel.ps1
Normal file
12
Publish/tunnel.ps1
Normal file
@@ -0,0 +1,12 @@
|
||||
Write-Host "tunnel success..."
|
||||
ssh -N `
|
||||
-L 3001:localhost:3001 `
|
||||
-L 4317:localhost:4317 `
|
||||
-L 6379:localhost:6379 `
|
||||
-L 2379:localhost:2379 `
|
||||
-L 3306:localhost:3306 `
|
||||
-L 9093:localhost:9093 `
|
||||
-L 9094:localhost:9094 `
|
||||
-L 9092:localhost:9092 `
|
||||
-L 8082:localhost:8082 `
|
||||
root@47.108.184.184
|
||||
@@ -1,16 +1,20 @@
|
||||
# gen.ps1 - 极简版
|
||||
# gen.ps1 - 支持参数版
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$dbName
|
||||
)
|
||||
& .\gentool.exe `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(47.108.184.184:3306)/user_db?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-dsn "root:gR9pV4tY7zR6qL3e@tcp(127.0.0.1:3306)/${dbName}?charset=utf8mb4&parseTime=True&loc=Local" `
|
||||
-fieldSignable `
|
||||
-outPath "./user_db/query"
|
||||
-outPath "./${dbName}/query"
|
||||
|
||||
Get-ChildItem ./user_db/model/*.gen.go | ForEach-Object {
|
||||
Get-ChildItem ./${dbName}/model/*.gen.go | ForEach-Object {
|
||||
$c = Get-Content $_.FullName -Raw -Encoding UTF8
|
||||
if ($c -match '\bSn\s+int64\b' -and $c -notmatch 'BeforeCreate') {
|
||||
$c -match 'type\s+(\w+)\s+struct' | Out-Null
|
||||
$n = $matches[1]
|
||||
$c = $c -replace '(?s)(import\s*\([^)]*)', "`$1`t`"common/utils`"`n"
|
||||
$hook = "`n`n// auto sn`nfunc (m *$n) BeforeCreate(_ *gorm.DB) error {`n`tif m.Sn == 0 {`n`t`tm.Sn = utils.SnowflakeInstance().Generate().Int64()`n`t}`n`treturn nil`n}"
|
||||
$c = $c -replace '(?s)(import\s*\([^)]*)', "`$1`t`"git.hlsq.asia/mmorpg/service-common/utils`"`n"
|
||||
$hook = "`n`n// Auto sn`nfunc (m *$n) BeforeCreate(_ *gorm.DB) error {`n`tif m.Sn == 0 {`n`t`tm.Sn = utils.SnowflakeInstance().Generate().Int64()`n`t}`n`treturn nil`n}"
|
||||
Set-Content $_.FullName ($c.TrimEnd() + $hook) -Encoding UTF8
|
||||
}
|
||||
}
|
||||
3
Tools/mysql_model/go.mod
Normal file
3
Tools/mysql_model/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module git.hlsq.asia/mmorpg
|
||||
|
||||
go 1.23.1
|
||||
37
Tools/mysql_model/qgdzs_db/model/categories.gen.go
Normal file
37
Tools/mysql_model/qgdzs_db/model/categories.gen.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameCategory = "categories"
|
||||
|
||||
// Category mapped from table <categories>
|
||||
type Category struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
Category string `gorm:"column:category;not null;comment:分类" json:"category"` // 分类
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName Category's table name
|
||||
func (*Category) TableName() string {
|
||||
return TableNameCategory
|
||||
}
|
||||
|
||||
// Auto sn
|
||||
func (m *Category) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
38
Tools/mysql_model/qgdzs_db/model/point_card.gen.go
Normal file
38
Tools/mysql_model/qgdzs_db/model/point_card.gen.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNamePointCard = "point_card"
|
||||
|
||||
// PointCard mapped from table <point_card>
|
||||
type PointCard struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
|
||||
Point int64 `gorm:"column:point;not null;comment:积分" json:"point"` // 积分
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName PointCard's table name
|
||||
func (*PointCard) TableName() string {
|
||||
return TableNamePointCard
|
||||
}
|
||||
|
||||
// Auto sn
|
||||
func (m *PointCard) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
46
Tools/mysql_model/qgdzs_db/model/point_records.gen.go
Normal file
46
Tools/mysql_model/qgdzs_db/model/point_records.gen.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNamePointRecord = "point_records"
|
||||
|
||||
// PointRecord mapped from table <point_records>
|
||||
type PointRecord struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
|
||||
/*
|
||||
来源:
|
||||
0. 未知
|
||||
1. 随机答题
|
||||
2. 类目答题
|
||||
3. 限时答题
|
||||
*/
|
||||
Source int32 `gorm:"column:source;not null;comment:来源:\n0. 未知\n1. 随机答题\n2. 类目答题\n3. 限时答题" json:"source"`
|
||||
Point int64 `gorm:"column:point;not null;comment:积分" json:"point"` // 积分
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName PointRecord's table name
|
||||
func (*PointRecord) TableName() string {
|
||||
return TableNamePointRecord
|
||||
}
|
||||
|
||||
// Auto sn
|
||||
func (m *PointRecord) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
42
Tools/mysql_model/qgdzs_db/model/questions.gen.go
Normal file
42
Tools/mysql_model/qgdzs_db/model/questions.gen.go
Normal file
@@ -0,0 +1,42 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameQuestion = "questions"
|
||||
|
||||
// Question mapped from table <questions>
|
||||
type Question struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
Question string `gorm:"column:question;not null;comment:题干" json:"question"` // 题干
|
||||
Options string `gorm:"column:options;not null;comment:选项" json:"options"` // 选项
|
||||
Answer string `gorm:"column:answer;not null;comment:答案" json:"answer"` // 答案
|
||||
Explanation string `gorm:"column:explanation;not null;comment:解析" json:"explanation"` // 解析
|
||||
Difficulty int32 `gorm:"column:difficulty;not null;comment:难度分 0 - 100" json:"difficulty"` // 难度分 0 - 100
|
||||
CategorySn int64 `gorm:"column:category_sn;not null;comment:分类-唯一编号" json:"category_sn"` // 分类-唯一编号
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName Question's table name
|
||||
func (*Question) TableName() string {
|
||||
return TableNameQuestion
|
||||
}
|
||||
|
||||
// Auto sn
|
||||
func (m *Question) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
40
Tools/mysql_model/qgdzs_db/model/records.gen.go
Normal file
40
Tools/mysql_model/qgdzs_db/model/records.gen.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameRecord = "records"
|
||||
|
||||
// Record mapped from table <records>
|
||||
type Record struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
|
||||
QuestionSn int64 `gorm:"column:question_sn;not null;comment:题目-唯一编号" json:"question_sn"` // 题目-唯一编号
|
||||
Answer string `gorm:"column:answer;not null;comment:答案" json:"answer"` // 答案
|
||||
IsCorrect int32 `gorm:"column:is_correct;not null;comment:是否正确 0 否 1 是" json:"is_correct"` // 是否正确 0 否 1 是
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName Record's table name
|
||||
func (*Record) TableName() string {
|
||||
return TableNameRecord
|
||||
}
|
||||
|
||||
// Auto sn
|
||||
func (m *Record) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
347
Tools/mysql_model/qgdzs_db/query/categories.gen.go
Normal file
347
Tools/mysql_model/qgdzs_db/query/categories.gen.go
Normal file
@@ -0,0 +1,347 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/qgdzs_db/model"
|
||||
)
|
||||
|
||||
func newCategory(db *gorm.DB, opts ...gen.DOOption) category {
|
||||
_category := category{}
|
||||
|
||||
_category.categoryDo.UseDB(db, opts...)
|
||||
_category.categoryDo.UseModel(&model.Category{})
|
||||
|
||||
tableName := _category.categoryDo.TableName()
|
||||
_category.ALL = field.NewAsterisk(tableName)
|
||||
_category.ID = field.NewUint64(tableName, "id")
|
||||
_category.Sn = field.NewInt64(tableName, "sn")
|
||||
_category.Category = field.NewString(tableName, "category")
|
||||
_category.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_category.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_category.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_category.fillFieldMap()
|
||||
|
||||
return _category
|
||||
}
|
||||
|
||||
type category struct {
|
||||
categoryDo categoryDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
Category field.String // 分类
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (c category) Table(newTableName string) *category {
|
||||
c.categoryDo.UseTable(newTableName)
|
||||
return c.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (c category) As(alias string) *category {
|
||||
c.categoryDo.DO = *(c.categoryDo.As(alias).(*gen.DO))
|
||||
return c.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (c *category) updateTableName(table string) *category {
|
||||
c.ALL = field.NewAsterisk(table)
|
||||
c.ID = field.NewUint64(table, "id")
|
||||
c.Sn = field.NewInt64(table, "sn")
|
||||
c.Category = field.NewString(table, "category")
|
||||
c.CreatedAt = field.NewTime(table, "created_at")
|
||||
c.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
c.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
c.fillFieldMap()
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *category) WithContext(ctx context.Context) *categoryDo { return c.categoryDo.WithContext(ctx) }
|
||||
|
||||
func (c category) TableName() string { return c.categoryDo.TableName() }
|
||||
|
||||
func (c category) Alias() string { return c.categoryDo.Alias() }
|
||||
|
||||
func (c category) Columns(cols ...field.Expr) gen.Columns { return c.categoryDo.Columns(cols...) }
|
||||
|
||||
func (c *category) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := c.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (c *category) fillFieldMap() {
|
||||
c.fieldMap = make(map[string]field.Expr, 6)
|
||||
c.fieldMap["id"] = c.ID
|
||||
c.fieldMap["sn"] = c.Sn
|
||||
c.fieldMap["category"] = c.Category
|
||||
c.fieldMap["created_at"] = c.CreatedAt
|
||||
c.fieldMap["updated_at"] = c.UpdatedAt
|
||||
c.fieldMap["deleted_at"] = c.DeletedAt
|
||||
}
|
||||
|
||||
func (c category) clone(db *gorm.DB) category {
|
||||
c.categoryDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return c
|
||||
}
|
||||
|
||||
func (c category) replaceDB(db *gorm.DB) category {
|
||||
c.categoryDo.ReplaceDB(db)
|
||||
return c
|
||||
}
|
||||
|
||||
type categoryDo struct{ gen.DO }
|
||||
|
||||
func (c categoryDo) Debug() *categoryDo {
|
||||
return c.withDO(c.DO.Debug())
|
||||
}
|
||||
|
||||
func (c categoryDo) WithContext(ctx context.Context) *categoryDo {
|
||||
return c.withDO(c.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (c categoryDo) ReadDB() *categoryDo {
|
||||
return c.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (c categoryDo) WriteDB() *categoryDo {
|
||||
return c.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (c categoryDo) Session(config *gorm.Session) *categoryDo {
|
||||
return c.withDO(c.DO.Session(config))
|
||||
}
|
||||
|
||||
func (c categoryDo) Clauses(conds ...clause.Expression) *categoryDo {
|
||||
return c.withDO(c.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Returning(value interface{}, columns ...string) *categoryDo {
|
||||
return c.withDO(c.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Not(conds ...gen.Condition) *categoryDo {
|
||||
return c.withDO(c.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Or(conds ...gen.Condition) *categoryDo {
|
||||
return c.withDO(c.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Select(conds ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Where(conds ...gen.Condition) *categoryDo {
|
||||
return c.withDO(c.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Order(conds ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Distinct(cols ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Omit(cols ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Join(table schema.Tabler, on ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (c categoryDo) LeftJoin(table schema.Tabler, on ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (c categoryDo) RightJoin(table schema.Tabler, on ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Group(cols ...field.Expr) *categoryDo {
|
||||
return c.withDO(c.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Having(conds ...gen.Condition) *categoryDo {
|
||||
return c.withDO(c.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Limit(limit int) *categoryDo {
|
||||
return c.withDO(c.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (c categoryDo) Offset(offset int) *categoryDo {
|
||||
return c.withDO(c.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (c categoryDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *categoryDo {
|
||||
return c.withDO(c.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Unscoped() *categoryDo {
|
||||
return c.withDO(c.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (c categoryDo) Create(values ...*model.Category) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return c.DO.Create(values)
|
||||
}
|
||||
|
||||
func (c categoryDo) CreateInBatches(values []*model.Category, batchSize int) error {
|
||||
return c.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (c categoryDo) Save(values ...*model.Category) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return c.DO.Save(values)
|
||||
}
|
||||
|
||||
func (c categoryDo) First() (*model.Category, error) {
|
||||
if result, err := c.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Category), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c categoryDo) Take() (*model.Category, error) {
|
||||
if result, err := c.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Category), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c categoryDo) Last() (*model.Category, error) {
|
||||
if result, err := c.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Category), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c categoryDo) Find() ([]*model.Category, error) {
|
||||
result, err := c.DO.Find()
|
||||
return result.([]*model.Category), err
|
||||
}
|
||||
|
||||
func (c categoryDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Category, err error) {
|
||||
buf := make([]*model.Category, 0, batchSize)
|
||||
err = c.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (c categoryDo) FindInBatches(result *[]*model.Category, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return c.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (c categoryDo) Attrs(attrs ...field.AssignExpr) *categoryDo {
|
||||
return c.withDO(c.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Assign(attrs ...field.AssignExpr) *categoryDo {
|
||||
return c.withDO(c.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (c categoryDo) Joins(fields ...field.RelationField) *categoryDo {
|
||||
for _, _f := range fields {
|
||||
c = *c.withDO(c.DO.Joins(_f))
|
||||
}
|
||||
return &c
|
||||
}
|
||||
|
||||
func (c categoryDo) Preload(fields ...field.RelationField) *categoryDo {
|
||||
for _, _f := range fields {
|
||||
c = *c.withDO(c.DO.Preload(_f))
|
||||
}
|
||||
return &c
|
||||
}
|
||||
|
||||
func (c categoryDo) FirstOrInit() (*model.Category, error) {
|
||||
if result, err := c.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Category), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c categoryDo) FirstOrCreate() (*model.Category, error) {
|
||||
if result, err := c.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Category), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c categoryDo) FindByPage(offset int, limit int) (result []*model.Category, count int64, err error) {
|
||||
result, err = c.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = c.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (c categoryDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = c.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = c.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c categoryDo) Scan(result interface{}) (err error) {
|
||||
return c.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (c categoryDo) Delete(models ...*model.Category) (result gen.ResultInfo, err error) {
|
||||
return c.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (c *categoryDo) withDO(do gen.Dao) *categoryDo {
|
||||
c.DO = *do.(*gen.DO)
|
||||
return c
|
||||
}
|
||||
117
Tools/mysql_model/qgdzs_db/query/gen.go
Normal file
117
Tools/mysql_model/qgdzs_db/query/gen.go
Normal file
@@ -0,0 +1,117 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gorm.io/gen"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: newCategory(db, opts...),
|
||||
PointCard: newPointCard(db, opts...),
|
||||
PointRecord: newPointRecord(db, opts...),
|
||||
Question: newQuestion(db, opts...),
|
||||
Record: newRecord(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
Category category
|
||||
PointCard pointCard
|
||||
PointRecord pointRecord
|
||||
Question question
|
||||
Record record
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: q.Category.clone(db),
|
||||
PointCard: q.PointCard.clone(db),
|
||||
PointRecord: q.PointRecord.clone(db),
|
||||
Question: q.Question.clone(db),
|
||||
Record: q.Record.clone(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) ReadDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
|
||||
}
|
||||
|
||||
func (q *Query) WriteDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
|
||||
}
|
||||
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
Category: q.Category.replaceDB(db),
|
||||
PointCard: q.PointCard.replaceDB(db),
|
||||
PointRecord: q.PointRecord.replaceDB(db),
|
||||
Question: q.Question.replaceDB(db),
|
||||
Record: q.Record.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
Category *categoryDo
|
||||
PointCard *pointCardDo
|
||||
PointRecord *pointRecordDo
|
||||
Question *questionDo
|
||||
Record *recordDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
Category: q.Category.WithContext(ctx),
|
||||
PointCard: q.PointCard.WithContext(ctx),
|
||||
PointRecord: q.PointRecord.WithContext(ctx),
|
||||
Question: q.Question.WithContext(ctx),
|
||||
Record: q.Record.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
|
||||
return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
|
||||
}
|
||||
|
||||
func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
|
||||
tx := q.db.Begin(opts...)
|
||||
return &QueryTx{Query: q.clone(tx), Error: tx.Error}
|
||||
}
|
||||
|
||||
type QueryTx struct {
|
||||
*Query
|
||||
Error error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Commit() error {
|
||||
return q.db.Commit().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Rollback() error {
|
||||
return q.db.Rollback().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) SavePoint(name string) error {
|
||||
return q.db.SavePoint(name).Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) RollbackTo(name string) error {
|
||||
return q.db.RollbackTo(name).Error
|
||||
}
|
||||
353
Tools/mysql_model/qgdzs_db/query/point_card.gen.go
Normal file
353
Tools/mysql_model/qgdzs_db/query/point_card.gen.go
Normal file
@@ -0,0 +1,353 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/qgdzs_db/model"
|
||||
)
|
||||
|
||||
func newPointCard(db *gorm.DB, opts ...gen.DOOption) pointCard {
|
||||
_pointCard := pointCard{}
|
||||
|
||||
_pointCard.pointCardDo.UseDB(db, opts...)
|
||||
_pointCard.pointCardDo.UseModel(&model.PointCard{})
|
||||
|
||||
tableName := _pointCard.pointCardDo.TableName()
|
||||
_pointCard.ALL = field.NewAsterisk(tableName)
|
||||
_pointCard.ID = field.NewUint64(tableName, "id")
|
||||
_pointCard.Sn = field.NewInt64(tableName, "sn")
|
||||
_pointCard.UserSn = field.NewInt64(tableName, "user_sn")
|
||||
_pointCard.Point = field.NewInt64(tableName, "point")
|
||||
_pointCard.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_pointCard.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_pointCard.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_pointCard.fillFieldMap()
|
||||
|
||||
return _pointCard
|
||||
}
|
||||
|
||||
type pointCard struct {
|
||||
pointCardDo pointCardDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
UserSn field.Int64 // 用户-唯一编号
|
||||
Point field.Int64 // 积分
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (p pointCard) Table(newTableName string) *pointCard {
|
||||
p.pointCardDo.UseTable(newTableName)
|
||||
return p.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (p pointCard) As(alias string) *pointCard {
|
||||
p.pointCardDo.DO = *(p.pointCardDo.As(alias).(*gen.DO))
|
||||
return p.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (p *pointCard) updateTableName(table string) *pointCard {
|
||||
p.ALL = field.NewAsterisk(table)
|
||||
p.ID = field.NewUint64(table, "id")
|
||||
p.Sn = field.NewInt64(table, "sn")
|
||||
p.UserSn = field.NewInt64(table, "user_sn")
|
||||
p.Point = field.NewInt64(table, "point")
|
||||
p.CreatedAt = field.NewTime(table, "created_at")
|
||||
p.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
p.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
p.fillFieldMap()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *pointCard) WithContext(ctx context.Context) *pointCardDo {
|
||||
return p.pointCardDo.WithContext(ctx)
|
||||
}
|
||||
|
||||
func (p pointCard) TableName() string { return p.pointCardDo.TableName() }
|
||||
|
||||
func (p pointCard) Alias() string { return p.pointCardDo.Alias() }
|
||||
|
||||
func (p pointCard) Columns(cols ...field.Expr) gen.Columns { return p.pointCardDo.Columns(cols...) }
|
||||
|
||||
func (p *pointCard) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := p.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (p *pointCard) fillFieldMap() {
|
||||
p.fieldMap = make(map[string]field.Expr, 7)
|
||||
p.fieldMap["id"] = p.ID
|
||||
p.fieldMap["sn"] = p.Sn
|
||||
p.fieldMap["user_sn"] = p.UserSn
|
||||
p.fieldMap["point"] = p.Point
|
||||
p.fieldMap["created_at"] = p.CreatedAt
|
||||
p.fieldMap["updated_at"] = p.UpdatedAt
|
||||
p.fieldMap["deleted_at"] = p.DeletedAt
|
||||
}
|
||||
|
||||
func (p pointCard) clone(db *gorm.DB) pointCard {
|
||||
p.pointCardDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return p
|
||||
}
|
||||
|
||||
func (p pointCard) replaceDB(db *gorm.DB) pointCard {
|
||||
p.pointCardDo.ReplaceDB(db)
|
||||
return p
|
||||
}
|
||||
|
||||
type pointCardDo struct{ gen.DO }
|
||||
|
||||
func (p pointCardDo) Debug() *pointCardDo {
|
||||
return p.withDO(p.DO.Debug())
|
||||
}
|
||||
|
||||
func (p pointCardDo) WithContext(ctx context.Context) *pointCardDo {
|
||||
return p.withDO(p.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (p pointCardDo) ReadDB() *pointCardDo {
|
||||
return p.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (p pointCardDo) WriteDB() *pointCardDo {
|
||||
return p.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (p pointCardDo) Session(config *gorm.Session) *pointCardDo {
|
||||
return p.withDO(p.DO.Session(config))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Clauses(conds ...clause.Expression) *pointCardDo {
|
||||
return p.withDO(p.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Returning(value interface{}, columns ...string) *pointCardDo {
|
||||
return p.withDO(p.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Not(conds ...gen.Condition) *pointCardDo {
|
||||
return p.withDO(p.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Or(conds ...gen.Condition) *pointCardDo {
|
||||
return p.withDO(p.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Select(conds ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Where(conds ...gen.Condition) *pointCardDo {
|
||||
return p.withDO(p.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Order(conds ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Distinct(cols ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Omit(cols ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Join(table schema.Tabler, on ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) LeftJoin(table schema.Tabler, on ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) RightJoin(table schema.Tabler, on ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Group(cols ...field.Expr) *pointCardDo {
|
||||
return p.withDO(p.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Having(conds ...gen.Condition) *pointCardDo {
|
||||
return p.withDO(p.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Limit(limit int) *pointCardDo {
|
||||
return p.withDO(p.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Offset(offset int) *pointCardDo {
|
||||
return p.withDO(p.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *pointCardDo {
|
||||
return p.withDO(p.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Unscoped() *pointCardDo {
|
||||
return p.withDO(p.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (p pointCardDo) Create(values ...*model.PointCard) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Create(values)
|
||||
}
|
||||
|
||||
func (p pointCardDo) CreateInBatches(values []*model.PointCard, batchSize int) error {
|
||||
return p.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (p pointCardDo) Save(values ...*model.PointCard) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Save(values)
|
||||
}
|
||||
|
||||
func (p pointCardDo) First() (*model.PointCard, error) {
|
||||
if result, err := p.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointCard), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointCardDo) Take() (*model.PointCard, error) {
|
||||
if result, err := p.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointCard), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointCardDo) Last() (*model.PointCard, error) {
|
||||
if result, err := p.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointCard), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointCardDo) Find() ([]*model.PointCard, error) {
|
||||
result, err := p.DO.Find()
|
||||
return result.([]*model.PointCard), err
|
||||
}
|
||||
|
||||
func (p pointCardDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PointCard, err error) {
|
||||
buf := make([]*model.PointCard, 0, batchSize)
|
||||
err = p.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (p pointCardDo) FindInBatches(result *[]*model.PointCard, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return p.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (p pointCardDo) Attrs(attrs ...field.AssignExpr) *pointCardDo {
|
||||
return p.withDO(p.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Assign(attrs ...field.AssignExpr) *pointCardDo {
|
||||
return p.withDO(p.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (p pointCardDo) Joins(fields ...field.RelationField) *pointCardDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Joins(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p pointCardDo) Preload(fields ...field.RelationField) *pointCardDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Preload(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p pointCardDo) FirstOrInit() (*model.PointCard, error) {
|
||||
if result, err := p.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointCard), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointCardDo) FirstOrCreate() (*model.PointCard, error) {
|
||||
if result, err := p.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointCard), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointCardDo) FindByPage(offset int, limit int) (result []*model.PointCard, count int64, err error) {
|
||||
result, err = p.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = p.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (p pointCardDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = p.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = p.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (p pointCardDo) Scan(result interface{}) (err error) {
|
||||
return p.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (p pointCardDo) Delete(models ...*model.PointCard) (result gen.ResultInfo, err error) {
|
||||
return p.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (p *pointCardDo) withDO(do gen.Dao) *pointCardDo {
|
||||
p.DO = *do.(*gen.DO)
|
||||
return p
|
||||
}
|
||||
364
Tools/mysql_model/qgdzs_db/query/point_records.gen.go
Normal file
364
Tools/mysql_model/qgdzs_db/query/point_records.gen.go
Normal file
@@ -0,0 +1,364 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/qgdzs_db/model"
|
||||
)
|
||||
|
||||
func newPointRecord(db *gorm.DB, opts ...gen.DOOption) pointRecord {
|
||||
_pointRecord := pointRecord{}
|
||||
|
||||
_pointRecord.pointRecordDo.UseDB(db, opts...)
|
||||
_pointRecord.pointRecordDo.UseModel(&model.PointRecord{})
|
||||
|
||||
tableName := _pointRecord.pointRecordDo.TableName()
|
||||
_pointRecord.ALL = field.NewAsterisk(tableName)
|
||||
_pointRecord.ID = field.NewUint64(tableName, "id")
|
||||
_pointRecord.Sn = field.NewInt64(tableName, "sn")
|
||||
_pointRecord.UserSn = field.NewInt64(tableName, "user_sn")
|
||||
_pointRecord.Source = field.NewInt32(tableName, "source")
|
||||
_pointRecord.Point = field.NewInt64(tableName, "point")
|
||||
_pointRecord.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_pointRecord.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_pointRecord.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_pointRecord.fillFieldMap()
|
||||
|
||||
return _pointRecord
|
||||
}
|
||||
|
||||
type pointRecord struct {
|
||||
pointRecordDo pointRecordDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
UserSn field.Int64 // 用户-唯一编号
|
||||
/*
|
||||
来源:
|
||||
0. 未知
|
||||
1. 随机答题
|
||||
2. 类目答题
|
||||
3. 限时答题
|
||||
*/
|
||||
Source field.Int32
|
||||
Point field.Int64 // 积分
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (p pointRecord) Table(newTableName string) *pointRecord {
|
||||
p.pointRecordDo.UseTable(newTableName)
|
||||
return p.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (p pointRecord) As(alias string) *pointRecord {
|
||||
p.pointRecordDo.DO = *(p.pointRecordDo.As(alias).(*gen.DO))
|
||||
return p.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (p *pointRecord) updateTableName(table string) *pointRecord {
|
||||
p.ALL = field.NewAsterisk(table)
|
||||
p.ID = field.NewUint64(table, "id")
|
||||
p.Sn = field.NewInt64(table, "sn")
|
||||
p.UserSn = field.NewInt64(table, "user_sn")
|
||||
p.Source = field.NewInt32(table, "source")
|
||||
p.Point = field.NewInt64(table, "point")
|
||||
p.CreatedAt = field.NewTime(table, "created_at")
|
||||
p.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
p.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
p.fillFieldMap()
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *pointRecord) WithContext(ctx context.Context) *pointRecordDo {
|
||||
return p.pointRecordDo.WithContext(ctx)
|
||||
}
|
||||
|
||||
func (p pointRecord) TableName() string { return p.pointRecordDo.TableName() }
|
||||
|
||||
func (p pointRecord) Alias() string { return p.pointRecordDo.Alias() }
|
||||
|
||||
func (p pointRecord) Columns(cols ...field.Expr) gen.Columns { return p.pointRecordDo.Columns(cols...) }
|
||||
|
||||
func (p *pointRecord) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := p.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (p *pointRecord) fillFieldMap() {
|
||||
p.fieldMap = make(map[string]field.Expr, 8)
|
||||
p.fieldMap["id"] = p.ID
|
||||
p.fieldMap["sn"] = p.Sn
|
||||
p.fieldMap["user_sn"] = p.UserSn
|
||||
p.fieldMap["source"] = p.Source
|
||||
p.fieldMap["point"] = p.Point
|
||||
p.fieldMap["created_at"] = p.CreatedAt
|
||||
p.fieldMap["updated_at"] = p.UpdatedAt
|
||||
p.fieldMap["deleted_at"] = p.DeletedAt
|
||||
}
|
||||
|
||||
func (p pointRecord) clone(db *gorm.DB) pointRecord {
|
||||
p.pointRecordDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return p
|
||||
}
|
||||
|
||||
func (p pointRecord) replaceDB(db *gorm.DB) pointRecord {
|
||||
p.pointRecordDo.ReplaceDB(db)
|
||||
return p
|
||||
}
|
||||
|
||||
type pointRecordDo struct{ gen.DO }
|
||||
|
||||
func (p pointRecordDo) Debug() *pointRecordDo {
|
||||
return p.withDO(p.DO.Debug())
|
||||
}
|
||||
|
||||
func (p pointRecordDo) WithContext(ctx context.Context) *pointRecordDo {
|
||||
return p.withDO(p.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) ReadDB() *pointRecordDo {
|
||||
return p.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) WriteDB() *pointRecordDo {
|
||||
return p.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Session(config *gorm.Session) *pointRecordDo {
|
||||
return p.withDO(p.DO.Session(config))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Clauses(conds ...clause.Expression) *pointRecordDo {
|
||||
return p.withDO(p.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Returning(value interface{}, columns ...string) *pointRecordDo {
|
||||
return p.withDO(p.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Not(conds ...gen.Condition) *pointRecordDo {
|
||||
return p.withDO(p.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Or(conds ...gen.Condition) *pointRecordDo {
|
||||
return p.withDO(p.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Select(conds ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Where(conds ...gen.Condition) *pointRecordDo {
|
||||
return p.withDO(p.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Order(conds ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Distinct(cols ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Omit(cols ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Join(table schema.Tabler, on ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) LeftJoin(table schema.Tabler, on ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) RightJoin(table schema.Tabler, on ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Group(cols ...field.Expr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Having(conds ...gen.Condition) *pointRecordDo {
|
||||
return p.withDO(p.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Limit(limit int) *pointRecordDo {
|
||||
return p.withDO(p.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Offset(offset int) *pointRecordDo {
|
||||
return p.withDO(p.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *pointRecordDo {
|
||||
return p.withDO(p.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Unscoped() *pointRecordDo {
|
||||
return p.withDO(p.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Create(values ...*model.PointRecord) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Create(values)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) CreateInBatches(values []*model.PointRecord, batchSize int) error {
|
||||
return p.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (p pointRecordDo) Save(values ...*model.PointRecord) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return p.DO.Save(values)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) First() (*model.PointRecord, error) {
|
||||
if result, err := p.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Take() (*model.PointRecord, error) {
|
||||
if result, err := p.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Last() (*model.PointRecord, error) {
|
||||
if result, err := p.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Find() ([]*model.PointRecord, error) {
|
||||
result, err := p.DO.Find()
|
||||
return result.([]*model.PointRecord), err
|
||||
}
|
||||
|
||||
func (p pointRecordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.PointRecord, err error) {
|
||||
buf := make([]*model.PointRecord, 0, batchSize)
|
||||
err = p.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (p pointRecordDo) FindInBatches(result *[]*model.PointRecord, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return p.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Attrs(attrs ...field.AssignExpr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Assign(attrs ...field.AssignExpr) *pointRecordDo {
|
||||
return p.withDO(p.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Joins(fields ...field.RelationField) *pointRecordDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Joins(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Preload(fields ...field.RelationField) *pointRecordDo {
|
||||
for _, _f := range fields {
|
||||
p = *p.withDO(p.DO.Preload(_f))
|
||||
}
|
||||
return &p
|
||||
}
|
||||
|
||||
func (p pointRecordDo) FirstOrInit() (*model.PointRecord, error) {
|
||||
if result, err := p.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointRecordDo) FirstOrCreate() (*model.PointRecord, error) {
|
||||
if result, err := p.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.PointRecord), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (p pointRecordDo) FindByPage(offset int, limit int) (result []*model.PointRecord, count int64, err error) {
|
||||
result, err = p.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = p.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (p pointRecordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = p.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = p.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Scan(result interface{}) (err error) {
|
||||
return p.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (p pointRecordDo) Delete(models ...*model.PointRecord) (result gen.ResultInfo, err error) {
|
||||
return p.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (p *pointRecordDo) withDO(do gen.Dao) *pointRecordDo {
|
||||
p.DO = *do.(*gen.DO)
|
||||
return p
|
||||
}
|
||||
367
Tools/mysql_model/qgdzs_db/query/questions.gen.go
Normal file
367
Tools/mysql_model/qgdzs_db/query/questions.gen.go
Normal file
@@ -0,0 +1,367 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/qgdzs_db/model"
|
||||
)
|
||||
|
||||
func newQuestion(db *gorm.DB, opts ...gen.DOOption) question {
|
||||
_question := question{}
|
||||
|
||||
_question.questionDo.UseDB(db, opts...)
|
||||
_question.questionDo.UseModel(&model.Question{})
|
||||
|
||||
tableName := _question.questionDo.TableName()
|
||||
_question.ALL = field.NewAsterisk(tableName)
|
||||
_question.ID = field.NewUint64(tableName, "id")
|
||||
_question.Sn = field.NewInt64(tableName, "sn")
|
||||
_question.Question = field.NewString(tableName, "question")
|
||||
_question.Options = field.NewString(tableName, "options")
|
||||
_question.Answer = field.NewString(tableName, "answer")
|
||||
_question.Explanation = field.NewString(tableName, "explanation")
|
||||
_question.Difficulty = field.NewInt32(tableName, "difficulty")
|
||||
_question.CategorySn = field.NewInt64(tableName, "category_sn")
|
||||
_question.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_question.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_question.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_question.fillFieldMap()
|
||||
|
||||
return _question
|
||||
}
|
||||
|
||||
type question struct {
|
||||
questionDo questionDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
Question field.String // 题干
|
||||
Options field.String // 选项
|
||||
Answer field.String // 答案
|
||||
Explanation field.String // 解析
|
||||
Difficulty field.Int32 // 难度分 0 - 100
|
||||
CategorySn field.Int64 // 分类-唯一编号
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (q question) Table(newTableName string) *question {
|
||||
q.questionDo.UseTable(newTableName)
|
||||
return q.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (q question) As(alias string) *question {
|
||||
q.questionDo.DO = *(q.questionDo.As(alias).(*gen.DO))
|
||||
return q.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (q *question) updateTableName(table string) *question {
|
||||
q.ALL = field.NewAsterisk(table)
|
||||
q.ID = field.NewUint64(table, "id")
|
||||
q.Sn = field.NewInt64(table, "sn")
|
||||
q.Question = field.NewString(table, "question")
|
||||
q.Options = field.NewString(table, "options")
|
||||
q.Answer = field.NewString(table, "answer")
|
||||
q.Explanation = field.NewString(table, "explanation")
|
||||
q.Difficulty = field.NewInt32(table, "difficulty")
|
||||
q.CategorySn = field.NewInt64(table, "category_sn")
|
||||
q.CreatedAt = field.NewTime(table, "created_at")
|
||||
q.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
q.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
q.fillFieldMap()
|
||||
|
||||
return q
|
||||
}
|
||||
|
||||
func (q *question) WithContext(ctx context.Context) *questionDo { return q.questionDo.WithContext(ctx) }
|
||||
|
||||
func (q question) TableName() string { return q.questionDo.TableName() }
|
||||
|
||||
func (q question) Alias() string { return q.questionDo.Alias() }
|
||||
|
||||
func (q question) Columns(cols ...field.Expr) gen.Columns { return q.questionDo.Columns(cols...) }
|
||||
|
||||
func (q *question) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := q.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (q *question) fillFieldMap() {
|
||||
q.fieldMap = make(map[string]field.Expr, 11)
|
||||
q.fieldMap["id"] = q.ID
|
||||
q.fieldMap["sn"] = q.Sn
|
||||
q.fieldMap["question"] = q.Question
|
||||
q.fieldMap["options"] = q.Options
|
||||
q.fieldMap["answer"] = q.Answer
|
||||
q.fieldMap["explanation"] = q.Explanation
|
||||
q.fieldMap["difficulty"] = q.Difficulty
|
||||
q.fieldMap["category_sn"] = q.CategorySn
|
||||
q.fieldMap["created_at"] = q.CreatedAt
|
||||
q.fieldMap["updated_at"] = q.UpdatedAt
|
||||
q.fieldMap["deleted_at"] = q.DeletedAt
|
||||
}
|
||||
|
||||
func (q question) clone(db *gorm.DB) question {
|
||||
q.questionDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return q
|
||||
}
|
||||
|
||||
func (q question) replaceDB(db *gorm.DB) question {
|
||||
q.questionDo.ReplaceDB(db)
|
||||
return q
|
||||
}
|
||||
|
||||
type questionDo struct{ gen.DO }
|
||||
|
||||
func (q questionDo) Debug() *questionDo {
|
||||
return q.withDO(q.DO.Debug())
|
||||
}
|
||||
|
||||
func (q questionDo) WithContext(ctx context.Context) *questionDo {
|
||||
return q.withDO(q.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (q questionDo) ReadDB() *questionDo {
|
||||
return q.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (q questionDo) WriteDB() *questionDo {
|
||||
return q.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (q questionDo) Session(config *gorm.Session) *questionDo {
|
||||
return q.withDO(q.DO.Session(config))
|
||||
}
|
||||
|
||||
func (q questionDo) Clauses(conds ...clause.Expression) *questionDo {
|
||||
return q.withDO(q.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Returning(value interface{}, columns ...string) *questionDo {
|
||||
return q.withDO(q.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (q questionDo) Not(conds ...gen.Condition) *questionDo {
|
||||
return q.withDO(q.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Or(conds ...gen.Condition) *questionDo {
|
||||
return q.withDO(q.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Select(conds ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Where(conds ...gen.Condition) *questionDo {
|
||||
return q.withDO(q.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Order(conds ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Distinct(cols ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (q questionDo) Omit(cols ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (q questionDo) Join(table schema.Tabler, on ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (q questionDo) LeftJoin(table schema.Tabler, on ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (q questionDo) RightJoin(table schema.Tabler, on ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (q questionDo) Group(cols ...field.Expr) *questionDo {
|
||||
return q.withDO(q.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (q questionDo) Having(conds ...gen.Condition) *questionDo {
|
||||
return q.withDO(q.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (q questionDo) Limit(limit int) *questionDo {
|
||||
return q.withDO(q.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (q questionDo) Offset(offset int) *questionDo {
|
||||
return q.withDO(q.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (q questionDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *questionDo {
|
||||
return q.withDO(q.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (q questionDo) Unscoped() *questionDo {
|
||||
return q.withDO(q.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (q questionDo) Create(values ...*model.Question) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return q.DO.Create(values)
|
||||
}
|
||||
|
||||
func (q questionDo) CreateInBatches(values []*model.Question, batchSize int) error {
|
||||
return q.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (q questionDo) Save(values ...*model.Question) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return q.DO.Save(values)
|
||||
}
|
||||
|
||||
func (q questionDo) First() (*model.Question, error) {
|
||||
if result, err := q.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Question), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (q questionDo) Take() (*model.Question, error) {
|
||||
if result, err := q.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Question), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (q questionDo) Last() (*model.Question, error) {
|
||||
if result, err := q.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Question), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (q questionDo) Find() ([]*model.Question, error) {
|
||||
result, err := q.DO.Find()
|
||||
return result.([]*model.Question), err
|
||||
}
|
||||
|
||||
func (q questionDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Question, err error) {
|
||||
buf := make([]*model.Question, 0, batchSize)
|
||||
err = q.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (q questionDo) FindInBatches(result *[]*model.Question, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return q.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (q questionDo) Attrs(attrs ...field.AssignExpr) *questionDo {
|
||||
return q.withDO(q.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (q questionDo) Assign(attrs ...field.AssignExpr) *questionDo {
|
||||
return q.withDO(q.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (q questionDo) Joins(fields ...field.RelationField) *questionDo {
|
||||
for _, _f := range fields {
|
||||
q = *q.withDO(q.DO.Joins(_f))
|
||||
}
|
||||
return &q
|
||||
}
|
||||
|
||||
func (q questionDo) Preload(fields ...field.RelationField) *questionDo {
|
||||
for _, _f := range fields {
|
||||
q = *q.withDO(q.DO.Preload(_f))
|
||||
}
|
||||
return &q
|
||||
}
|
||||
|
||||
func (q questionDo) FirstOrInit() (*model.Question, error) {
|
||||
if result, err := q.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Question), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (q questionDo) FirstOrCreate() (*model.Question, error) {
|
||||
if result, err := q.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Question), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (q questionDo) FindByPage(offset int, limit int) (result []*model.Question, count int64, err error) {
|
||||
result, err = q.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = q.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (q questionDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = q.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = q.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (q questionDo) Scan(result interface{}) (err error) {
|
||||
return q.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (q questionDo) Delete(models ...*model.Question) (result gen.ResultInfo, err error) {
|
||||
return q.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (q *questionDo) withDO(do gen.Dao) *questionDo {
|
||||
q.DO = *do.(*gen.DO)
|
||||
return q
|
||||
}
|
||||
359
Tools/mysql_model/qgdzs_db/query/records.gen.go
Normal file
359
Tools/mysql_model/qgdzs_db/query/records.gen.go
Normal file
@@ -0,0 +1,359 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/qgdzs_db/model"
|
||||
)
|
||||
|
||||
func newRecord(db *gorm.DB, opts ...gen.DOOption) record {
|
||||
_record := record{}
|
||||
|
||||
_record.recordDo.UseDB(db, opts...)
|
||||
_record.recordDo.UseModel(&model.Record{})
|
||||
|
||||
tableName := _record.recordDo.TableName()
|
||||
_record.ALL = field.NewAsterisk(tableName)
|
||||
_record.ID = field.NewUint64(tableName, "id")
|
||||
_record.Sn = field.NewInt64(tableName, "sn")
|
||||
_record.UserSn = field.NewInt64(tableName, "user_sn")
|
||||
_record.QuestionSn = field.NewInt64(tableName, "question_sn")
|
||||
_record.Answer = field.NewString(tableName, "answer")
|
||||
_record.IsCorrect = field.NewInt32(tableName, "is_correct")
|
||||
_record.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_record.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_record.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_record.fillFieldMap()
|
||||
|
||||
return _record
|
||||
}
|
||||
|
||||
type record struct {
|
||||
recordDo recordDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
UserSn field.Int64 // 用户-唯一编号
|
||||
QuestionSn field.Int64 // 题目-唯一编号
|
||||
Answer field.String // 答案
|
||||
IsCorrect field.Int32 // 是否正确 0 否 1 是
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (r record) Table(newTableName string) *record {
|
||||
r.recordDo.UseTable(newTableName)
|
||||
return r.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (r record) As(alias string) *record {
|
||||
r.recordDo.DO = *(r.recordDo.As(alias).(*gen.DO))
|
||||
return r.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (r *record) updateTableName(table string) *record {
|
||||
r.ALL = field.NewAsterisk(table)
|
||||
r.ID = field.NewUint64(table, "id")
|
||||
r.Sn = field.NewInt64(table, "sn")
|
||||
r.UserSn = field.NewInt64(table, "user_sn")
|
||||
r.QuestionSn = field.NewInt64(table, "question_sn")
|
||||
r.Answer = field.NewString(table, "answer")
|
||||
r.IsCorrect = field.NewInt32(table, "is_correct")
|
||||
r.CreatedAt = field.NewTime(table, "created_at")
|
||||
r.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
r.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
r.fillFieldMap()
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *record) WithContext(ctx context.Context) *recordDo { return r.recordDo.WithContext(ctx) }
|
||||
|
||||
func (r record) TableName() string { return r.recordDo.TableName() }
|
||||
|
||||
func (r record) Alias() string { return r.recordDo.Alias() }
|
||||
|
||||
func (r record) Columns(cols ...field.Expr) gen.Columns { return r.recordDo.Columns(cols...) }
|
||||
|
||||
func (r *record) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := r.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (r *record) fillFieldMap() {
|
||||
r.fieldMap = make(map[string]field.Expr, 9)
|
||||
r.fieldMap["id"] = r.ID
|
||||
r.fieldMap["sn"] = r.Sn
|
||||
r.fieldMap["user_sn"] = r.UserSn
|
||||
r.fieldMap["question_sn"] = r.QuestionSn
|
||||
r.fieldMap["answer"] = r.Answer
|
||||
r.fieldMap["is_correct"] = r.IsCorrect
|
||||
r.fieldMap["created_at"] = r.CreatedAt
|
||||
r.fieldMap["updated_at"] = r.UpdatedAt
|
||||
r.fieldMap["deleted_at"] = r.DeletedAt
|
||||
}
|
||||
|
||||
func (r record) clone(db *gorm.DB) record {
|
||||
r.recordDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return r
|
||||
}
|
||||
|
||||
func (r record) replaceDB(db *gorm.DB) record {
|
||||
r.recordDo.ReplaceDB(db)
|
||||
return r
|
||||
}
|
||||
|
||||
type recordDo struct{ gen.DO }
|
||||
|
||||
func (r recordDo) Debug() *recordDo {
|
||||
return r.withDO(r.DO.Debug())
|
||||
}
|
||||
|
||||
func (r recordDo) WithContext(ctx context.Context) *recordDo {
|
||||
return r.withDO(r.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (r recordDo) ReadDB() *recordDo {
|
||||
return r.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (r recordDo) WriteDB() *recordDo {
|
||||
return r.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (r recordDo) Session(config *gorm.Session) *recordDo {
|
||||
return r.withDO(r.DO.Session(config))
|
||||
}
|
||||
|
||||
func (r recordDo) Clauses(conds ...clause.Expression) *recordDo {
|
||||
return r.withDO(r.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Returning(value interface{}, columns ...string) *recordDo {
|
||||
return r.withDO(r.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (r recordDo) Not(conds ...gen.Condition) *recordDo {
|
||||
return r.withDO(r.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Or(conds ...gen.Condition) *recordDo {
|
||||
return r.withDO(r.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Select(conds ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Where(conds ...gen.Condition) *recordDo {
|
||||
return r.withDO(r.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Order(conds ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Distinct(cols ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (r recordDo) Omit(cols ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (r recordDo) Join(table schema.Tabler, on ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (r recordDo) LeftJoin(table schema.Tabler, on ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (r recordDo) RightJoin(table schema.Tabler, on ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (r recordDo) Group(cols ...field.Expr) *recordDo {
|
||||
return r.withDO(r.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (r recordDo) Having(conds ...gen.Condition) *recordDo {
|
||||
return r.withDO(r.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (r recordDo) Limit(limit int) *recordDo {
|
||||
return r.withDO(r.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (r recordDo) Offset(offset int) *recordDo {
|
||||
return r.withDO(r.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (r recordDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *recordDo {
|
||||
return r.withDO(r.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (r recordDo) Unscoped() *recordDo {
|
||||
return r.withDO(r.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (r recordDo) Create(values ...*model.Record) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return r.DO.Create(values)
|
||||
}
|
||||
|
||||
func (r recordDo) CreateInBatches(values []*model.Record, batchSize int) error {
|
||||
return r.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (r recordDo) Save(values ...*model.Record) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return r.DO.Save(values)
|
||||
}
|
||||
|
||||
func (r recordDo) First() (*model.Record, error) {
|
||||
if result, err := r.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Record), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r recordDo) Take() (*model.Record, error) {
|
||||
if result, err := r.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Record), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r recordDo) Last() (*model.Record, error) {
|
||||
if result, err := r.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Record), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r recordDo) Find() ([]*model.Record, error) {
|
||||
result, err := r.DO.Find()
|
||||
return result.([]*model.Record), err
|
||||
}
|
||||
|
||||
func (r recordDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.Record, err error) {
|
||||
buf := make([]*model.Record, 0, batchSize)
|
||||
err = r.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (r recordDo) FindInBatches(result *[]*model.Record, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return r.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (r recordDo) Attrs(attrs ...field.AssignExpr) *recordDo {
|
||||
return r.withDO(r.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (r recordDo) Assign(attrs ...field.AssignExpr) *recordDo {
|
||||
return r.withDO(r.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (r recordDo) Joins(fields ...field.RelationField) *recordDo {
|
||||
for _, _f := range fields {
|
||||
r = *r.withDO(r.DO.Joins(_f))
|
||||
}
|
||||
return &r
|
||||
}
|
||||
|
||||
func (r recordDo) Preload(fields ...field.RelationField) *recordDo {
|
||||
for _, _f := range fields {
|
||||
r = *r.withDO(r.DO.Preload(_f))
|
||||
}
|
||||
return &r
|
||||
}
|
||||
|
||||
func (r recordDo) FirstOrInit() (*model.Record, error) {
|
||||
if result, err := r.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Record), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r recordDo) FirstOrCreate() (*model.Record, error) {
|
||||
if result, err := r.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.Record), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (r recordDo) FindByPage(offset int, limit int) (result []*model.Record, count int64, err error) {
|
||||
result, err = r.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = r.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (r recordDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = r.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = r.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (r recordDo) Scan(result interface{}) (err error) {
|
||||
return r.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (r recordDo) Delete(models ...*model.Record) (result gen.ResultInfo, err error) {
|
||||
return r.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (r *recordDo) withDO(do gen.Dao) *recordDo {
|
||||
r.DO = *do.(*gen.DO)
|
||||
return r
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
@@ -7,21 +7,23 @@ package model
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.hlsq.asia/mmorpg/service-common/utils"
|
||||
"gorm.io/gorm"
|
||||
"common/utils"
|
||||
)
|
||||
|
||||
const TableNameUser = "users"
|
||||
|
||||
// User mapped from table <users>
|
||||
type User struct {
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
Name string `gorm:"column:name;not null" json:"name"`
|
||||
Phone string `gorm:"column:phone;not null" json:"phone"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
||||
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
||||
Name string `gorm:"column:name;not null" json:"name"`
|
||||
Phone string `gorm:"column:phone" json:"phone"`
|
||||
WxUnionID string `gorm:"column:wx_union_id;comment:微信用户唯一标识" json:"wx_union_id"` // 微信用户唯一标识
|
||||
WxMiniOpenID string `gorm:"column:wx_mini_open_id;comment:微信小程序的openID" json:"wx_mini_open_id"` // 微信小程序的openID
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
||||
}
|
||||
|
||||
// TableName User's table name
|
||||
@@ -29,7 +31,7 @@ func (*User) TableName() string {
|
||||
return TableNameUser
|
||||
}
|
||||
|
||||
// auto sn
|
||||
// Auto sn
|
||||
func (m *User) BeforeCreate(_ *gorm.DB) error {
|
||||
if m.Sn == 0 {
|
||||
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
||||
|
||||
@@ -15,6 +15,8 @@ import (
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"git.hlsq.asia/mmorpg/user_db/model"
|
||||
)
|
||||
|
||||
func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
@@ -29,6 +31,8 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
_user.Sn = field.NewInt64(tableName, "sn")
|
||||
_user.Name = field.NewString(tableName, "name")
|
||||
_user.Phone = field.NewString(tableName, "phone")
|
||||
_user.WxUnionID = field.NewString(tableName, "wx_union_id")
|
||||
_user.WxMiniOpenID = field.NewString(tableName, "wx_mini_open_id")
|
||||
_user.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_user.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_user.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
@@ -41,14 +45,16 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
type user struct {
|
||||
userDo userDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
Name field.String
|
||||
Phone field.String
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Sn field.Int64 // 业务唯一编号
|
||||
Name field.String
|
||||
Phone field.String
|
||||
WxUnionID field.String // 微信用户唯一标识
|
||||
WxMiniOpenID field.String // 微信小程序的openID
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
@@ -69,6 +75,8 @@ func (u *user) updateTableName(table string) *user {
|
||||
u.Sn = field.NewInt64(table, "sn")
|
||||
u.Name = field.NewString(table, "name")
|
||||
u.Phone = field.NewString(table, "phone")
|
||||
u.WxUnionID = field.NewString(table, "wx_union_id")
|
||||
u.WxMiniOpenID = field.NewString(table, "wx_mini_open_id")
|
||||
u.CreatedAt = field.NewTime(table, "created_at")
|
||||
u.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
u.DeletedAt = field.NewField(table, "deleted_at")
|
||||
@@ -96,11 +104,13 @@ func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (u *user) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 7)
|
||||
u.fieldMap = make(map[string]field.Expr, 9)
|
||||
u.fieldMap["id"] = u.ID
|
||||
u.fieldMap["sn"] = u.Sn
|
||||
u.fieldMap["name"] = u.Name
|
||||
u.fieldMap["phone"] = u.Phone
|
||||
u.fieldMap["wx_union_id"] = u.WxUnionID
|
||||
u.fieldMap["wx_mini_open_id"] = u.WxMiniOpenID
|
||||
u.fieldMap["created_at"] = u.CreatedAt
|
||||
u.fieldMap["updated_at"] = u.UpdatedAt
|
||||
u.fieldMap["deleted_at"] = u.DeletedAt
|
||||
|
||||
4
Tools/quickly/.gitignore
vendored
Normal file
4
Tools/quickly/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
build/bin
|
||||
node_modules
|
||||
frontend/dist
|
||||
.idea
|
||||
13
Tools/quickly/README.md
Normal file
13
Tools/quickly/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# README
|
||||
|
||||
## 文档
|
||||
https://wails.io/zh-Hans/docs/introduction
|
||||
|
||||
## 安装 Wails CLI
|
||||
go install github.com/wailsapp/wails/v2/cmd/wails@v2.11.0
|
||||
|
||||
## 运行
|
||||
wails dev
|
||||
|
||||
## 打包
|
||||
wails build
|
||||
14
Tools/quickly/backend/app.go
Normal file
14
Tools/quickly/backend/app.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func NewApp() *App {
|
||||
return &App{}
|
||||
}
|
||||
|
||||
func (a *App) Startup(ctx context.Context) {
|
||||
a.ctx = ctx
|
||||
a.loadSettings()
|
||||
}
|
||||
56
Tools/quickly/backend/database.go
Normal file
56
Tools/quickly/backend/database.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (a *App) AddDatabaseConfig(name string, targetPath string, modelPackagePath string) error {
|
||||
if name == "" {
|
||||
return fmt.Errorf("database name is empty")
|
||||
}
|
||||
if targetPath == "" {
|
||||
return fmt.Errorf("target path is empty")
|
||||
}
|
||||
|
||||
for _, db := range a.settings.Databases {
|
||||
if db.Name == name {
|
||||
return fmt.Errorf("database with name '%s' already exists", name)
|
||||
}
|
||||
}
|
||||
|
||||
a.settings.Databases = append(a.settings.Databases, DatabaseConfig{
|
||||
Name: name,
|
||||
TargetPath: targetPath,
|
||||
ModelPackagePath: modelPackagePath,
|
||||
})
|
||||
return a.saveSettings()
|
||||
}
|
||||
|
||||
func (a *App) RemoveDatabaseConfig(name string) error {
|
||||
for i, db := range a.settings.Databases {
|
||||
if db.Name == name {
|
||||
a.settings.Databases = append(a.settings.Databases[:i], a.settings.Databases[i+1:]...)
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("database with name '%s' not found", name)
|
||||
}
|
||||
|
||||
func (a *App) UpdateDatabaseConfig(oldName string, newName string, targetPath string, modelPackagePath string) error {
|
||||
if newName == "" {
|
||||
return fmt.Errorf("database name is empty")
|
||||
}
|
||||
if targetPath == "" {
|
||||
return fmt.Errorf("target path is empty")
|
||||
}
|
||||
|
||||
for i, db := range a.settings.Databases {
|
||||
if db.Name == oldName {
|
||||
a.settings.Databases[i].Name = newName
|
||||
a.settings.Databases[i].TargetPath = targetPath
|
||||
a.settings.Databases[i].ModelPackagePath = modelPackagePath
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("database with name '%s' not found", oldName)
|
||||
}
|
||||
9
Tools/quickly/backend/greet.go
Normal file
9
Tools/quickly/backend/greet.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (a *App) Greet(name string) string {
|
||||
return fmt.Sprintf("Hello %s, It's show time!", name)
|
||||
}
|
||||
56
Tools/quickly/backend/helpers.go
Normal file
56
Tools/quickly/backend/helpers.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func copyDir(src string, dst string) error {
|
||||
srcInfo, err := os.Stat(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(dst, srcInfo.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entries, err := os.ReadDir(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
srcPath := filepath.Join(src, entry.Name())
|
||||
dstPath := filepath.Join(dst, entry.Name())
|
||||
|
||||
if entry.IsDir() {
|
||||
if err := copyDir(srcPath, dstPath); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := copyFile(srcPath, dstPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func copyFile(src string, dst string) error {
|
||||
source, err := os.Open(src)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer destination.Close()
|
||||
|
||||
_, err = destination.ReadFrom(source)
|
||||
return err
|
||||
}
|
||||
34
Tools/quickly/backend/models.go
Normal file
34
Tools/quickly/backend/models.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type DatabaseConfig struct {
|
||||
Name string `json:"name"`
|
||||
TargetPath string `json:"targetPath"`
|
||||
ModelPackagePath string `json:"modelPackagePath"`
|
||||
}
|
||||
|
||||
type ProjectConfig struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Theme string `json:"theme"`
|
||||
Language string `json:"language"`
|
||||
Notifications bool `json:"notifications"`
|
||||
AutoStart bool `json:"autoStart"`
|
||||
MysqlModelPath string `json:"mysqlModelPath"`
|
||||
DefaultQueryPackagePath string `json:"defaultQueryPackagePath"`
|
||||
ModelBasePath string `json:"modelBasePath"`
|
||||
SwaggerFilePath string `json:"swaggerFilePath"`
|
||||
Databases []DatabaseConfig `json:"databases"`
|
||||
Projects []ProjectConfig `json:"projects"`
|
||||
}
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
settings Settings
|
||||
}
|
||||
171
Tools/quickly/backend/mysql_model.go
Normal file
171
Tools/quickly/backend/mysql_model.go
Normal file
@@ -0,0 +1,171 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
func (a *App) SelectFile(title string, defaultDir string, filter string) (string, error) {
|
||||
return runtime.OpenFileDialog(a.ctx, runtime.OpenDialogOptions{
|
||||
Title: title,
|
||||
DefaultDirectory: defaultDir,
|
||||
Filters: []runtime.FileFilter{{Pattern: filter}},
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) SelectDirectory(title string, defaultDir string) (string, error) {
|
||||
return runtime.OpenDirectoryDialog(a.ctx, runtime.OpenDialogOptions{
|
||||
Title: title,
|
||||
DefaultDirectory: defaultDir,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) CheckGenPs1Exists(filePath string) (bool, error) {
|
||||
if filePath == "" {
|
||||
return false, fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
_, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (a *App) ReadGoModModule(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
dirPath := filepath.Dir(filePath)
|
||||
goModPath := filepath.Join(dirPath, "go.mod")
|
||||
|
||||
content, err := os.ReadFile(goModPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("go.mod not found: %w", err)
|
||||
}
|
||||
|
||||
lines := strings.Split(string(content), "\n")
|
||||
for _, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if strings.HasPrefix(line, "module ") {
|
||||
moduleName := strings.TrimPrefix(line, "module ")
|
||||
moduleName = strings.TrimSpace(moduleName)
|
||||
return moduleName, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("module declaration not found in go.mod")
|
||||
}
|
||||
|
||||
func (a *App) ExecuteGenPs1(genPs1Path string, dbName string, targetPath string, modelPackagePath string) (string, error) {
|
||||
if genPs1Path == "" {
|
||||
return "", fmt.Errorf("gen.ps1 path is empty")
|
||||
}
|
||||
if dbName == "" {
|
||||
return "", fmt.Errorf("database name is empty")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(genPs1Path); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return "", fmt.Errorf("gen.ps1 not found")
|
||||
}
|
||||
return "", fmt.Errorf("error checking gen.ps1: %w", err)
|
||||
}
|
||||
|
||||
dirPath := filepath.Dir(genPs1Path)
|
||||
|
||||
psPath, err := exec.LookPath("powershell.exe")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("PowerShell not found: %w", err)
|
||||
}
|
||||
|
||||
args := []string{
|
||||
"-NoProfile",
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-Command",
|
||||
fmt.Sprintf("Set-Location -Path '%s'; & .\\gen.ps1 -dbName '%s'", dirPath, dbName),
|
||||
}
|
||||
|
||||
cmd := exec.Command(psPath, args...)
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("script execution failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
if targetPath != "" {
|
||||
sourceDir := filepath.Join(dirPath, dbName)
|
||||
if _, err := os.Stat(sourceDir); err == nil {
|
||||
modelSource := filepath.Join(sourceDir, "model")
|
||||
querySource := filepath.Join(sourceDir, "query")
|
||||
|
||||
modelTarget := filepath.Join(targetPath, "model")
|
||||
queryTarget := filepath.Join(targetPath, "query")
|
||||
|
||||
if _, err := os.Stat(modelSource); err == nil {
|
||||
if err := copyDir(modelSource, modelTarget); err != nil {
|
||||
return string(output), fmt.Errorf("failed to copy model directory: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := os.Stat(querySource); err == nil {
|
||||
if err := copyDir(querySource, queryTarget); err != nil {
|
||||
return string(output), fmt.Errorf("failed to copy query directory: %w", err)
|
||||
}
|
||||
if modelPackagePath != "" {
|
||||
if err := replaceImportPaths(queryTarget, dbName, modelPackagePath, a.settings.DefaultQueryPackagePath); err != nil {
|
||||
return string(output), fmt.Errorf("failed to replace import paths: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string(output), nil
|
||||
}
|
||||
|
||||
func replaceImportPaths(queryDir string, dbName string, newPackagePath string, basePath string) error {
|
||||
err := filepath.Walk(queryDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() && strings.HasSuffix(path, ".gen.go") {
|
||||
if err := replaceImportInFile(path, dbName, newPackagePath, basePath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func replaceImportInFile(filePath string, dbName string, newPackagePath string, basePath string) error {
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if basePath == "" {
|
||||
basePath = "git.hlsq.asia/mmorpg"
|
||||
}
|
||||
|
||||
oldImport := fmt.Sprintf(`"%s/%s/model"`, basePath, dbName)
|
||||
newImport := fmt.Sprintf(`"%s"`, newPackagePath)
|
||||
|
||||
newContent := bytes.ReplaceAll(content, []byte(oldImport), []byte(newImport))
|
||||
|
||||
return os.WriteFile(filePath, newContent, 0644)
|
||||
}
|
||||
73
Tools/quickly/backend/project.go
Normal file
73
Tools/quickly/backend/project.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (a *App) AddProjectConfig(name string, path string) error {
|
||||
if path == "" {
|
||||
return fmt.Errorf("project path is empty")
|
||||
}
|
||||
|
||||
if name == "" {
|
||||
name = filepath.Base(path)
|
||||
}
|
||||
|
||||
goModPath := filepath.Join(path, "go.mod")
|
||||
if _, err := os.Stat(goModPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("go.mod file not found in the specified path")
|
||||
}
|
||||
return fmt.Errorf("error checking go.mod file: %w", err)
|
||||
}
|
||||
|
||||
for _, project := range a.settings.Projects {
|
||||
if project.Name == name {
|
||||
return fmt.Errorf("project with name '%s' already exists", name)
|
||||
}
|
||||
}
|
||||
|
||||
a.settings.Projects = append(a.settings.Projects, ProjectConfig{
|
||||
Name: name,
|
||||
Path: path,
|
||||
})
|
||||
return a.saveSettings()
|
||||
}
|
||||
|
||||
func (a *App) RemoveProjectConfig(name string) error {
|
||||
for i, project := range a.settings.Projects {
|
||||
if project.Name == name {
|
||||
a.settings.Projects = append(a.settings.Projects[:i], a.settings.Projects[i+1:]...)
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("project with name '%s' not found", name)
|
||||
}
|
||||
|
||||
func (a *App) UpdateProjectConfig(oldName string, newName string, path string) error {
|
||||
if newName == "" {
|
||||
return fmt.Errorf("project name is empty")
|
||||
}
|
||||
if path == "" {
|
||||
return fmt.Errorf("project path is empty")
|
||||
}
|
||||
|
||||
goModPath := filepath.Join(path, "go.mod")
|
||||
if _, err := os.Stat(goModPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return fmt.Errorf("go.mod file not found in the specified path")
|
||||
}
|
||||
return fmt.Errorf("error checking go.mod file: %w", err)
|
||||
}
|
||||
|
||||
for i, project := range a.settings.Projects {
|
||||
if project.Name == oldName {
|
||||
a.settings.Projects[i].Name = newName
|
||||
a.settings.Projects[i].Path = path
|
||||
return a.saveSettings()
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("project with name '%s' not found", oldName)
|
||||
}
|
||||
104
Tools/quickly/backend/settings.go
Normal file
104
Tools/quickly/backend/settings.go
Normal file
@@ -0,0 +1,104 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (a *App) getSettingsPath() (string, error) {
|
||||
configDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
appConfigDir := filepath.Join(configDir, "quickly")
|
||||
if err := os.MkdirAll(appConfigDir, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(appConfigDir, "settings.json"), nil
|
||||
}
|
||||
|
||||
func (a *App) loadSettings() {
|
||||
settingsPath, err := a.getSettingsPath()
|
||||
if err != nil {
|
||||
fmt.Println("Error getting settings path:", err)
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerFilePath: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
data, err := os.ReadFile(settingsPath)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerFilePath: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
return
|
||||
}
|
||||
fmt.Println("Error reading settings file:", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &a.settings); err != nil {
|
||||
fmt.Println("Error parsing settings file:", err)
|
||||
a.settings = Settings{
|
||||
Theme: "light",
|
||||
Language: "zh-CN",
|
||||
Notifications: true,
|
||||
AutoStart: false,
|
||||
MysqlModelPath: "",
|
||||
DefaultQueryPackagePath: "",
|
||||
ModelBasePath: "",
|
||||
SwaggerFilePath: "",
|
||||
Databases: []DatabaseConfig{},
|
||||
Projects: []ProjectConfig{},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) saveSettings() error {
|
||||
settingsPath, err := a.getSettingsPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting settings path: %w", err)
|
||||
}
|
||||
|
||||
data, err := json.MarshalIndent(a.settings, "", " ")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error marshaling settings: %w", err)
|
||||
}
|
||||
|
||||
if err := os.WriteFile(settingsPath, data, 0644); err != nil {
|
||||
return fmt.Errorf("error writing settings file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) GetSettings() Settings {
|
||||
return a.settings
|
||||
}
|
||||
|
||||
func (a *App) SaveSettings(settings Settings) error {
|
||||
a.settings = settings
|
||||
return a.saveSettings()
|
||||
}
|
||||
232
Tools/quickly/backend/swagger.go
Normal file
232
Tools/quickly/backend/swagger.go
Normal file
@@ -0,0 +1,232 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SwaggerFile struct {
|
||||
Name string `json:"name"`
|
||||
Path string `json:"path"`
|
||||
Size int64 `json:"size"`
|
||||
ModifiedTime string `json:"modifiedTime"`
|
||||
}
|
||||
|
||||
type SwaggerServer struct {
|
||||
server *http.Server
|
||||
port int
|
||||
running bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
var swaggerServer *SwaggerServer
|
||||
var swaggerServerMu sync.Mutex
|
||||
|
||||
func (a *App) GetSwaggerFiles(dirPath string) ([]SwaggerFile, error) {
|
||||
if dirPath == "" {
|
||||
return nil, fmt.Errorf("directory path is empty")
|
||||
}
|
||||
|
||||
var files []SwaggerFile
|
||||
|
||||
err := filepath.Walk(dirPath, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasSuffix(strings.ToLower(info.Name()), ".swagger.json") {
|
||||
files = append(files, SwaggerFile{
|
||||
Name: info.Name(),
|
||||
Path: path,
|
||||
Size: info.Size(),
|
||||
ModifiedTime: info.ModTime().Format("2006-01-02 15:04:05"),
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to walk directory: %w", err)
|
||||
}
|
||||
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func (a *App) GetSwaggerFileInfo(filePath string) (SwaggerFile, error) {
|
||||
if filePath == "" {
|
||||
return SwaggerFile{}, fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
info, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return SwaggerFile{}, fmt.Errorf("failed to get file info: %w", err)
|
||||
}
|
||||
|
||||
return SwaggerFile{
|
||||
Name: info.Name(),
|
||||
Path: filePath,
|
||||
Size: info.Size(),
|
||||
ModifiedTime: info.ModTime().Format("2006-01-02 15:04:05"),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *App) ReadSwaggerFile(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to read file: %w", err)
|
||||
}
|
||||
|
||||
return string(content), nil
|
||||
}
|
||||
|
||||
func (a *App) StartSwaggerServer(filePath string) (string, error) {
|
||||
if filePath == "" {
|
||||
return "", fmt.Errorf("file path is empty")
|
||||
}
|
||||
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer != nil && swaggerServer.running {
|
||||
return fmt.Sprintf("http://localhost:%d", swaggerServer.port), nil
|
||||
}
|
||||
|
||||
port := 8080
|
||||
for i := 0; i < 100; i++ {
|
||||
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||
if err == nil {
|
||||
listener.Close()
|
||||
break
|
||||
}
|
||||
port++
|
||||
}
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
swaggerHTML := `<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5.10.5/swagger-ui.css">
|
||||
<style>
|
||||
html { box-sizing: border-box; overflow: -moz-scrollbars-vertical; overflow-y: scroll; }
|
||||
*, *:before, *:after { box-sizing: inherit; }
|
||||
body { margin: 0; background: #fafafa; }
|
||||
.topbar { display: none; }
|
||||
.swagger-ui .topbar { display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@5.10.5/swagger-ui-bundle.js"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
const ui = SwaggerUIBundle({
|
||||
url: '/swagger.json',
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIBundle.SwaggerUIStandalonePreset
|
||||
],
|
||||
layout: "BaseLayout",
|
||||
deepLinking: true,
|
||||
showExtensions: true,
|
||||
showCommonExtensions: true,
|
||||
docExpansion: "list",
|
||||
filter: true,
|
||||
tryItOutEnabled: true
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>`
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Write([]byte(swaggerHTML))
|
||||
})
|
||||
|
||||
mux.HandleFunc("/swagger.json", func(w http.ResponseWriter, r *http.Request) {
|
||||
content, err := os.ReadFile(filePath)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write(content)
|
||||
})
|
||||
|
||||
server := &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", port),
|
||||
Handler: mux,
|
||||
ReadTimeout: 15 * time.Second,
|
||||
WriteTimeout: 15 * time.Second,
|
||||
}
|
||||
|
||||
swaggerServer = &SwaggerServer{
|
||||
server: server,
|
||||
port: port,
|
||||
running: true,
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
fmt.Printf("Swagger server error: %v\n", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return fmt.Sprintf("http://localhost:%d", port), nil
|
||||
}
|
||||
|
||||
func (a *App) StopSwaggerServer() error {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil || !swaggerServer.running {
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := swaggerServer.server.Close(); err != nil {
|
||||
return fmt.Errorf("failed to stop server: %w", err)
|
||||
}
|
||||
|
||||
swaggerServer.running = false
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) IsSwaggerServerRunning() bool {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil {
|
||||
return false
|
||||
}
|
||||
return swaggerServer.running
|
||||
}
|
||||
|
||||
func (a *App) GetSwaggerServerURL() string {
|
||||
swaggerServerMu.Lock()
|
||||
defer swaggerServerMu.Unlock()
|
||||
|
||||
if swaggerServer == nil || !swaggerServer.running {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("http://localhost:%d", swaggerServer.port)
|
||||
}
|
||||
90
Tools/quickly/backend/update_service_common.go
Normal file
90
Tools/quickly/backend/update_service_common.go
Normal file
@@ -0,0 +1,90 @@
|
||||
package backend
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (a *App) UpdateServiceCommon(commitId string, projectNames []string) (string, error) {
|
||||
if commitId == "" {
|
||||
return "", fmt.Errorf("commit id is empty")
|
||||
}
|
||||
|
||||
if len(projectNames) == 0 {
|
||||
return "", fmt.Errorf("no projects selected")
|
||||
}
|
||||
|
||||
var results strings.Builder
|
||||
results.WriteString(fmt.Sprintf("开始更新 Common 版本: %s\n", commitId))
|
||||
results.WriteString(fmt.Sprintf("共选择 %d 个项目\n\n", len(projectNames)))
|
||||
|
||||
for _, projectName := range projectNames {
|
||||
var projectPath string
|
||||
found := false
|
||||
for _, project := range a.settings.Projects {
|
||||
if project.Name == projectName {
|
||||
projectPath = project.Path
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
results.WriteString(fmt.Sprintf("❌ 项目 '%s' 未找到配置\n\n", projectName))
|
||||
continue
|
||||
}
|
||||
|
||||
results.WriteString(fmt.Sprintf("正在更新项目: %s\n", projectName))
|
||||
results.WriteString(fmt.Sprintf("路径: %s\n", projectPath))
|
||||
|
||||
if err := updateProjectCommonVersion(projectPath, commitId, &results, a.settings.ModelBasePath); err != nil {
|
||||
results.WriteString(fmt.Sprintf("❌ 更新失败: %v\n\n", err))
|
||||
continue
|
||||
}
|
||||
|
||||
results.WriteString(fmt.Sprintf("✅ 更新成功\n\n"))
|
||||
}
|
||||
|
||||
results.WriteString("所有项目更新完成!")
|
||||
return results.String(), nil
|
||||
}
|
||||
|
||||
func updateProjectCommonVersion(projectPath string, commitId string, results *strings.Builder, moduleName string) error {
|
||||
goPath, err := exec.LookPath("go")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Go not found: %w", err)
|
||||
}
|
||||
|
||||
if moduleName == "" {
|
||||
return fmt.Errorf("Go Module Name 未配置,请在设置中填写")
|
||||
}
|
||||
|
||||
results.WriteString("执行: go get -u " + moduleName + "@" + commitId + "\n")
|
||||
|
||||
cmd := exec.Command(goPath, "get", "-u", fmt.Sprintf("%s@%s", moduleName, commitId))
|
||||
cmd.Dir = projectPath
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("go get failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
results.WriteString(string(output))
|
||||
results.WriteString("\n")
|
||||
|
||||
results.WriteString("执行: go mod tidy\n")
|
||||
|
||||
cmd = exec.Command(goPath, "mod", "tidy")
|
||||
cmd.Dir = projectPath
|
||||
|
||||
output, err = cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("go mod tidy failed: %w\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
results.WriteString(string(output))
|
||||
results.WriteString("\n")
|
||||
|
||||
return nil
|
||||
}
|
||||
35
Tools/quickly/build/README.md
Normal file
35
Tools/quickly/build/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Build Directory
|
||||
|
||||
The build directory is used to house all the build files and assets for your application.
|
||||
|
||||
The structure is:
|
||||
|
||||
* bin - Output directory
|
||||
* darwin - macOS specific files
|
||||
* windows - Windows specific files
|
||||
|
||||
## Mac
|
||||
|
||||
The `darwin` directory holds files specific to Mac builds.
|
||||
These may be customised and used as part of the build. To return these files to the default state, simply delete them
|
||||
and
|
||||
build with `wails build`.
|
||||
|
||||
The directory contains the following files:
|
||||
|
||||
- `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`.
|
||||
- `Info.dev.plist` - same as the main plist file but used when building using `wails dev`.
|
||||
|
||||
## Windows
|
||||
|
||||
The `windows` directory contains the manifest and rc files used when building with `wails build`.
|
||||
These may be customised for your application. To return these files to the default state, simply delete them and
|
||||
build with `wails build`.
|
||||
|
||||
- `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to
|
||||
use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file
|
||||
will be created using the `appicon.png` file in the build directory.
|
||||
- `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`.
|
||||
- `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer,
|
||||
as well as the application itself (right click the exe -> properties -> details)
|
||||
- `wails.exe.manifest` - The main application manifest file.
|
||||
BIN
Tools/quickly/build/appicon.png
Normal file
BIN
Tools/quickly/build/appicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
68
Tools/quickly/build/darwin/Info.dev.plist
Normal file
68
Tools/quickly/build/darwin/Info.dev.plist
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{{.Info.ProductName}}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.OutputFilename}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>{{.Info.Comments}}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>{{.Info.Copyright}}</string>
|
||||
{{if .Info.FileAssociations}}
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
{{range .Info.FileAssociations}}
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>{{.Ext}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>{{.IconName}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
{{if .Info.Protocols}}
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
{{range .Info.Protocols}}
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.wails.{{.Scheme}}</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>{{.Scheme}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
63
Tools/quickly/build/darwin/Info.plist
Normal file
63
Tools/quickly/build/darwin/Info.plist
Normal file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>{{.Info.ProductName}}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>{{.OutputFilename}}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.{{.Name}}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>{{.Info.Comments}}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>{{.Info.ProductVersion}}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>iconfile</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>{{.Info.Copyright}}</string>
|
||||
{{if .Info.FileAssociations}}
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
{{range .Info.FileAssociations}}
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>{{.Ext}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>{{.Name}}</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>{{.IconName}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
{{if .Info.Protocols}}
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
{{range .Info.Protocols}}
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.wails.{{.Scheme}}</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>{{.Scheme}}</string>
|
||||
</array>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>{{.Role}}</string>
|
||||
</dict>
|
||||
{{end}}
|
||||
</array>
|
||||
{{end}}
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
Tools/quickly/build/windows/icon.ico
Normal file
BIN
Tools/quickly/build/windows/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
15
Tools/quickly/build/windows/info.json
Normal file
15
Tools/quickly/build/windows/info.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"fixed": {
|
||||
"file_version": "{{.Info.ProductVersion}}"
|
||||
},
|
||||
"info": {
|
||||
"0000": {
|
||||
"ProductVersion": "{{.Info.ProductVersion}}",
|
||||
"CompanyName": "{{.Info.CompanyName}}",
|
||||
"FileDescription": "{{.Info.ProductName}}",
|
||||
"LegalCopyright": "{{.Info.Copyright}}",
|
||||
"ProductName": "{{.Info.ProductName}}",
|
||||
"Comments": "{{.Info.Comments}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Tools/quickly/build/windows/installer/project.nsi
Normal file
114
Tools/quickly/build/windows/installer/project.nsi
Normal file
@@ -0,0 +1,114 @@
|
||||
Unicode true
|
||||
|
||||
####
|
||||
## Please note: Template replacements don't work in this file. They are provided with default defines like
|
||||
## mentioned underneath.
|
||||
## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo.
|
||||
## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually
|
||||
## from outside of Wails for debugging and development of the installer.
|
||||
##
|
||||
## For development first make a wails nsis build to populate the "wails_tools.nsh":
|
||||
## > wails build --target windows/amd64 --nsis
|
||||
## Then you can call makensis on this file with specifying the path to your binary:
|
||||
## For a AMD64 only installer:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe
|
||||
## For a ARM64 only installer:
|
||||
## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe
|
||||
## For a installer with both architectures:
|
||||
## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe
|
||||
####
|
||||
## The following information is taken from the ProjectInfo file, but they can be overwritten here.
|
||||
####
|
||||
## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}"
|
||||
## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}"
|
||||
## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}"
|
||||
## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}"
|
||||
## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}"
|
||||
###
|
||||
## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe"
|
||||
## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
||||
####
|
||||
## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html
|
||||
####
|
||||
## Include the wails tools
|
||||
####
|
||||
!include "wails_tools.nsh"
|
||||
|
||||
# The version information for this two must consist of 4 parts
|
||||
VIProductVersion "${INFO_PRODUCTVERSION}.0"
|
||||
VIFileVersion "${INFO_PRODUCTVERSION}.0"
|
||||
|
||||
VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}"
|
||||
VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer"
|
||||
VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}"
|
||||
VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}"
|
||||
VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}"
|
||||
|
||||
# Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware
|
||||
ManifestDPIAware true
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
!define MUI_ICON "..\icon.ico"
|
||||
!define MUI_UNICON "..\icon.ico"
|
||||
# !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps
|
||||
!define MUI_ABORTWARNING # This will warn the user if they exit from the installer.
|
||||
|
||||
!insertmacro MUI_PAGE_WELCOME # Welcome to the installer page.
|
||||
# !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer
|
||||
!insertmacro MUI_PAGE_DIRECTORY # In which folder install page.
|
||||
!insertmacro MUI_PAGE_INSTFILES # Installing page.
|
||||
!insertmacro MUI_PAGE_FINISH # Finished installation page.
|
||||
|
||||
!insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" # Set the Language of the installer
|
||||
|
||||
## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1
|
||||
#!uninstfinalize 'signtool --file "%1"'
|
||||
#!finalize 'signtool --file "%1"'
|
||||
|
||||
Name "${INFO_PRODUCTNAME}"
|
||||
OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file.
|
||||
InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder).
|
||||
ShowInstDetails show # This will always show the installation details.
|
||||
|
||||
Function .onInit
|
||||
!insertmacro wails.checkArchitecture
|
||||
FunctionEnd
|
||||
|
||||
Section
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
!insertmacro wails.webview2runtime
|
||||
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
!insertmacro wails.files
|
||||
|
||||
CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
|
||||
!insertmacro wails.associateFiles
|
||||
!insertmacro wails.associateCustomProtocols
|
||||
|
||||
!insertmacro wails.writeUninstaller
|
||||
SectionEnd
|
||||
|
||||
Section "uninstall"
|
||||
!insertmacro wails.setShellContext
|
||||
|
||||
RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath
|
||||
|
||||
RMDir /r $INSTDIR
|
||||
|
||||
Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk"
|
||||
Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk"
|
||||
|
||||
!insertmacro wails.unassociateFiles
|
||||
!insertmacro wails.unassociateCustomProtocols
|
||||
|
||||
!insertmacro wails.deleteUninstaller
|
||||
SectionEnd
|
||||
249
Tools/quickly/build/windows/installer/wails_tools.nsh
Normal file
249
Tools/quickly/build/windows/installer/wails_tools.nsh
Normal file
@@ -0,0 +1,249 @@
|
||||
# DO NOT EDIT - Generated automatically by `wails build`
|
||||
|
||||
!include "x64.nsh"
|
||||
!include "WinVer.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
|
||||
!ifndef INFO_PROJECTNAME
|
||||
!define INFO_PROJECTNAME "{{.Name}}"
|
||||
!endif
|
||||
!ifndef INFO_COMPANYNAME
|
||||
!define INFO_COMPANYNAME "{{.Info.CompanyName}}"
|
||||
!endif
|
||||
!ifndef INFO_PRODUCTNAME
|
||||
!define INFO_PRODUCTNAME "{{.Info.ProductName}}"
|
||||
!endif
|
||||
!ifndef INFO_PRODUCTVERSION
|
||||
!define INFO_PRODUCTVERSION "{{.Info.ProductVersion}}"
|
||||
!endif
|
||||
!ifndef INFO_COPYRIGHT
|
||||
!define INFO_COPYRIGHT "{{.Info.Copyright}}"
|
||||
!endif
|
||||
!ifndef PRODUCT_EXECUTABLE
|
||||
!define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe"
|
||||
!endif
|
||||
!ifndef UNINST_KEY_NAME
|
||||
!define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}"
|
||||
!endif
|
||||
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}"
|
||||
|
||||
!ifndef REQUEST_EXECUTION_LEVEL
|
||||
!define REQUEST_EXECUTION_LEVEL "admin"
|
||||
!endif
|
||||
|
||||
RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}"
|
||||
|
||||
!ifdef ARG_WAILS_AMD64_BINARY
|
||||
!define SUPPORTS_AMD64
|
||||
!endif
|
||||
|
||||
!ifdef ARG_WAILS_ARM64_BINARY
|
||||
!define SUPPORTS_ARM64
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_AMD64
|
||||
!ifdef SUPPORTS_ARM64
|
||||
!define ARCH "amd64_arm64"
|
||||
!else
|
||||
!define ARCH "amd64"
|
||||
!endif
|
||||
!else
|
||||
!ifdef SUPPORTS_ARM64
|
||||
!define ARCH "arm64"
|
||||
!else
|
||||
!error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY"
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!macro wails.checkArchitecture
|
||||
!ifndef WAILS_WIN10_REQUIRED
|
||||
!define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later."
|
||||
!endif
|
||||
|
||||
!ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED
|
||||
!define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}"
|
||||
!endif
|
||||
|
||||
${If} ${AtLeastWin10}
|
||||
!ifdef SUPPORTS_AMD64
|
||||
${if} ${IsNativeAMD64}
|
||||
Goto ok
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
Goto ok
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
IfSilent silentArch notSilentArch
|
||||
silentArch:
|
||||
SetErrorLevel 65
|
||||
Abort
|
||||
notSilentArch:
|
||||
MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}"
|
||||
Quit
|
||||
${else}
|
||||
IfSilent silentWin notSilentWin
|
||||
silentWin:
|
||||
SetErrorLevel 64
|
||||
Abort
|
||||
notSilentWin:
|
||||
MessageBox MB_OK "${WAILS_WIN10_REQUIRED}"
|
||||
Quit
|
||||
${EndIf}
|
||||
|
||||
ok:
|
||||
!macroend
|
||||
|
||||
!macro wails.files
|
||||
!ifdef SUPPORTS_AMD64
|
||||
${if} ${IsNativeAMD64}
|
||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}"
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef SUPPORTS_ARM64
|
||||
${if} ${IsNativeARM64}
|
||||
File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}"
|
||||
${EndIf}
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
!macro wails.writeUninstaller
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
SetRegView 64
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}"
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
||||
WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
||||
|
||||
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
||||
IntFmt $0 "0x%08X" $0
|
||||
WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
|
||||
!macroend
|
||||
|
||||
!macro wails.deleteUninstaller
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
|
||||
SetRegView 64
|
||||
DeleteRegKey HKLM "${UNINST_KEY}"
|
||||
!macroend
|
||||
|
||||
!macro wails.setShellContext
|
||||
${If} ${REQUEST_EXECUTION_LEVEL} == "admin"
|
||||
SetShellVarContext all
|
||||
${else}
|
||||
SetShellVarContext current
|
||||
${EndIf}
|
||||
!macroend
|
||||
|
||||
# Install webview2 by launching the bootstrapper
|
||||
# See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
|
||||
!macro wails.webview2runtime
|
||||
!ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT
|
||||
!define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime"
|
||||
!endif
|
||||
|
||||
SetRegView 64
|
||||
# If the admin key exists and is not empty then webview2 is already installed
|
||||
ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||
${If} $0 != ""
|
||||
Goto ok
|
||||
${EndIf}
|
||||
|
||||
${If} ${REQUEST_EXECUTION_LEVEL} == "user"
|
||||
# If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed
|
||||
ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
|
||||
${If} $0 != ""
|
||||
Goto ok
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
SetDetailsPrint both
|
||||
DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}"
|
||||
SetDetailsPrint listonly
|
||||
|
||||
InitPluginsDir
|
||||
CreateDirectory "$pluginsdir\webview2bootstrapper"
|
||||
SetOutPath "$pluginsdir\webview2bootstrapper"
|
||||
File "tmp\MicrosoftEdgeWebview2Setup.exe"
|
||||
ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install'
|
||||
|
||||
SetDetailsPrint both
|
||||
ok:
|
||||
!macroend
|
||||
|
||||
# Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b
|
||||
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}"
|
||||
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_UNASSOCIATE EXT FILECLASS
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup`
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0"
|
||||
|
||||
DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}`
|
||||
!macroend
|
||||
|
||||
!macro wails.associateFiles
|
||||
; Create file associations
|
||||
{{range .Info.FileAssociations}}
|
||||
!insertmacro APP_ASSOCIATE "{{.Ext}}" "{{.Name}}" "{{.Description}}" "$INSTDIR\{{.IconName}}.ico" "Open with ${INFO_PRODUCTNAME}" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\""
|
||||
|
||||
File "..\{{.IconName}}.ico"
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro wails.unassociateFiles
|
||||
; Delete app associations
|
||||
{{range .Info.FileAssociations}}
|
||||
!insertmacro APP_UNASSOCIATE "{{.Ext}}" "{{.Name}}"
|
||||
|
||||
Delete "$INSTDIR\{{.IconName}}.ico"
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND
|
||||
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "" "${DESCRIPTION}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "URL Protocol" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\DefaultIcon" "" "${ICON}"
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell" "" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open" "" ""
|
||||
WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open\command" "" "${COMMAND}"
|
||||
!macroend
|
||||
|
||||
!macro CUSTOM_PROTOCOL_UNASSOCIATE PROTOCOL
|
||||
DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}"
|
||||
!macroend
|
||||
|
||||
!macro wails.associateCustomProtocols
|
||||
; Create custom protocols associations
|
||||
{{range .Info.Protocols}}
|
||||
!insertmacro CUSTOM_PROTOCOL_ASSOCIATE "{{.Scheme}}" "{{.Description}}" "$INSTDIR\${PRODUCT_EXECUTABLE},0" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\""
|
||||
|
||||
{{end}}
|
||||
!macroend
|
||||
|
||||
!macro wails.unassociateCustomProtocols
|
||||
; Delete app custom protocol associations
|
||||
{{range .Info.Protocols}}
|
||||
!insertmacro CUSTOM_PROTOCOL_UNASSOCIATE "{{.Scheme}}"
|
||||
{{end}}
|
||||
!macroend
|
||||
15
Tools/quickly/build/windows/wails.exe.manifest
Normal file
15
Tools/quickly/build/windows/wails.exe.manifest
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<assemblyIdentity type="win32" name="com.wails.{{.Name}}" version="{{.Info.ProductVersion}}.0" processorArchitecture="*"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
23
Tools/quickly/frontend/README.md
Normal file
23
Tools/quickly/frontend/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Vue 3 + TypeScript + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue
|
||||
3 `<script setup>` SFCs, check out
|
||||
the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
|
||||
|
||||
## Type Support For `.vue` Imports in TS
|
||||
|
||||
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type
|
||||
by default. In most cases this is fine if you don't really care about component prop types outside of templates.
|
||||
However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using
|
||||
manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
|
||||
|
||||
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look
|
||||
for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default,
|
||||
Take Over mode will enable itself if the default TypeScript extension is disabled.
|
||||
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
|
||||
|
||||
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
|
||||
13
Tools/quickly/frontend/index.html
Normal file
13
Tools/quickly/frontend/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>Quickly</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="./src/main.ts" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1319
Tools/quickly/frontend/package-lock.json
generated
Normal file
1319
Tools/quickly/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
Tools/quickly/frontend/package.json
Normal file
24
Tools/quickly/frontend/package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"element-plus": "^2.13.1",
|
||||
"vue": "^3.2.37",
|
||||
"vue-router": "^4.6.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "^7.18.10",
|
||||
"@vitejs/plugin-vue": "^3.0.3",
|
||||
"typescript": "^4.6.4",
|
||||
"vite": "^3.0.7",
|
||||
"vue-tsc": "^1.8.27"
|
||||
}
|
||||
}
|
||||
1
Tools/quickly/frontend/package.json.md5
Normal file
1
Tools/quickly/frontend/package.json.md5
Normal file
@@ -0,0 +1 @@
|
||||
12a2c8ac492a939e7178bbd4f4e7ce00
|
||||
164
Tools/quickly/frontend/src/App.vue
Normal file
164
Tools/quickly/frontend/src/App.vue
Normal file
@@ -0,0 +1,164 @@
|
||||
<script lang="ts" setup>
|
||||
import {ref} from 'vue'
|
||||
import {useRoute, useRouter} from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const activeMenu = ref('home')
|
||||
|
||||
const menuItems = [
|
||||
{index: 'home', path: '/home', title: '主页'},
|
||||
{index: 'settings', path: '/settings', title: '设置'},
|
||||
{index: 'swagger', path: '/swagger', title: 'Swagger'},
|
||||
{index: 'mysql-model', path: '/mysql-model', title: 'MySQL Model'},
|
||||
{index: 'update-common', path: '/update-common', title: '更新 Common'}
|
||||
]
|
||||
|
||||
function handleMenuSelect(index: string) {
|
||||
activeMenu.value = index
|
||||
const menuItem = menuItems.find(item => item.index === index)
|
||||
if (menuItem) {
|
||||
router.push(menuItem.path)
|
||||
}
|
||||
}
|
||||
|
||||
router.afterEach((to) => {
|
||||
const menuItem = menuItems.find(item => item.path === to.path)
|
||||
if (menuItem) {
|
||||
activeMenu.value = menuItem.index
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-container class="app-container">
|
||||
<el-aside width="200px" class="app-aside">
|
||||
<div class="logo-container">
|
||||
<img src="./assets/images/logo-universal.png" alt="logo" class="logo"/>
|
||||
<span class="app-title">Quickly</span>
|
||||
</div>
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
class="el-menu-vertical"
|
||||
@select="handleMenuSelect"
|
||||
>
|
||||
<el-menu-item index="home">
|
||||
<el-icon>
|
||||
<House/>
|
||||
</el-icon>
|
||||
<span>主页</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="settings">
|
||||
<el-icon>
|
||||
<Setting/>
|
||||
</el-icon>
|
||||
<span>设置</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="swagger">
|
||||
<el-icon>
|
||||
<Document/>
|
||||
</el-icon>
|
||||
<span>Swagger</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="mysql-model">
|
||||
<el-icon>
|
||||
<DataLine/>
|
||||
</el-icon>
|
||||
<span>MySQL Model</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="update-common">
|
||||
<el-icon>
|
||||
<Refresh/>
|
||||
</el-icon>
|
||||
<span>更新 Common</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-container class="main-container">
|
||||
<el-header class="app-header">
|
||||
<div class="header-title">{{ route.meta.title || 'Quickly 金牌助手' }}</div>
|
||||
</el-header>
|
||||
<el-main class="app-main">
|
||||
<router-view/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.app-container {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.app-aside {
|
||||
background-color: #1b2636;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
gap: 10px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.app-title {
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.el-menu-vertical {
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item {
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.el-menu-vertical .el-menu-item.is-active {
|
||||
background-color: #409eff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.main-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 20px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.header-title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
background-color: #f5f7fa;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
93
Tools/quickly/frontend/src/assets/fonts/OFL.txt
Normal file
93
Tools/quickly/frontend/src/assets/fonts/OFL.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright 2016 The Nunito Project Authors (contact@sansoxygen.com),
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
BIN
Tools/quickly/frontend/src/assets/images/logo-universal.png
Normal file
BIN
Tools/quickly/frontend/src/assets/images/logo-universal.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 136 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user