package eta_forum import ( "encoding/json" "eta/eta_api/models" "eta/eta_api/models/eta_trial" "eta/eta_api/services/alarm_msg" "fmt" ) // EtaTrialUserReq 更新试用客户最后登录时间和次数请求体 type EtaTrialUserReq struct { Mobile string `description:"手机号"` } // UpdateEtaTrialUserLogin eta_forum_hub服务-更新试用客户最后登录时间和次数 func UpdateEtaTrialUserLogin(pars EtaTrialUserReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("GetEtaTrialMobileCount, 新增试用客户手工录入权限失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/update_login") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // GetEtaTrialUserReq 获取试用客户请求体 type GetEtaTrialUserReq struct { Mobile string `description:"手机号"` } type EtaTrialUserResp struct { Ret int Msg string ErrMsg string ErrCode string Data eta_trial.EtaTrialUserItem Success bool `description:"true 执行成功,false 执行失败"` } // GetEtaTrialUser eta_forum_hub服务-获取试用客户信息 func GetEtaTrialUser(pars GetEtaTrialUserReq) (res eta_trial.EtaTrialUserItem, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("GetEtaTrialUser, 获取试用客户信息, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/mobile_fetch") resp := new(EtaTrialUserResp) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = resp.Data return } // DisableEtaTrialUser eta_forum_hub服务-禁用试用客户 func DisableEtaTrialUser(pars EtaTrialUserReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("DisableEtaTrialUser eta_forum_hub服务-禁用试用客户, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/disable") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // RemoveEtaTrialUser eta_forum_hub服务-删除试用客户 func RemoveEtaTrialUser(pars EtaTrialUserReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("RemoveEtaTrialUser eta_forum_hub服务-删除试用客户失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/remove") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // EtaTrialUserEditReq 更新用户信息请求体 type EtaTrialUserEditReq struct { RealName string `description:"姓名"` Position string `description:"职务"` Mobile string `description:"手机号"` Enabled int `description:"禁启用"` } // EditEtaTrialUser eta_forum_hub服务-编辑试用客户 func EditEtaTrialUser(pars EtaTrialUserEditReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("EditEtaTrialUser eta_forum_hub服务-编辑试用客户失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/edit") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // UpdateUserIndexNum eta_forum_hub服务-更新用户累计新增指标数 func UpdateUserIndexNum(pars EtaTrialUserReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf(" UpdateUserIndexNum eta_forum_hub服务-更新用户累计新增指标数失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/update_index_num") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // UpdateUserChartNum eta_forum_hub服务-更新用户累计新增图表数 func UpdateUserChartNum(pars EtaTrialUserReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("UpdateUserChartNum eta_forum_hub服务-更新用户累计新增图表数失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/update_chart_num") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // UpdateEtaTrialUserActiveTimeReq 更新试用客户活跃时长请求体 type UpdateEtaTrialUserActiveTimeReq struct { Mobile string `description:"手机号"` UserName string `description:"用户姓名"` ActiveTime int `description:"活跃时长, 单位秒"` Part string `description:"活跃板块"` } // UpdateEtaTrialUserActiveTime eta_forum_hub服务-更新试用客户活跃时长 func UpdateEtaTrialUserActiveTime(pars UpdateEtaTrialUserActiveTimeReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("UpdateEtaTrialUserActiveTime eta_forum_hub服务-更新试用客户活跃时长失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/update_active_time") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return } // UpdateEtaTrialUserLoginDurationReq 更新试用客户登录时长请求体 type UpdateEtaTrialUserLoginDurationReq struct { Mobile string `description:"手机号"` UserName string `description:"用户姓名"` ActiveTime int `description:"活跃时长, 单位秒"` } // UpdateEtaTrialUserLoginDuration eta_forum_hub服务-更新试用客户登录时长 func UpdateEtaTrialUserLoginDuration(pars UpdateEtaTrialUserLoginDurationReq) (res bool, err error) { defer func() { if err != nil { alarm_msg.SendAlarmMsg(fmt.Sprintf("UpdateEtaTrialUserLoginDuration eta_forum_hub服务-更新试用客户登录时长失败, ErrMsg: %s", err.Error()), 3) } }() reqJson, e := json.Marshal(pars) if e != nil { err = fmt.Errorf("data json marshal err: %s", e.Error()) return } _, resultByte, err := post(string(reqJson), "/v1/eta_trial/user/update_login_duration") resp := new(models.BaseResponse) err = json.Unmarshal(resultByte, &resp) if err != nil { return } if resp.Ret != 200 { err = fmt.Errorf("result: %s, errmsg: %s", resp.Msg, resp.ErrMsg) return } res = true return }