This commit is contained in:
ziming 2025-03-26 14:47:49 +08:00
parent 87c22cad47
commit 05d9d6ff6b
2 changed files with 6 additions and 4 deletions

View File

@ -17,5 +17,4 @@ func NewDb(db *GormDb) *Db {
func (d *Db) DB(_ context.Context) *gorm.DB { func (d *Db) DB(_ context.Context) *gorm.DB {
return d.db.Client return d.db.Client
//return d.db.Client.WithContext(ctx)
} }

View File

@ -49,13 +49,16 @@ func (c *CmbService) OrderFail(ctx context.Context, err error) (*v1.CmbReply, er
func (c *CmbService) Order(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) { func (c *CmbService) Order(ctx context.Context, request *v1.CmbRequest) (*v1.CmbReply, error) {
orderNo, err := c.order(ctx, request) ctx2, cancel := context.WithCancel(ctx)
defer cancel()
orderNo, err := c.order(ctx2, request)
if err != nil { if err != nil {
return c.OrderFail(ctx, err) return c.OrderFail(ctx2, err)
} }
return c.OrderSuccess(ctx, orderNo) return c.OrderSuccess(ctx2, orderNo)
} }
func (c *CmbService) order(ctx context.Context, request *v1.CmbRequest) (string, error) { func (c *CmbService) order(ctx context.Context, request *v1.CmbRequest) (string, error) {