This commit is contained in:
laodaming 2023-06-21 12:34:57 +08:00
parent 152e18b0e5
commit 41386fca3b
6 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@ import (
)
func (a *FsAddressModel) GetOne(ctx context.Context, id int64, userId int64) (resp *FsAddress, err error) {
err = a.db.WithContext(ctx).Model(&FsAddress{}).Where("`id` = ? and `user_id` = ? and `status` = ? ", id, userId, 1).Take(resp).Error
err = a.db.WithContext(ctx).Model(&FsAddress{}).Where("`id` = ? and `user_id` = ? and `status` = ? ", id, userId, 1).Take(&resp).Error
return resp, err
}

View File

@ -20,6 +20,6 @@ func (c *FsCanteenTypeModel) FindAllGetType(ctx context.Context) (resp []*FsGetT
return resp, nil
}
func (c *FsCanteenTypeModel) FindOne(ctx context.Context, id int64) (resp *FsCanteenType, err error) {
err = c.db.WithContext(ctx).Model(&FsCanteenType{}).Where("`id` = ?", id).First(resp).Error
err = c.db.WithContext(ctx).Model(&FsCanteenType{}).Where("`id` = ?", id).First(&resp).Error
return resp, err
}

View File

@ -17,7 +17,7 @@ type FindOneCartByParamsReq struct {
}
func (c *FsCartModel) FindOne(ctx context.Context, id int64) (resp *FsCart, err error) {
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ?", id).First(resp).Error
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ?", id).First(&resp).Error
return resp, err
}
func (c *FsCartModel) FindOneCartByParams(ctx context.Context, req FindOneCartByParamsReq) (resp *FsCart, err error) {

View File

@ -4,7 +4,7 @@ import "context"
// TODO: 使用model的属性做你想做的
func (g *FsGerentModel) Find(ctx context.Context, authKey string) (resp FsGerent, err error) {
func (g *FsGerentModel) Find(ctx context.Context, authKey string) (resp *FsGerent, err error) {
err = g.db.WithContext(ctx).Model(&FsGerent{}).Where("`auth_key` = ?", authKey).Take(&resp).Error
return resp, err
}

View File

@ -5,12 +5,12 @@ import (
)
func (o *FsOrderModel) FindOneBySn(ctx context.Context, userId int64, sn string) (resp *FsOrder, err error) {
err = o.db.WithContext(ctx).Model(&FsOrder{}).Where(" `user_id` = ? and `sn` = ? ", userId, sn).Take(resp).Error
err = o.db.WithContext(ctx).Model(&FsOrder{}).Where(" `user_id` = ? and `sn` = ? ", userId, sn).Take(&resp).Error
return resp, err
}
func (o *FsOrderModel) FindOne(ctx context.Context, userId int64, OrderId int64) (order *FsOrder, err error) {
err = o.db.WithContext(ctx).Model(&order).Where("`user_id` = ? and `id` = ?", userId, OrderId).Take(order).Error
err = o.db.WithContext(ctx).Model(&order).Where("`user_id` = ? and `id` = ?", userId, OrderId).Take(&order).Error
if err != nil {
return nil, err
}

View File

@ -1,6 +1,6 @@
Name: product-templatev2
Host: 0.0.0.0
Port: 8895
Port: 8896
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
Auth:
AccessSecret: fusen2023