|
@@ -1,21 +1,11 @@
|
|
|
package api
|
|
|
|
|
|
import (
|
|
|
- "../../pkg/app"
|
|
|
- "../../pkg/e"
|
|
|
- "../../pkg/logging"
|
|
|
- "../../pkg/setting"
|
|
|
- "../../routers/restful"
|
|
|
"bytes"
|
|
|
"database/sql"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"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"
|
|
|
"net/http"
|
|
|
"os"
|
|
@@ -24,6 +14,17 @@ import (
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"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执行得到数据集
|
|
@@ -1047,8 +1048,19 @@ func PostDataByName(c *gin.Context) {
|
|
|
if err != nil {
|
|
|
logging.Error("PostDataByName err: ", err)
|
|
|
//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 {
|
|
|
appG.Response(http.StatusOK, e.SUCCESS, queryData)
|
|
|
}
|