wangfei 6 년 전
부모
커밋
55438672d2
5개의 변경된 파일24개의 추가작업 그리고 11개의 파일을 삭제
  1. 1
    0
      log/common.log
  2. 14
    5
      models/goods/orders.go
  3. 8
    1
      models/goods/types.go
  4. 0
    4
      models/verify/verify.go
  5. 1
    1
      service/verify/verify.go

+ 1
- 0
log/common.log 파일 보기

268
 2018/09/06 19:58:18 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
268
 2018/09/06 19:58:18 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
269
 2018/09/06 19:59:58 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
269
 2018/09/06 19:59:58 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
270
 2018/09/06 20:00:48 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
270
 2018/09/06 20:00:48 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string
271
+2018/09/06 20:03:48 [E] 下单转换JSON失败: json: cannot unmarshal number into Go struct field TaGoodsOrders.Amount of type string

+ 14
- 5
models/goods/orders.go 파일 보기

162
 	}
162
 	}
163
 
163
 
164
 	for i, o := range orderList {
164
 	for i, o := range orderList {
165
-		var details []model.TaGoodsOrdersDetail
166
-		if err := m.db.Where("orders_id=?", o.OrdersId).Find(&details); err != nil {
165
+		details, err := m.GetOrderDetailByOrder(o.OrdersId)
166
+		if err != nil {
167
 			return nil, 0, err
167
 			return nil, 0, err
168
 		}
168
 		}
169
-
170
 		orderList[i].Goods = details
169
 		orderList[i].Goods = details
171
 	}
170
 	}
172
 
171
 
173
 	return orderList, cnt, nil
172
 	return orderList, cnt, nil
174
 }
173
 }
175
 
174
 
175
+// GetOrderDetailByOrder 获取商品明细
176
+func (m *GoodsDAO) GetOrderDetailByOrder(orderid string) ([]DetailWithType, error) {
177
+	var details []DetailWithType
178
+	sql := `select a.*,b.type_id,c.type_name from ta_goods_orders_detail a inner join ta_goods b on a.goods_id=b.goods_id inner join td_goods_type c on b.type_id=c.type_id where a.orders_id=?`
179
+	if err := m.db.Sql(sql, orderid).Find(&details); err != nil {
180
+		return nil, err
181
+	}
182
+	return details, nil
183
+}
184
+
176
 // GetOrdersByRecord 根据
185
 // GetOrdersByRecord 根据
177
 func (m *GoodsDAO) GetOrdersByRecord(recordid string) ([]OrdersWithGoods, error) {
186
 func (m *GoodsDAO) GetOrdersByRecord(recordid string) ([]OrdersWithGoods, error) {
178
 	var orderList []OrdersWithGoods
187
 	var orderList []OrdersWithGoods
183
 		return nil, err
192
 		return nil, err
184
 	}
193
 	}
185
 	for i, o := range orderList {
194
 	for i, o := range orderList {
186
-		var details []model.TaGoodsOrdersDetail
187
-		if err := m.db.Where("orders_id=?", o.OrdersId).Find(&details); err != nil {
195
+		details, err := m.GetOrderDetailByOrder(o.OrdersId)
196
+		if err != nil {
188
 			return nil, err
197
 			return nil, err
189
 		}
198
 		}
190
 		orderList[i].Goods = details
199
 		orderList[i].Goods = details

+ 8
- 1
models/goods/types.go 파일 보기

31
 	model.TaGoodsSpec `xorm:"extends"`
31
 	model.TaGoodsSpec `xorm:"extends"`
32
 }
32
 }
33
 
33
 
34
+// DetailWithType 含类型的明细
35
+type DetailWithType struct {
36
+	model.TaGoodsOrdersDetail `xorm:"extends"`
37
+	TypeId                    string
38
+	TypeName                  string
39
+}
40
+
34
 // OrdersWithGoods 订单列表
41
 // OrdersWithGoods 订单列表
35
 type OrdersWithGoods struct {
42
 type OrdersWithGoods struct {
36
 	model.TaGoodsOrders `xorm:"extends"`
43
 	model.TaGoodsOrders `xorm:"extends"`
37
-	Goods               []model.TaGoodsOrdersDetail
44
+	Goods               []DetailWithType
38
 }
45
 }

+ 0
- 4
models/verify/verify.go 파일 보기

28
 	CourseName                   string
28
 	CourseName                   string
29
 	DetailName                   string
29
 	DetailName                   string
30
 	LocationName                 string
30
 	LocationName                 string
31
-<<<<<<< HEAD
32
-	CostomerId                   string
33
-=======
34
 	CustomerId                   string
31
 	CustomerId                   string
35
->>>>>>> 802c15c146846cf0ddc7fc7e0273f2683cea90f4
36
 }
32
 }
37
 
33
 
38
 func (m *VerifyDAO) GetCustomerCourseDetailById(id string) (*model.TaCustomerCourseDetail, error) {
34
 func (m *VerifyDAO) GetCustomerCourseDetailById(id string) (*model.TaCustomerCourseDetail, error) {

+ 1
- 1
service/verify/verify.go 파일 보기

80
 		utils.LogError("获取列表失败: " + err.Error())
80
 		utils.LogError("获取列表失败: " + err.Error())
81
 		return nil, errors.New("获取列表失败")
81
 		return nil, errors.New("获取列表失败")
82
 	}
82
 	}
83
-	customerId := customerDetail[0].
83
+	customerId := customerDetail[0].CustomerId
84
 	total, err := s.dao.GetCustomerCourseListByTelCount(tel, caseid)
84
 	total, err := s.dao.GetCustomerCourseListByTelCount(tel, caseid)
85
 	if err != nil {
85
 	if err != nil {
86
 		utils.LogError("获取列表失败: " + err.Error())
86
 		utils.LogError("获取列表失败: " + err.Error())