Browse Source

fix:原销售申请领取后,客户todo也要清空

Roc 2 years ago
parent
commit
9a743e1ea0
1 changed files with 8 additions and 1 deletions
  1. 8 1
      models/tables/company_approval/company_approval.go

+ 8 - 1
models/tables/company_approval/company_approval.go

@@ -435,12 +435,19 @@ func ApplyReceive(companyId, productId, sysUserId, companyApprovalId, applyUserI
 	endDate := time.Now().AddDate(0, 2, 0).Format(utils.FormatDate)
 
 	//更新用户产品状态
-	sql := `UPDATE company_product SET status='试用',approve_status='已审批', start_date=?,end_date=?,seller_id=?,seller_name=?,group_id=?,department_id=?,modify_time=NOW() WHERE company_id=? AND product_id=? `
+	sql := `UPDATE company_product SET status='试用',approve_status='已审批', start_date=?,end_date=?,seller_id=?,seller_name=?,group_id=?,department_id=?,modify_time=NOW(),todo_status="无任务",todo_create_time=null,todo_approve_time=null,todo_modify_time=null,todo_end_time=null WHERE company_id=? AND product_id=? `
 	_, err = o.Raw(sql, startDate, endDate, sellerItem.AdminId, sellerItem.RealName, sellerItem.GroupId, sellerItem.DepartmentId, companyId, productId).Exec()
 	if err != nil {
 		return
 	}
 
+	// 将进行中的任务给作废掉
+	sql = `UPDATE company_todo SET status="已作废",modify_time=NOW() WHERE company_id=? AND product_id=? and status="进行中" `
+	_, err = o.Raw(sql, companyId, productId).Exec()
+	if err != nil {
+		return
+	}
+
 	//更新用户状态
 	sql = `UPDATE company SET type=2,last_updated_time=NOW() WHERE company_id=? `
 	_, err = o.Raw(sql, companyId).Exec()