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,37 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"ansque.go",
"answer.go",
"answer_state.go",
"captcha.go",
"databus.go",
"identify.go",
"pendant.go",
"question.go",
],
importpath = "go-common/app/interface/main/answer/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,48 @@
package model
// AnsQueDetail .
type AnsQueDetail struct {
ID int64 `json:"qs_id"`
AnsImg string `json:"ans_img"`
QsHeight float64 `json:"qs_h"`
QsPositionY float64 `json:"qs_y"`
Ans1Hash string `json:"ans1_hash"`
Ans2Hash string `json:"ans2_hash"`
Ans3Hash string `json:"ans3_hash"`
Ans4Hash string `json:"ans4_hash"`
Ans0Height float64 `json:"ans0_h"`
Ans0PositionY float64 `json:"ans0_y"`
Ans1Height float64 `json:"ans1_h"`
Ans1PositionY float64 `json:"ans1_y"`
Ans2Height float64 `json:"ans2_h"`
Ans2PositionY float64 `json:"ans2_y"`
Ans3Height float64 `json:"ans3_h"`
Ans3PositionY float64 `json:"ans3_y"`
}
// AnsQueDetailList .
type AnsQueDetailList struct {
CurrentTime int64 `json:"current_time"`
EndTime int64 `json:"end_time"`
QuesList []*AnsQueDetail `json:"items"`
}
// AnsProType .
type AnsProType struct {
List []*AnsTypeList `json:"list"`
CurrentTime int64 `json:"current_time"`
EndTime int64 `json:"end_time"`
Repro string `json:"repro"`
}
// AnsTypeList .
type AnsTypeList struct {
Name string `json:"name"`
Fields []*AnsType `json:"fields"`
}
// AnsType info.
type AnsType struct {
ID int64 `json:"id"`
Name string `json:"name"`
}

View File

