|
@@ -132,7 +132,7 @@ type CompanyProductUser struct {
|
|
|
Email string `description:"邮箱"`
|
|
|
}
|
|
|
|
|
|
-// 获取列表
|
|
|
+// 获取销售信息列表
|
|
|
func GetCompanyProductListByMobiles(mobiles []string) (items []*CompanyProductUser, err error) {
|
|
|
lenArr := len(mobiles)
|
|
|
if lenArr == 0 {
|
|
@@ -141,18 +141,43 @@ func GetCompanyProductListByMobiles(mobiles []string) (items []*CompanyProductUs
|
|
|
o := orm.NewOrmUsingDB("weekly_report")
|
|
|
sql := ` SELECT
|
|
|
u.mobile,
|
|
|
+ u.user_id,
|
|
|
+ u.email,
|
|
|
+ u.real_name,
|
|
|
+ u.company_id,
|
|
|
p.seller_name,
|
|
|
p.status,
|
|
|
c.company_name
|
|
|
FROM
|
|
|
- company_product AS p
|
|
|
- INNER JOIN company AS c ON c.company_id = p.company_id
|
|
|
- INNER JOIN wx_user AS u ON u.company_id = p.company_id
|
|
|
- WHERE u.mobile IN (` + utils.GetOrmInReplace(lenArr) + `) `
|
|
|
+ wx_user as u
|
|
|
+ INNER JOIN company AS c ON c.company_id = u.company_id
|
|
|
+ LEFT JOIN company_product AS p ON p.company_id = u.company_id
|
|
|
+ WHERE u.mobile IN (` + utils.GetOrmInReplace(lenArr) + `) AND p.product_id = 2 `
|
|
|
_, err = o.Raw(sql, mobiles).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// 获取销售信息
|
|
|
+func GetCompanyProductListByUserId(userId int) (item *CompanyProductUser, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("weekly_report")
|
|
|
+ sql := `SELECT
|
|
|
+ u.mobile,
|
|
|
+ u.user_id,
|
|
|
+ u.email,
|
|
|
+ u.real_name,
|
|
|
+ u.company_id,
|
|
|
+ p.seller_name,
|
|
|
+ p.status,
|
|
|
+ c.company_name
|
|
|
+ FROM
|
|
|
+ wx_user as u
|
|
|
+ INNER JOIN company AS c ON c.company_id = u.company_id
|
|
|
+ INNER JOIN company_product AS p ON p.company_id = u.company_id
|
|
|
+ WHERE u.user_id = ? AND p.product_id = 2 `
|
|
|
+ err = o.Raw(sql, userId).QueryRow(&item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// 获取权益客户下的正式、试用、永续客户。
|
|
|
func GetRaiCompanyProductCompanyids() (items []*CompanyProduct, err error) {
|
|
|
sql := ` SELECT company_id FROM company_product WHERE product_id = 2 AND status IN ('正式','试用','永续') AND company_id > 1 `
|