|
@@ -3,6 +3,7 @@ package eta_trial
|
|
|
import (
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "hongze/hz_crm_api/utils"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -24,6 +25,13 @@ type EtaTrial struct {
|
|
|
LastLoginDuration int `description:"最后一次登录时长"`
|
|
|
}
|
|
|
|
|
|
+type TrialAccountTransferReq struct {
|
|
|
+ EtaTrialIdList []int `description:"转移使用用户id列表"`
|
|
|
+ CurrentSellerId int `description:"转移后员工id"`
|
|
|
+ CurrentSellerName string `description:"转移后员工名称"`
|
|
|
+ IsCheckAll bool `description:"是否全选"`
|
|
|
+}
|
|
|
+
|
|
|
// Update 更新用户基础信息
|
|
|
func (item *EtaTrial) Update(cols []string) (err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -126,3 +134,32 @@ WHERE mobile=? `
|
|
|
_, err = o.Raw(sql, mobile).Exec()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// TransferETATrial 转移试用用户跟进销售人员
|
|
|
+func TransferETATrial(item *TrialAccountTransferReq) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `UPDATE eta_trial SET seller=?,seller_id=?,modify_time=NOW() WHERE 1 = 1 `
|
|
|
+
|
|
|
+ var condition string
|
|
|
+ var params []interface{}
|
|
|
+
|
|
|
+ if item.IsCheckAll {
|
|
|
+ if len(item.EtaTrialIdList) > 0 {
|
|
|
+ condition = ` AND eta_trial_id not IN (` + utils.GetOrmInReplace(len(item.EtaTrialIdList)) + `)`
|
|
|
+ for _, id := range item.EtaTrialIdList {
|
|
|
+ params = append(params, id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ condition = ` AND eta_trial_id IN (` + utils.GetOrmInReplace(len(item.EtaTrialIdList)) + `)`
|
|
|
+ for _, id := range item.EtaTrialIdList {
|
|
|
+ params = append(params, id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sql += condition
|
|
|
+ params = append([]interface{}{item.CurrentSellerName, item.CurrentSellerId}, params...)
|
|
|
+
|
|
|
+ _, err = o.Raw(sql, params...).Exec()
|
|
|
+
|
|
|
+ return
|
|
|
+}
|