跨域回滚,药品订单回滚增加药品名称

This commit is contained in:
wucongxing8150 2024-02-27 17:16:11 +08:00
parent c89b9169f6
commit a5114ab0aa
2 changed files with 17 additions and 1 deletions

View File

@ -15,7 +15,7 @@ func Cors() gin.HandlerFunc {
if origin != "" {
c.Header("Access-Control-Allow-Origin", origin)
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization,appId,sign")
c.Header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization")
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Cache-Control, Content-Language, Content-Type")
c.Header("Access-Control-Allow-Credentials", "false")
c.Set("content-type", "application/json")

View File

@ -263,6 +263,7 @@ type OrderProductData struct {
LogisticsFee float64 // 运费金额
LogisticsNo string // 物流编号
LogisticsCompanyCode string // 快递公司编码
ProductNames string // 药品列表
DeliveryTime time.Time // 发货时间
PayTime time.Time // 支付时间
Remarks string // 订单备注
@ -1479,6 +1480,7 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
{Value: "运费金额", CellType: "float64", NumberFmt: "0.0000", ColWidth: 18},
{Value: "物流编号", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "快递公司编码", CellType: "string", NumberFmt: "", ColWidth: 18},
{Value: "药品", CellType: "string", NumberFmt: "", ColWidth: 35},
{Value: "发货时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
{Value: "支付时间", CellType: "date", NumberFmt: "yyyy-mm-dd hh:mm:ss", ColWidth: 30},
{Value: "订单备注", CellType: "string", NumberFmt: "", ColWidth: 18},
@ -1575,6 +1577,20 @@ func (r *ExportService) OrderProduct(d []*model.OrderProduct) (string, error) {
data.CreatedAt = t
}
// 处理药品列表
orderProductItemDao := dao.OrderProductItemDao{}
orderProductItems, err := orderProductItemDao.GetOrderProductItemByOrderProductId(v.OrderProductId)
if err == nil || len(orderProductItems) > 0 {
var products []string
for _, v := range orderProductItems {
amount := fmt.Sprintf("%d", v.Amount)
product := v.ProductName + "(" + amount + ")"
products = append(products, product)
}
data.ProductNames = strings.Join(products, ";")
}
dataSlice = append(dataSlice, data)
}