12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package services
- import (
- "errors"
- "fmt"
- "hongze/hz_crm_api/models/company"
- "hongze/hz_crm_api/models/system"
- "hongze/hz_crm_api/services/alarm_msg"
- )
- // 根据公司ID获取权益销售名称
- func GetSellNameMapByCompanyIds(companyIds []int) (respMap map[int]string) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println(err)
- go alarm_msg.SendAlarmMsg("根据公司ID获取权益销售名称,失败:"+err.Error()+fmt.Sprint(companyIds), 2)
- }
- }()
- lenarr := len(companyIds)
- if lenarr == 0 {
- return
- }
- var pars []interface{}
- var condition string
- respMap = make(map[int]string, 0)
- condition = " AND product_id = 2 "
- list, e := company.GetCompanyProductList(condition, pars)
- if e != nil {
- err = errors.New("GetCompanyProductList, Err: " + e.Error())
- return
- }
- for _, v := range list {
- respMap[v.CompanyId] = v.SellerName
- }
- return
- }
- // 更新客户是否签约状态
- func init12323() {
- list, err := company.GetTryOutCompanyOperationRecordList()
- if err != nil {
- fmt.Println(err)
- return
- }
- for _, v := range list {
- fmt.Println(v.CompanyId)
- err = company.UpdateCompanyProductIsSigningById(v.CompanyId, v.ProductId)
- }
- return
- }
- // func init() {
- // Need960init()
- // }
- func Need960init() (respMap map[int]string) {
- var err error
- defer func() {
- if err != nil {
- fmt.Println(err)
- }
- }()
- var pars []interface{}
- var condition string
- respMap = make(map[int]string, 0)
- condition = " AND share_seller_id > 0 GROUP BY share_seller_id "
- list, e := company.GetCompanyProductList(condition, pars)
- if e != nil {
- err = errors.New("GetCompanyProductList, Err: " + e.Error())
- return
- }
- for _, v := range list {
- fmt.Println(v.ShareSellerId)
- seller, err := system.GetSysAdminById(v.ShareSellerId)
- if err != nil {
- fmt.Println(err)
- return
- }
- err = company.UpdateSharGroupid(seller.GroupId, v.ShareSellerId)
- if err != nil {
- fmt.Println(err)
- return
- }
- }
- return
- }
|