Browse Source

Merge branch 'cygx_12.0' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 year ago
parent
commit
e25a52d3d7

+ 5 - 5
models/cygx/cygx_yanxuan_special.go

@@ -57,7 +57,7 @@ type Doc struct {
 }
 }
 
 
 func GetYanxuanSpecialList(condition string, pars []interface{}) (items []*CygxYanxuanSpeciaResplItem, err error) {
 func GetYanxuanSpecialList(condition string, pars []interface{}) (items []*CygxYanxuanSpeciaResplItem, err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `SELECT a.*,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,b.nick_name,b.real_name,b.special_name
 	sql = `SELECT a.*,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,b.nick_name,b.real_name,b.special_name
 FROM cygx_yanxuan_special AS a
 FROM cygx_yanxuan_special AS a
@@ -78,7 +78,7 @@ type EnableCygxYanxuanSpecialReq struct {
 }
 }
 
 
 func EnableYanxuanSpecial(id, status int, reason string) (err error) {
 func EnableYanxuanSpecial(id, status int, reason string) (err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `UPDATE cygx_yanxuan_special SET status=?,reason=?,publish_time=NOW() WHERE id = ? `
 	sql = `UPDATE cygx_yanxuan_special SET status=?,reason=?,publish_time=NOW() WHERE id = ? `
 	_, err = o.Raw(sql, status, reason, id).Exec()
 	_, err = o.Raw(sql, status, reason, id).Exec()
@@ -117,7 +117,7 @@ type CygxYanxuanSpecialItem struct {
 }
 }
 
 
 func GetYanxuanSpecialFollowUserById(specialId int) (items []int, err error) {
 func GetYanxuanSpecialFollowUserById(specialId int) (items []int, err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `SELECT b.user_id
 	sql = `SELECT b.user_id
 FROM cygx_yanxuan_special AS a
 FROM cygx_yanxuan_special AS a
@@ -128,7 +128,7 @@ JOIN cygx_yanxuan_special_follow AS b ON a.user_id = b.follow_user_id
 }
 }
 
 
 func GetYanxuanSpecialItemById(specialId int) (item *CygxYanxuanSpecialItem, err error) {
 func GetYanxuanSpecialItemById(specialId int) (item *CygxYanxuanSpecialItem, err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `SELECT a.*,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,
 	sql = `SELECT a.*,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,
 b.nick_name,b.real_name,b.special_name
 b.nick_name,b.real_name,b.special_name
@@ -137,4 +137,4 @@ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
  WHERE a.id=? `
  WHERE a.id=? `
 	err = o.Raw(sql, specialId).QueryRow(&item)
 	err = o.Raw(sql, specialId).QueryRow(&item)
 	return
 	return
-}
+}

+ 5 - 7
models/cygx/cygx_yanxuan_special_user.go

@@ -41,7 +41,7 @@ type CygxYanxuanSpecialAuthorItem struct {
 }
 }
 
 
 func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64, err error) {
 func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64, err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	lastId, err = o.Insert(item)
 	lastId, err = o.Insert(item)
 	return
 	return
 }
 }
@@ -59,7 +59,7 @@ type EnableCygxYanxuanSpecialAuthorReq struct {
 
 
 // 启用禁用作者
 // 启用禁用作者
 func EnableYanxuanSpecialAuthor(userId, status int) (err error) {
 func EnableYanxuanSpecialAuthor(userId, status int) (err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `UPDATE cygx_yanxuan_special_author SET status=? WHERE user_id = ? `
 	sql = `UPDATE cygx_yanxuan_special_author SET status=? WHERE user_id = ? `
 	_, err = o.Raw(sql, status, userId).Exec()
 	_, err = o.Raw(sql, status, userId).Exec()
@@ -67,14 +67,12 @@ func EnableYanxuanSpecialAuthor(userId, status int) (err error) {
 }
 }
 
 
 func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err error) {
 func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err error) {
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	sql := ``
 	sql = `SELECT
 	sql = `SELECT
-	a.*,c.company_name  
+	a.*
 FROM
 FROM
-	cygx_yanxuan_special_author as a
-	INNER JOIN wx_user AS u ON u.user_id = a.user_id
-	INNER JOIN company AS c ON c.company_id = u.company_id ORDER BY create_time DESC `
+	cygx_yanxuan_special_author as a ORDER BY create_time DESC `
 	_, err = o.Raw(sql).QueryRows(&items)
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 	return
 }
 }

