作者 yangfu

修改:小程序原始id修改

... ... @@ -211,7 +211,16 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
if company, err = CompanyResponsitory.FindOne(map[string]interface{}{"id": header.CompanyId}); err != nil {
return
}
var miniProgram = make(map[string]interface{})
if len(company.Applets) > 0 {
if company.Applets[0].Valid() {
miniProgram["webpageUrl"] = "www.baidu.com"
miniProgram["userName"] = company.Applets[0].Id
miniProgram["path"] = fmt.Sprintf("%v?inviter_id=%v", company.Applets[0].URL, partnerInfo.Id)
miniProgram["hdImageUrl"] = "http://suplus-business-admin-test.fjmaimaimai.com/images/default/default_logo.png"
miniProgram["title"] = company.Applets[0].Name
}
}
u := userx.User{
Id: partnerInfo.Id,
PartnerName: partnerInfo.PartnerName,
... ... @@ -222,13 +231,8 @@ func UserInfoV2(header *protocol.RequestHeader, request *protocol.UserInfoReques
Phone: company.Phone,
SerialNo: partnerInfo.Id,
CooperateTime: partnerInfo.CooperateTime.Unix() * 1000,
MiniProgram: map[string]interface{}{
"webpageUrl": "www.baidu.com", //兼容低版本的网页链接
"userName": "gh_eae893edc61d", // //小程序的原始id
"path": fmt.Sprintf("%v?inviter_id=%v", "pages/index/index", partnerInfo.Id), //小程序的path
"hdImageUrl": "http://suplus-business-admin-test.fjmaimaimai.com/images/default/default_logo.png", //小程序的预览图链接
},
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
MiniProgram: miniProgram,
District: map[string]interface{}{"id": partnerInfo.RegionInfo.RegionId, "name": partnerInfo.RegionInfo.RegionName},
},
}
if len(partnerInfo.Salesman) > 0 {
... ...
package domain
type CompanyApplets struct {
Name string `json:"name"`
URL string `json:"url"`
Id string `json:"id"`
}
func (applets CompanyApplets) Valid() bool {
if len(applets.Name) == 0 {
return false
}
if len(applets.URL) == 0 {
return false
}
if len(applets.Id) == 0 {
return false
}
return true
}
... ...
... ... @@ -28,6 +28,8 @@ type Company struct {
DeleteAt time.Time `json:"deleteAt"`
// 是否开启合伙人模块,是否有效【1:有效】【2:无效】
Enable int8 `json:"enable"`
// 小程序
Applets []CompanyApplets `json:"applets"`
}
type CompanyRepository interface {
... ...
... ... @@ -28,8 +28,8 @@ func init() {
(*models.PartnerInfo)(nil),
(*models.PartnerSubAccount)(nil),
(*models.Company)(nil),
(*models.SysMessageConsume)(nil),
(*models.SysMessageProduce)(nil),
//(*models.SysMessageConsume)(nil),
//(*models.SysMessageProduce)(nil),
(*models.OrderBase)(nil),
(*models.OrderGood)(nil),
(*models.ImInfo)(nil),
... ...
package models
import "time"
import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
"time"
)
// 公司信息
type Company struct {
... ... @@ -29,4 +32,6 @@ type Company struct {
DeleteAt time.Time
// 是否开启合伙人模块,是否有效【1:有效】【2:无效】
Enable int8
// 小程序
Applets []domain.CompanyApplets
}
... ...