22 lines
575 B
Go
22 lines
575 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"server/internal/model"
|
|
"server/internal/service"
|
|
|
|
"server/api/store/v1"
|
|
)
|
|
|
|
func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) {
|
|
fromCtx := g.RequestFromCtx(ctx)
|
|
operatorId := fromCtx.Get("id").Int64()
|
|
operatorRole := fromCtx.Get("role").String()
|
|
out, err := service.Store().Update(ctx, &model.StoreUpdateIn{OperatorRole: operatorRole, OperatorId: operatorId})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &v1.UpdateRes{Success: out.Success}, nil
|
|
}
|