作者 yangfu

修改:小程序原始id修改

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