deliver_user_service_test.go 873 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package service
  2. import (
  3. "encoding/json"
  4. "testing"
  5. "xiaoniaokuaiyan.com/xiaoniao/dal"
  6. "xiaoniaokuaiyan.com/xiaoniao/entity"
  7. )
  8. func Test_DetectInfoAdd(t *testing.T) {
  9. srv := &DeliverUserService{
  10. IOrder: dal.DefaultOrderDal,
  11. }
  12. jsonStr := `[{
  13. "order_no":"SZ17071214022697390",
  14. "detect_item_id":111,
  15. "final":"34",
  16. "unit":"kg",
  17. "refValue":"44-78",
  18. "final_status":35,
  19. "created_at":"2020-08-26 20:00:00"
  20. },
  21. {
  22. "order_no":"SZ17071214022697390",
  23. "detect_item_id":112,
  24. "final":"87",
  25. "unit":"cm",
  26. "refValue":"61-59",
  27. "final_status":35,
  28. "created_at":"2020-08-26 20:00:00"
  29. }]`
  30. dataList := []entity.DetectInfoParam{}
  31. err := json.Unmarshal([]byte(jsonStr), &dataList)
  32. if err == nil {
  33. srv.DetectInfoAdd(dataList)
  34. }
  35. }