Compare commits
4 Commits
15808c58d9
...
bd21a4998c
Author | SHA1 | Date | |
---|---|---|---|
bd21a4998c | |||
c2cfcd7899 | |||
d7047470e4 | |||
77539466f8 |
9852
api/account/account.pb.go
Normal file
9852
api/account/account.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
778
api/account/account.proto
Normal file
778
api/account/account.proto
Normal file
@ -0,0 +1,778 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
syntax = "proto3";
|
||||
package account;
|
||||
import "github.com/mwitkow/go-proto-validators@v0.3.2/validator.proto";
|
||||
|
||||
option go_package = "./;account";
|
||||
|
||||
service Account {
|
||||
rpc Login (LoginRequest) returns (TokenInfo) {}
|
||||
rpc RefreshToken (RefreshTokenRequest) returns (TokenInfo) {} //刷新token
|
||||
rpc Logout (DecryptJwtRequest) returns (CommonResponse) {}
|
||||
rpc OffLine (CommonRequest) returns (CommonResponse) {}
|
||||
rpc OnlineLog (LoginInfosByUserIdRequest) returns (LoginLogsResponse) {}//根据用户id获取登录的信息
|
||||
rpc OnlineLogById (OnlineLogByIdRequest) returns (LoginLog) {}//根据用户id获取登录的信息
|
||||
rpc CheckPwd (CheckPwdRequest) returns (UpdateResponse) {}//检测密码是否正确
|
||||
// rpc RegisterOrExist (RegistRequest) returns (RequestStatus) {}
|
||||
rpc SendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} //登陆发送验证码
|
||||
rpc SendCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//定制化发送内容
|
||||
rpc SendExCustomMsg (SendCustomMsgRequest) returns (SendMsgStatusResponse) {}//定制化发送内容
|
||||
rpc SendMsgRegister (SendMsgRequest) returns (SendMsgStatusResponse) {}//注册发送
|
||||
rpc CheckMsg (CheckMsgRequest) returns (SendMsgStatusResponse) {}
|
||||
rpc SendNewTelNumMsg (SendNewTelNumMsgRequest) returns (SendMsgStatusResponse) {}//发送新账号验证码,不携带新号码
|
||||
rpc UpdateTelNum (SendNewTelNumMsgRequest) returns (SendMsgStatusResponse) {}//更新新手机号,校验新号码验证码
|
||||
rpc Authentication (AuthenticationRequest) returns (RequestStatus) {}
|
||||
rpc DecryptJwt (DecryptJwtRequest) returns (DecryptJwtResponse) {}//最好放在调用方
|
||||
rpc Info (InfoRequest) returns (UserInfoResponse) {}
|
||||
rpc JobNumGetInfo (JobNumGetInfoRequest) returns (InfoResponse) {}
|
||||
rpc List (ListRequest) returns (ListResponse) {}
|
||||
rpc RandList (ListRequest) returns (ListResponse) {}
|
||||
rpc ListByIDs (ListByIDsRequest) returns (ListResponse) {}
|
||||
rpc Remove (RemoveRequest) returns (RemoveResponse) {}
|
||||
rpc Update (UpdateRequest) returns (UpdateResponse) {}
|
||||
rpc UsersByTel (UsersByTelRequest) returns (ListResponse) {}
|
||||
rpc UserByTel (UserByTelRequest) returns (InfoResponse) {}
|
||||
rpc OnlySendMsg (SendMsgRequest) returns (SendMsgStatusResponse) {} //仅发验证码
|
||||
rpc OnlyCheckMsg (CheckMsgRequest) returns (SendMsgStatusResponse) {}//仅校验之前发送的验证码
|
||||
rpc MailAccountByNickName(MailAccountByNickNameRequest) returns(MaiAccountResponse){} //根据昵称姓名获取昵称的邮箱和拼音名称
|
||||
rpc ListV2 (ListV2Request) returns (ListResponse) {}// 新版列表 查询
|
||||
rpc QueryPersonnelWithTheSameName (QueryPersonnelWithTheSameNameRequest) returns (QueryPersonnelWithTheSameNameResponse) {}// 查询同名的员工
|
||||
rpc UsersByJobNum (UsersByJobNumRequest) returns (ListResponse) {}
|
||||
rpc RealName (RealNameRequest) returns (RealNameResponse) {}//实名认证
|
||||
rpc Register (RegistRequest) returns (RegisterResponse) {}//注册
|
||||
rpc UserList (UserListRequest) returns (UserListResponse) {}//用户列表
|
||||
rpc CheckRealName (CheckRealNameRequest) returns (CheckRealNameResponse) {}//审核实名
|
||||
}
|
||||
message CheckRealNameResponse{
|
||||
uint64 id =1;
|
||||
string status =2;
|
||||
}
|
||||
message CheckRealNameRequest{
|
||||
uint64 id = 1;
|
||||
bool pass = 2;
|
||||
string notPassRemarks = 3;
|
||||
}
|
||||
message UserListResponse{
|
||||
uint64 count = 1;
|
||||
uint64 page = 2;
|
||||
uint64 pageSize = 3;
|
||||
repeated UserListInfo userList = 4;
|
||||
}
|
||||
message UserListInfo{
|
||||
uint64 id = 1;
|
||||
int32 status = 2;
|
||||
string name = 3;
|
||||
int32 sex = 4;
|
||||
string nationality = 5;
|
||||
int32 documentType =6;
|
||||
string certificatePicture = 7;
|
||||
string validity = 8;
|
||||
string placeOfResidence = 9;
|
||||
string groupPhoto = 10;
|
||||
string attachment = 11;
|
||||
string registrationTime = 12;
|
||||
string auditTime = 13;
|
||||
string subNum = 14;
|
||||
string notPassRemarks = 15;
|
||||
string telNum = 16;
|
||||
}
|
||||
message UserListRequest{
|
||||
string domain = 1;
|
||||
string subNum = 2;
|
||||
int32 realNameOrNot = 3;
|
||||
string name = 4;
|
||||
int32 sex = 5;
|
||||
int32 documentType = 6;
|
||||
int32 auditStatus = 7;
|
||||
uint64 page = 8;
|
||||
uint64 pageSize = 9;
|
||||
}
|
||||
message UserInfoResponse{
|
||||
uint64 id = 1;
|
||||
int32 status = 2;
|
||||
string name = 3;
|
||||
int32 sex = 4;
|
||||
string nationality = 5;
|
||||
int32 documentType =6;
|
||||
string certificatePicture = 7;
|
||||
string validity = 8;
|
||||
string placeOfResidence = 9;
|
||||
string groupPhoto = 10;
|
||||
string attachment = 11;
|
||||
string subNum = 12;
|
||||
string notPassRemarks = 13;
|
||||
}
|
||||
message RealNameResponse{
|
||||
uint64 id = 1;
|
||||
string status = 2;
|
||||
}
|
||||
message RealNameRequest{
|
||||
uint64 id = 1;
|
||||
string name = 2;
|
||||
int32 sex = 3;
|
||||
string nationality = 4;
|
||||
int32 documentType = 5;
|
||||
string certificatePicture = 6;
|
||||
string validity = 7;
|
||||
string placeOfResidence = 8;
|
||||
string groupPhoto = 9;
|
||||
string attachment = 10;
|
||||
}
|
||||
message RegisterResponse{
|
||||
uint64 ID = 1;
|
||||
uint64 status = 2;
|
||||
string token = 3;
|
||||
}
|
||||
message UsersByJobNumRequest{
|
||||
string domain = 1 ;
|
||||
repeated string jobNum =2 ;
|
||||
}
|
||||
message QueryPersonnelWithTheSameNameRequest{
|
||||
repeated string names = 1 ;
|
||||
string domain = 2 ;
|
||||
string status = 3 ;
|
||||
}
|
||||
message QueryPersonnelWithTheSameNameResponse{
|
||||
repeated string names = 1 ;
|
||||
uint64 count = 2 ;
|
||||
}
|
||||
message ListV2Request {
|
||||
string domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
uint64 pageSize = 2 ;
|
||||
uint64 page = 3 ;
|
||||
string key = 4 ;
|
||||
string nickName = 5;
|
||||
string telNum = 6 ;
|
||||
string status = 7 ;
|
||||
string positionName = 8 ;
|
||||
string jobNum = 9 ;
|
||||
string mailAccount = 10 ;
|
||||
string startEnterDate = 11 ;
|
||||
string endEnterDate = 12 ;
|
||||
uint32 positionId = 13 ;
|
||||
uint32 departmentId = 14 ;
|
||||
string departmentName =15 ;
|
||||
repeated string departmentNames =16 ;
|
||||
repeated uint32 positionIds =17 ;
|
||||
repeated uint32 departmentIds =18 ;
|
||||
}
|
||||
|
||||
message SendClockInWechatRequest {
|
||||
string domain = 1;
|
||||
string telNum =2;
|
||||
string operatedAt =3;
|
||||
string clockType =4;
|
||||
uint32 userId =5;
|
||||
string ghId =6;
|
||||
string address =7;
|
||||
uint64 logId = 8;
|
||||
}
|
||||
message MailAccountByNickNameRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"}];
|
||||
string NickName = 2 [json_name = "nickName",(validator.field) = {length_lt: 20,string_not_empty: true,human_error: "70005"}];
|
||||
uint32 ID = 3 ;
|
||||
}
|
||||
|
||||
message CreateMaiAccountRequest {
|
||||
uint32 ID = 1 ;
|
||||
string nickName = 2;
|
||||
string domain = 3 ;
|
||||
}
|
||||
|
||||
message MaiAccountResponse {
|
||||
string englishName = 1 ;
|
||||
string mailAccount = 2;
|
||||
}
|
||||
|
||||
message FddCreateUserRequest {
|
||||
string openid = 1 ;
|
||||
uint32 wxUserId = 2;
|
||||
//string UserId = 3;
|
||||
string customerId = 4;
|
||||
bool isVerify = 5;
|
||||
string transactionNo = 6;
|
||||
}
|
||||
|
||||
message WxBoxUserInfoRequest {
|
||||
string openid = 2 ;
|
||||
string ghId = 3;
|
||||
}
|
||||
|
||||
message WxGetOpenIdByCodeRequest {
|
||||
string code = 1 ;
|
||||
string state = 2 ;
|
||||
string ghId = 3;
|
||||
}
|
||||
|
||||
message WxGetOpenIdByCodeResponse {
|
||||
string openId = 1 ;
|
||||
}
|
||||
|
||||
message WxBoxTelNumByCodeResponse {
|
||||
string telNum = 1 ;
|
||||
}
|
||||
|
||||
message WxBoxUserInfo {
|
||||
string openId = 1 ;
|
||||
string ghId = 2 ;
|
||||
bool isNew = 3 ;
|
||||
UserInfo user = 4 ;
|
||||
uint32 wxUserId = 5 ;
|
||||
FddInfo fdd = 6 ;
|
||||
}
|
||||
|
||||
message FddInfo {
|
||||
uint64 ID = 1 ;
|
||||
string customerId = 2 ;
|
||||
bool isVerify = 3 ;
|
||||
string transactionNo = 4;
|
||||
}
|
||||
|
||||
message UserInfo {
|
||||
uint64 ID = 1 ;
|
||||
string nickName = 3 ;
|
||||
string telNum = 5 ;
|
||||
string avatar = 7 ;
|
||||
string createAt = 8 ;
|
||||
uint64 realNameID = 9 ;
|
||||
string realName = 10;
|
||||
string iDNum = 11;
|
||||
string domain = 12;
|
||||
string realIDImgA = 17;
|
||||
string realIDImgB = 18;
|
||||
string realNameIDName = 19;
|
||||
string video = 20;
|
||||
}
|
||||
|
||||
message CommonRequest {
|
||||
uint64 ID = 1 [json_name = "ID"];
|
||||
}
|
||||
|
||||
message WxAppRequest {
|
||||
string GhId = 1 [json_name = "ID"];
|
||||
}
|
||||
|
||||
message WxAppResponse {
|
||||
string AppID = 1 [json_name = "appID"];
|
||||
string AppSecret = 2 [json_name = "appSecret"];
|
||||
}
|
||||
|
||||
message WxUserUpdateRequest {
|
||||
uint32 wxID = 1 [json_name = "wxId" ,(validator.field) = {string_not_empty: true,human_error: "缺少参数wxID"} ];
|
||||
uint32 userID = 2 [json_name = "userID"];
|
||||
}
|
||||
|
||||
message WxUserOrCreateRequest {
|
||||
string OpenID = 1 [json_name = "openID" ,(validator.field) = {string_not_empty: true,human_error: "缺少openid"} ];
|
||||
string GhID = 2 [json_name = "ghID" ,(validator.field) = {string_not_empty: true,human_error: "缺少参数ghid"} ];
|
||||
}
|
||||
|
||||
message WxUserResponse {
|
||||
string OpenID = 1 [json_name = "openID"];
|
||||
uint32 UserID = 2 [json_name = "userID"];
|
||||
string GhID = 3 [json_name = "ghID"];
|
||||
string RoleAuth = 4 [json_name = "roleAuth"];
|
||||
uint32 ID = 5 [json_name = "ID"];
|
||||
}
|
||||
|
||||
|
||||
message LoginLogsResponse {
|
||||
repeated LoginLog Data = 1 [json_name = "data"];
|
||||
}
|
||||
|
||||
message LoginLog {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 ID = 2 [json_name = "ID"];
|
||||
uint64 UserId = 3 [json_name = "userId"];
|
||||
string Ip = 4 [json_name = "ip"];
|
||||
string Token = 5 [json_name = "token"];
|
||||
uint64 Status = 6 [json_name = "status"];
|
||||
string ExpireDate = 7 [json_name = "expireDate"];
|
||||
string LastDate = 8 [json_name = "lastDate"];
|
||||
string LogoutDate = 9 [json_name = "logoutDate"];
|
||||
string CreatedAt = 10 [json_name = "createdAt"];
|
||||
string Address = 11 [json_name = "address"];
|
||||
}
|
||||
|
||||
message OnlineLogByIdRequest {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 ID = 2 [json_name = "ID"];
|
||||
}
|
||||
|
||||
message LoginInfosByUserIdRequest {
|
||||
string Domain = 1 [json_name = "domain"];
|
||||
uint64 UserId = 2 [json_name = "userId"];
|
||||
}
|
||||
|
||||
message SendNewTelNumMsgRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
uint64 ID = 2 [json_name = "ID",(validator.field) = {string_not_empty: true,human_error: "缺少参数"} ];
|
||||
string NewTelNum = 3 [json_name = "newTelNum"];
|
||||
string Code = 4 [json_name = "code"];
|
||||
string Project = 5 [json_name = "project"];
|
||||
uint32 signNo = 6 ;
|
||||
}
|
||||
|
||||
message UserByTelRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string Tel =2 [json_name = "tel"];
|
||||
}
|
||||
|
||||
message CommonResponse {
|
||||
}
|
||||
|
||||
message UsersByTelRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
repeated string Tels =2 [json_name = "tels"];
|
||||
}
|
||||
|
||||
message ListByIDsRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
repeated uint64 IDs = 2 [json_name = "IDs"];
|
||||
uint64 OrderType = 3 [json_name = "OrderType"];
|
||||
uint64 Page = 4 [json_name = "page"];
|
||||
uint64 PageSize = 5 [json_name = "pageSize"];
|
||||
string NickName = 6 [json_name = "nickName"];
|
||||
repeated string InvitationCode = 7 [json_name = "invitationCode"];
|
||||
|
||||
}
|
||||
|
||||
message SendMsgRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
|
||||
string Project = 3 [json_name = "project"];
|
||||
uint32 signNo = 4;
|
||||
uint32 mId = 5;
|
||||
string scope = 6;//标记模块
|
||||
}
|
||||
|
||||
message SendCustomMsgRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
|
||||
string Project = 3 [json_name = "project"];
|
||||
string Url = 4 [json_name = "Url"];
|
||||
uint64 ID = 5 [json_name = "ID"];
|
||||
uint64 MId = 6 [json_name = "mId"];
|
||||
uint64 Location = 7 [json_name = "location"];
|
||||
uint32 SigNo = 8 [json_name = "sigNo"];
|
||||
}
|
||||
|
||||
message CheckMsgRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
|
||||
string Code = 3 [json_name = "code",(validator.field) = {string_not_empty: true,human_error: "70003"} ];
|
||||
string scope = 4;//标记模块
|
||||
}
|
||||
|
||||
message SendMsgStatusResponse {
|
||||
}
|
||||
|
||||
message RemoveRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
uint64 ID = 2 [json_name = "ID",(validator.field) = {int_gt: 0,human_error: "70004"} ];
|
||||
string code = 3;
|
||||
}
|
||||
message WriteOffRequest{
|
||||
uint64 id = 1;
|
||||
string domain = 2;
|
||||
uint64 userId = 3;
|
||||
string tel = 4;
|
||||
string jonNum = 5;
|
||||
string userName = 6;
|
||||
string enterDate = 7;
|
||||
string positionName =8;
|
||||
uint64 positionId = 9;
|
||||
string siteName = 10;
|
||||
uint64 siteId =11;
|
||||
string authUrl =12;
|
||||
string type =13;
|
||||
uint32 status =14;
|
||||
string submitDate=15;
|
||||
}
|
||||
message WriteOffListRequest{
|
||||
uint64 page = 1;
|
||||
uint64 pageSize =2;
|
||||
string domain = 3;
|
||||
string userName =4;
|
||||
uint64 userId = 5;
|
||||
uint64 siteId =6;
|
||||
string type =7;
|
||||
uint32 status =8;
|
||||
}
|
||||
message WriteOffApproveRequest{
|
||||
uint64 id = 1;
|
||||
uint32 status = 2;
|
||||
}
|
||||
message WriteOffListResponse{
|
||||
int64 total = 1;
|
||||
repeated WriteOffRequest writeOffList = 2;
|
||||
}
|
||||
message RemoveResponse {
|
||||
}
|
||||
|
||||
message UpdateRequest {
|
||||
uint64 ID = 1 [json_name = "ID"]; //ID
|
||||
string Domain = 2 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string NickName = 3 [json_name = "nickName"];
|
||||
string Password = 4 [json_name = "password"]; //密码
|
||||
string Avatar = 5 [json_name = "avatar"]; //头像
|
||||
string Status = 7 [json_name = "status"];
|
||||
string TelNum = 8 [json_name = "telNum"];
|
||||
string EnterDate = 14 [json_name = "enterDate"];
|
||||
Extend Extend = 17 [json_name = "extend"];
|
||||
string Title = 18 [json_name = "title"];
|
||||
string JobNum = 19 [json_name = "jobNum"];
|
||||
string BirthDate = 20 [json_name = "birthDate"];
|
||||
uint64 Sex = 21 [json_name = "sex"];
|
||||
string IdNum = 22 [json_name = "idNum"];
|
||||
string RealName = 23 [json_name = "realName"];
|
||||
string InvitationCode = 24 [json_name = "invitationCode"];
|
||||
string LeftDate = 25 [json_name = "leftDate"];
|
||||
string Remark = 26 [json_name = "remark"];
|
||||
string RecentImg = 27 [json_name = "recentImg"];
|
||||
string ICNum = 28 [json_name = "icNum"];
|
||||
string Train = 29 [json_name = "train"];
|
||||
string Certificate = 30 [json_name = "certificate"];
|
||||
repeated trainVideo TrainVideos = 31 [json_name = "trainVideos"];
|
||||
Operator operator = 32;
|
||||
string SecurityCode = 33 [json_name = "securityCode"];
|
||||
}
|
||||
|
||||
message Operator {
|
||||
uint32 ID = 1;
|
||||
string Name = 2;
|
||||
}
|
||||
|
||||
message trainVideo {
|
||||
string trainUUID = 1 [json_name = "trainUUID"];
|
||||
string trainDesc = 2 [json_name = "trainDesc"];
|
||||
string video = 3 [json_name = "video"];
|
||||
string SecurityCode = 31 [json_name = "securityCode"];
|
||||
}
|
||||
|
||||
message UpdateResponse {
|
||||
}
|
||||
|
||||
message PrivacyInfoRequest {
|
||||
uint64 ID = 1 [json_name = "ID"]; //ID
|
||||
string Domain = 2 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string SecurityCode = 3 [json_name = "securityCode"];
|
||||
}
|
||||
|
||||
message ListRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
uint64 PageSize = 2 [json_name = "pageSize"];
|
||||
uint64 Page = 3 [json_name = "page"];
|
||||
string key = 4 [json_name = "key"];
|
||||
string status = 5 ;
|
||||
string telNum = 6;
|
||||
string startEnterDate = 7;
|
||||
string endEnterDate = 8;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
string Status = 1 [json_name = "status"];
|
||||
uint64 Count = 2 [json_name = "count"];
|
||||
repeated AccountInfo Data = 3 [json_name = "data"];
|
||||
uint64 AllCount = 4 [json_name = "allCount"];
|
||||
}
|
||||
|
||||
message InfoRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
uint64 ID = 2 [json_name = "id"];
|
||||
string scene = 3 ;//场景值 base-默认仅仅user数据
|
||||
}
|
||||
|
||||
message InfoResponse {
|
||||
string Status = 1 [json_name = "status"];
|
||||
AccountInfo Info = 2 [json_name = "accountInfo"];
|
||||
bool IsExist = 3 [json_name = "isExist"];
|
||||
}
|
||||
|
||||
message DecryptJwtResponse {
|
||||
string Domain = 1 [json_name = "status"];
|
||||
uint64 ID = 2 [json_name = "id"];
|
||||
string Account = 3 [json_name = "account"];
|
||||
string NickName = 4 [json_name = "nickName"];
|
||||
bool IsOffline = 5 [json_name = "isOffline"];
|
||||
}
|
||||
|
||||
message DecryptJwtRequest {
|
||||
string token = 1 [json_name = "token"];
|
||||
string Domain = 2 [json_name = "Domain"];
|
||||
}
|
||||
|
||||
message CheckPwdRequest {
|
||||
string Token = 1 [json_name = "token"];
|
||||
string Password = 2 [json_name = "password"];
|
||||
}
|
||||
|
||||
message AuthenticationRequest {
|
||||
string Name = 1 [json_name = "name"];
|
||||
string IDNum = 2 [json_name = "idNum",(validator.field) = {length_eq: 18,human_error: "70006"}];
|
||||
string Token = 3 [json_name = "token"];
|
||||
}
|
||||
|
||||
message RequestStatus {
|
||||
string Status = 1 [json_name = "status"];
|
||||
uint64 ID = 2 [json_name = "ID"];
|
||||
bool isExist = 3;
|
||||
}
|
||||
|
||||
message RegistRequest {
|
||||
string domain = 1;
|
||||
string telNum = 2;
|
||||
string code = 3;
|
||||
string address = 4;
|
||||
string telAreaCode = 5;
|
||||
}
|
||||
|
||||
message LoginRequest {
|
||||
string Domain = 1 [json_name = "domain",(validator.field) = {string_not_empty: true,human_error: "70001"} ];
|
||||
string TelNum = 2 [json_name = "telNum",(validator.field) = {regex: "^1\\d{10}$",human_error: "70002"}];
|
||||
string Code = 3 [json_name = "code"];
|
||||
string Password = 4 [json_name = "password"];
|
||||
string Ip = 5 [json_name = "ip"];
|
||||
bool passCheckIp = 6 ;
|
||||
}
|
||||
|
||||
message TokenInfo {
|
||||
AccountInfo AccountInfo = 1 [json_name = "accountInfo"];
|
||||
string Token = 2 [json_name = "token"];
|
||||
string RefreshToken = 4 [json_name = "refresh"];
|
||||
bool IsSampleAddress = 3 [json_name = "isSampleAddress"];
|
||||
string nowAddress = 5 [json_name = "nowAddress"];
|
||||
}
|
||||
|
||||
message Extend {
|
||||
string JumpTo = 1 [json_name = "jumpTo"];
|
||||
string Lang = 2 [json_name = "lang"];
|
||||
bool CanScan = 3 [json_name = "canScan"];
|
||||
bool ResolutionRatio = 4 [json_name = "resolutionRatio"];
|
||||
}
|
||||
|
||||
message Department {
|
||||
uint64 ID = 1 [json_name = "ID"];
|
||||
string Name = 2 [json_name = "name"];
|
||||
}
|
||||
|
||||
// The response message containing the greetings
|
||||
message AccountInfo {
|
||||
uint64 ID = 1 [json_name = "id"];
|
||||
string Account = 2 [json_name = "account"];
|
||||
string NickName = 3 [json_name = "nickName"];
|
||||
int64 Type = 4 [json_name = "type"];
|
||||
string TelNum = 5 [json_name = "telNum"];
|
||||
int32 Status = 6 [json_name = "status"];
|
||||
string Avatar = 7 [json_name = "avatar"];
|
||||
string CreateAt = 8 [json_name = "createAt"];
|
||||
uint64 RealNameID = 9 [json_name = "realNameID"];
|
||||
string RealName = 10 [json_name = "realName"];
|
||||
string IDNum = 11 [json_name = "iDNum"];
|
||||
string MnemonicWords = 12 [json_name = "mnemonicWords"];
|
||||
uint64 IsNeedChange = 13 [json_name = "isNeedChange"];
|
||||
string EnterDate = 14 [json_name = "enterDate"];
|
||||
float WorkYear = 15 [json_name = "workYear"];
|
||||
string Domain = 16 [json_name = "domain"];
|
||||
Extend Extend = 17 [json_name = "extend"];
|
||||
string JobNum = 18 [json_name = "jobNum"];
|
||||
string BirthDate = 19 [json_name = "birth_date"];
|
||||
uint64 Age = 20 [json_name = "age"];
|
||||
uint64 Sex = 21 [json_name = "sex"];
|
||||
string Title = 22 [json_name = "title"];
|
||||
repeated Department Departments = 23 [json_name = "departments"];
|
||||
string Ip = 24 [json_name = "ip"];
|
||||
string LoginDate = 25 [json_name = "loginDate"];
|
||||
string InvitationCode = 26 [json_name = "invitationCode"];
|
||||
uint64 NowLogId = 27 [json_name = "nowLogId"];
|
||||
bool CanScan = 28 [json_name = "canScan"];
|
||||
string LeftDate = 29 [json_name = "leftDate"];
|
||||
repeated PositionUser Positions = 30 [json_name = "positions"];
|
||||
string Remark = 31 [json_name = "remark"];
|
||||
string recentImg =32;
|
||||
repeated ClockUser clocks = 33;
|
||||
string mailAccount = 34;
|
||||
string ICNum = 35 [json_name = "icNum"];
|
||||
string englishName = 36;
|
||||
string Train = 37 [json_name = "train"];
|
||||
string Certificate = 38 [json_name = "certificate"];
|
||||
repeated trainVideo TrainVideos = 39 [json_name = "trainVideos"];
|
||||
Operator operator = 40;
|
||||
string updatedAt = 41;
|
||||
string SecurityCode = 42 [json_name = "securityCode"];
|
||||
string BlockAddr = 43 [json_name = "blockAddr"];
|
||||
}
|
||||
|
||||
message UserInfoV2 {
|
||||
uint64 ID = 1 ;
|
||||
string Account = 2 ;
|
||||
string NickName = 3 ;
|
||||
string TelNum = 4 ;
|
||||
string Status = 5 ;
|
||||
string Avatar = 6 ;
|
||||
string CreateAt = 7 ;
|
||||
string RealName = 8;
|
||||
string IDNum = 9;
|
||||
string EnterDate = 10;
|
||||
Extend Extend = 11;
|
||||
string JobNum = 12;
|
||||
string recentImg = 13;
|
||||
string mailAccount = 14;
|
||||
Operator operator = 15;
|
||||
string updatedAt = 16;
|
||||
}
|
||||
|
||||
message RefreshTokenRequest {
|
||||
string refreshToken = 1 ;
|
||||
string domain = 2;
|
||||
string ip = 3 ;
|
||||
}
|
||||
|
||||
message PositionUser {
|
||||
uint64 PositionID = 1 [json_name = "positionID"];
|
||||
string PositionName = 2 [json_name = "positionName"];
|
||||
uint64 DepartmentId = 3 [json_name = "departmentId"];
|
||||
string DepartmentCode = 4 [json_name = "departmentCode"];
|
||||
string DepartmentName = 5 [json_name = "departmentName"];
|
||||
uint64 UserId = 6 [json_name = "userId"];
|
||||
string UserName = 7 [json_name = "userName"];
|
||||
}
|
||||
message JobNumGetInfoRequest{
|
||||
string jobNum = 1;
|
||||
string domain = 2;
|
||||
}
|
||||
message CreateClockDeviceRequest{
|
||||
string deviceNum =1;
|
||||
string deviceName =2;
|
||||
string deviceSite = 3;
|
||||
}
|
||||
message UpdateClockDeviceRequest{
|
||||
uint64 id = 1;
|
||||
string deviceNum =2;
|
||||
string deviceName =3;
|
||||
string deviceSite = 4;
|
||||
}
|
||||
message ClockDeviceResponse{
|
||||
uint64 id = 1;
|
||||
}
|
||||
message RemoveClockDeviceRequest{
|
||||
uint64 id = 1;
|
||||
}
|
||||
message ClockDeviceListRequest{
|
||||
uint64 id =1;
|
||||
string deviceSite = 2;
|
||||
string deviceNum = 3;
|
||||
string deviceName = 4;
|
||||
uint64 page = 5 ;
|
||||
uint64 pageSize = 6 ;
|
||||
repeated uint64 ids = 7;
|
||||
}
|
||||
message ClockDeviceListResponse{
|
||||
uint64 count =1;
|
||||
repeated ClockDeviceInfo data = 2;
|
||||
}
|
||||
message ClockUser{
|
||||
uint64 id =1;
|
||||
string createdAt =2;
|
||||
string updatedAt =3;
|
||||
string deletedAt =4;
|
||||
uint64 deviceID =5;
|
||||
uint64 userId =6;
|
||||
uint64 status =7;
|
||||
ClockDeviceInfo device = 8;
|
||||
}
|
||||
message ClockDeviceInfo {
|
||||
uint64 id = 1 ;
|
||||
string createAt = 2 ;
|
||||
string updateAt = 3 ;
|
||||
string deviceSite = 4;
|
||||
string deviceNum = 5;
|
||||
string deviceName = 6;
|
||||
uint64 userNum = 7;
|
||||
repeated ClockUserRel data = 8 ;
|
||||
}
|
||||
|
||||
message ClockDeviceInfoResponse{
|
||||
uint64 count = 1;
|
||||
repeated ClockUserRel data = 2 ;
|
||||
}
|
||||
message ClockUserRel {
|
||||
uint64 id = 1 ;
|
||||
string createAt = 2 ;
|
||||
string updateAt = 3;
|
||||
string nickName = 4 ;
|
||||
string jobNum = 5 ;
|
||||
string icNum = 6;
|
||||
}
|
||||
message ClockDeviceInfoRequest{
|
||||
uint64 id = 1;
|
||||
uint64 page = 2 ;
|
||||
uint64 pageSize = 3 ;
|
||||
}
|
||||
message ClockBatchBindRequest{
|
||||
uint64 id = 1;
|
||||
repeated uint64 userId = 2;
|
||||
repeated uint64 deviceId =3;
|
||||
}
|
||||
message ClockBatchListResponse{
|
||||
repeated ClockUserDeviceBatch data = 1;
|
||||
}
|
||||
message ClockUserDeviceBatch{
|
||||
uint64 userId = 1;
|
||||
uint64 deviceId = 2;
|
||||
string JobNum = 3;
|
||||
string deviceNum = 4;
|
||||
string deviceName = 5;
|
||||
string workStatus = 6;
|
||||
}
|
||||
message ClockLogInfo{
|
||||
uint64 id = 1;
|
||||
string sn = 2;
|
||||
string userId =3;
|
||||
string recogType =4;
|
||||
string recogTime =5;
|
||||
float gender =6;
|
||||
string photo =7;
|
||||
float passStatus =8;
|
||||
string userName =9;
|
||||
float userType =10;
|
||||
string confidence =11;
|
||||
float reflectivity =12;
|
||||
string cardNumber =13;
|
||||
string passWord =14;
|
||||
string qrCode =15;
|
||||
string tel = 16;
|
||||
string reasonVisit = 17;
|
||||
string receiverTel = 18;
|
||||
uint64 numOfPeople = 19;
|
||||
}
|
||||
message ClockLogReq{
|
||||
uint64 id = 1;
|
||||
uint64 page = 2;
|
||||
uint64 pageSize = 3;
|
||||
string userName = 4;
|
||||
string recogType = 5;
|
||||
string deviceNum = 6;
|
||||
string recogDate = 7;
|
||||
uint64 userId = 8;
|
||||
}
|
||||
message ClockLogListResponse{
|
||||
repeated ClockLogInfo data =1;
|
||||
uint64 count = 2;
|
||||
}
|
535
api/account/account.validator.pb.go
Normal file
535
api/account/account.validator.pb.go
Normal file
@ -0,0 +1,535 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: api/account/account.proto
|
||||
|
||||
package account
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
math "math"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "github.com/mwitkow/go-proto-validators"
|
||||
regexp "regexp"
|
||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
func (this *CheckRealNameResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CheckRealNameRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UserListResponse) Validate() error {
|
||||
for _, item := range this.UserList {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("UserList", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *UserListInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UserListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UserInfoResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RealNameResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RealNameRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RegisterResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UsersByJobNumRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *QueryPersonnelWithTheSameNameRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *QueryPersonnelWithTheSameNameResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ListV2Request) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SendClockInWechatRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MailAccountByNickNameRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if this.NickName == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("NickName", fmt.Errorf(`70005`))
|
||||
}
|
||||
if !(len(this.NickName) < 20) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("NickName", fmt.Errorf(`70005`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *CreateMaiAccountRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *MaiAccountResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *FddCreateUserRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxBoxUserInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxGetOpenIdByCodeRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxGetOpenIdByCodeResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxBoxTelNumByCodeResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxBoxUserInfo) Validate() error {
|
||||
if this.User != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.User); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("User", err)
|
||||
}
|
||||
}
|
||||
if this.Fdd != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Fdd); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Fdd", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *FddInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UserInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CommonRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxAppRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxAppResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxUserUpdateRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WxUserOrCreateRequest) Validate() error {
|
||||
if this.OpenID == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("OpenID", fmt.Errorf(`缺少openid`))
|
||||
}
|
||||
if this.GhID == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("GhID", fmt.Errorf(`缺少参数ghid`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *WxUserResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LoginLogsResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *LoginLog) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *OnlineLogByIdRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *LoginInfosByUserIdRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *SendNewTelNumMsgRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *UserByTelRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *CommonResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UsersByTelRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ListByIDsRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _regex_SendMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
|
||||
|
||||
func (this *SendMsgRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if !_regex_SendMsgRequest_TelNum.MatchString(this.TelNum) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TelNum", fmt.Errorf(`70002`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _regex_SendCustomMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
|
||||
|
||||
func (this *SendCustomMsgRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if !_regex_SendCustomMsgRequest_TelNum.MatchString(this.TelNum) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TelNum", fmt.Errorf(`70002`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _regex_CheckMsgRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
|
||||
|
||||
func (this *CheckMsgRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if !_regex_CheckMsgRequest_TelNum.MatchString(this.TelNum) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TelNum", fmt.Errorf(`70002`))
|
||||
}
|
||||
if this.Code == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Code", fmt.Errorf(`70003`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *SendMsgStatusResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RemoveRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if !(this.ID > 0) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("ID", fmt.Errorf(`70004`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *WriteOffRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WriteOffListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WriteOffApproveRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *WriteOffListResponse) Validate() error {
|
||||
for _, item := range this.WriteOffList {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("WriteOffList", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RemoveResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if this.Extend != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Extend); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Extend", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.TrainVideos {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TrainVideos", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.Operator != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Operator); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Operator", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Operator) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *TrainVideo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PrivacyInfoRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ListRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ListResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InfoRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *InfoResponse) Validate() error {
|
||||
if this.Info != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Info); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Info", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *DecryptJwtResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *DecryptJwtRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CheckPwdRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *AuthenticationRequest) Validate() error {
|
||||
if !(len(this.IDNum) == 18) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("IDNum", fmt.Errorf(`70006`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RequestStatus) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RegistRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _regex_LoginRequest_TelNum = regexp.MustCompile(`^1\d{10}$`)
|
||||
|
||||
func (this *LoginRequest) Validate() error {
|
||||
if this.Domain == "" {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Domain", fmt.Errorf(`70001`))
|
||||
}
|
||||
if !_regex_LoginRequest_TelNum.MatchString(this.TelNum) {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TelNum", fmt.Errorf(`70002`))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *TokenInfo) Validate() error {
|
||||
if this.AccountInfo != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.AccountInfo); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("AccountInfo", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Extend) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *Department) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *AccountInfo) Validate() error {
|
||||
if this.Extend != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Extend); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Extend", err)
|
||||
}
|
||||
}
|
||||
for _, item := range this.Departments {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Departments", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Positions {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Positions", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.Clocks {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Clocks", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, item := range this.TrainVideos {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("TrainVideos", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if this.Operator != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Operator); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Operator", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *UserInfoV2) Validate() error {
|
||||
if this.Extend != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Extend); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Extend", err)
|
||||
}
|
||||
}
|
||||
if this.Operator != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Operator); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Operator", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *RefreshTokenRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *PositionUser) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *JobNumGetInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *CreateClockDeviceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *UpdateClockDeviceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceResponse) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *RemoveClockDeviceRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceListRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceListResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ClockUser) Validate() error {
|
||||
if this.Device != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Device); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Device", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceInfo) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceInfoResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ClockUserRel) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockDeviceInfoRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockBatchBindRequest) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockBatchListResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *ClockUserDeviceBatch) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockLogInfo) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockLogReq) Validate() error {
|
||||
return nil
|
||||
}
|
||||
func (this *ClockLogListResponse) Validate() error {
|
||||
for _, item := range this.Data {
|
||||
if item != nil {
|
||||
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||
return github_com_mwitkow_go_proto_validators.FieldError("Data", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
1679
api/account/account_triple.pb.go
Normal file
1679
api/account/account_triple.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -31,10 +31,8 @@ func main() {
|
||||
if err := bootstrap(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
r := router.NewRouter()
|
||||
_ = r.Run(config.AppConfig.System.HttpPort)
|
||||
|
||||
select {}
|
||||
}
|
||||
|
||||
|
@ -3,13 +3,94 @@ package config
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/pkg/common"
|
||||
"github.com/BurntSushi/toml"
|
||||
"gopkg.in/ini.v1"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
AppMode string
|
||||
HttpPort string
|
||||
Key string
|
||||
Cert string
|
||||
IsHttps bool
|
||||
RunHttps bool
|
||||
Domain string
|
||||
OssDomain string
|
||||
ServerDM string
|
||||
Env string
|
||||
DriverUrl string
|
||||
AppointUrl string
|
||||
MaterialHost string
|
||||
BosAk string
|
||||
BosSk string
|
||||
Endpoint string
|
||||
BosBucketName string
|
||||
BosBaseDir string
|
||||
BosUrl string
|
||||
BosHttp string
|
||||
BosDomain string
|
||||
ProjectMapDir string
|
||||
JaegerHost string
|
||||
JaegerOpen bool
|
||||
Cron bool
|
||||
DingAccessToken string
|
||||
DingUrl string
|
||||
HolidayID string
|
||||
HolidaySecret string
|
||||
HolidaySingleUrl string
|
||||
HolidayMultiUrl string
|
||||
|
||||
ErpAk string
|
||||
ErpSk string
|
||||
|
||||
// rabbitmq
|
||||
RabbitmqUser string
|
||||
RabbitmqPassword string
|
||||
RabbitmqHost string
|
||||
RabbitmqPort int
|
||||
RabbitmqVhost string
|
||||
RabbitmqVhostArtwork string
|
||||
|
||||
RedisDB int
|
||||
RedisAddr string
|
||||
RedisPw string
|
||||
|
||||
//shop配置
|
||||
ShopHost string
|
||||
//ShopDetail string
|
||||
|
||||
// 地图
|
||||
MapAppCode string
|
||||
// es
|
||||
ElasticHost string
|
||||
SendIndexesUrl string
|
||||
ChatGptHost string
|
||||
|
||||
ApiHost string
|
||||
|
||||
Level string
|
||||
Filename string
|
||||
MaxSize string
|
||||
MaxAge string
|
||||
MaxBackups string
|
||||
|
||||
YearGiftCheckHost string
|
||||
Aliyun struct {
|
||||
AccessKeyId string
|
||||
AccessKeySecret string
|
||||
}
|
||||
Blockchain struct {
|
||||
Key string
|
||||
PubKey string
|
||||
}
|
||||
)
|
||||
|
||||
/********start-配置信息*********/
|
||||
|
||||
//Baiduco 百度上链
|
||||
// Baiduco 百度上链
|
||||
type Mysql struct {
|
||||
Db string
|
||||
DbHost string
|
||||
@ -90,3 +171,92 @@ func LoadEnvFromFileInfo(data string) (*Config, error) {
|
||||
|
||||
return AppConfig, nil
|
||||
}
|
||||
func GetOptions() {
|
||||
iniConf, err := common.GetConf()
|
||||
if err != nil {
|
||||
panic("iniConf error")
|
||||
}
|
||||
file, err := ini.Load(iniConf)
|
||||
if err != nil {
|
||||
fmt.Println("服务器配置文件读取错误,请检查文件路径:", err)
|
||||
}
|
||||
LoadServer(file)
|
||||
}
|
||||
func LoadServer(file *ini.File) {
|
||||
AppMode = file.Section("service").Key("AppMode").String()
|
||||
IsHttps, _ = file.Section("service").Key("IsHTTPS").Bool()
|
||||
RunHttps, _ = file.Section("service").Key("RunHTTPS").Bool()
|
||||
Key = file.Section("service").Key("Key").String()
|
||||
Cert = file.Section("service").Key("Cert").String()
|
||||
HttpPort = file.Section("service").Key("HttpPort").String()
|
||||
Domain = file.Section("service").Key("Domain").String()
|
||||
OssDomain = file.Section("service").Key("OssDomain").String()
|
||||
ServerDM = file.Section("service").Key("ServerDM").String()
|
||||
DriverUrl = file.Section("service").Key("DriverUrl").String()
|
||||
Env = file.Section("service").Key("Env").String()
|
||||
JaegerHost = file.Section("service").Key("JaegerHost").String()
|
||||
JaegerOpen, _ = file.Section("service").Key("JaegerOpen").Bool()
|
||||
Cron, _ = file.Section("service").Key("Cron").Bool()
|
||||
YearGiftCheckHost = file.Section("service").Key("YearGiftCheckHost").String()
|
||||
|
||||
ProjectMapDir = file.Section("file").Key("ProjectMapDir").String()
|
||||
|
||||
AppointUrl = file.Section("service").Key("AppointUrl").String()
|
||||
MaterialHost = file.Section("service").Key("MaterialHost").String()
|
||||
|
||||
BosAk = file.Section("bos").Key("Ak").String()
|
||||
BosSk = file.Section("bos").Key("Sk").String()
|
||||
BosBucketName = file.Section("bos").Key("BucketName").String()
|
||||
BosBaseDir = file.Section("bos").Key("BosBaseDir").String()
|
||||
Endpoint = file.Section("bos").Key("Endpoint").String()
|
||||
BosUrl = file.Section("bos").Key("BosUrl").String()
|
||||
BosHttp = file.Section("bos").Key("BosHttp").String()
|
||||
BosDomain = file.Section("bos").Key("BosDomain").String()
|
||||
DingUrl = file.Section("ding").Key("Url").String()
|
||||
DingAccessToken = file.Section("ding").Key("AccessToken").String()
|
||||
|
||||
//加载获取万年历配置
|
||||
HolidayID = file.Section("holiday").Key("ID").String()
|
||||
HolidaySecret = file.Section("holiday").Key("Secret").String()
|
||||
HolidaySingleUrl = file.Section("holiday").Key("SingleUrl").String()
|
||||
HolidayMultiUrl = file.Section("holiday").Key("MultiUrl").String()
|
||||
|
||||
// 加载 rabbitmq 配置
|
||||
RabbitmqUser = file.Section("rabbitmq").Key("User").String()
|
||||
RabbitmqPassword = file.Section("rabbitmq").Key("Password").String()
|
||||
RabbitmqHost = file.Section("rabbitmq").Key("Host").String()
|
||||
RabbitmqPort, _ = file.Section("rabbitmq").Key("Port").Int()
|
||||
RabbitmqVhost = file.Section("rabbitmq").Key("Vhost").String()
|
||||
RabbitmqVhostArtwork = file.Section("rabbitmq").Key("VhostArtwork").String()
|
||||
|
||||
//加载 redis
|
||||
dbStr := file.Section("redis").Key("RedisDBNAme").String()
|
||||
RedisDB, _ = strconv.Atoi(dbStr)
|
||||
RedisAddr = file.Section("redis").Key("RedisAddr").String()
|
||||
RedisPw = file.Section("redis").Key("RedisPW").String()
|
||||
|
||||
ShopHost = file.Section("shop").Key("ShopHost").String()
|
||||
//ShopDetail = file.Section("shop").Key("ShopDetail").String()
|
||||
|
||||
// 地图
|
||||
MapAppCode = file.Section("service").Key("MapAppCode").String()
|
||||
|
||||
// 地图
|
||||
ElasticHost = file.Section("es").Key("ElasticHost").String()
|
||||
SendIndexesUrl = file.Section("api").Key("SendIndexesUrl").String()
|
||||
ChatGptHost = file.Section("api").Key("chatGptHost").String()
|
||||
ErpAk = file.Section("api").Key("erpak").String()
|
||||
ErpSk = file.Section("api").Key("erpsk").String()
|
||||
ApiHost = file.Section("service").Key("ApiHost").String()
|
||||
|
||||
// zap
|
||||
Level = file.Section("zap").Key("Level").String()
|
||||
Filename = file.Section("zap").Key("Filename").String()
|
||||
MaxSize = file.Section("zap").Key("MaxSize").String()
|
||||
MaxAge = file.Section("zap").Key("MaxAge").String()
|
||||
MaxBackups = file.Section("zap").Key("MaxBackups").String()
|
||||
Aliyun.AccessKeyId = file.Section("aliyun").Key("accessKeyId").String()
|
||||
Aliyun.AccessKeySecret = file.Section("aliyun").Key("accessKeySecret").String()
|
||||
Blockchain.PubKey = file.Section("blockchain").Key("PubKey").String()
|
||||
Blockchain.Key = file.Section("blockchain").Key("Key").String()
|
||||
}
|
||||
|
25
cmd/dev/conf.ini
Normal file
25
cmd/dev/conf.ini
Normal file
@ -0,0 +1,25 @@
|
||||
[system]
|
||||
Domain = "fiee"
|
||||
AppMode = "debug"
|
||||
HttpPort = ":8085"
|
||||
Host = "http://127.0.0.1:8085"
|
||||
RedirectUri = "/api/redirect/url"
|
||||
|
||||
[bos]
|
||||
Ak = "ALTAKxrqOQHnAN525Tb2GX4Bhe"
|
||||
Sk = "d2ecaa9d75114d3b9f42b99014198306"
|
||||
BucketName = "dci-file-new"
|
||||
BosUrl = ".bj.bcebos.com"
|
||||
BosBaseDir = "fonchain-main"
|
||||
BosHttp = "https://"
|
||||
|
||||
[redis]
|
||||
RedisDB = "1"
|
||||
RedisAddr = "127.0.0.1:6379"
|
||||
RedisPW = ""
|
||||
RedisDBNAme = "1"
|
||||
|
||||
[ai]
|
||||
Host = "https://erpapi.fontree.cn"
|
||||
TelNum = "18021272627"
|
||||
Password = "Gy.123456"
|
16
cmd/dev/dubbogo.yaml
Normal file
16
cmd/dev/dubbogo.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
dubbo:
|
||||
registries:
|
||||
demoZK:
|
||||
protocol: zookeeper
|
||||
timeout: 5s
|
||||
address: 127.0.0.1:2181
|
||||
consumer:
|
||||
references:
|
||||
AccountClientImpl:
|
||||
protocol: tri
|
||||
retries: 0
|
||||
interface: com.fontree.microservices.common.account
|
||||
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
|
||||
# params:
|
||||
# .accessKeyId: "Accountksl"
|
||||
# .secretAccessKey: "BSDY-FDF1-Fontree_account"
|
16
conf/dubbogo.yaml
Normal file
16
conf/dubbogo.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
dubbo:
|
||||
registries:
|
||||
demoZK:
|
||||
protocol: zookeeper
|
||||
timeout: 5s
|
||||
address: 127.0.0.1:2181
|
||||
consumer:
|
||||
references:
|
||||
AccountClientImpl:
|
||||
protocol: tri
|
||||
retries: 0
|
||||
interface: com.fontree.microservices.common.account
|
||||
# filter: cshutdown,sign,fonDomainFilter,fonValidateFilter
|
||||
# params:
|
||||
# .accessKeyId: "Accountksl"
|
||||
# .secretAccessKey: "BSDY-FDF1-Fontree_account"
|
228
go.mod
228
go.mod
@ -1,103 +1,191 @@
|
||||
module fonchain-fiee
|
||||
|
||||
go 1.20
|
||||
go 1.18
|
||||
|
||||
replace (
|
||||
//github.com/fonchain_enterprise/utils/aes => ./docs/utils/aes
|
||||
//github.com/fonchain_enterprise/utils/chain => ./docs/utils/chain
|
||||
//github.com/fonchain_enterprise/utils/jwt => ./docs/utils/jwt
|
||||
//github.com/fonchain_enterprise/utils/logger => ./docs/utils/logger
|
||||
//github.com/fonchain_enterprise/utils/rand => ./docs/utils/rand
|
||||
|
||||
github.com/fonchain/electronic-contract => ../../electronic-contract
|
||||
github.com/fonchain_enterprise/utils/aes => ../utils/aes
|
||||
github.com/fonchain_enterprise/utils/baidu => ../utils/baidu
|
||||
github.com/fonchain_enterprise/utils/bankQuery => ../utils/bankQuery
|
||||
github.com/fonchain_enterprise/utils/chain => ../utils/chain
|
||||
github.com/fonchain_enterprise/utils/feie => ../utils/feie
|
||||
github.com/fonchain_enterprise/utils/ipAddrQuery => ../utils/ipAddrQuery
|
||||
github.com/fonchain_enterprise/utils/jwt => ../utils/jwt
|
||||
github.com/fonchain_enterprise/utils/logger => ../utils/logger
|
||||
github.com/fonchain_enterprise/utils/objstorage => ../utils/objstorage
|
||||
github.com/fonchain_enterprise/utils/ocr => ../utils/ocr
|
||||
github.com/fonchain_enterprise/utils/pay => ../utils/pay
|
||||
github.com/fonchain_enterprise/utils/rand => ../utils/rand
|
||||
github.com/fonchain_enterprise/utils/utils => ../utils/utils
|
||||
|
||||
require (
|
||||
dubbo.apache.org/dubbo-go/v3 v3.1.1
|
||||
github.com/BurntSushi/toml v1.4.0
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/dubbogo/grpc-go v1.42.10
|
||||
github.com/dubbogo/triple v1.2.2-rc3
|
||||
github.com/gin-contrib/gzip v1.2.2
|
||||
github.com/gin-contrib/pprof v1.5.2
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/mwitkow/go-proto-validators v0.3.2
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
google.golang.org/protobuf v1.36.5
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/RoaringBitmap/roaring v1.2.3 // indirect
|
||||
dubbo.apache.org/dubbo-go/v3 v3.0.2
|
||||
github.com/dubbogo/grpc-go v1.42.9
|
||||
github.com/dubbogo/triple v1.1.8
|
||||
//github.com/fonchain_enterprise/utils/jwt v0.0.0-00010101000000-000000000000
|
||||
//github.com/fonchain_enterprise/utils/logger v0.0.0-00010101000000-000000000000
|
||||
github.com/gin-contrib/gzip v0.0.5
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/mwitkow/go-proto-validators v0.3.2
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
google.golang.org/protobuf v1.31.0
|
||||
gopkg.in/ini.v1 v1.67.0
|
||||
)
|
||||
|
||||
require (
|
||||
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
|
||||
github.com/RoaringBitmap/roaring v1.1.0 // indirect
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/Workiva/go-datastructures v1.0.52 // indirect
|
||||
github.com/apache/dubbo-getty v1.4.9 // indirect
|
||||
github.com/apache/dubbo-go-hessian2 v1.12.2 // indirect
|
||||
github.com/aliyun/aliyun-oss-go-sdk v2.2.6+incompatible
|
||||
github.com/apache/dubbo-getty v1.4.8 // indirect
|
||||
github.com/apache/dubbo-go-hessian2 v1.11.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.2.0 // indirect
|
||||
github.com/bytedance/sonic v1.12.7 // indirect
|
||||
github.com/bytedance/sonic/loader v0.2.2 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/creasty/defaults v1.5.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dubbogo/gost v1.14.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/dubbogo/gost v1.11.25 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-kit/log v0.1.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.5.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.24.0 // indirect
|
||||
github.com/goccy/go-json v0.10.4 // indirect
|
||||
github.com/go-playground/validator/v10 v10.14.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/influxdata/tdigest v0.0.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/jinzhu/copier v0.3.5 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/k0kubun/pp v3.0.1+incompatible // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
|
||||
github.com/knadh/koanf v1.5.0 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/knadh/koanf v1.4.1 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/magiconair/properties v1.8.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mschoch/smat v0.2.0 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.1 // indirect
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/prometheus/client_golang v1.13.0 // indirect
|
||||
github.com/prometheus/client_model v0.3.0 // indirect
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.10 // indirect
|
||||
github.com/tklauser/numcpus v0.4.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/pelletier/go-toml v1.7.0 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
|
||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
|
||||
github.com/shirou/gopsutil v3.20.11+incompatible // indirect
|
||||
github.com/uber/jaeger-client-go v2.29.1+incompatible // indirect
|
||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.opentelemetry.io/contrib/propagators/b3 v1.10.0 // indirect
|
||||
go.opentelemetry.io/otel v1.10.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.10.0 // indirect
|
||||
go.uber.org/atomic v1.10.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
golang.org/x/arch v0.13.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
|
||||
google.golang.org/grpc v1.52.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
golang.org/x/crypto v0.19.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20211104193956-4c6863e31247 // indirect
|
||||
google.golang.org/grpc v1.47.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.2.1
|
||||
github.com/gin-contrib/pprof v1.4.0
|
||||
github.com/go-redis/redis v6.15.9+incompatible
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/spf13/viper v1.7.1
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.65.0 // indirect
|
||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
||||
github.com/alibaba/sentinel-golang v1.0.4 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/bytedance/sonic v1.9.1 // indirect
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/dubbogo/go-zookeeper v1.0.4-0.20211212162352-f9d2183d89d5 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.7.4 // indirect
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-co-op/gocron v1.9.0 // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-resty/resty/v2 v2.7.0 // indirect
|
||||
github.com/golang/mock v1.5.0 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/vault/sdk v0.3.0 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/nxadm/tail v1.4.11 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
github.com/onsi/gomega v1.18.1 // indirect
|
||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||
github.com/polarismesh/polaris-go v1.1.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.6 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/smartystreets/assertions v1.1.1 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.3.3 // indirect
|
||||
github.com/spf13/cast v1.3.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.6 // indirect
|
||||
github.com/tklauser/numcpus v0.2.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/zouyx/agollo/v3 v3.4.5 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
|
||||
go.opentelemetry.io/otel v1.7.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.7.0 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/pkg/cache"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
86
pkg/common/jwt/jwt.go
Normal file
86
pkg/common/jwt/jwt.go
Normal file
@ -0,0 +1,86 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
)
|
||||
|
||||
type Claims struct {
|
||||
ID uint `json:"id"`
|
||||
Account string `json:"account"`
|
||||
Domain string `json:"domain"`
|
||||
NickName string `json:"nickName"`
|
||||
Phone string `json:"phone"`
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
type RefreshClaims struct {
|
||||
ID uint `json:"id"`
|
||||
RId int `json:"rid"`
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
// GenerateToken 签发用户Token
|
||||
func GenerateToken(id uint, account string, domain string, nickName string, hour int, phone string, jwtSecret []byte) (string, error) {
|
||||
nowTime := time.Now()
|
||||
expireTime := nowTime.Add(time.Duration(hour) * time.Hour)
|
||||
claims := Claims{
|
||||
ID: id,
|
||||
Account: account,
|
||||
Domain: domain,
|
||||
NickName: nickName,
|
||||
Phone: phone,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: expireTime.Unix(),
|
||||
Issuer: domain,
|
||||
},
|
||||
}
|
||||
tokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
token, err := tokenClaims.SignedString(jwtSecret)
|
||||
return token, err
|
||||
}
|
||||
|
||||
// ParseToken 验证用户token
|
||||
func ParseToken(token string, jwtSecret []byte) (*Claims, error) {
|
||||
tokenClaims, err := jwt.ParseWithClaims(token, &Claims{}, func(token *jwt.Token) (interface{}, error) {
|
||||
return jwtSecret, nil
|
||||
})
|
||||
if tokenClaims != nil {
|
||||
if claims, ok := tokenClaims.Claims.(*Claims); ok && tokenClaims.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// GenerateRefreshToken 签发用户Token
|
||||
func GenerateRefreshToken(id uint, domain string, hour int, jwtSecret []byte) (string, error) {
|
||||
nowTime := time.Now()
|
||||
expireTime := nowTime.Add(time.Duration(hour) * time.Hour)
|
||||
claims := RefreshClaims{
|
||||
ID: id,
|
||||
RId: rand.Intn(999),
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: expireTime.Unix(),
|
||||
Issuer: domain,
|
||||
},
|
||||
}
|
||||
tokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
token, err := tokenClaims.SignedString(jwtSecret)
|
||||
return token, err
|
||||
}
|
||||
|
||||
// ParseRefreshToken 验证用户token
|
||||
func ParseRefreshToken(token string, jwtSecret []byte) (*RefreshClaims, error) {
|
||||
tokenClaims, err := jwt.ParseWithClaims(token, &RefreshClaims{}, func(token *jwt.Token) (interface{}, error) {
|
||||
return jwtSecret, nil
|
||||
})
|
||||
if tokenClaims != nil {
|
||||
if claims, ok := tokenClaims.Claims.(*RefreshClaims); ok && tokenClaims.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
}
|
74
pkg/common/m/msg.go
Normal file
74
pkg/common/m/msg.go
Normal file
@ -0,0 +1,74 @@
|
||||
package m
|
||||
|
||||
var JWTSecret = []byte("asdfqwer1234")
|
||||
|
||||
const (
|
||||
SERVER_CONFIG = "../conf/conf.ini"
|
||||
LOG_CONFIG = "../conf/log.yaml"
|
||||
Domain = "blockchain"
|
||||
)
|
||||
|
||||
const (
|
||||
TokenTime = 24
|
||||
StatusInDoor = 1
|
||||
RefreshTokenTime = 720
|
||||
)
|
||||
|
||||
const (
|
||||
DateNormalYMDFormat = "2006-01-02"
|
||||
)
|
||||
|
||||
const (
|
||||
SUCCESS = "success"
|
||||
FAILED = "failed"
|
||||
)
|
||||
|
||||
const (
|
||||
ERRORCONFIG = "配置文件读取错误,请检查文件路径:"
|
||||
ERRORAUTH = "没有权限"
|
||||
)
|
||||
|
||||
const (
|
||||
//丰链编号为20开头
|
||||
FC = iota + 200
|
||||
FONCHAIN //丰链商城
|
||||
)
|
||||
|
||||
const (
|
||||
LineStatusRun = 1
|
||||
LineStatusStop = 2
|
||||
CircuitStatusOpen = 1
|
||||
CircuitStatusClose = 2
|
||||
)
|
||||
|
||||
// 订单状态参数
|
||||
const (
|
||||
ORDER_STATUS_NEED_PUBLIC = iota + 1 //待发布
|
||||
ORDER_STATUS_NEED_CONFIRM //待确认
|
||||
ORDER_STATUS_APPEAL //申诉状态
|
||||
ORDER_STATUS_CONFIRMED //已确认
|
||||
)
|
||||
|
||||
const (
|
||||
Order_Doing = iota + 1 //待总监确认 待发布
|
||||
Order_Need_Seller_Sure //待销售确认
|
||||
Order_Status_Que //申诉订单
|
||||
Order_Done //完成
|
||||
Order_Need_Cashier_Sure //待出纳确认
|
||||
Order_Need_Control_Sure //待内控确认
|
||||
Order_Need_Finance_Sure //待财务确认
|
||||
)
|
||||
|
||||
const (
|
||||
REPORT_STATUS_NEED_PUBLIC = iota + 1 //待发布
|
||||
REPORT_PUBLISH //已发布
|
||||
REPORT_NEED_CASHIER_SURE //待出纳补充
|
||||
REPORT_NEED_BOSS_SURE //带最后总价确认
|
||||
REPORT_CASHIER_FINAL_OPTION //待出纳确认 重置
|
||||
)
|
||||
|
||||
const (
|
||||
TYPE_WEEK = iota + 1 //周
|
||||
TYPE_MOUNTH //月
|
||||
TYPE_QUARTER //日期
|
||||
)
|
64
pkg/common/tools.go
Normal file
64
pkg/common/tools.go
Normal file
@ -0,0 +1,64 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
||||
"fmt"
|
||||
"fonchain-fiee/pkg/e"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Result struct {
|
||||
IP string `json:"ip"`
|
||||
Location Location `json:"location"`
|
||||
AdInfo AdInfo `json:"ad_info"`
|
||||
}
|
||||
|
||||
type Location struct {
|
||||
Lat float64 `json:"lat"`
|
||||
Lng float64 `json:"lng"`
|
||||
}
|
||||
|
||||
type AdInfo struct {
|
||||
Nation string `json:"nation"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
District string `json:"district"`
|
||||
AdcodE int `json:"adcode"`
|
||||
}
|
||||
|
||||
type IpResult struct {
|
||||
Status int `json:"status"`
|
||||
Message string `json:"message"`
|
||||
RequestID string `json:"request_id"`
|
||||
Result Result `json:"result"`
|
||||
}
|
||||
|
||||
type IPDict struct {
|
||||
fileData []byte //文件数据
|
||||
offset uint32 //当前下标定位
|
||||
firstOffset uint32 //第一条IP记录的偏移地址
|
||||
lastOffset uint32 //最后一条IP记录的偏移地址
|
||||
totalIPNum uint32 //IP记录的总条数(不包含版本信息记录)
|
||||
}
|
||||
|
||||
type IPLocation struct {
|
||||
IP string `json:"ip"`
|
||||
BeginIP string `json:"begin_ip"`
|
||||
EndIP string `json:"end_ip"`
|
||||
Country string `json:"country"`
|
||||
Area string `json:"area"`
|
||||
}
|
||||
|
||||
func GetConf() (iniConf string, err error) {
|
||||
if os.Getenv(e.MODE_ENV) != "" {
|
||||
if err = os.Setenv(constant.ConfigFileEnvKey, fmt.Sprintf("./conf/%s/%s", os.Getenv(e.MODE_ENV), e.SERVER_DUBBOGO_CONFIG)); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if os.Getenv(e.MODE_ENV) == "" {
|
||||
iniConf = fmt.Sprintf("../conf/%s", e.SERVER_CONFIG)
|
||||
} else {
|
||||
iniConf = fmt.Sprintf("./conf/%s/%s", os.Getenv(e.MODE_ENV), e.SERVER_CONFIG)
|
||||
}
|
||||
return
|
||||
}
|
251
pkg/config/config.go
Normal file
251
pkg/config/config.go
Normal file
@ -0,0 +1,251 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"fonchain-fiee/pkg/common"
|
||||
"github.com/spf13/viper"
|
||||
"gopkg.in/ini.v1"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
AppMode string
|
||||
HttpPort string
|
||||
Key string
|
||||
Cert string
|
||||
IsHttps bool
|
||||
RunHttps bool
|
||||
Domain string
|
||||
OssDomain string
|
||||
ServerDM string
|
||||
Env string
|
||||
DriverUrl string
|
||||
AppointUrl string
|
||||
MaterialHost string
|
||||
//TODO
|
||||
//BosAk string
|
||||
//BosSk string
|
||||
//BosBucketName string
|
||||
//BosBaseDir string
|
||||
//BosUrl string
|
||||
//BosHttp string
|
||||
//BosDomain string
|
||||
//TODO
|
||||
ProjectMapDir string
|
||||
JaegerHost string
|
||||
JaegerOpen bool
|
||||
Cron bool
|
||||
DingAccessToken string
|
||||
DingUrl string
|
||||
HolidayID string
|
||||
HolidaySecret string
|
||||
HolidaySingleUrl string
|
||||
HolidayMultiUrl string
|
||||
|
||||
ErpAk string
|
||||
ErpSk string
|
||||
|
||||
// rabbitmq
|
||||
RabbitmqUser string
|
||||
RabbitmqPassword string
|
||||
RabbitmqHost string
|
||||
RabbitmqPort int
|
||||
RabbitmqVhost string
|
||||
RabbitmqVhostArtwork string
|
||||
|
||||
RedisDB int
|
||||
RedisAddr string
|
||||
RedisPw string
|
||||
|
||||
//shop配置
|
||||
ShopHost string
|
||||
//ShopDetail string
|
||||
|
||||
// 地图
|
||||
MapAppCode string
|
||||
|
||||
//百度地图的ak
|
||||
BaiduMapAK string
|
||||
|
||||
// es
|
||||
ElasticHost string
|
||||
SendIndexesUrl string
|
||||
ChatGptHost string
|
||||
|
||||
ApiHost string
|
||||
|
||||
Level string
|
||||
Filename string
|
||||
MaxSize string
|
||||
MaxAge string
|
||||
MaxBackups string
|
||||
|
||||
YearGiftCheckHost string
|
||||
IsOut bool
|
||||
OutUrl string
|
||||
Aliyun struct {
|
||||
AccessKeyId string
|
||||
AccessKeySecret string
|
||||
}
|
||||
SendTime int
|
||||
XMChannelId string
|
||||
OPChannelId string
|
||||
OPNotifyLevel int
|
||||
Route string
|
||||
|
||||
PdfHost string
|
||||
|
||||
DefaultSignNo uint64
|
||||
|
||||
// 审批 es index
|
||||
ApprovalIndex string
|
||||
)
|
||||
|
||||
var ConfigData = new(AppConfig)
|
||||
|
||||
type AppConfig struct {
|
||||
Oss struct {
|
||||
AccessKeyId string
|
||||
AccessKeySecret string
|
||||
Endpoint string
|
||||
BucketName string
|
||||
BaseDir string
|
||||
CdnHost string
|
||||
}
|
||||
Rabbitmq struct {
|
||||
User string
|
||||
Password string
|
||||
Host string
|
||||
Port int
|
||||
Vhost string
|
||||
VhostArtwork string
|
||||
VhostCopyright string
|
||||
}
|
||||
}
|
||||
|
||||
func GetOptions() {
|
||||
iniConf, err := common.GetConf()
|
||||
if err != nil {
|
||||
panic("iniConf error")
|
||||
}
|
||||
file, err := ini.Load(iniConf)
|
||||
if err != nil {
|
||||
fmt.Println("服务器配置文件读取错误,请检查文件路径:", err)
|
||||
}
|
||||
_ = os.MkdirAll("runtime", os.ModePerm)
|
||||
LoadServer(file)
|
||||
_ = Viper(iniConf)
|
||||
}
|
||||
|
||||
func LoadServer(file *ini.File) {
|
||||
AppMode = file.Section("service").Key("AppMode").String()
|
||||
IsHttps, _ = file.Section("service").Key("IsHTTPS").Bool()
|
||||
RunHttps, _ = file.Section("service").Key("RunHTTPS").Bool()
|
||||
Key = file.Section("service").Key("Key").String()
|
||||
Cert = file.Section("service").Key("Cert").String()
|
||||
HttpPort = file.Section("service").Key("HttpPort").String()
|
||||
Domain = file.Section("service").Key("Domain").String()
|
||||
OssDomain = file.Section("service").Key("OssDomain").String()
|
||||
ServerDM = file.Section("service").Key("ServerDM").String()
|
||||
DriverUrl = file.Section("service").Key("DriverUrl").String()
|
||||
Env = file.Section("service").Key("Env").String()
|
||||
JaegerHost = file.Section("service").Key("JaegerHost").String()
|
||||
JaegerOpen, _ = file.Section("service").Key("JaegerOpen").Bool()
|
||||
Cron, _ = file.Section("service").Key("Cron").Bool()
|
||||
YearGiftCheckHost = file.Section("service").Key("YearGiftCheckHost").String()
|
||||
IsOut, _ = file.Section("service").Key("IsOut").Bool()
|
||||
OutUrl = file.Section("service").Key("OutUrl").String()
|
||||
|
||||
ProjectMapDir = file.Section("file").Key("ProjectMapDir").String()
|
||||
|
||||
AppointUrl = file.Section("service").Key("AppointUrl").String()
|
||||
MaterialHost = file.Section("service").Key("MaterialHost").String()
|
||||
|
||||
//TODO
|
||||
//BosAk = file.Section("bos").Key("Ak").String()
|
||||
//BosSk = file.Section("bos").Key("Sk").String()
|
||||
//BosBucketName = file.Section("bos").Key("BucketName").String()
|
||||
//BosBaseDir = file.Section("bos").Key("BosBaseDir").String()
|
||||
|
||||
//BosUrl = file.Section("bos").Key("BosUrl").String()
|
||||
//BosHttp = file.Section("bos").Key("BosHttp").String()
|
||||
//BosDomain = file.Section("bos").Key("BosDomain").String()
|
||||
|
||||
//TODO
|
||||
|
||||
DingUrl = file.Section("ding").Key("Url").String()
|
||||
DingAccessToken = file.Section("ding").Key("AccessToken").String()
|
||||
|
||||
//加载获取万年历配置
|
||||
HolidayID = file.Section("holiday").Key("ID").String()
|
||||
HolidaySecret = file.Section("holiday").Key("Secret").String()
|
||||
HolidaySingleUrl = file.Section("holiday").Key("SingleUrl").String()
|
||||
HolidayMultiUrl = file.Section("holiday").Key("MultiUrl").String()
|
||||
|
||||
// 加载 rabbitmq 配置
|
||||
RabbitmqUser = file.Section("rabbitmq").Key("User").String()
|
||||
RabbitmqPassword = file.Section("rabbitmq").Key("Password").String()
|
||||
RabbitmqHost = file.Section("rabbitmq").Key("Host").String()
|
||||
RabbitmqPort, _ = file.Section("rabbitmq").Key("Port").Int()
|
||||
RabbitmqVhost = file.Section("rabbitmq").Key("Vhost").String()
|
||||
RabbitmqVhostArtwork = file.Section("rabbitmq").Key("VhostArtwork").String()
|
||||
|
||||
//加载 redis
|
||||
dbStr := file.Section("redis").Key("RedisDBNAme").String()
|
||||
RedisDB, _ = strconv.Atoi(dbStr)
|
||||
RedisAddr = file.Section("redis").Key("RedisAddr").String()
|
||||
RedisPw = file.Section("redis").Key("RedisPW").String()
|
||||
|
||||
ShopHost = file.Section("shop").Key("ShopHost").String()
|
||||
//ShopDetail = file.Section("shop").Key("ShopDetail").String()
|
||||
|
||||
// 地图
|
||||
MapAppCode = file.Section("service").Key("MapAppCode").String()
|
||||
BaiduMapAK = file.Section("service").Key("BaiduMapAK").String()
|
||||
|
||||
// 地图
|
||||
ElasticHost = file.Section("es").Key("ElasticHost").String()
|
||||
SendIndexesUrl = file.Section("api").Key("SendIndexesUrl").String()
|
||||
ChatGptHost = file.Section("api").Key("chatGptHost").String()
|
||||
ErpAk = file.Section("api").Key("erpak").String()
|
||||
ErpSk = file.Section("api").Key("erpsk").String()
|
||||
ApiHost = file.Section("service").Key("ApiHost").String()
|
||||
|
||||
// zap
|
||||
Level = file.Section("zap").Key("Level").String()
|
||||
Filename = file.Section("zap").Key("Filename").String()
|
||||
MaxSize = file.Section("zap").Key("MaxSize").String()
|
||||
MaxAge = file.Section("zap").Key("MaxAge").String()
|
||||
MaxBackups = file.Section("zap").Key("MaxBackups").String()
|
||||
Aliyun.AccessKeyId = file.Section("aliyun").Key("accessKeyId").String()
|
||||
Aliyun.AccessKeySecret = file.Section("aliyun").Key("accessKeySecret").String()
|
||||
|
||||
Aliyun.AccessKeySecret = file.Section("aliyun").Key("accessKeySecret").String()
|
||||
|
||||
//发送次数
|
||||
SendTime, _ = file.Section("send").Key("SendTime").Int()
|
||||
OPNotifyLevel, _ = file.Section("send").Key("OPNotifyLevel").Int()
|
||||
XMChannelId = file.Section("send").Key("XMChannelId").String()
|
||||
OPChannelId = file.Section("send").Key("OPChannelId").String()
|
||||
PdfHost = file.Section("pdf").Key("Host").String()
|
||||
DefaultSignNo, _ = file.Section("msg").Key("defaultSignNo").Uint64()
|
||||
Route = file.Section("send").Key("Route").String()
|
||||
|
||||
// 审批 es index
|
||||
ApprovalIndex = file.Section("es").Key("ApprovalIndex").String()
|
||||
}
|
||||
|
||||
func Viper(iniConf string) (err error) {
|
||||
viper.SetConfigFile(iniConf)
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
panic("viper.ReadInConfig failed" + err.Error())
|
||||
return
|
||||
}
|
||||
if err = viper.Unmarshal(ConfigData); err != nil {
|
||||
panic("viper.Unmarshal failed" + err.Error())
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
146
pkg/e/code.go
Normal file
146
pkg/e/code.go
Normal file
@ -0,0 +1,146 @@
|
||||
package e
|
||||
|
||||
var (
|
||||
JWTSecret = []byte("asdfqwer1234")
|
||||
)
|
||||
|
||||
const (
|
||||
Success = 200
|
||||
Error = 500
|
||||
ParamsError = 400
|
||||
InvalidToken = 501
|
||||
)
|
||||
|
||||
const (
|
||||
DomainAdmin = "blockchain"
|
||||
)
|
||||
|
||||
const (
|
||||
InventoryKey = "inventory_auth"
|
||||
)
|
||||
|
||||
const (
|
||||
ErrNotLogin = "请先登录"
|
||||
ErrOffline = "您已经下线"
|
||||
)
|
||||
|
||||
const (
|
||||
Failed = 1
|
||||
Ok = 0
|
||||
BindError = 2
|
||||
JsonUnmarshal = 3
|
||||
NotLogin = 401
|
||||
SUCCESS = 200
|
||||
UpdatePasswordSuccess = 201
|
||||
DeleteSuccess = 204
|
||||
NotExistInentifier = 202
|
||||
ERROR = 500
|
||||
InvalidParams = 400
|
||||
|
||||
//成员错误
|
||||
ErrorExistNick = 10001
|
||||
ErrorExistUser = 10002
|
||||
ErrorNotExistUser = 10003
|
||||
ErrorNotCompare = 10004
|
||||
ErrorNotComparePassword = 10005
|
||||
ErrorFailEncryption = 10006
|
||||
ErrorNotExistProduct = 10007
|
||||
ErrorNotExistAddress = 10008
|
||||
ErrorExistFavorite = 10009
|
||||
ErrorGetUserInfo = 10010
|
||||
ErrorGetDepart = 10011
|
||||
ErrorUpdateAw = 10012
|
||||
|
||||
//店家错误
|
||||
ErrorBossCheckTokenFail = 20001
|
||||
ErrorBossCheckTokenTimeout = 20002
|
||||
ErrorBossToken = 20003
|
||||
ErrorBoss = 20004
|
||||
ErrorBossInsufficientAuthority = 20005
|
||||
ErrorBossProduct = 20006
|
||||
|
||||
//管理员错误
|
||||
ErrorAuthCheckTokenFail = 30001 //token 错误
|
||||
ErrorAuthCheckTokenTimeout = 30002 //token 过期
|
||||
ErrorAuthToken = 30003
|
||||
ErrorAuth = 30004
|
||||
ErrorAuthInsufficientAuthority = 30005
|
||||
ErrorReadFile = 30006
|
||||
ErrorSendEmail = 30007
|
||||
ErrorCallApi = 30008
|
||||
ErrorUnmarshalJson = 30009
|
||||
ErrorAdminFindUser = 30010
|
||||
//数据库错误
|
||||
ErrorDatabase = 40001
|
||||
|
||||
//对象存储错误
|
||||
ErrorOss = 50001
|
||||
ErrorUploadFile = 50002
|
||||
|
||||
//店铺错误
|
||||
ErrorExistShopName = 60001
|
||||
ErrorNotExistShopName = 60002
|
||||
ErrorNotAdmin = 60003
|
||||
|
||||
ErrNoDomain = 70001
|
||||
ErrTelNum = 70002
|
||||
ErrNoCode = 70003
|
||||
ErrNoID = 70004
|
||||
ErrNickName = 70005
|
||||
InvalidID = 70006
|
||||
InvalidPas = 70007
|
||||
ErrStatus = 70008
|
||||
ErrNoType = 70009
|
||||
ErrNoUserID = 70010
|
||||
ErrNoName = 70011
|
||||
ErrNoDepCode = 70012
|
||||
ErrNoTitle = 70013
|
||||
ErrNoUrl = 70014
|
||||
ErrNoMethod = 70015
|
||||
ErrNotDep = 70016
|
||||
ErrCreateQr = 70017
|
||||
ErrNotSellerBoss = 70018
|
||||
ErrWrongDate = 70019
|
||||
ErrLoginSeller = 70020
|
||||
|
||||
//上传
|
||||
ErrorUploadVideoCover = 80001
|
||||
ErrorUploadValidParam = 80002
|
||||
ErrorFileReadErr = 80003
|
||||
ErrorFileNotExists = 80004
|
||||
ErrorChunkNotGt = 80005
|
||||
ErrorChunk = 80006
|
||||
ErrorUploadBos = 80007
|
||||
ErrorFileCreate = 80008
|
||||
ERROR_UID = 80009
|
||||
|
||||
//画作
|
||||
ErrorAllotUids = 90001
|
||||
//
|
||||
ErrorExistSecurity = 90001
|
||||
ErrorSecurity = 90002
|
||||
ErrorNoSecurity = 90003
|
||||
ErrorRealName = 90004
|
||||
ErrorCode = 90005
|
||||
NOTDATA = 90006
|
||||
ErrorBaiduChainAlreadyDone = 90007
|
||||
ErrorBaiduChaining = 90008
|
||||
ErrorBaiduChainError = 90009
|
||||
ERROR_BAIDU_IMAGE = 90010
|
||||
ERROR_BAIDU_FAIL = 90011
|
||||
ERROR_DOWNLOAD_FILE = 90012
|
||||
ERROR_Addr_FILE = 90013
|
||||
ERROR_Amount = 90014
|
||||
ERROR_Create_Block = 90015
|
||||
ERROR_Fee_Deduction = 90016
|
||||
ERROR_Insufficient_Balance = 90017
|
||||
ERROR_Text_Irregularity = 90018
|
||||
ERROR_Text_Length = 90019
|
||||
ERROR_NoPermission = 90020
|
||||
)
|
||||
const (
|
||||
Push = 1
|
||||
Read = 2
|
||||
NotFilled = 3
|
||||
Save = 4
|
||||
)
|
158
pkg/e/msg.go
Normal file
158
pkg/e/msg.go
Normal file
@ -0,0 +1,158 @@
|
||||
package e
|
||||
|
||||
const (
|
||||
SERVER_CONFIG = "conf.ini"
|
||||
SERVER_DUBBOGO_CONFIG = "dubbogo.yaml"
|
||||
MODE_ENV = "MODE_ENV"
|
||||
)
|
||||
|
||||
const (
|
||||
Authorization = "Authorization"
|
||||
BoxAuthorization = "Authorization"
|
||||
StaffAuthorization = "StaffAuthorization"
|
||||
AuthMobileInventoryKey = "mobile_inventory_auth"
|
||||
|
||||
AuthorizationCookie = "token"
|
||||
)
|
||||
|
||||
const (
|
||||
Acquire_Daily_Login = "daily_login"
|
||||
Acquire_Register = "register"
|
||||
)
|
||||
|
||||
const (
|
||||
VerifierDomain = "fontree"
|
||||
StaffJwtKey = "jwtStaffInfo"
|
||||
)
|
||||
const (
|
||||
Status_Not_In_House = iota + 1 //未入库
|
||||
Status_In_House //已入库
|
||||
Status_Out_House //已出库
|
||||
Status_Not_Pay //未付款
|
||||
)
|
||||
|
||||
const (
|
||||
DateNormalFormat = "2006-01-02 15:04:05"
|
||||
DateNormalYMDFormat = "2006-01-02"
|
||||
DateNormalPointFormat = "2006.01.02"
|
||||
DateNormalPointFormatHM = "2006.01.02 15:04"
|
||||
)
|
||||
|
||||
var MsgFlags = map[int]string{
|
||||
SUCCESS: "操作成功",
|
||||
UpdatePasswordSuccess: "修改密码成功",
|
||||
NotExistInentifier: "该第三方账号未绑定",
|
||||
ERROR: "fail",
|
||||
InvalidParams: "请求参数错误",
|
||||
BindError: "参数绑定错误,类型不一致",
|
||||
JsonUnmarshal: "Json解析错误",
|
||||
|
||||
ErrorExistNick: "已存在该昵称",
|
||||
ErrorExistUser: "已存在该用户名",
|
||||
ErrorNotExistUser: "该用户不存在",
|
||||
ErrorNotCompare: "账号密码错误",
|
||||
ErrorNotComparePassword: "两次密码输入不一致",
|
||||
ErrorFailEncryption: "加密失败",
|
||||
ErrorNotExistProduct: "该商品不存在",
|
||||
ErrorNotExistAddress: "该收获地址不存在",
|
||||
ErrorExistFavorite: "已收藏该商品",
|
||||
ErrorGetUserInfo: "获取用户信息错误",
|
||||
ErrorGetDepart: "获取部门信息错误",
|
||||
ErrorUpdateAw: "同步画作信息错误",
|
||||
|
||||
ErrorBossCheckTokenFail: "商家的Token鉴权失败",
|
||||
ErrorBossCheckTokenTimeout: "商家TOken已超时",
|
||||
ErrorBossToken: "商家的Token生成失败",
|
||||
ErrorBoss: "商家Token错误",
|
||||
ErrorBossInsufficientAuthority: "商家权限不足",
|
||||
ErrorBossProduct: "商家读文件错误",
|
||||
|
||||
ErrorAuthCheckTokenFail: "Token鉴权失败",
|
||||
ErrorAuthCheckTokenTimeout: "TOken已超时",
|
||||
ErrorAuthToken: "Token生成失败",
|
||||
ErrorAuth: "Token错误",
|
||||
ErrorAuthInsufficientAuthority: "权限不足",
|
||||
ErrorReadFile: "读文件失败",
|
||||
ErrorSendEmail: "发送邮件失败",
|
||||
ErrorCallApi: "调用接口失败",
|
||||
ErrorUnmarshalJson: "解码JSON失败",
|
||||
|
||||
ErrorUploadFile: "上传失败",
|
||||
ErrorAdminFindUser: "管理员查询用户失败",
|
||||
|
||||
ErrorDatabase: "数据库操作出错,请重试",
|
||||
|
||||
ErrorOss: "OSS配置错误",
|
||||
|
||||
ErrorExistShopName: "店铺已被注册,请检查店铺名称和统一社会信用码",
|
||||
ErrorNotExistShopName: "店铺不存在",
|
||||
ErrorNotAdmin: "非管理员",
|
||||
|
||||
InvalidToken: "Token验证失败",
|
||||
|
||||
ErrorUploadVideoCover: "视频截取封面错误",
|
||||
ErrorUploadValidParam: "上传参数非法",
|
||||
ErrorFileReadErr: "读取文件错误",
|
||||
ErrorFileNotExists: "文件不存在",
|
||||
ErrorChunkNotGt: "分块数量不一致",
|
||||
ErrorChunk: "读取分块错误",
|
||||
ErrorUploadBos: "上传bos错误",
|
||||
ErrorFileCreate: "文件创建错误",
|
||||
ERROR_UID: "uid创建错误",
|
||||
|
||||
ErrNoDomain: "环境变量必须要有",
|
||||
ErrTelNum: "手机号码错误",
|
||||
ErrNoCode: "验证码必须要有",
|
||||
ErrNoID: "ID缺少",
|
||||
ErrNickName: "昵称长度超过了20个字符或者缺失",
|
||||
InvalidID: "身份证长度18位",
|
||||
InvalidPas: "密码不小于6位",
|
||||
|
||||
ErrStatus: "状态非法",
|
||||
ErrNoType: "缺少类型",
|
||||
ErrNoUserID: "缺少用户ID",
|
||||
ErrNoName: "缺少名称",
|
||||
ErrNoDepCode: "缺少部门code",
|
||||
ErrNoTitle: "缺少标题",
|
||||
ErrNoUrl: "缺少url",
|
||||
ErrNoMethod: "缺少method",
|
||||
ErrNotDep: "缺少部门",
|
||||
ErrCreateQr: "生成二维码错误",
|
||||
ErrNotSellerBoss: "当前人员身份非销售总监,不能操作",
|
||||
ErrWrongDate: "时间数据填写错误",
|
||||
ErrLoginSeller: "您暂时没有权限登录销售宝,请联系管理员",
|
||||
|
||||
ErrorExistSecurity: "安全码已存在",
|
||||
ErrorSecurity: "安全码错误",
|
||||
ErrorNoSecurity: "安全码不存在",
|
||||
ErrorRealName: "不可重复实名认证",
|
||||
ErrorCode: "验证码错误",
|
||||
NOTDATA: "没有数据",
|
||||
ErrorBaiduChainAlreadyDone: "百度链已完成",
|
||||
ErrorBaiduChaining: "百度链未完成",
|
||||
ErrorBaiduChainError: "百度链错误",
|
||||
ERROR_BAIDU_IMAGE: "图片审核不通过",
|
||||
ERROR_BAIDU_FAIL: "图片审核失败",
|
||||
ERROR_DOWNLOAD_FILE: "下载文件错误",
|
||||
ERROR_Addr_FILE: "获取区块链地址错误",
|
||||
ERROR_Amount: "开票金额错误",
|
||||
ERROR_Create_Block: "上链失败",
|
||||
ERROR_Fee_Deduction: "扣费失败",
|
||||
ERROR_Insufficient_Balance: "余额不足",
|
||||
ERROR_Text_Irregularity: "文字内容不合规",
|
||||
ERROR_Text_Length: "文本长度超出限制",
|
||||
ERROR_NoPermission: "您暂无权限,请联系客服",
|
||||
}
|
||||
|
||||
const (
|
||||
ErrorCreateFeedback = "请勿重复提交"
|
||||
)
|
||||
|
||||
// GetMsg 获取状态码对应信息
|
||||
func GetMsg(code int) string {
|
||||
msg, ok := MsgFlags[code]
|
||||
if ok {
|
||||
return msg
|
||||
}
|
||||
return MsgFlags[ERROR]
|
||||
}
|
67
pkg/middleware/check_login.go
Normal file
67
pkg/middleware/check_login.go
Normal file
@ -0,0 +1,67 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
api "fonchain-fiee/api/account"
|
||||
jwt2 "fonchain-fiee/pkg/common/jwt"
|
||||
"fonchain-fiee/pkg/common/m"
|
||||
"fonchain-fiee/pkg/e"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// CheckLogin 检测登陆
|
||||
func CheckLogin(provider *api.AccountClientImpl) gin.HandlerFunc {
|
||||
|
||||
return func(ctx *gin.Context) {
|
||||
|
||||
//如果没有登录
|
||||
authorization := ctx.GetHeader(e.BoxAuthorization)
|
||||
if authorization == "" {
|
||||
service.Error(ctx, errors.New(e.ErrNotLogin))
|
||||
return
|
||||
}
|
||||
|
||||
jwt, err := jwt2.ParseToken(authorization, m.JWTSecret)
|
||||
fmt.Println(jwt)
|
||||
|
||||
if err != nil {
|
||||
service.Error(ctx, errors.New(e.ErrNotLogin))
|
||||
return
|
||||
}
|
||||
|
||||
//1 获取用户的账号信息
|
||||
infoReq := &api.UserByTelRequest{
|
||||
Tel: jwt.Phone,
|
||||
Domain: jwt.Domain,
|
||||
}
|
||||
|
||||
infoRes, err := service.AccountProvider.UserByTel(ctx, infoReq)
|
||||
if err != nil {
|
||||
service.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
if infoRes.IsExist == false {
|
||||
service.Error(ctx, errors.New(e.ErrNotLogin))
|
||||
return
|
||||
}
|
||||
|
||||
info := infoRes.Info
|
||||
loginInfo := login.Info{
|
||||
Domain: info.Domain,
|
||||
ID: info.ID,
|
||||
Account: info.Account,
|
||||
NickName: info.NickName,
|
||||
TelNum: infoRes.Info.TelNum,
|
||||
Avatar: infoRes.Info.Avatar,
|
||||
RealName: infoRes.Info.RealName,
|
||||
IDNum: infoRes.Info.IDNum,
|
||||
}
|
||||
|
||||
ctx.Set("jwtInfo", loginInfo)
|
||||
|
||||
ctx.Next()
|
||||
}
|
||||
}
|
39
pkg/model/login/login.go
Normal file
39
pkg/model/login/login.go
Normal file
@ -0,0 +1,39 @@
|
||||
package login
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type WxUser struct {
|
||||
OpenID string `json:"openID"`
|
||||
GHID string `json:"gHID"`
|
||||
}
|
||||
|
||||
type Info struct {
|
||||
Domain string `json:"domain"`
|
||||
ID uint64 `json:"ID"`
|
||||
Account string `json:"account"`
|
||||
NickName string `json:"nickName"`
|
||||
TelNum string `json:"telNum"`
|
||||
Avatar string `json:"avatar"`
|
||||
RealName string `json:"realName"`
|
||||
IDNum string `json:"idNum"`
|
||||
Coin string `json:"coin"` //追加一个余额
|
||||
}
|
||||
|
||||
func GetUserInfoFromC(c *gin.Context) Info {
|
||||
userInfoAny, _ := c.Get("jwtInfo")
|
||||
userInfo := userInfoAny.(Info)
|
||||
return userInfo
|
||||
}
|
||||
|
||||
func GetUserInfoFromCtx(c *gin.Context) (Info, error) {
|
||||
userInfoAny, _ := c.Get("jwtInfo")
|
||||
if userInfoAny != nil {
|
||||
userInfo := userInfoAny.(Info)
|
||||
return userInfo, nil
|
||||
} else {
|
||||
return Info{}, errors.New("not login")
|
||||
}
|
||||
}
|
98
pkg/model/union/user.go
Normal file
98
pkg/model/union/user.go
Normal file
@ -0,0 +1,98 @@
|
||||
package union
|
||||
|
||||
import (
|
||||
"fonchain-fiee/api/account"
|
||||
)
|
||||
|
||||
type Extend struct {
|
||||
JumpTo string `json:"JumpTo"`
|
||||
Lang string `json:"Lang"`
|
||||
CanScan bool `json:"CanScan"`
|
||||
ResolutionRatio bool `json:"ResolutionRatio"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
ID uint64 `json:"ID"`
|
||||
Domain string `json:"Domain"` //环境
|
||||
NickName string `json:"NickName"` //昵称
|
||||
TelNum string `json:"TelNum"` //手机号
|
||||
Password string `json:"Password"` //密码
|
||||
Avatar string `json:"Avatar"` //头像
|
||||
Status string `json:"Status"` //头像
|
||||
EnterDate string `json:"EnterDate"` //头像
|
||||
WorkYear float32 `json:"WorkYear"` //头像
|
||||
IsNeedChange uint64 `json:"IsNeedChange"` //是否强制修改密码
|
||||
JumpTo string `json:"JumpTo"` //是否跳转老平台 origin-老平台 onsite当前
|
||||
JobNum string `json:"JobNum"`
|
||||
BirthDate string `json:"BirthDate"`
|
||||
Sex uint64 `json:"Sex"`
|
||||
Title string `json:"Title"`
|
||||
LeftDate string `json:"LeftDate"`
|
||||
Remark string `json:"Remark"`
|
||||
RecentImg string `json:"RecentImg"` //近照
|
||||
ICNum string `json:"ICNum"` //门禁卡号
|
||||
Extend *account.Extend `json:"Extend"` //设置
|
||||
Train string `json:"train"` //培训视频
|
||||
Certificate string `json:"certificate"` //证书
|
||||
Source string `json:"source"` //来源
|
||||
Operator *account.Operator `json:"operator"` //来源
|
||||
}
|
||||
|
||||
type UserResponse struct {
|
||||
ID uint64 `json:"ID"`
|
||||
Domain string `json:"Domain"` //环境
|
||||
NickName string `json:"NickName"` //昵称
|
||||
TelNum string `json:"TelNum"` //手机号
|
||||
Password string `json:"Password"` //密码
|
||||
Avatar string `json:"Avatar"`
|
||||
Status string `json:"Status"`
|
||||
CreateAt string `json:"CreateAt"`
|
||||
RealNameID uint64 `json:"RealNameID"`
|
||||
RealName string `json:"RealName"`
|
||||
IsAdmin bool `json:"IsAdmin"`
|
||||
EnterDate string `json:"EnterDate"` //头像
|
||||
WorkYear float32 `json:"WorkYear"` //头像
|
||||
IsNeedChange uint64 `json:"IsNeedChange"` //是否强制修改密码
|
||||
JumpTo string `json:"JumpTo"` //是否跳转老平台 origin-老平台 onsite当前
|
||||
Extend *account.Extend `json:"Extend"` //附件信息
|
||||
DepartmentName string `json:"DepartmentName"`
|
||||
JobNum string `json:"JobNum"`
|
||||
BirthDate string `json:"BirthDate"`
|
||||
Age uint64 `json:"Age"`
|
||||
Sex uint64 `json:"Sex"`
|
||||
Title string `json:"Title"`
|
||||
IDNum string `json:"IDNum"`
|
||||
LeftDate string `json:"LeftDate"`
|
||||
DriverAuth bool `json:"DriverAuth"`
|
||||
DriverSupervisorAuth bool `json:"DriverSupervisorAuth"`
|
||||
Remark string `json:"Remark"`
|
||||
IdentityKey string `json:"IdentityKey"` //身份
|
||||
RecentImg string `json:"RecentImg"` //近照
|
||||
MailAccount string `json:"MailAccount"` //近照
|
||||
Clocks []*account.ClockUser `json:"clocks"`
|
||||
ICNum string `json:"ICNum"` //门禁卡号
|
||||
Train string `json:"train"` //培训视频
|
||||
Certificate string `json:"certificate"` //证书
|
||||
Source string `json:"source"` //来源
|
||||
TrainVideos []*account.TrainVideo `json:"TrainVideos"` //关联用户岗位
|
||||
}
|
||||
|
||||
type AccountInfo struct {
|
||||
ID uint64 `json:"ID"`
|
||||
Domain string `json:"Domain"` //环境
|
||||
NickName string `json:"NickName"` //昵称
|
||||
Account string `json:"Account"` //昵称
|
||||
TelNum string `json:"TelNum"` //手机号
|
||||
Avatar string `json:"Avatar"` //头像
|
||||
Status string `json:"Status"` //头像
|
||||
CreatedAt string `json:"CreatedAt"` //头像
|
||||
IsNeedChange uint64 `json:"IsNeedChange"` //是否强制修改密码
|
||||
Sex uint64 `json:"Sex"`
|
||||
}
|
||||
|
||||
type Login struct {
|
||||
AccountInfo *AccountInfo `json:"AccountInfo"`
|
||||
Token string `json:"Token"` //环境
|
||||
RefreshToken string `json:"RefreshToken"` //refresh_token
|
||||
JumpToWhere string `json:"JumpToWhere"` //环境
|
||||
}
|
@ -2,6 +2,8 @@ package router
|
||||
|
||||
import (
|
||||
"fonchain-fiee/pkg/middleware"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"fonchain-fiee/pkg/service/account"
|
||||
"fonchain-fiee/pkg/service/auth"
|
||||
"fonchain-fiee/pkg/service/lang"
|
||||
"fonchain-fiee/pkg/service/qr"
|
||||
@ -22,7 +24,8 @@ func NewRouter() *gin.Engine {
|
||||
r.Use(gzip.Gzip(gzip.BestSpeed)) // 中间件占用绝大部分内存
|
||||
//加入日志中间件,跨域中间件
|
||||
r.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true))
|
||||
|
||||
privateGroup := r.Group("")
|
||||
privateGroup.Use(middleware.NewLogger(), middleware.Cors(), middleware.GinRecovery(true))
|
||||
//加入日志中间件,跨域中间件
|
||||
v1 := r.Group("api")
|
||||
GiteaRoute(v1)
|
||||
@ -36,7 +39,24 @@ func NewRouter() *gin.Engine {
|
||||
{
|
||||
v1.POST("version", version.Version) //版本号公共
|
||||
}
|
||||
|
||||
//账号模块
|
||||
{
|
||||
r.POST("user/register", account.UserRegister) //h5注册登录
|
||||
r.POST("user/login", account.UserLogin) //后台登录
|
||||
r.POST("user/send", account.SendMsg) //发送验证码
|
||||
r.POST("user/logout", account.UserLogout) //登出
|
||||
r.POST("user/check/msg", account.CheckMsg) //校验验证码
|
||||
acRoute := r.Group("/user")
|
||||
acRoute.Use(middleware.CheckLogin(service.AccountProvider))
|
||||
{
|
||||
acRoute.POST("real-name", account.RealName) //实名
|
||||
acRoute.POST("info", account.UserInfo) //用户详情
|
||||
}
|
||||
{
|
||||
acRoute.POST("list", account.UserList) //用户列表
|
||||
acRoute.POST("approval", account.UserApproval) //用户列表
|
||||
}
|
||||
}
|
||||
{
|
||||
//图片相关
|
||||
imageRoute := v1.Group("image")
|
||||
@ -69,11 +89,11 @@ func NewRouter() *gin.Engine {
|
||||
|
||||
// 套餐
|
||||
{
|
||||
bundleRoute := r.Group("bundle")
|
||||
//bundleRoute := r.Group("bundle")
|
||||
|
||||
bundleClientRoute := bundleRoute.Group("system")
|
||||
//bundleClientRoute := bundleRoute.Group("system")
|
||||
{
|
||||
bundleClientRoute.POST("create", bundle.CreateBundle)
|
||||
//bundleClientRoute.POST("create", bundle.CreateBundle)
|
||||
}
|
||||
}
|
||||
|
||||
|
194
pkg/service/account/account.go
Normal file
194
pkg/service/account/account.go
Normal file
@ -0,0 +1,194 @@
|
||||
package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fonchain-fiee/api/account"
|
||||
"fonchain-fiee/pkg/config"
|
||||
"fonchain-fiee/pkg/e"
|
||||
"fonchain-fiee/pkg/model/login"
|
||||
"fonchain-fiee/pkg/model/union"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
func UserApproval(c *gin.Context) {
|
||||
var req account.CheckRealNameRequest
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
res, err := service.AccountProvider.CheckRealName(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
func UserList(c *gin.Context) {
|
||||
var req account.UserListRequest
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
req.Domain = "app"
|
||||
res, err := service.AccountProvider.UserList(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
func UserInfo(c *gin.Context) {
|
||||
var req account.InfoRequest
|
||||
user := login.GetUserInfoFromC(c)
|
||||
req.ID = user.ID
|
||||
req.Domain = user.Domain
|
||||
res, err := service.AccountProvider.Info(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
|
||||
// SendMsg 用户登录操作
|
||||
func SendMsg(c *gin.Context) {
|
||||
|
||||
var req account.SendMsgRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
//req.Domain = "app"
|
||||
req.SignNo = uint32(config.DefaultSignNo)
|
||||
res, err := service.AccountProvider.SendMsg(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
func RealName(c *gin.Context) {
|
||||
var req account.RealNameRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
user := login.GetUserInfoFromC(c)
|
||||
req.Id = user.ID
|
||||
res, err := service.AccountProvider.RealName(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
|
||||
// CheckMsg 验证码是否正确
|
||||
func CheckMsg(c *gin.Context) {
|
||||
|
||||
var req account.CheckMsgRequest
|
||||
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
res, err := service.AccountProvider.CheckMsg(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
|
||||
func UserLogout(c *gin.Context) {
|
||||
req := account.DecryptJwtRequest{}
|
||||
req.Token = c.GetHeader(e.Authorization)
|
||||
res, err := service.AccountProvider.Logout(c, &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
func UserRegister(c *gin.Context) {
|
||||
var req account.RegistRequest
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
req.Domain = "app"
|
||||
res, err := service.AccountProvider.Register(context.Background(), &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
tokenInfo, err := service.AccountProvider.Login(context.Background(), &account.LoginRequest{
|
||||
Domain: req.Domain,
|
||||
TelNum: req.TelNum,
|
||||
Code: req.Code,
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
res.Token = tokenInfo.Token
|
||||
service.Success(c, res)
|
||||
return
|
||||
}
|
||||
|
||||
// UserLogin 用户登录操作
|
||||
func UserLogin(c *gin.Context) {
|
||||
var req account.LoginRequest
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
req.Ip = c.ClientIP()
|
||||
req.Domain = "fontree"
|
||||
res, err := service.AccountProvider.Login(c, &req)
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
accountInfo := &union.AccountInfo{
|
||||
ID: res.AccountInfo.ID,
|
||||
Account: res.AccountInfo.Account,
|
||||
NickName: res.AccountInfo.NickName,
|
||||
Domain: res.AccountInfo.Domain,
|
||||
TelNum: res.AccountInfo.TelNum,
|
||||
Avatar: res.AccountInfo.Avatar,
|
||||
CreatedAt: res.AccountInfo.CreateAt,
|
||||
IsNeedChange: res.AccountInfo.IsNeedChange,
|
||||
Sex: res.AccountInfo.Sex,
|
||||
}
|
||||
resInfo := &union.Login{
|
||||
Token: res.Token,
|
||||
RefreshToken: res.RefreshToken,
|
||||
AccountInfo: accountInfo,
|
||||
//JumpToWhere: jumpToWhere,
|
||||
}
|
||||
|
||||
service.Success(c, resInfo)
|
||||
|
||||
return
|
||||
}
|
@ -2,7 +2,10 @@ package auth
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"fonchain-fiee/pkg/service"
|
||||
"github.com/aliyun/aliyun-oss-go-sdk/oss"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -1,18 +1,31 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
||||
"dubbo.apache.org/dubbo-go/v3/config"
|
||||
|
||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||
"fmt"
|
||||
"fonchain-fiee/api/account"
|
||||
"fonchain-fiee/api/bundle"
|
||||
"fonchain-fiee/api/order"
|
||||
pkConfig "fonchain-fiee/cmd/config"
|
||||
)
|
||||
|
||||
var AccountProvider = new(account.AccountClientImpl)
|
||||
|
||||
var BundleProvider = new(bundle.BundleClientImpl)
|
||||
var OrderProvider = new(order.OrderClientImpl)
|
||||
|
||||
func init() {
|
||||
config.SetConsumerService(BundleProvider)
|
||||
config.SetConsumerService(OrderProvider)
|
||||
config.SetConsumerService(AccountProvider)
|
||||
//config.SetConsumerService(BundleProvider)
|
||||
|
||||
if err := config.Load(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
pkConfig.GetOptions()
|
||||
fmt.Println(os.Getenv(constant.ConfigFileEnvKey))
|
||||
|
||||
if err := config.Load(); err != nil {
|
||||
panic(err)
|
||||
|
@ -3,6 +3,12 @@ package qr
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"fonchain-fiee/cmd/config"
|
||||
"fonchain-fiee/pkg/common/utils"
|
||||
"fonchain-fiee/pkg/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/skip2/go-qrcode"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user