xingzai 1 سال پیش
والد
کامیت
37aa0d496e
3فایلهای تغییر یافته به همراه46 افزوده شده و 0 حذف شده
  1. 11 0
      models/company_product.go
  2. 28 0
      services/company_permission.go
  3. 7 0
      services/yidong.go

+ 11 - 0
models/company_product.go

@@ -10,3 +10,14 @@ func GetCountCompanyProductCompanyId(companyId, productId int) (count int, err e
 	err = orm.NewOrm().Raw(sql, companyId, productId).QueryRow(&count)
 	return
 }
+
+// 获取列表
+func GetCompanyProductList(condition string, pars []interface{}) (items []*CompanyProduct, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM company_product WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 28 - 0
services/company_permission.go

@@ -2,6 +2,7 @@ package services
 
 import (
 	"errors"
+	"fmt"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
 	"strings"
@@ -222,3 +223,30 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 	}
 	return
 }
+
+// 根据公司ID获取权益销售名称
+func GetSellNameMapByCompanyIds(companyIds []int) (respMap map[int]string) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.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)
+	list, e := models.GetCompanyProductList(condition, pars)
+	if e != nil {
+		err = errors.New("GetCompanyProductList, Err: " + e.Error())
+		return
+	}
+	for _, v := range list {
+		respMap[v.CompanyId] = v.SellerName
+	}
+	return
+}

+ 7 - 0
services/yidong.go

@@ -854,6 +854,11 @@ func YiDongSignAppointmentsForThird(cont context.Context) (err error) {
 		if len(listSignUp) == 0 {
 			continue
 		}
+		var companyIds []int
+		for _, vS := range listSignUp {
+			companyIds = append(companyIds, vS.CompanyId)
+		}
+		sellNameMap := GetSellNameMapByCompanyIds(companyIds)
 		for _, vS := range listSignUp {
 			if vS.SignupType == 1 {
 				outCallStatus = "1"
@@ -869,6 +874,7 @@ func YiDongSignAppointmentsForThird(cont context.Context) (err error) {
 				PersonName:        vS.RealName,
 				JoinRole:          "2",
 				CompanyName:       vS.CompanyName,
+				Extend1:           sellNameMap[vS.CompanyId],
 				OutCallStatus:     outCallStatus,
 			}
 			postData, e := json.Marshal(params)
@@ -929,6 +935,7 @@ type SignAppointmentsForThirdParam struct {
 	CompanyName       string `description:"公司名" json:"companyName"`
 	JoinRole          string `description:"1:嘉宾, 2:普通参会人员, 3:会议助理。不传默认取值2" json:"joinRole"`
 	OutCallStatus     string `description:"1:需要,0:不需要。不传取默认值0" json:"outCallStatus"`
+	Extend1           string `description:"对口销售" json:"extend1"`
 }
 
 type YiDongSignAppointmentsForThirdResp struct {