作者 yangfu

机会统计

... ... @@ -37,4 +37,4 @@ user_center_app_key ="39aefef9e22744a3b2d2d3791824ae7b"
user_center_app_secret ="cykbjnfqgctn"
#Html5
h5_host = "https://web-open.fjmaimaimai.com"
\ No newline at end of file
h5_host = "https://web-open.fjmaimaimai.com"
... ...
... ... @@ -122,9 +122,9 @@ func FilterComm(ctx *context.Context) {
// return
//}
if !CheckSign(ctx) {
return
}
//if !CheckSign(ctx) {
// return
//}
//2.检查token是否有效
if !CheckToken(ctx) {
return
... ...
... ... @@ -230,3 +230,24 @@ func (this *ChanceController) ChanceSubmit() {
}
msg = protocol.NewReturnResponse(chance.ChanceSubmit(header, request))
}
//ChanceStatistics
//@router /statistics [post]
func (this *ChanceController) ChanceStatistics() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.ChanceStatisticsRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(chance.ChanceStatistics(header, request))
}
... ...
... ... @@ -158,3 +158,24 @@ func (this *UserController) UserInfo() {
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(user.UserInfo(header, request))
}
//UserStatistics 用户中心-统计信息
//@router /statistics [post]
func (this *UserController) UserStatistics() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.UserStatisticsRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(user.UserStatistics(header, request))
}
... ...
... ... @@ -109,7 +109,7 @@ type Template struct {
type Form struct {
Id int `json:"id"`
Lable string `json:"lable"`
Label string `json:"label"`
InputType string `json:"inputType"`
SectionType int8 `json:"sectionType"`
Value string `json:"value"`
... ... @@ -141,10 +141,24 @@ type Picture struct {
}
type Video struct {
Path string `json:"path"`
Cover string `json:"cover"` //封面
Cover Cover `json:"cover"` //封面
Duration int `json:"duration"`
}
type AuditConfig struct {
NoApprover int8 `json:"no_approver"` //审核人空时:【1:自动通过】【2:转交给管理员】
}
/*ChanceStatistics */
type ChanceStatisticsRequest struct {
}
type ChanceStatisticsResponse struct {
ChanceTotal int `json:"chanceTotal"`
List []ChanceTotalItem `json:"list"`
}
type ChanceTotalItem struct {
Id int `json:"id"` //类型
Name string `json:"name"` //总数
Total int `json:"total"`
}
... ...
... ... @@ -21,3 +21,18 @@ const (
InValid = 0 //无效
Valid = 1 //有效
)
//统计 注意:只能往后面加,不然会乱序
const (
CollectStatic = 1 << iota //收藏
ZanStatic //点赞
CommentStatic //评论
MyCommitChance //我提交的机会
MyCommitChanceWait //我提交的机会-待审批
MyCommitChanceReturn //我提交的机会-退回
MyCommitChancePass //我提交的机会-已通过
MyAuditChance //我审核的机会
MyAuditChanceWait //我审核的机会-待我审批
MyAuditChancePass //我审核的机会-待我审批
MyAuditChanceReturn //我审核的机会-已退回
)
... ...
... ... @@ -68,18 +68,35 @@ type User struct {
Companys []Company `json:"companys"`
}
//公司
type Company struct {
Id int64 `json:"id"`
Name string `json:"name"`
}
//部门
type Dep struct {
Id int `json:"id"`
Name string `json:"name"`
}
//岗位
type Job struct {
Id int `json:"id"`
Name string `json:"name"`
Level int `json:"level"`
}
//用户统计信息
/*UserStatistics */
type UserStatisticsRequest struct {
TypeTotal int64 `json:"typeTotal" valid:"Required"`
}
type UserStatisticsResponse struct {
Totals []TypeTotalItem `json:"totals"`
}
type TypeTotalItem struct {
Type int64 `json:"type"` //类型
Total int `json:"total"` //总数
HaveUpdate int `json:"haveUpdate"` //是否含有更新(0无更新,1有更新)
}
... ...
... ... @@ -113,6 +113,14 @@ func init() {
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "ChanceStatistics",
Router: `/statistics`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "ChanceSubmit",
Router: `/submit`,
AllowHTTPMethods: []string{"post"},
... ... @@ -273,6 +281,14 @@ func init() {
beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
beego.ControllerComments{
Method: "UserStatistics",
Router: `/statistics`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:UserController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:UserController"],
beego.ControllerComments{
Method: "SwitchCompany",
Router: `/switchCompany`,
AllowHTTPMethods: []string{"post"},
... ...
package agg
... ...
... ... @@ -195,7 +195,7 @@ func Templates(header *protocol.RequestHeader, request *protocol.TemplatesReques
form := forms[j]
template.FormList[j] = &protocol.Form{
Id: form.Id,
Lable: form.Label,
Label: form.Label,
Value: "",
InputType: form.InputType,
SectionType: form.Section,
... ... @@ -562,3 +562,23 @@ func getParentDepartmentors(pid int) (ids []int64) {
}
return getParentDepartmentors(department.ParentId)
}
//首页机会池统计
func ChanceStatistics(header *protocol.RequestHeader, request *protocol.ChanceStatisticsRequest) (rsp *protocol.ChanceStatisticsResponse, err error) {
var (
chanceType []*models.ChanceType
)
if chanceType, err = models.GetChanceTypeAll(header.CompanyId); err != nil {
log.Error(err)
return
}
rsp = &protocol.ChanceStatisticsResponse{}
for i := range chanceType {
item := chanceType[i]
rsp.List = append(rsp.List, protocol.ChanceTotalItem{
Id: item.Id,
Name: item.Name,
})
}
return
}
... ...
... ... @@ -315,3 +315,19 @@ func UserInfo(header *protocol.RequestHeader, request *protocol.UserInfoRequest)
}
return
}
//用户中心-统计信息
func UserStatistics(header *protocol.RequestHeader, request *protocol.UserStatisticsRequest) (rsp *protocol.UserStatisticsResponse, err error) {
var (
flag int64
)
rsp = &protocol.UserStatisticsResponse{}
for flag = 1; flag < (1 << 20); flag = flag << 1 {
if flag&request.TypeTotal > 0 {
rsp.Totals = append(rsp.Totals, protocol.TypeTotalItem{
Type: flag,
})
}
}
return
}
... ...