作者 yangfu

版本更新优化

@@ -103,6 +103,8 @@ spec: @@ -103,6 +103,8 @@ spec:
103 value: "false" 103 value: "false"
104 - name: HTTP_PORT 104 - name: HTTP_PORT
105 value: "8082" 105 value: "8082"
  106 + - name: SUPLUS_ADMIN_BASE_HOST
  107 + value: "http://suplus-admin-base-dev.fjmaimaimai.com"
106 - name: ALLIED_CREATION_GATEWAY_HOST 108 - name: ALLIED_CREATION_GATEWAY_HOST
107 value: "https://allied-creation-gateway-dev.fjmaimaimai.com" 109 value: "https://allied-creation-gateway-dev.fjmaimaimai.com"
108 - name: ALLIED_CREATION_USER_HOST 110 - name: ALLIED_CREATION_USER_HOST
@@ -108,7 +108,7 @@ spec: @@ -108,7 +108,7 @@ spec:
108 - name: HTTP_PORT 108 - name: HTTP_PORT
109 value: "8082" 109 value: "8082"
110 - name: SUPLUS_ADMIN_BASE_HOST 110 - name: SUPLUS_ADMIN_BASE_HOST
111 - value: "http://suplus-admin-base-test.fjmaimaimai.com" 111 + value: "http://suplus-admin-base-dev.fjmaimaimai.com"
112 - name: ALLIED_CREATION_GATEWAY_HOST 112 - name: ALLIED_CREATION_GATEWAY_HOST
113 value: "https://allied-creation-gateway-test.fjmaimaimai.com" 113 value: "https://allied-creation-gateway-test.fjmaimaimai.com"
114 - name: ALLIED_CREATION_USER_HOST 114 - name: ALLIED_CREATION_USER_HOST
@@ -11,7 +11,7 @@ type GetLatestVersionQuery struct { @@ -11,7 +11,7 @@ type GetLatestVersionQuery struct {
11 //操作人 11 //操作人
12 //Operator domain.Operator `json:"-"` 12 //Operator domain.Operator `json:"-"`
13 DeviceType string `json:"-"` 13 DeviceType string `json:"-"`
14 - VersionNo int `json:"versionNo"` 14 + VersionNo int `json:"versionNo,string"`
15 Channel int `json:"channel"` 15 Channel int `json:"channel"`
16 Request *http.Request `json:"-"` 16 Request *http.Request `json:"-"`
17 } 17 }
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/version_server"
9 ) 10 )
10 11
11 const IOSPage = "http://fir.fjmaimaimai.com/pdvn" 12 const IOSPage = "http://fir.fjmaimaimai.com/pdvn"
@@ -28,95 +29,32 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti @@ -28,95 +29,32 @@ func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDicti
28 return nil, err 29 return nil, err
29 } 30 }
30 return result, nil 31 return result, nil
31 - //type dictItem struct {  
32 - // ItemCode string `json:"itemCode"`  
33 - // ItemValue string `json:"itemValue"`  
34 - //}  
35 - //dictionaries := make([]interface{}, 0)  
36 - //for i := range getDictionaryQuery.DictCode {  
37 - // switch getDictionaryQuery.DictCode[i] {  
38 - // case "MenuType":  
39 - // dictionaries = append(dictionaries, map[string]interface{}{  
40 - // "dictName": "菜单类型",  
41 - // "dictItems": []dictItem{  
42 - // {"目录", "catalog"},  
43 - // {"菜单", "menu"},  
44 - // {"按钮", "button"},  
45 - // },  
46 - // "dictCode": "MenuType",  
47 - // })  
48 - // case "XTZD-001":  
49 - // dictionaries = append(dictionaries, map[string]interface{}{  
50 - // "dictName": "规模",  
51 - // "dictItems": []dictItem{  
52 - // {"1", "0~100人"},  
53 - // {"2", "101~200人"},  
54 - // {"3", "201~500人"},  
55 - // {"4", "501~1000人"},  
56 - // {"5", "1000人以上"},  
57 - // },  
58 - // "dictCode": "XTZD-001",  
59 - // })  
60 - // case "XTZD-002":  
61 - // dictionaries = append(dictionaries, map[string]interface{}{  
62 - // "dictName": "产业类型",  
63 - // "dictItems": []dictItem{  
64 - // {"1", "食品行业"},  
65 - // {"2", "电子行业"},  
66 - // {"3", "纺织业"},  
67 - // },  
68 - // "dictCode": "XTZD-002",  
69 - // })  
70 - // }  
71 - //}  
72 - //return map[string]interface{}{"dictionarys": dictionaries}, nil  
73 } 32 }
74 33
75 //LatestVersionInfo 版本升级 34 //LatestVersionInfo 版本升级
76 func (srv *CommonService) LatestVersionInfo(q *query.GetLatestVersionQuery) (interface{}, error) { 35 func (srv *CommonService) LatestVersionInfo(q *query.GetLatestVersionQuery) (interface{}, error) {
77 - page := IOSPage  
78 - if q.DeviceType == "1" { // 安卓  
79 - page = ANDPage 36 + vs := version_server.NewHttpLibVersionServer()
  37 + data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{
  38 + VersionNo: q.VersionNo,
  39 + Channel: q.Channel,
  40 + })
  41 + if err != nil {
  42 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
80 } 43 }
81 - return map[string]interface{}{  
82 - "version": map[string]interface{}{  
83 - "downloadPage": page,  
84 - "downloadFile": "",  
85 - "updateType": 0,  
86 - },  
87 - }, nil  
88 - //vs:= version_server.NewHttpLibVersionServer()  
89 - //data,err:= vs.GetLatestVersion(q.Request,version_server.ReqLatestVersion{  
90 - // VersionNo: q.VersionNo,  
91 - // Channel: q.Channel,  
92 - //})  
93 - //if err != nil {  
94 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
95 - //}  
96 - //return data, nil 44 + return data, nil
97 } 45 }
98 46
99 //AppSharing 获取分享链接地址 47 //AppSharing 获取分享链接地址
100 func (srv *CommonService) AppSharing(q *query.GetLatestVersionQuery) (interface{}, error) { 48 func (srv *CommonService) AppSharing(q *query.GetLatestVersionQuery) (interface{}, error) {
101 - page := IOSPage  
102 - if q.DeviceType == "1" { // 安卓  
103 - page = ANDPage 49 + vs := version_server.NewHttpLibVersionServer()
  50 + data, err := vs.GetLatestVersion(q.Request, version_server.ReqLatestVersion{
  51 + VersionNo: q.VersionNo,
  52 + Channel: q.Channel,
  53 + })
  54 + if err != nil {
  55 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
104 } 56 }
105 - return map[string]interface{}{  
106 - "version": map[string]interface{}{  
107 - "downloadPage": page,  
108 - "downloadFile": "",  
109 - },  
110 - }, nil  
111 - //vs:= version_server.NewHttpLibVersionServer()  
112 - //data,err:= vs.GetLatestVersion(q.Request,version_server.ReqLatestVersion{  
113 - // VersionNo: q.VersionNo,  
114 - // Channel: q.Channel,  
115 - //})  
116 - //if err != nil {  
117 - // return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())  
118 - //}  
119 - //return data, nil 57 + return data, nil
120 } 58 }
121 59
122 // AdvancedSetting 高级查询 配置 60 // AdvancedSetting 高级查询 配置
@@ -26,7 +26,7 @@ var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creatio @@ -26,7 +26,7 @@ var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creatio
26 var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied-creation-cooperation-dev.fjmaimaimai.com" 26 var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied-creation-cooperation-dev.fjmaimaimai.com"
27 27
28 // 版本更新模块 28 // 版本更新模块
29 -var SUPLUS_ADMIN_BASE_HOST = "http://suplus-admin-base-test.fjmaimaimai.com" 29 +var SUPLUS_ADMIN_BASE_HOST = "http://suplus-admin-base-dev.fjmaimaimai.com"
30 30
31 //通用模块短信服务 31 //通用模块短信服务
32 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897" 32 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
@@ -48,7 +48,8 @@ func (gateway HttpLibVersionServer) GetLatestVersion(rc *http.Request, param Req @@ -48,7 +48,8 @@ func (gateway HttpLibVersionServer) GetLatestVersion(rc *http.Request, param Req
48 req.Header(k, vs[i]) 48 req.Header(k, vs[i])
49 } 49 }
50 } 50 }
51 - 51 + req.Header("X-MMM-AppProject", "AlliedCreation")
  52 + req.Header("X-MMM-AppName", "com.mmm.alliedcreation")
52 byteResult, err := req.Bytes() 53 byteResult, err := req.Bytes()
53 if err != nil { 54 if err != nil {
54 return nil, fmt.Errorf("获取版本失败:%w", err) 55 return nil, fmt.Errorf("获取版本失败:%w", err)