|
@@ -16,9 +16,10 @@ type CygxXzsChooseCategory struct {
|
|
CategoryId int `description:"权益文章对应分类,cygx_article"`
|
|
CategoryId int `description:"权益文章对应分类,cygx_article"`
|
|
CreateTime time.Time `description:"创建时间"`
|
|
CreateTime time.Time `description:"创建时间"`
|
|
ModifyTime time.Time `description:"更新时间"`
|
|
ModifyTime time.Time `description:"更新时间"`
|
|
|
|
+ IdCygx int `description:"cygx_report_mapping_cygx 表主键ID"`
|
|
}
|
|
}
|
|
|
|
|
|
-//根据手机号获取用户关注的产业
|
|
|
|
|
|
+// 根据手机号获取用户关注的产业
|
|
func GetCygxXzsChooseCategoryList(mobile string) (items []*CygxXzsChooseCategory, err error) {
|
|
func GetCygxXzsChooseCategoryList(mobile string) (items []*CygxXzsChooseCategory, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `SELECT * FROM cygx_xzs_choose_category WHERE mobile = ?`
|
|
sql := `SELECT * FROM cygx_xzs_choose_category WHERE mobile = ?`
|
|
@@ -26,14 +27,14 @@ func GetCygxXzsChooseCategoryList(mobile string) (items []*CygxXzsChooseCategory
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//添加
|
|
|
|
|
|
+// 添加
|
|
func AddCygxCategoryFllow(item *CygxXzsChooseCategory) (lastId int64, err error) {
|
|
func AddCygxCategoryFllow(item *CygxXzsChooseCategory) (lastId int64, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
lastId, err = o.Insert(item)
|
|
lastId, err = o.Insert(item)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//删除
|
|
|
|
|
|
+// 删除
|
|
func RemoveCygxCategoryFllow(mobile string, CategoryId int) (err error) {
|
|
func RemoveCygxCategoryFllow(mobile string, CategoryId int) (err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
sql := `DELETE FROM cygx_xzs_choose_category WHERE mobile=? AND category_id=? `
|
|
sql := `DELETE FROM cygx_xzs_choose_category WHERE mobile=? AND category_id=? `
|
|
@@ -41,7 +42,7 @@ func RemoveCygxCategoryFllow(mobile string, CategoryId int) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取产业数量
|
|
|
|
|
|
+// 获取产业数量
|
|
func GetCategoryCount(categoryId int) (count int, err error) {
|
|
func GetCategoryCount(categoryId int) (count int, err error) {
|
|
sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping WHERE category_id=? `
|
|
sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping WHERE category_id=? `
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
@@ -49,9 +50,34 @@ func GetCategoryCount(categoryId int) (count int, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//获取关注数量
|
|
|
|
|
|
+// 获取关注数量
|
|
func GetCountCategoryFllow(categoryId int, mobile, condition string) (count int, err error) {
|
|
func GetCountCategoryFllow(categoryId int, mobile, condition string) (count int, err error) {
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_xzs_choose_category WHERE mobile=? AND category_id=? ` + condition
|
|
sql := `SELECT COUNT(1) AS count FROM cygx_xzs_choose_category WHERE mobile=? AND category_id=? ` + condition
|
|
err = orm.NewOrm().Raw(sql, mobile, categoryId).QueryRow(&count)
|
|
err = orm.NewOrm().Raw(sql, mobile, categoryId).QueryRow(&count)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+type XzsChooseMapResp struct {
|
|
|
|
+ Id int `description:"id"`
|
|
|
|
+ CategoryId int `description:"权益文章对应分类,cygx_article"`
|
|
|
|
+ CharPpermissionName string `description:"权限名称"`
|
|
|
|
+ MatchTypeName string `description:"分类名称"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// 根据手机号获取用户关注的产业
|
|
|
|
+func GetCygxXzsChooseCategoryMapList() (items []*XzsChooseMapResp, err error) {
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ sql := `SELECT
|
|
|
|
+ r.id,
|
|
|
|
+ r.chart_permission_name,
|
|
|
|
+ r.match_type_name,
|
|
|
|
+ c.category_id
|
|
|
|
+ FROM
|
|
|
|
+ cygx_report_mapping_cygx AS r
|
|
|
|
+ INNER JOIN cygx_report_mapping_group AS p ON p.id_cygx = r.id
|
|
|
|
+ INNER JOIN cygx_report_mapping_celue AS c ON c.category_id = p.category_id_celue
|
|
|
|
+ WHERE
|
|
|
|
+ r.chart_permission_id IN (23,100000)`
|
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
|
+ return
|
|
|
|
+}
|