2021-04-27 15:33:49 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
2021-05-16 15:21:52 +08:00
|
|
|
"github.com/beego/beego/v2/core/logs"
|
2021-04-27 15:33:49 +08:00
|
|
|
"legend/models/fast"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MerchantService struct {
|
|
|
|
BaseService
|
|
|
|
}
|
|
|
|
|
2021-05-16 15:21:52 +08:00
|
|
|
func (c *MerchantService) GetMerchantBankInfo(mobile string) (*fast.MerchantInfo, *fast.BankCardInfo) {
|
2021-04-27 15:33:49 +08:00
|
|
|
|
2021-05-16 15:21:52 +08:00
|
|
|
merchantInfo := fast.GetMerchantInfoByUserName(mobile)
|
|
|
|
bankInfo := fast.GetBankCardInfoByUserNo(merchantInfo.MerchantUid)
|
2021-04-27 15:33:49 +08:00
|
|
|
|
2021-05-16 15:21:52 +08:00
|
|
|
return merchantInfo, bankInfo
|
2021-04-27 15:33:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
** 获取商户的密钥等信息
|
|
|
|
*/
|
2021-05-16 15:21:52 +08:00
|
|
|
/*func (c *MerchantService) UserPayConfig(userName string) map[string]string {
|
2021-04-27 15:33:49 +08:00
|
|
|
|
|
|
|
merchantMapData := make(map[string]string)
|
|
|
|
|
2021-04-30 15:55:02 +08:00
|
|
|
userInfo := fast.GetMerchantInfoByUserName(userName)
|
2021-04-27 15:33:49 +08:00
|
|
|
|
2021-04-30 15:55:02 +08:00
|
|
|
if userInfo == nil || userInfo.LoginAccount == "" {
|
2021-04-27 15:33:49 +08:00
|
|
|
return merchantMapData
|
|
|
|
}
|
|
|
|
|
2021-04-30 15:55:02 +08:00
|
|
|
userNo := userInfo.LoginAccount
|
2021-04-27 15:33:49 +08:00
|
|
|
|
|
|
|
userPayConfig := fast.GetUserPayConfigByUserNo(userNo)
|
|
|
|
if nil == userPayConfig || userPayConfig.UserNo == "" {
|
|
|
|
return merchantMapData
|
|
|
|
}
|
|
|
|
|
|
|
|
return merchantMapData
|
2021-05-16 15:21:52 +08:00
|
|
|
}*/
|
2021-04-27 15:33:49 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
** 获取商户信息
|
|
|
|
*/
|
2021-04-30 15:55:02 +08:00
|
|
|
func (c *MerchantService) MerchantInfo(mobile string) *fast.MerchantInfo {
|
|
|
|
userInfo := fast.GetMerchantInfoByUserName(mobile)
|
|
|
|
if nil == userInfo || userInfo.LoginAccount == "" {
|
2021-04-27 15:33:49 +08:00
|
|
|
logs.Error("获取用户信息失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
//logs.Debug("用户信息:", userInfo)
|
|
|
|
return userInfo
|
|
|
|
}
|