xingzai 5 mesi fa
parent
commit
6f894bf65f
2 ha cambiato i file con 16 aggiunte e 1 eliminazioni
  1. 7 0
      models/cygx_yanxuan_special.go
  2. 9 1
      services/html2Img.go

+ 7 - 0
models/cygx_yanxuan_special.go

@@ -323,3 +323,10 @@ func UpdateYanxuanSpecialMomentsImg(momentsImg string, id int) (err error) {
 	_, err = o.Raw(sql, momentsImg, id).Exec()
 	return
 }
+
+func GetYanxuanSpecialListByconditioninit() (items []*CygxYanxuanSpecialItem, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT a.* FROM cygx_yanxuan_special AS a WHERE 1=1 AND moments_img is NULL`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 9 - 1
services/html2Img.go

@@ -67,7 +67,15 @@ func Html2ImgHttpPost(url, postData string, params ...string) ([]byte, error) {
 }
 
 //func init() {
-//	MakeYanxuanSpecialMomentsImg(185)
+//	//MakeYanxuanSpecialMomentsImg(185)
+//	list, err := models.GetYanxuanSpecialListByconditioninit()
+//	if err != nil {
+//		fmt.Println(err)
+//	}
+//	for _, v := range list {
+//		fmt.Println(v.Id)
+//		MakeYanxuanSpecialMomentsImg(v.Id)
+//	}
 //}
 
 // 生成研选专栏分享到朋友圈的图片