@@ -0,0 +1,250 @@
package model
import (
"time"
)
// answer constants
const (
LangZhCN = "zh-CN"
LangZhTW = "zh-TW"
LangZhHK = "zh-HK"
)
// answer constants
const (
UserInfoRank = 5000
PenDantDays = 7 //答题优秀设置挂件的天数
ExtraAnsA = "符合规范"
ExtraAnsB = "不符合规范"
)
// Score info.
const (
FullScore = 100
Score85 = 85
Score60 = 60
Score0 = 0
)
// Rank info.
const (
RankTop int = 122
)
// question type.
const (
Q int8 = iota
BaseExtraNoPassQ // 1 extra no pass
BaseExtraPassQ // 2 extra pass
)
// extra question ans.
const (
UnKownQ int8 = iota
ViolationQ
NormalQ
)
// answer captcha pass
const (
CaptchaNopass int8 = iota
CaptchaPass
)
// BaseQues question record
type BaseQues struct {
Question string
Check int8
Ctime time.Time
}
// MyQues my question
type MyQues struct {
Count int64
List []*BaseQues
}
// RankInfo rank
type RankInfo struct {
Mid int64 `json:"mid"`
Face string `json:"face"`
Uname string `json:"uname"`
Num int64 `json:"num"`
Nameplate *NameplateInfo `json:"nameplate"`
}
// NameplateInfo .
type NameplateInfo struct {
Nid int `json:"nid"`
Name string `json:"name"`
Image string `json:"image"`
ImageSmall string `json:"image_small"`
Level string `json:"level"`
Condition string `json:"condition"`
}
// TypeInfo type info
type TypeInfo struct {
ID, Parentid int64
Name string
LabelName string
Subs []*SubType
}
// ProTypes .
type ProTypes struct {
List []*TypeInfo
CurrentTime, EndTime time.Time
Repro bool
}
// SubType sub type info
type SubType struct {
ID int64 `json:"id"`
Name string `json:"name"`
LabelName string `json:"-"`
}
// AnsQue .
type AnsQue struct {
ID int64
Img string
Height float64
PositionY float64 // background-position-y
Ans []*AnsPosition
}
// AnsPosition .
type AnsPosition struct {
AnsHash string
Height float64 // height
PositionY float64 // background-position-y
}
// AnsQuesList .
type AnsQuesList struct {
CurrentTime, EndTime time.Time
QuesList []*AnsQue
}
// AnsCheck .
type AnsCheck struct {
QidList []int64
HistoryID int64
Pass bool
}
// CaptchaReq Captcha request.
type CaptchaReq struct {
Mid int64
IP string
ClientType string
NewCaptcha int
}
// CaptchaCheckReq Captcha check request.
type CaptchaCheckReq struct {
Mid int64
IP string
Challenge string
ClientType string
Validate string
Seccode string
Success int
Cookie string
Comargs map[string]string
}
// QueReq request
type QueReq struct {
ID int64
}
// AnsCool .
type AnsCool struct {
Hid int64 `json:"hid,omitempty"`
URL string `json:"url,omitempty"`
Name string `json:"uname"`
Face string `json:"face"`
Powers []*CoolPower `json:"power_result"`
Score int8 `json:"score"`
Rank *CoolRank `json:"rank"`
Share *CoolShare `json:"share"`
CanShowRankBtn bool `json:"can_show_rank_btn"`
IsSameUser bool `json:"is_same_user"`
ViewMore string `json:"view_more"`
VideoInfo *CoolVideo `json:"video_info"`
IsFirstPass int8 `json:"is_first_pass"`
Level int8 `json:"level"`
MainTids []int `json:"main_tids"`
SubTids []int `json:"sub_tids"`
}
// CoolPower .
type CoolPower struct {
Num int64 `json:"num"`
Name string `json:"name"`
}
// CoolRank .
type CoolRank struct {
ID int `json:"id"`
Name string `json:"name"`
Img string `json:"img"`
}
// CoolShare .
type CoolShare struct {
Content string `json:"content"`
ShortContent string `json:"short_content"`
}
// CoolVideo .
type CoolVideo struct {
URL string `json:"url"`
Name string `json:"name"`
Img string `json:"img"`
WatchNum string `json:"watch_num"`
UpNum string `json:"up_num"`
}
// AnswerHistory info.
type AnswerHistory struct {
ID int64 `json:"id"`
Hid int64 `json:"hid"`
Mid int64 `json:"mid"`
StartTime time.Time `json:"start_time"`
StepOneErrTimes int8 `json:"step_one_err_times"`
StepOneCompleteTime int64 `json:"step_one_complete_time"`
StepExtraStartTime time.Time `json:"step_extra_start_time"`
StepExtraCompleteTime int64 `json:"step_extra_complete_time"`
StepExtraScore int64 `json:"step_extra_score"`
StepTwoStartTime time.Time `json:"step_two_start_time"`
CompleteTime time.Time `json:"complete_time"`
CompleteResult string `json:"complete_result"`
Score int8 `json:"score"`
IsFirstPass int8 `json:"is_first_pass"`
IsPassCaptcha int8 `json:"is_pass_captcha"`
PassedLevel int8 `json:"passed_level"`
RankID int `json:"rank_id"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// AnswerTime info.
type AnswerTime struct {
Stime time.Time `json:"stime"` // answer start time
Etimes int8 `json:"etimes"` // base answer error times
}
// AnsHash .
type AnsHash struct {
AnsHashName string
AnsHashVal string
}
// ExtraScoreReply .
type ExtraScoreReply struct {
Score int64 `json:"score"`
}

View File

@@ -0,0 +1,33 @@
package model
// const .
const (
MobileUserAgentFlag = "Mobile"
ProPassed = "/v3/result/%d"
MinType = 3
MaxType = 10
BlockMsg = "12小时内无法再次答题!"
DefPageSize = 10
DefPageNo = 1
NoParam = -1
OfficialType = 6
ShowOfficialRank = 31300
// ans info.
AnsSize = 4 // 题目答案数
HashSalt = "bilirqeust"
// platfrom
PlatH5 = "h5"
PlatPC = "pc"
DefBirthday1 = "1930-01-01"
DefBirthday2 = "1980-01-01"
// rank
FlagAll = "all"
FlagMonth = "m"
)

View File

@@ -0,0 +1,24 @@
package model
// var
var (
// Geetest captcha_type .
Geetest = "gt"
BiliCaptcha = "bili"
)
// ProcessRes geetest Captcha resp info.
type ProcessRes struct {
Success int8 `json:"success"`
CaptchaID string `json:"gt"`
Challenge string `json:"challenge"`
NewCaptcha int `json:"new_captcha"`
CaptchaType string `json:"type,omitempty"`
Token string `json:"token,omitempty"`
URL string `json:"url,omitempty"`
}
// ValidateRes info.
type ValidateRes struct {
Seccode string `json:"seccode"`
}

View File

@@ -0,0 +1,51 @@
package model
import "time"
// const .
const (
AnswerLogID = 15
AnswerUpdate = "answer_update"
BasePass = "basePass"
ExtraStartTime = "extraStartTime"
ExtraCheck = "extraCheck"
ProQues = "proQues"
ProCheck = "proCheck"
Captcha = "captchaPass"
Level = "level"
)
// DataBusResult databus.
type DataBusResult struct {
Mid int64 `json:"mid"` // 用户 ID
Buvid string `json:"buvid"` // 设备标识符 前端传入
IP string `json:"ip"` // 用户 IP 地址
Ua string `json:"ua"` // 客户端 User Agent
Refer string `json:"refer"` // 页面跳转来源地址 Refer
Score int8 `json:"score"` // 答题总分数
Hid int64 `json:"hid"` // hid
Rs []*Rs
}
// Rs def.
type Rs struct {
ID int64 `json:"id"` // 题目自增 ID
Question string `json:"question"` // 问题内容
Ans int8 `json:"ans"` // 用户答案
TrueAns int8 `json:"trueAns"` // 真实答案 答案0:未知 1:违规 2:不违规
AvID int64 `json:"av_id"` // 相关视频id
Status int8 `json:"status"` // 问题状态 1:未申核 2:已审核
Source int8 `json:"source"` // 问题来源 0:未知1:评论 2:弹幕
Ctime time.Time `json:"ctime"` // 创建时间
Mtime time.Time `json:"mtime"` // 修改时间
}
// Formal user formal info.
type Formal struct {
Mid int64 `json:"mid"` // 用户 ID
Hid int64 `json:"history_id"` // 答题历史 ID
Cookie string `json:"cookie"` // cookie
IP string `json:"ip"` // cookie
PassTime time.Time `json:"pass_time"` // 通过时间
}

View File

@@ -0,0 +1,17 @@
package model
// const .
const (
IdentifyOk = 0
IdentifyNoInfo = 1
PhoneOk = 0
Phone17x = 1
PhoneEmpty = 2
)
// IdentifyInfo .
type IdentifyInfo struct {
Identify int8 `json:"'identify'"`
Phone int8 `json:"phone"`
}

View File

@@ -0,0 +1,19 @@
package model
// const .
const (
PendantNotGet = 0
PendantGet = 1
)
// Pendant .
type Pendant struct {
Pid int `json:"pid"`
Name string `json:"name"`
}
// ReqPendant .
type ReqPendant struct {
HID int64 `form:"hid" validate:"required"`
MID int64
}

View File

@@ -0,0 +1,109 @@
package model
import (
"time"
)
// state
const (
WaitCheck = int8(0)
PassCheck = int8(1)
NoPassCheck = int8(2)
)
// size
const (
MaxQuestion = 120
MinQuestion = 6
MaxAns = 100
MinAns = 2
MaxTips = 100
MinTips = 2
MaxLoadQueSize = 100000
)
// media type
const (
TextMediaType = int8(1)
ImageMediaType = int8(2)
TopRankSize = 10
MyQuestionSize = 12
AttrUnknown = -1
)
// QuestionRPC stion question info.
type QuestionRPC struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
IP uint32 `json:"ip"`
TypeID int8 `json:"type"`
MediaType int8 `json:"media_type"`
Check int8 `json:"check"`
Source int8 `json:"source"`
Question string `json:"question"`
Ans1 string `json:"ans1"`
Ans2 string `json:"ans2"`
Ans3 string `json:"ans3"`
Ans4 string `json:"ans4"`
Tips string `json:"tips"`
AvID int32 `json:"av_id"`
Ctime time.Time `json:"ctime"`
}
// Question question info rpc.
type Question struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
IP string `json:"ip"`
TypeID int8 `json:"type"`
MediaType int8 `json:"media_type"`
Check int8 `json:"check"`
Source int8 `json:"source"`
Question string `json:"question"`
Ans1 string `json:"ans1"`
Ans2 string `json:"ans2"`
Ans3 string `json:"ans3"`
Ans4 string `json:"ans4"`
Ans []string `json:"-"`
Tips string `json:"tips"`
AvID int32 `json:"av_id"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// ExtraQst etc.
type ExtraQst struct {
ID int64 `json:"id"`
Question string `json:"question"`
Ans int8 `json:"ans"`
Status int8 `json:"status"`
OriginID int64 `json:"origin_id"`
AvID int64 `json:"av_id"`
Source int8 `json:"source"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}
// ImgPosition .
type ImgPosition struct {
Ans0H float64 `json:"ans_0_h"`
Ans0Y float64 `json:"ans_0_y"`
Ans1H float64 `json:"ans_1_h"`
Ans1Y float64 `json:"ans_1_y"`
Ans2H float64 `json:"ans_2_h"`
Ans2Y float64 `json:"ans_2_y"`
Ans3H float64 `json:"ans_3_h"`
Ans3Y float64 `json:"ans_3_y"`
Ans4H float64 `json:"ans_4_h"`
Ans4Y float64 `json:"ans_4_y"`
QsH float64 `json:"qs_h"`
QsY float64 `json:"qs_y"`
}
// ExtraBigData ret.
type ExtraBigData struct {
Done []int64 `json:"done"`
Pend []int64 `json:"pend"`
}