|
@@ -1,21 +1,11 @@
|
|
package api
|
|
package api
|
|
|
|
|
|
import (
|
|
import (
|
|
- "../../pkg/app"
|
|
|
|
- "../../pkg/e"
|
|
|
|
- "../../pkg/logging"
|
|
|
|
- "../../pkg/setting"
|
|
|
|
- "../../routers/restful"
|
|
|
|
"bytes"
|
|
"bytes"
|
|
"database/sql"
|
|
"database/sql"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"errors"
|
|
"errors"
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/360EntSecGroup-Skylar/excelize"
|
|
|
|
- "github.com/Anderson-Lu/gofasion/gofasion"
|
|
|
|
- "github.com/gin-gonic/gin"
|
|
|
|
- "github.com/tealeg/xlsx"
|
|
|
|
- "github.com/xormplus/xorm"
|
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"net/http"
|
|
"os"
|
|
"os"
|
|
@@ -24,6 +14,17 @@ import (
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
|
|
+
|
|
|
|
+ "../../pkg/app"
|
|
|
|
+ "../../pkg/e"
|
|
|
|
+ "../../pkg/logging"
|
|
|
|
+ "../../pkg/setting"
|
|
|
|
+ "../../routers/restful"
|
|
|
|
+ "github.com/360EntSecGroup-Skylar/excelize"
|
|
|
|
+ "github.com/Anderson-Lu/gofasion/gofasion"
|
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
|
+ "github.com/tealeg/xlsx"
|
|
|
|
+ "github.com/xormplus/xorm"
|
|
)
|
|
)
|
|
|
|
|
|
// @Summary 根据SQL执行得到数据集
|
|
// @Summary 根据SQL执行得到数据集
|
|
@@ -1047,8 +1048,19 @@ func PostDataByName(c *gin.Context) {
|
|
if err != nil {
|
|
if err != nil {
|
|
logging.Error("PostDataByName err: ", err)
|
|
logging.Error("PostDataByName err: ", err)
|
|
//appG.Response(http.StatusOK, e.ERROR, err.Error())
|
|
//appG.Response(http.StatusOK, e.ERROR, err.Error())
|
|
- msg := geterrmsg(err.Error())
|
|
|
|
- appG.Response(http.StatusOK, e.ERROR, msg)
|
|
|
|
|
|
+
|
|
|
|
+ if (sqlnamestr == "copybarfeedremain" || sqlnamestr == "copyFtdry" || sqlnamestr == "copyPennsieve") &&
|
|
|
|
+ strings.Contains(err.Error(), "Duplicate entry") {
|
|
|
|
+
|
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "同一栏舍,同一班次不可重复录入")
|
|
|
|
+ } else if (sqlnamestr == "copybarmilk" || sqlnamestr == "copyBodyscore" || sqlnamestr == "copyDungsieve" || sqlnamestr == "copyDungscore") &&
|
|
|
|
+ strings.Contains(err.Error(), "Duplicate entry") {
|
|
|
|
+
|
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, "同一栏舍不可重复录入")
|
|
|
|
+ } else {
|
|
|
|
+ msg := geterrmsg(err.Error())
|
|
|
|
+ appG.Response(http.StatusOK, e.ERROR, msg)
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
appG.Response(http.StatusOK, e.SUCCESS, queryData)
|
|
appG.Response(http.StatusOK, e.SUCCESS, queryData)
|
|
}
|
|
}
|