Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"constant.go",
"rpc.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/service/main/sms/model",
tags = ["automanaged"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
proto_library(
name = "model_proto",
srcs = ["model.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importpath = "go-common/app/service/main/sms/model",
proto = ":model_proto",
tags = ["automanaged"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
],
)

View File

@@ -0,0 +1,85 @@
package model
//go:generate $GOPATH/src/go-common/app/tool/warden/protoc.sh
const (
// CountryChina .
CountryChina = "86" // 中国地区码
)
// 短信模板状态
const (
// TemplateStatusNew .
TemplateStatusNew = 0 // 新建
// TemplateStatusApprovel .
TemplateStatusApprovel = 1 // 已审核
// TemplateStatusCanceled .
TemplateStatusCanceled = 2 // 已取消
)
// 运营商
const (
// ProviderMengWang .
ProviderMengWang = int32(2)
// ProviderChuangLan
ProviderChuangLan = int32(4)
)
// 短信类型
const (
// TypeSms 验证码
TypeSms = int32(1)
// TypeActSms 营销短信
TypeActSms = int32(2)
// TypeActBatch 批量营销
TypeActBatch = int32(3)
)
// 短信回执用户行为日志
const (
// UserActionTypeSend 日志类型为发送
UserActionTypeSend = int32(1)
// UserActionCallback 日志类型为回执
UserActionCallback = int32(2)
// UserActionSendFailedStatus 发送失败的日志状态
UserActionSendFailedStatus = "SUBMIT FAILED"
// UserActionSendFailedDesc 发送失败的日志描述
UserActionSendFailedDesc = "短信提交失败"
// UserActionSendSuccessStatus 提交成功的日志状态
UserActionSendSuccessStatus = "SUBMIT SUCCESS"
// UserActionSendSuccessDesc 提交失败的日志描述
UserActionSendSuccessDesc = "短信提交成功"
)
// 短信状态
const (
// StatusNew .
StatusNew = int32(0)
// StatusSuccess .
StatusSuccess = int32(1)
// StatusFail .
StatusFail = int32(2)
)
// 短信任务类型
const (
// TaskTypeMobile 按手机号发送
TaskTypeMobile = int32(1)
// TaskTypeMid 按mid发送
TaskTypeMid = int32(2)
)
// 短信任务状态
const (
// TaskStatusPrepared 准备发
TaskStatusPrepared = int32(1)
// TaskStatusDoing 进行中
TaskStatusDoing = int32(2)
// TaskStatusSuccess 发送成功
TaskStatusSuccess = int32(3)
// TaskStatusFailed 发送失败
TaskStatusFailed = int32(4)
// TaskStatusStop 停止发送
TaskStatusStop = int32(5)
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,59 @@
syntax = "proto3";
package sms.service.model;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "model";
message ModelTemplate {
int64 id = 1 [(gogoproto.customname) = "ID", (gogoproto.moretags) = 'json:"id"'];
string code = 2 [(gogoproto.moretags) = 'json:"code"'];
string template = 3 [(gogoproto.moretags) = 'json:"template"'];
int32 stype = 4 [(gogoproto.moretags) = 'json:"stype"'];
int32 status = 5 [(gogoproto.moretags) = 'json:"status"'];
string approver = 6 [(gogoproto.moretags) = 'json:"approver"'];
string submitter = 7 [(gogoproto.moretags) = 'json:"submitter"'];
repeated string param = 8 [(gogoproto.moretags) = 'json:"param" gorm:"-"'];
int64 ctime = 9 [(gogoproto.moretags) = 'json:"ctime" gorm:"column:ctime"', (gogoproto.casttype) = "go-common/library/time.Time"];
int64 mtime = 10 [(gogoproto.moretags) = 'json:"mtime" gorm:"column:mtime"', (gogoproto.casttype) = "go-common/library/time.Time"];
}
message ModelSend {
int64 id = 1 [(gogoproto.customname) = "ID"];
string mid = 2;
string mobile = 3;
string country = 4;
string code = 5;
string content = 6;
int32 status = 7;
int32 type = 8;
int32 pid = 9;
}
message ModelUserActionLog {
string msgid = 1 [(gogoproto.customname) = "MsgID"];
string mobile = 2;
string content = 3;
string status = 4;
string desc = 5;
int32 provider = 6;
int32 type = 7;
int32 action = 8;
int64 ts = 9;
}
message ModelTask {
int64 id = 1 [(gogoproto.customname) = "ID"];
int32 type = 2;
int32 business_id = 3 [(gogoproto.customname) = "BusinessID"];
string template_code = 4;
string template_content = 5 [(gogoproto.moretags) = 'gorm:"-"'];
string desc = 6;
string file_name = 7;
string file_path = 8;
int64 send_time = 9 [(gogoproto.casttype) = "go-common/library/time.Time"];
int32 status = 10;
int64 ctime = 11 [(gogoproto.moretags) = 'gorm:"column:ctime"', (gogoproto.casttype) = "go-common/library/time.Time"];
int64 mtime = 12 [(gogoproto.moretags) = 'gorm:"column:mtime"', (gogoproto.casttype) = "go-common/library/time.Time"];
}

View File

@@ -0,0 +1,39 @@
package model
// ArgMid is rpc mid params.
type ArgMid struct {
Mid int64
RealIP string
}
// ArgSend send sms
type ArgSend struct {
Mid int64
RealIP string
Mobile string
Country string
Tcode string
Tparam string
}
// ArgSendBatch send batch
type ArgSendBatch struct {
Mids []int64
RealIP string
Mobiles []string
Tcode string
Tparam string
}
// ArgUserActionLog add user action log
type ArgUserActionLog struct {
MsgID string // 发送短信时服务商返回的随机ID
Mobile string
Content string // 短信内容
Status string // 回执状态
Desc string // 回执状态描述
Provider int // 短信服务商ID
Type int // 短信类型,验证码/国际/营销
Action int // 操作类型,发送或回执
Ts int64 // 操作时间
}