40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"bsm/full/module/ec/mall/internal/impl"
|
|
"bsm/full/module/ec/mall/internal/models"
|
|
pb "bsm/full/module/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
|
|
}
|