|
@@ -24,7 +24,7 @@ type CompanyOperationRecord struct {
|
|
|
Status string `description:"状态"`
|
|
|
}
|
|
|
|
|
|
-//新增PPT
|
|
|
+//新增操作记录
|
|
|
func AddCompanyOperationRecord(item *CompanyOperationRecord) (lastId int64, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
lastId, err = o.Insert(item)
|
|
@@ -37,6 +37,14 @@ func CompanyFreeze(companyId, productId int) (err error) {
|
|
|
freezeEndDate := time.Now().AddDate(0, 3, 0).Format(utils.FormatDate)
|
|
|
sql := `UPDATE company_product SET status='冻结',freeze_time=NOW(),modify_time=NOW(),freeze_start_date=?,freeze_end_date=? WHERE company_id=? AND product_id=? `
|
|
|
_, err = o.Raw(sql, freezeStartDate, freezeEndDate, companyId, productId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ sql = `UPDATE company SET type=3,last_updated_time=NOW() WHERE company_id=? `
|
|
|
+ _, err = o.Raw(sql, companyId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -44,6 +52,14 @@ func CompanyLoss(companyId, productId int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `UPDATE company_product SET status='流失',loss_time=NOW(),modify_time=NOW(),lose_reason=‘冻结到期系统自动流失’ WHERE company_id=? AND product_id=? `
|
|
|
_, err = o.Raw(sql, companyId, productId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ sql = `UPDATE company SET type=3,last_updated_time=NOW() WHERE company_id=? `
|
|
|
+ _, err = o.Raw(sql, companyId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -51,6 +67,14 @@ func CompanyTryOut(companyId, productId int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `UPDATE company_product SET status='试用',modify_time=NOW() WHERE company_id=? AND product_id=? `
|
|
|
_, err = o.Raw(sql, companyId, productId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ sql = `UPDATE company SET type=2,last_updated_time=NOW() WHERE company_id=? `
|
|
|
+ _, err = o.Raw(sql, companyId).Exec()
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -64,7 +88,6 @@ func GetCompanyOldDataSync() (items []*Company, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
type CompanyProduct struct {
|
|
|
CompanyProductId int `orm:"column(company_product_id);pk" description:"客户产品id"`
|
|
|
CompanyId int `description:"客户id"`
|
|
@@ -99,4 +122,4 @@ func AddCompanyProduct(item *CompanyProduct) (newId int64, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
newId, err = o.Insert(item)
|
|
|
return
|
|
|
-}
|
|
|
+}
|