作者 唐旭辉

bug 修复

@@ -2,37 +2,36 @@ package models @@ -2,37 +2,36 @@ package models
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 - "time"  
6 5
7 "github.com/astaxie/beego/orm" 6 "github.com/astaxie/beego/orm"
8 ) 7 )
9 8
10 type Chance struct { 9 type Chance struct {
11 - Id int64 `orm:"column(id);pk" description:"id 主键"`  
12 - UserId int64 `orm:"column(user_id)" description:"表user_company.id id"`  
13 - DepartmentId int64 `orm:"column(department_id)" description:"表department.id 部门id (提交机会指定的部门)"`  
14 - ChanceTypeId int `orm:"column(chance_type_id)" description:"表chance_type.id 机会类型 "`  
15 - CompanyId int64 `orm:"column(company_id)" description:"表company.id 公司编号"`  
16 - AuditTemplateId int64 `orm:"column(audit_template_id)" description:"表audit_template.id 所属审批模板编号"`  
17 - AuditTemplateConfig string `orm:"column(audit_template_config);size(255);null" description:"模板配置 (存旧的配置信息,对新改动的不影响)"`  
18 - Content string `orm:"column(content)" description:"格式化后的文本内容"`  
19 - SourceContent string `orm:"column(source_content)" description:"原始表单内容 json"`  
20 - ViewTotal int `orm:"column(view_total)" description:"查看总数"`  
21 - CommentTotal int `orm:"column(comment_total)" description:"评论总数"`  
22 - ZanTotal int `orm:"column(zan_total)" description:"点赞总数"`  
23 - ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:待处理 1:待审核 2:被退回 3:已通过 "`  
24 - EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 "`  
25 - UpdateAt time.Time `orm:"column(update_at);type(timestamp)" description:"更新时间"`  
26 - CreateAt time.Time `orm:"column(create_at);type(timestamp)" description:"创建时间"`  
27 - BasicScore float64 `orm:"column(basic_score);null;digits(4);decimals(1)" description:"基础评分"`  
28 - ExtraScore float64 `orm:"column(extra_score);null;digits(4);decimals(1)" description:"附加评分"`  
29 - ValueScore float64 `orm:"column(value_score);null;digits(4);decimals(1)" description:"价值评分"`  
30 - DiscoveryScore float64 `orm:"column(discovery_score);null;digits(4);decimals(1)" description:"发现得分(发现得分=基础评分*系数 + 附加评分*系数 + 价值评分*系数)"`  
31 - PublishStatus int `orm:"column(publish_status)" description:"公开状态 -1 未公开、1部门公开、2公司公开"`  
32 - AuditLevel int `orm:"column(audit_level)" description:"当前审批步骤"`  
33 - ApproveData string `orm:"column(approve_data);size(500);null" description:"公开数据 (公开状态 公开对象)"`  
34 - Code string `orm:"column(code)" description:"机会编码"`  
35 - Status int8 `orm:"column(status)" description:"机会状态 1:开启 2:关闭"` 10 + Id int64 `orm:"column(id);pk" description:"id 主键"`
  11 + UserId int64 `orm:"column(user_id)" description:"表user_company.id id"`
  12 + DepartmentId int64 `orm:"column(department_id)" description:"表department.id 部门id (提交机会指定的部门)"`
  13 + ChanceTypeId int `orm:"column(chance_type_id)" description:"表chance_type.id 机会类型 "`
  14 + CompanyId int64 `orm:"column(company_id)" description:"表company.id 公司编号"`
  15 + AuditTemplateId int64 `orm:"column(audit_template_id)" description:"表audit_template.id 所属审批模板编号"`
  16 + AuditTemplateConfig string `orm:"column(audit_template_config);size(255);null" description:"模板配置 (存旧的配置信息,对新改动的不影响)"`
  17 + Content string `orm:"column(content)" description:"格式化后的文本内容"`
  18 + SourceContent string `orm:"column(source_content)" description:"原始表单内容 json"`
  19 + ViewTotal int `orm:"column(view_total)" description:"查看总数"`
  20 + CommentTotal int `orm:"column(comment_total)" description:"评论总数"`
  21 + ZanTotal int `orm:"column(zan_total)" description:"点赞总数"`
  22 + ReviewStatus int8 `orm:"column(review_status)" description:"审核状态 0:待处理 1:待审核 2:被退回 3:已通过 "`
  23 + EnableStatus int8 `orm:"column(enable_status)" description:"有效状态 0:无效 1:有效 "`
  24 + UpdateAt string `orm:"column(update_at)" description:"更新时间"`
  25 + CreateAt string `orm:"column(create_at)" description:"创建时间"`
  26 + BasicScore float64 `orm:"column(basic_score);null;digits(4);decimals(1)" description:"基础评分"`
  27 + ExtraScore float64 `orm:"column(extra_score);null;digits(4);decimals(1)" description:"附加评分"`
  28 + ValueScore float64 `orm:"column(value_score);null;digits(4);decimals(1)" description:"价值评分"`
  29 + DiscoveryScore float64 `orm:"column(discovery_score);null;digits(4);decimals(1)" description:"发现得分(发现得分=基础评分*系数 + 附加评分*系数 + 价值评分*系数)"`
  30 + PublishStatus int `orm:"column(publish_status)" description:"公开状态 -1 未公开、1部门公开、2公司公开"`
  31 + AuditLevel int `orm:"column(audit_level)" description:"当前审批步骤"`
  32 + ApproveData string `orm:"column(approve_data);size(500);null" description:"公开数据 (公开状态 公开对象)"`
  33 + Code string `orm:"column(code)" description:"机会编码"`
  34 + Status int8 `orm:"column(status)" description:"机会状态 1:开启 2:关闭"`
36 } 35 }
37 36
38 func (t *Chance) TableName() string { 37 func (t *Chance) TableName() string {
@@ -14,19 +14,19 @@ import ( @@ -14,19 +14,19 @@ import (
14 ) 14 )
15 15
16 type SqlData struct { 16 type SqlData struct {
17 - Id int64 `orm:"column(id)"`  
18 - UserId int64 `orm:"column(user_id)"`  
19 - NickName string `orm:"column(nick_name)"`  
20 - DepartmentId int64 `orm:"column(department_id)"`  
21 - AuditTemplateId int64 `orm:"column(audit_template_id)"`  
22 - ChanceTypeId int `orm:"column(chance_type_id)"`  
23 - PublishStatus int `orm:"column(publish_status)"`  
24 - CreateAt time.Time `orm:"column(create_at);type(timestamp)"`  
25 - ReviewStatus int8 `orm:"column(review_status)"`  
26 - Status int8 `orm:"column(status)"`  
27 - DiscoveryScore string `orm:"column(discovery_score)"`  
28 - CommentTotal string `orm:"column(comment_total)"`  
29 - Code string `orm:"column(code)"` 17 + Id int64 `orm:"column(id)"`
  18 + UserId int64 `orm:"column(user_id)"`
  19 + NickName string `orm:"column(nick_name)"`
  20 + DepartmentId int64 `orm:"column(department_id)"`
  21 + AuditTemplateId int64 `orm:"column(audit_template_id)"`
  22 + ChanceTypeId int `orm:"column(chance_type_id)"`
  23 + PublishStatus int `orm:"column(publish_status)"`
  24 + CreateAt string `orm:"column(create_at)`
  25 + ReviewStatus int8 `orm:"column(review_status)"`
  26 + Status int8 `orm:"column(status)"`
  27 + DiscoveryScore string `orm:"column(discovery_score)"`
  28 + CommentTotal string `orm:"column(comment_total)"`
  29 + Code string `orm:"column(code)"`
30 } 30 }
31 31
32 //根据权限获取机会列表 32 //根据权限获取机会列表
@@ -277,7 +277,6 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -277,7 +277,6 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
277 return returnData, nil 277 return returnData, nil
278 } 278 }
279 for _, v := range data { 279 for _, v := range data {
280 - t := v.CreateAt.Unix()  
281 item := protocol.RspAuditList{ 280 item := protocol.RspAuditList{
282 Id: fmt.Sprint(v.Id), 281 Id: fmt.Sprint(v.Id),
283 Status: v.Status, 282 Status: v.Status,
@@ -290,12 +289,11 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -290,12 +289,11 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
290 DiscoveryScore: v.DiscoveryScore, 289 DiscoveryScore: v.DiscoveryScore,
291 CommentTotal: v.CommentTotal, 290 CommentTotal: v.CommentTotal,
292 UserName: v.NickName, 291 UserName: v.NickName,
  292 + CreateTime: 0,
293 } 293 }
294 -  
295 - if t < 0 {  
296 - item.CreateTime = 0  
297 - } else {  
298 - item.CreateTime = t 294 + t, err := time.ParseInLocation("2006-01-02 15:04:05", v.CreateAt, time.Local)
  295 + if err == nil {
  296 + item.CreateTime = t.Unix()
299 } 297 }
300 if d, err := models.GetDepartmentById(v.DepartmentId); err == nil { 298 if d, err := models.GetDepartmentById(v.DepartmentId); err == nil {
301 item.Department = d.Name 299 item.Department = d.Name
@@ -350,8 +348,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -350,8 +348,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
350 log.Error("机会的公司不匹配") 348 log.Error("机会的公司不匹配")
351 return returnData, protocol.NewErrWithMessage("1") 349 return returnData, protocol.NewErrWithMessage("1")
352 } 350 }
353 - returnData.CreateTime = chanceInfo.CreateAt.Format("2006-01-02 15:16:17")  
354 - 351 + returnData.CreateTime = chanceInfo.CreateAt
355 var ( 352 var (
356 chanceContent []protocol.InputElement 353 chanceContent []protocol.InputElement
357 ) 354 )
@@ -446,7 +443,7 @@ func AllowChanceEnableStatus(chanceid int64, companyid int64) error { @@ -446,7 +443,7 @@ func AllowChanceEnableStatus(chanceid int64, companyid int64) error {
446 return nil 443 return nil
447 } 444 }
448 chanceinfo.Status = models.ChanceStatusAllow 445 chanceinfo.Status = models.ChanceStatusAllow
449 - chanceinfo.UpdateAt = time.Now() 446 + chanceinfo.UpdateAt = time.Now().String()
450 err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"}) 447 err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"})
451 if err != nil { 448 if err != nil {
452 log.Error("更新机会数据失败:%s", err) 449 log.Error("更新机会数据失败:%s", err)
@@ -470,7 +467,7 @@ func ForbidChanceEnableStatus(chanceid int64, companyid int64) error { @@ -470,7 +467,7 @@ func ForbidChanceEnableStatus(chanceid int64, companyid int64) error {
470 return protocol.NewErrWithMessage("1") 467 return protocol.NewErrWithMessage("1")
471 } 468 }
472 chanceinfo.Status = models.ChanceStatusForbid 469 chanceinfo.Status = models.ChanceStatusForbid
473 - chanceinfo.UpdateAt = time.Now() 470 + chanceinfo.UpdateAt = time.Now().String()
474 err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"}) 471 err = models.UpdateChanceById(chanceinfo, []string{"Status", "UpdateAt"})
475 if err != nil { 472 if err != nil {
476 log.Error("更新机会数据失败:%s", err) 473 log.Error("更新机会数据失败:%s", err)