浏览代码

空指针bug

xyxie 6 月之前
父节点
当前提交
cfa3a01163
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      models/data_manage/chart_info.go

+ 1 - 1
models/data_manage/chart_info.go

@@ -1950,7 +1950,7 @@ func GetChartInfoByUniqueCode(uniqueCode string) (item *ChartInfo, err error) {
 func GetChartInfoViewByUniqueCode(uniqueCode string) (item *ChartInfoView, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM chart_info WHERE unique_code=? `
-	err = o.Raw(sql, uniqueCode).Scan(&item).Error
+	err = o.Raw(sql, uniqueCode).First(&item).Error
 	if err != nil {
 		return
 	}