作者 tangxvhui

。。

... ... @@ -348,14 +348,20 @@ func (c *AuditController) ChanceStoreChange() {
msg = protocol.BadRequestParam("1")
return
}
// companyId := c.GetCompanyId()
companyId := c.GetCompanyId()
var (
chanceData *models.Chance
err error
)
chanceId, _ := strconv.ParseInt(param.ChanceId, 64, 10)
chanceId, _ := strconv.ParseInt(param.ChanceId, 10, 64)
chanceData, err = models.GetChanceById(chanceId)
if err != nil {
log.Error("获取chance数据失败,err;%s", err)
msg = protocol.BadRequestParam("1")
return
}
if chanceData.CompanyId != companyId {
log.Error("chance数据的公司不一致")
msg = protocol.BadRequestParam("1")
return
}
... ... @@ -364,3 +370,29 @@ func (c *AuditController) ChanceStoreChange() {
msg = protocol.NewReturnResponse(nil, nil)
return
}
//GetChangeMedia 获取机会的图片、音频、视频的地址
//@router /v1/chance/media
func (c *AuditController) GetChangeMedia() {
var msg *protocol.ResponseMessage
defer func() {
c.ResposeJson(msg)
}()
type Parameter struct {
ChanceId string `json:"chance_id"`
CheckSum string `json:"check_sum"`
}
var param Parameter
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
log.Error("json 解析失败", err)
msg = protocol.BadRequestParam("1")
return
}
// chanceId, _ := strconv.ParseInt(param.ChanceId, 10, 64)
// var (
// err error
// chanceData models.ChanceData
// )
// models.GetChanceDataByChanceId(chanceId)
return
}
... ...
... ... @@ -260,6 +260,8 @@ type RequestAuditList struct {
CreateTimeEndS string `json:"create_time_end"` //
Code string `json:"code"` //机会编码
UserName string `json:"user_name"` //提交人姓名
StoreType string `json:"store_type"` //分类 【-1:全部】【0:机会池】【1:储备池】
ReserveType int `json:"reserve_type"` //储备池分类id
}
type ResponseAuditList struct {
... ...
... ... @@ -10,6 +10,7 @@ import (
serverabc "oppmg/services/rbac"
"oppmg/storage/redisdata"
"oppmg/utils"
"strconv"
"strings"
"time"
)
... ... @@ -272,6 +273,22 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
datasql.WriteString(s)
countsql.WriteString(s)
}
if param.ReserveType > 0 {
cond = append(cond, param.ReserveType)
s := ` And a.reserve_type_id=? `
datasql.WriteString(s)
countsql.WriteString(s)
}
if len(param.StoreType) > 0 {
storeType, _ := strconv.Atoi(param.StoreType)
if storeType >= 0 {
cond = append(cond, storeType)
s := ` And a.type=? `
datasql.WriteString(s)
countsql.WriteString(s)
}
}
dataStart := (param.PageIndex - 1) * param.PageSize
datasql.WriteString(fmt.Sprintf(` ORDER BY a.create_at DESC limit %d,%d `, dataStart, param.PageSize))
err = utils.ExecuteQueryOne(&cnt, countsql.String(), cond...)
... ... @@ -301,7 +318,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
CommentTotal: v.CommentTotal,
UserName: v.NickName,
CreateTime: 0,
ReserveType: "",
ReserveType: "未设置",
StoreType: v.StoreType,
StoreTypeName: models.ChanceStoreTypeMap[v.StoreType],
}
... ...