feat: import services and standardize Go 1.26.5
This commit is contained in:
39
apps/ec/mall/internal/logic/store/get_setting.go
Normal file
39
apps/ec/mall/internal/logic/store/get_setting.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-ec/mall/internal/impl"
|
||||
"git.apinb.com/bsm-ec/mall/internal/models"
|
||||
pb "git.apinb.com/bsm-ec/mall/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
)
|
||||
|
||||
// 获取店铺基础配置
|
||||
func GetSetting(ctx context.Context, in *pb.IdentRequest) (reply *pb.StoreBasic, err error) {
|
||||
// valildate request id,identity.
|
||||
if in.Id == 0 && in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
var data models.MallStore
|
||||
if err := impl.DBService.Where("id=? or identity=?", in.GetId(), in.GetIdentity()).First(&data).Error; err != nil {
|
||||
print(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
// TODO: add your logic code & delete this line.
|
||||
|
||||
return &pb.StoreBasic{
|
||||
Id: int64(data.ID),
|
||||
Identity: data.Identity,
|
||||
Logo: data.Logo,
|
||||
Title: data.Title,
|
||||
Intro: data.Intro,
|
||||
Template: data.Template,
|
||||
Subdomain: data.Subdomain,
|
||||
Configs: data.Configs,
|
||||
CreatedAt: data.CreatedAt.Format(time.DateTime),
|
||||
Keywords: data.Keywords,
|
||||
Approve: int32(data.Approve),
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user