+ 2 - 2
models/cygx/tag_history.go

@@ -125,7 +125,7 @@ func GetCygxTagHistoryCountByCompanyIds(companyIds, condition string) (count int
 		sqlCount += condition
 		sqlCount += condition
 	}
 	}
 	sql := `SELECT COUNT(1) AS count  FROM (` + sqlCount + `)  AS t`
 	sql := `SELECT COUNT(1) AS count  FROM (` + sqlCount + `)  AS t`
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	err = o.Raw(sql).QueryRow(&count)
 	err = o.Raw(sql).QueryRow(&count)
 	return
 	return
 }
 }
@@ -145,7 +145,7 @@ LEFT JOIN cygx_user_interaction_num AS ui ON ui.user_id = a.user_id WHERE 1=1 `
 		sqlCount += condition
 		sqlCount += condition
 	}
 	}
 	sqlCount += ` ORDER BY tag_num DESC ,ui_tag_num DESC , create_time DESC LIMIT ?,? `
 	sqlCount += ` ORDER BY tag_num DESC ,ui_tag_num DESC , create_time DESC LIMIT ?,? `
-	o := orm.NewOrm()
+	o := orm.NewOrmUsingDB("hz_cygx")
 	_, err = o.Raw(sqlCount, startSize, pageSize).QueryRows(&list)
 	_, err = o.Raw(sqlCount, startSize, pageSize).QueryRows(&list)
 	return
 	return
 }
 }

+ 5 - 6
services/cygx/cygx_yanxuan_special.go

@@ -59,13 +59,12 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 		mobile = append(mobile, v.Mobile)
 		mobile = append(mobile, v.Mobile)
 	}
 	}
 
 
+	//condition := ""
+	//pars := make([]interface{}, 0)
+	//condition += ` AND u.mobile IN (` + utils.GetOrmInReplace(len(mobile)) + `)`
+	//pars = append(pars, mobile)
 
 
-	condition := ""
-	pars := make([]interface{}, 0)
-	condition += ` AND u.mobile IN (` + utils.GetOrmInReplace(len(mobile)) + `)`
-	pars = append(pars, mobile)
-
-	openIdList, e := cygx.GetWxOpenIdBList(condition, pars)
+	openIdList, e := cygx.GetUserRecordListByMobileArr(mobile)
 	if e != nil {
 	if e != nil {
 		err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 		err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 		return
 		return

+ 7 - 7
utils/constants.go

@@ -524,6 +524,13 @@ const (
 	ApproveUserId = 2 //施琪-出差审批人
 	ApproveUserId = 2 //施琪-出差审批人
 )
 )
 
 
+// 查研观向 研选专栏 作者头像和背景
+const (
+	CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL  = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/head_img/Mask%20group-"
+	CYGX_YANXUAN_SPECIAL_BG_IMG_URL    = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/bg_img/"
+	CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/bg_img/pc/"
+)
+
 // 验证码
 // 验证码
 const (
 const (
 	CaptchaCachePrefix     = "captcha:lock:crm_" // 验证码缓存Key
 	CaptchaCachePrefix     = "captcha:lock:crm_" // 验证码缓存Key
@@ -534,11 +541,4 @@ const (
 
 
 const CrmEtaAuthorization = "NIi1RbEmH0C2rksXtPGDPBBgRgTZY87Q"
 const CrmEtaAuthorization = "NIi1RbEmH0C2rksXtPGDPBBgRgTZY87Q"
 
 
-// 查研观向 研选专栏 作者头像和背景
-const (
-	CYGX_YANXUAN_SPECIAL_HEAD_IMG_URL  = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/head_img/Mask%20group-"
-	CYGX_YANXUAN_SPECIAL_BG_IMG_URL    = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/bg_img/"
-	CYGX_YANXUAN_SPECIAL_BG_IMG_URL_PC = "https://hzstatic.hzinsights.com/cygx/yanxuan_special/bg_img/pc/"
-)
-
 const LoginCacheTime = 60 // 登录缓存时长, 分钟
 const LoginCacheTime = 60 // 登录缓存时长, 分钟