作者 yangfu

修改示例

... ... @@ -27,13 +27,13 @@
### 阶段二接口完成进度
|功能|完成状态|时间|接口路径
|---|---|----|----|
|我的机会-我提交的| | | |
|机会详情| | | |
|我的机会-我提交的| | |/v1/chance/mySubmitChance|
|机会详情| | |v1/chance/detail|
|机会更新| | | |
|机会删除| | | |
|机会删除| | |/v1/chance/delete|
|我的机会-我的审核| | | |
|机会审核(评分/修改公开状态)| | | |
|用户评分配置| | | |
|计算发现分| | | |
|用户机会权限| | | |
|机会池| | | |
|消息-点赞| | |v1/message/msgInteractive|
... ... @@ -49,7 +49,7 @@
|机会审核消息| | |v1/message/msgInteractive|
|我提交的机会| | | v1/chance/chances|
|我审核的机会| | | v1/chance/chances|
|机会详情| | | v1/chance/detail|
|机会详情| | | |
|待抓住机会列表| | |v1/chance/chances|
|配置-评分| | |v1/config/score|
|机会审核| | |v1/chance/audit|
... ...
... ... @@ -74,7 +74,6 @@ func (this *BaseController) Valid(obj interface{}) (result bool, msg *protocol.R
}
func (this *BaseController) Resp(msg *protocol.ResponseMessage) {
this.Data["json"] = msg
this.ServeJSON()
}
... ...
... ... @@ -315,7 +315,7 @@ func (this *ChanceController) ChanceDetail() {
//}
//ChanceDelete 机会删除
//@router /chanceDelete [post]
//@router /delete [post]
func (this *ChanceController) ChanceDelete() {
var msg *protocol.ResponseMessage
defer func() {
... ...
... ... @@ -65,3 +65,12 @@ func JoinInt64s(ids []int64, spilt string) string {
}
return strings.Join(idStrings, spilt)
}
//判断是否为空
func IsNil(i interface{}) bool {
vi := reflect.ValueOf(i)
if vi.Kind() == reflect.Ptr {
return vi.IsNil()
}
return false
}
... ...
... ... @@ -127,3 +127,13 @@ func GetAuditFlowProcessList(chanceId int64) (v []*AuditFlowProcess, err error)
}
return nil, err
}
//删除机会时关闭所有审核信息
func CloseAuditFlowProcess(chanceId int64) (err error) {
o := orm.NewOrm()
sql := "update audit_flow_process set enable_status =0,is_active=0,update_at=now() where chance_id=?"
if err = utils.ExecuteSQLWithOrmer(o, sql, chanceId); err != nil {
return
}
return
}
... ...
... ... @@ -94,6 +94,7 @@ type Score struct {
//审核操作权限
type ApproveAccess struct {
AllowApprove int `json:"allowApprove"`
AllowReject int `json:"allowReject"`
ProcessId int64 `json:"processId"`
AllowApprove int `json:"allowApprove"`
AllowReject int `json:"allowReject"`
}
... ...
... ... @@ -37,7 +37,7 @@ var errmessge ErrorMap = map[int]string{
//机会审批相关
5201: "该机会模板未配置审批人,请选择其他模板",
5202: "该机会已被其他人审批",
5202: "该机会已被审批",
5203: "审批服务器操作失败",
//模板相关
... ...
... ... @@ -65,14 +65,6 @@ func init() {
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "ChanceDelete",
Router: `/chanceDelete`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "ChanceDetail",
Router: `/chanceDetail`,
AllowHTTPMethods: []string{"post"},
... ... @@ -113,6 +105,14 @@ func init() {
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "ChanceDelete",
Router: `/delete`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:ChanceController"],
beego.ControllerComments{
Method: "Favorite",
Router: `/favorite`,
AllowHTTPMethods: []string{"post"},
... ...
... ... @@ -30,6 +30,7 @@ const (
ApproveIntegrate = "/approve-processes/integrate"
)
//素加审批系统
type SuplusApprove struct {
}
... ... @@ -315,7 +316,7 @@ func ChanceApprove(header *protocol.RequestHeader, request *protocol.ChanceAppro
if approveItemResponse.IsOver == 1 {
//结束审批
if err = utils.UpdateTableByMap(chance, map[string]interface{}{
"ReviewStatus": int8(request.ReviewStatus), "AuditLevel": chance.AuditLevel + 1}); err != nil {
"ReviewStatus": int8(request.ReviewStatus), "AuditLevel": chance.AuditLevel}); err != nil {
log.Error("更新机会审核状态失败 chance_id:", chance.Id, err)
return
}
... ... @@ -446,6 +447,7 @@ func ChanceApproveProcess(header *protocol.RequestHeader, chance *models.Chance)
rsp.ApproveAccess = &protocol.ApproveAccess{
AllowApprove: 1,
AllowReject: 1,
ProcessId: process.Id,
}
}
}
... ...
... ... @@ -699,6 +699,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail
provider *protocol.BaseUserInfo
approveProcess *protocol.ChanceApproveProcessResponse
)
rsp = &protocol.ChanceDetailResponse{}
if chance, err = models.GetChanceById(request.Id); err != nil {
if err == orm.ErrNoRows {
err = protocol.NewErrWithMessage(5101)
... ... @@ -707,13 +708,16 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail
log.Error(err)
return
}
if chance.EnableStatus == 0 {
err = protocol.NewErrWithMessage(5101)
return
}
//用户信息
if provider, err = agg.GetUserBaseInfo(chance.UserId, header.CompanyId); err != nil {
log.Error(err)
return
}
rsp = &protocol.ChanceDetailResponse{}
item := protocol.ChanceItem{
Id: chance.Id,
Provider: provider,
... ... @@ -742,6 +746,7 @@ func ChanceDelete(header *protocol.RequestHeader, request *protocol.ChanceDelete
var (
chance *models.Chance
)
rsp = &protocol.ChanceDeleteResponse{}
if chance, err = models.GetChanceById(request.Id); err != nil {
if err == orm.ErrNoRows {
err = protocol.NewErrWithMessage(5101)
... ... @@ -750,8 +755,24 @@ func ChanceDelete(header *protocol.RequestHeader, request *protocol.ChanceDelete
log.Error(err)
return
}
if chance != nil {
if chance.ReviewStatus == protocol.ReviewStatusPass {
err = protocol.NewErrWithMessage(5202)
return
}
//被人审核过 公开状态数据不为空
if chance.ReviewStatus == protocol.ReviewStatusAuditging && len(chance.PublishData) != 0 {
err = protocol.NewErrWithMessage(5202)
return
}
if err = utils.UpdateTableByMap(chance, map[string]interface{}{
"EnableStatus": int8(0),
}); err != nil {
log.Error(err)
return
}
if err = models.CloseAuditFlowProcess(chance.Id); err != nil {
log.Error(err)
return
}
rsp = &protocol.ChanceDeleteResponse{}
return
}
... ...
... ... @@ -91,3 +91,7 @@ func UploadFile(request *protocol.FileRequest) (rsp *protocol.FileResponse, err
}
return
}
func ResizeImage(fileType int, fileName string, file *multipart.FileHeader) (err error) {
return
}
... ...