34 lines
857 B
Go
34 lines
857 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
|
|
"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"
|
|
"git.apinb.com/bsm-sdk/core/service"
|
|
)
|
|
|
|
// 获取支付方式配置
|
|
func GetPayment(ctx context.Context, in *pb.IdentRequest) (reply *pb.ConfigsReply, err error) {
|
|
// parse authorization meta.
|
|
_, err = service.ParseMetaCtx(ctx, nil)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if in.Id == 0 && in.Identity == "" {
|
|
return nil, errcode.ErrInvalidArgument
|
|
}
|
|
|
|
sotre := models.MallStore{}
|
|
if err := impl.DBService.Model(&models.MallStore{}).Select("pay_configs").Where("id=? or identity=?", in.GetId(), in.GetIdentity()).Find(&sotre).Error; err != nil {
|
|
print(err.Error())
|
|
return nil, errcode.ErrDB
|
|
}
|
|
|
|
return &pb.ConfigsReply{Configs: sotre.PayConfigs}, nil
|
|
|
|
}
|