|
@@ -1,5 +1,11 @@
|
|
|
package api
|
|
|
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
+)
|
|
|
+
|
|
|
// import (
|
|
|
// "box-cost/db/model"
|
|
|
// "box-cost/db/repo"
|
|
@@ -19,22 +25,51 @@ package api
|
|
|
// "go.mongodb.org/mongo-driver/mongo"
|
|
|
// )
|
|
|
|
|
|
-// func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
+func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
|
|
|
-// // https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675757991547cnt7X9_2.jpg zhang
|
|
|
-// // https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675758027305uLKtda_1.jpg zhu
|
|
|
-// loc, _ := time.LoadLocation("Local")
|
|
|
-// date := time.Now().Format("2006-01-02")
|
|
|
-// startDate := date + " 00:00:00"
|
|
|
-// startTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, loc)
|
|
|
-// endDate := date + " 23:59:59"
|
|
|
-// endTime, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, loc)
|
|
|
-// fmt.Println(startTime.Unix())
|
|
|
-// fmt.Println(endTime.Unix())
|
|
|
+ // https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675757991547cnt7X9_2.jpg zhang
|
|
|
+ // https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675758027305uLKtda_1.jpg zhu
|
|
|
+ // loc, _ := time.LoadLocation("Local")
|
|
|
+ // date := time.Now().Format("2006-01-02")
|
|
|
+ // startDate := date + " 00:00:00"
|
|
|
+ // startTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, loc)
|
|
|
+ // endDate := date + " 23:59:59"
|
|
|
+ // endTime, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, loc)
|
|
|
+ // fmt.Println(startTime.Unix())
|
|
|
+ // fmt.Println(endTime.Unix())
|
|
|
|
|
|
-// return "success", nil
|
|
|
+ // return "success", nil
|
|
|
+ arr := []string{"a", "b", "a", "c", "c", "b"}
|
|
|
+ newArr := removeDuplication_sort(arr)
|
|
|
+ for k, v := range newArr {
|
|
|
+ fmt.Println("k:%d,v:%s", k, v)
|
|
|
+ }
|
|
|
+ return nil, nil
|
|
|
|
|
|
-// }
|
|
|
+}
|
|
|
+
|
|
|
+func removeDuplication_sort(arr []string) []string {
|
|
|
+ length := len(arr)
|
|
|
+ if length == 0 {
|
|
|
+ return arr
|
|
|
+ }
|
|
|
+
|
|
|
+ j := 0
|
|
|
+ for i := 1; i < length; i++ {
|
|
|
+ if arr[i] != arr[j] {
|
|
|
+ j++
|
|
|
+ if j < i {
|
|
|
+ swap(arr, i, j)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return arr[:j+1]
|
|
|
+}
|
|
|
+
|
|
|
+func swap(arr []string, a, b int) {
|
|
|
+ arr[a], arr[b] = arr[b], arr[a]
|
|
|
+}
|
|
|
|
|
|
// // 生成百万数据
|
|
|
// func GenData(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
|