|
@@ -24,14 +24,20 @@ type CygxIndustryFllowRep struct {
|
|
IndustrialManagementId int `description:"产业D"`
|
|
IndustrialManagementId int `description:"产业D"`
|
|
}
|
|
}
|
|
|
|
|
|
-//添加
|
|
|
|
|
|
+type IndustryFllowArryReq struct {
|
|
|
|
+ SourceId int `description:"资源ID"`
|
|
|
|
+ Source string `description:"资源类型 报告 :article 、活动 :activity"`
|
|
|
|
+ DoType string `description:"操作方式 关注 :add 、取消关注 :cancel"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 添加
|
|
func AddCygxIndustryFllow(item *CygxIndustryFllow) (lastId int64, err error) {
|
|
func AddCygxIndustryFllow(item *CygxIndustryFllow) (lastId int64, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
lastId, err = o.Insert(item)
|
|
lastId, err = o.Insert(item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//批量添加
|
|
|
|
|
|
+// 批量添加
|
|
func AddCygxIndustryFllowMulti(items []*CygxIndustryFllow) (err error) {
|
|
func AddCygxIndustryFllowMulti(items []*CygxIndustryFllow) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
if len(items) > 0 {
|
|
if len(items) > 0 {
|
|
@@ -53,21 +59,32 @@ func RemoveCygxIndustryFllow(userId, industrialManagementId int) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取数量
|
|
|
|
|
|
+// RemoveCygxIndustryFllowArry 多个产业同时取消关注
|
|
|
|
+func RemoveCygxIndustryFllowArry(userId int, condition string, pars []interface{}) (err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ if condition == "" {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ sql := `DELETE FROM cygx_industry_fllow WHERE user_id=? ` + condition
|
|
|
|
+ _, err = o.Raw(sql, userId, pars).Exec()
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 获取数量
|
|
func GetCountCygxIndustryFllow(userId, industrialManagementId int, condition string) (count int, err error) {
|
|
func GetCountCygxIndustryFllow(userId, industrialManagementId int, condition string) (count int, err error) {
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? AND industrial_management_id=? ` + condition
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? AND industrial_management_id=? ` + condition
|
|
err = orm.NewOrm().Raw(sql, userId, industrialManagementId).QueryRow(&count)
|
|
err = orm.NewOrm().Raw(sql, userId, industrialManagementId).QueryRow(&count)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取数量
|
|
|
|
|
|
+// 获取数量
|
|
func GetCountCygxIndustryFllowByUid(userId int) (count int, err error) {
|
|
func GetCountCygxIndustryFllowByUid(userId int) (count int, err error) {
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? `
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_industry_fllow WHERE user_id=? `
|
|
err = orm.NewOrm().Raw(sql, userId).QueryRow(&count)
|
|
err = orm.NewOrm().Raw(sql, userId).QueryRow(&count)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取列表信息根据手机号分组
|
|
|
|
|
|
+// 获取列表信息根据手机号分组
|
|
func GetCygxIndustryFllowList(condition string) (items []*CygxIndustryFllow, err error) {
|
|
func GetCygxIndustryFllowList(condition string) (items []*CygxIndustryFllow, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT * FROM cygx_industry_fllow WHERE 1 =1 ` + condition + ` GROUP BY user_id `
|
|
sql := `SELECT * FROM cygx_industry_fllow WHERE 1 =1 ` + condition + ` GROUP BY user_id `
|
|
@@ -75,7 +92,7 @@ func GetCygxIndustryFllowList(condition string) (items []*CygxIndustryFllow, err
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//修改用户关注的相关信息
|
|
|
|
|
|
+// 修改用户关注的相关信息
|
|
func UpdateCygxIndustryFllow(wxUser *WxUserItem) (err error) {
|
|
func UpdateCygxIndustryFllow(wxUser *WxUserItem) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
var sql string
|
|
var sql string
|
|
@@ -89,7 +106,7 @@ func UpdateCygxIndustryFllow(wxUser *WxUserItem) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取用户关注的产业列表
|
|
|
|
|
|
+// 获取用户关注的产业列表
|
|
func GetUserFllowIndustrialList(userId int) (items []*CygxIndustryFllow, err error) {
|
|
func GetUserFllowIndustrialList(userId int) (items []*CygxIndustryFllow, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT
|
|
sql := `SELECT
|
|
@@ -112,7 +129,7 @@ type CygxIndustryFllowCountRep struct {
|
|
Num int `description:"数量"`
|
|
Num int `description:"数量"`
|
|
}
|
|
}
|
|
|
|
|
|
-//获取产业被关注的数量
|
|
|
|
|
|
+// 获取产业被关注的数量
|
|
func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err error) {
|
|
func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT
|
|
sql := `SELECT
|
|
@@ -133,7 +150,7 @@ func GetUserFllowIndustrialCountList() (items []*CygxIndustryFllowCountRep, err
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//GetUserFllowIndustrialListByUserIdAndIndustrial 通过用户ID 跟产业ID获取用户关注的产业列表
|
|
|
|
|
|
+// GetUserFllowIndustrialListByUserIdAndIndustrial 通过用户ID 跟产业ID获取用户关注的产业列表
|
|
func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string) (items []*CygxIndustryFllow, err error) {
|
|
func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string) (items []*CygxIndustryFllow, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT * FROM cygx_industry_fllow
|
|
sql := `SELECT * FROM cygx_industry_fllow
|
|
@@ -144,7 +161,7 @@ func GetUserFllowIndustrialListByUserIdAndIndustrial(userIds, industrials string
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取某个用户关注某个行业下的产业数量
|
|
|
|
|
|
+// 获取某个用户关注某个行业下的产业数量
|
|
func GetCountCygxIndustryFllowByUidAndChartPermissionId(userId, ChartPermissionId int) (count int, err error) {
|
|
func GetCountCygxIndustryFllowByUidAndChartPermissionId(userId, ChartPermissionId int) (count int, err error) {
|
|
sql := `SELECT
|
|
sql := `SELECT
|
|
COUNT( 1 ) AS count
|
|
COUNT( 1 ) AS count
|