|
@@ -6,10 +6,16 @@ import (
|
|
|
)
|
|
|
|
|
|
type CygxChartCollect struct {
|
|
|
- Id int `orm:"column(id);pk"`
|
|
|
- ChartId int
|
|
|
- UserId int
|
|
|
- CreateTime time.Time
|
|
|
+ Id int `orm:"column(id);pk"`
|
|
|
+ ChartId int `description:"图表ID"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ CompanyId int `description:"公司id"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ SellerName string `description:"所属销售"`
|
|
|
}
|
|
|
|
|
|
|
|
@@ -26,35 +32,51 @@ type ChartCollectResp struct {
|
|
|
|
|
|
func RemoveChartCollect(userId, ChartId int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `DELETE FROM cygx_Chart_collect WHERE user_id=? AND Chart_id=? `
|
|
|
+ sql := `DELETE FROM cygx_chart_collect WHERE user_id=? AND chart_id=? `
|
|
|
_, err = o.Raw(sql, userId, ChartId).Exec()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetChartCollectUsersCount(ChartId int) (count int, err error) {
|
|
|
- sql := `SELECT COUNT(user_id) AS count FROM cygx_Chart_collect WHERE Chart_id=? `
|
|
|
- err = orm.NewOrm().Raw(sql, ChartId).QueryRow(&count)
|
|
|
+func GetChartCountByUserId(userId, chartID int) (count int, err error) {
|
|
|
+ sql := `SELECT COUNT(1) AS count FROM cygx_chart_collect WHERE user_id=? AND chart_id=? `
|
|
|
+ err = orm.NewOrm().Raw(sql, userId, chartID).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func GetChartCollectCount(userId, ChartId int) (count int, err error) {
|
|
|
- sql := `SELECT COUNT(1) AS count FROM cygx_Chart_collect WHERE user_id=? AND Chart_id=? `
|
|
|
- err = orm.NewOrm().Raw(sql, userId, ChartId).QueryRow(&count)
|
|
|
+type CygxChartTop struct {
|
|
|
+ Id int `orm:"column(id);pk"`
|
|
|
+ ChartId int `description:"图表ID"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ CompanyId int `description:"公司id"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ SellerName string `description:"所属销售"`
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+func AddCygxChartTop(item *CygxChartTop) (lastId int64, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ lastId, err = o.Insert(item)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type ChartTopresp struct {
|
|
|
+ Status int `description:"1:收藏,2:取消收藏"`
|
|
|
+ CollectCount int `description:"收藏总数"`
|
|
|
+}
|
|
|
+
|
|
|
+func RemoveChartTop(userId, ChartId int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `DELETE FROM cygx_chart_top WHERE user_id=? AND chart_id=? `
|
|
|
+ _, err = o.Raw(sql, userId, ChartId).Exec()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-type ChartCollectList struct {
|
|
|
- Id int `orm:"column(id);pk"`
|
|
|
- ChartId int
|
|
|
- UserId int
|
|
|
- CreateTime time.Time
|
|
|
- Title string `description:"标题"`
|
|
|
- TitleEn string `description:"英文标题 "`
|
|
|
- UpdateFrequency string `description:"更新周期"`
|
|
|
- CreateDate string `description:"创建时间"`
|
|
|
- PublishDate string `description:"发布时间"`
|
|
|
- Body string `description:"内容"`
|
|
|
- Abstract string `description:"摘要"`
|
|
|
- CategoryName string `description:"一级分类"`
|
|
|
- SubCategoryName string `description:"二级分类"`
|
|
|
+func GetChartTopCountByUserId(userId, chartID int) (count int, err error) {
|
|
|
+ sql := `SELECT COUNT(1) AS count FROM cygx_chart_top WHERE user_id=? AND chart_id=? `
|
|
|
+ err = orm.NewOrm().Raw(sql, userId, chartID).QueryRow(&count)
|
|
|
+ return
|
|
|
}
|