|
@@ -2,6 +2,8 @@ package controller
|
|
|
|
|
|
import (
|
|
import (
|
|
. "app.yhyue.com/moapp/jybase/api"
|
|
. "app.yhyue.com/moapp/jybase/api"
|
|
|
|
+ "context"
|
|
|
|
+ "github.com/gogf/gf/v2/database/gdb"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
"github.com/pkg/errors"
|
|
"github.com/pkg/errors"
|
|
@@ -37,9 +39,13 @@ func SaleRecordUpdateHandler(r *ghttp.Request) {
|
|
return nil, errors.New("渠道为空")
|
|
return nil, errors.New("渠道为空")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- err = order.OrderSalerChange(r.Context(), saleRecord, orderCode, userName, reason)
|
|
|
|
- if err != nil {
|
|
|
|
- return nil, errors.Wrap(err, "修改业绩异常")
|
|
|
|
|
|
+ if err := g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) error {
|
|
|
|
+ if err = order.OrderSalerChange(ctx, saleRecord, orderCode, userName, reason); err != nil {
|
|
|
|
+ return errors.Wrap(err, "修改业绩异常")
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
|
|
+ }); err != nil {
|
|
|
|
+ return nil, err
|
|
}
|
|
}
|
|
return "success", nil
|
|
return "success", nil
|
|
}()
|
|
}()
|