浏览代码

体积小

XMLWAN 3 年前
父节点
当前提交
c38ffbc02f

+ 1 - 1
conf/app.conf 查看文件

@@ -1,6 +1,6 @@
1 1
 appname = 小程序
2 2
 httpport = 9539
3
-runmode = dev
3
+runmode = prod
4 4
 
5 5
 #
6 6
 copyrequestbody = true

+ 14 - 0
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go 查看文件

@@ -63,6 +63,8 @@ func XcxApiControllersRegisterRouters() {
63 63
 	beego.Router("/xcx/api/mobile/getarticlist", &XcxApiController{}, "Get:GetArticList")
64 64
 
65 65
 	beego.Router("/xcx/api/mobile/getarticlistdetail", &XcxApiController{}, "Get:GetArticListDetail")
66
+
67
+	beego.Router("/xcx/api/mobile/getstoryscore", &XcxApiController{}, "Get:GetStoryScoreList")
66 68
 }
67 69
 
68 70
 type XcxApiController struct {
@@ -910,3 +912,15 @@ func (this *XcxApiController) GetArticListDetail() {
910 912
 		"story": detail,
911 913
 	})
912 914
 }
915
+
916
+func (this *XcxApiController) GetStoryScoreList() {
917
+
918
+	//page, _ := this.GetInt64("page")
919
+	//limit, _ := this.GetInt64("limit")
920
+	//activity_id, _ := this.GetInt64("activity_id")
921
+	list, total, _ := service.GetStoryScoreList(6, 1, 10)
922
+	this.ServeSuccessJSON(map[string]interface{}{
923
+		"list":  list,
924
+		"total": total,
925
+	})
926
+}

+ 18 - 0
models/his_models.go 查看文件

@@ -1546,3 +1546,21 @@ type SybStory struct {
1546 1546
 func (SybStory) TableName() string {
1547 1547
 	return "syb_story"
1548 1548
 }
1549
+
1550
+type SybStoryScore struct {
1551
+	ID          int64    `gorm:"column:id" json:"id" form:"id"`
1552
+	StoryId     int64    `gorm:"column:story_id" json:"story_id" form:"story_id"`
1553
+	PingweiId   int64    `gorm:"column:pingwei_id" json:"pingwei_id" form:"pingwei_id"`
1554
+	Round       int64    `gorm:"column:round" json:"round" form:"round"`
1555
+	Score       int64    `gorm:"column:score" json:"score" form:"score"`
1556
+	Content     string   `gorm:"column:content" json:"content" form:"content"`
1557
+	Status      int64    `gorm:"column:status" json:"status" form:"status"`
1558
+	CreatedTime int64    `gorm:"column:created_time" json:"created_time" form:"created_time"`
1559
+	UpdatedTime int64    `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
1560
+	ActivityId  int64    `gorm:"column:activity_id" json:"activity_id" form:"activity_id"`
1561
+	SybStory    SybStory `gorm:"ForeignKey:ID;AssociationForeignKey:StoryId" json:"story"`
1562
+}
1563
+
1564
+func (SybStoryScore) TableName() string {
1565
+	return "syb_story_score"
1566
+}

+ 6 - 0
service/xcx_mobile_api_service.go 查看文件

@@ -626,3 +626,9 @@ func GetArticListDetail(id int64) (models.SybStory, error) {
626 626
 	err := UserReadDB().Where("id = ?", id).Find(&story).Error
627 627
 	return story, err
628 628
 }
629
+
630
+func GetStoryScoreList(activityID int64, page int64, limit int64) (score []*models.SybStoryScore, total int64, err error) {
631
+	offset := (page - 1) * limit
632
+	err = UserReadDB().Model(&score).Where("activity_id = ?", activityID).Count(&total).Offset(offset).Limit(limit).Preload("SybStory").Find(&score).Error
633
+	return score, total, err
634
+}