Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks-h5
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks-h5
Commits
9decf790
Commit
9decf790
authored
Nov 22, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build(apollo): 调整apollo配置
parent
dbee52d7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
49 deletions
+40
-49
activity.ts
app/controller/activity.ts
+13
-14
dev.config.ts
app/web/config/dev.config.ts
+3
-3
sa.service.ts
app/web/service/sa.service.ts
+1
-2
apollo.json
config/apollo.json
+9
-5
apollo.ssr.json
config/apollo.ssr.json
+5
-1
config.default.ts
config/config.default.ts
+7
-0
config.local.ts
config/config.local.ts
+0
-8
config.prod.ts
config/config.prod.ts
+1
-11
config.sit.ts
config/config.sit.ts
+1
-5
No files found.
app/controller/activity.ts
View file @
9decf790
...
...
@@ -3,23 +3,22 @@ export default class ActivityController extends Controller {
public
async
home
(
ctx
:
Context
)
{
// 开发环境不走redis缓存
const
apollo
=
ctx
.
app
.
config
.
apollo
||
{};
let
body
=
''
;
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
ctx
.
body
=
await
ctx
.
renderToHtml
(
'
activity.js
'
,
{
url
:
ctx
.
url
});
return
;
}
const
redisKey
=
`quantum-blocks:page:
${
ctx
.
params
.
id
}
`
;
let
body
=
await
ctx
.
service
.
redis
.
get
(
redisKey
);
if
(
body
)
{
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
}
if
(
!
body
)
{
let
apollo
=
{};
if
(
process
.
env
.
NODE_ENV
===
'
production
'
&&
process
.
env
.
EGG_SERVER_ENV
===
'
sit
'
)
{
apollo
=
ctx
.
app
.
config
.
apollo
||
{};
}
body
=
await
ctx
.
renderToHtml
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
else
{
const
redisKey
=
`quantum-blocks:page:
${
ctx
.
params
.
id
}
`
;
body
=
await
ctx
.
service
.
redis
.
get
(
redisKey
);
if
(
body
)
{
ctx
.
logger
.
info
(
'
请求redis成功 key: %j
'
,
redisKey
);
}
if
(
!
body
)
{
body
=
await
ctx
.
renderToHtml
(
'
activity.js
'
,
{
url
:
ctx
.
url
,
apollo
});
await
ctx
.
service
.
redis
.
set
(
redisKey
,
body
);
}
}
ctx
.
body
=
body
;
}
}
app/web/config/dev.config.ts
View file @
9decf790
...
...
@@ -2,10 +2,10 @@ import apolloSsr from '../../../config/apollo.ssr.json';
const
protocol
=
EASY_ENV_IS_BROWSER
?
window
.
location
.
protocol
:
'
https
'
;
const
hostMap
=
{
apiHost
:
`
${
protocol
}
//quantum-blocks-
vcc3
.liangkebang.net`
,
kdspHost
:
`
${
protocol
}
//talos-
vcc3
.liangkebang.net`
,
apiHost
:
`
${
protocol
}
//quantum-blocks-
tob
.liangkebang.net`
,
kdspHost
:
`
${
protocol
}
//talos-
tob
.liangkebang.net`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=default`
,
mallHost
:
`
${
protocol
}
://mall-
vcc3
.liangkebang.net`
,
mallHost
:
`
${
protocol
}
://mall-
tob
.liangkebang.net`
,
test
:
true
,
yxmTenantId
:
560761
,
appIdMap
:
{
...
...
app/web/service/sa.service.ts
View file @
9decf790
...
...
@@ -4,7 +4,6 @@ import Storage from '@/service/localStorage.service';
import
{
getParameterByName
,
isWxMp
,
isApp
}
from
'
@/service/utils.service
'
;
export
function
initSa
(
router
)
{
if
(
process
.
env
.
NODE_ENV
===
'
development
'
)
{
return
;
}
const
sa
=
require
(
'
sa-sdk-javascript
'
);
const
activityId
=
window
.
location
.
pathname
.
split
(
'
/
'
)?.[
2
]
||
''
;
const
vccChannel
=
getParameterByName
(
'
vccChannel
'
)
||
getParameterByName
(
'
registerFrom
'
);
...
...
@@ -19,7 +18,7 @@ export function initSa(router) {
},
// 判断外层是否有 App 的 SDK ,如果有的话,会往 App 的 SDK 发数据。如果没有,就正常发送数据。
use_app_track
:
true
,
show_log
:
config
.
test
,
show_log
:
process
.
env
.
NODE_ENV
!==
'
development
'
&&
config
.
test
,
app_js_bridge
:
true
,
batch_send
:
true
,
});
...
...
config/apollo.json
View file @
9decf790
...
...
@@ -8,20 +8,24 @@
"loginUrl"
:
""
,
"mallHost"
:
"https://mall-vcc3.liangkebang.net"
,
"h5ShopHost"
:
"https://tenet-vcc3.liangkebang.net/#"
,
"yxmTenantId"
:
560761
"yxmTenantId"
:
560761
,
"appIdMap"
:
{
"560761"
:
"wxe16bf9293671506c"
,
"560867"
:
"wxccb8435d68e8c7d6"
}
},
"mysql"
:
{
"low_code"
:
{
"host"
:
"172.17.5.
17
"
,
"port"
:
"3
1548
"
,
"host"
:
"172.17.5.
36
"
,
"port"
:
"3
0983
"
,
"username"
:
"qa"
,
"password"
:
"qatest"
,
"database"
:
"low_code"
}
},
"redis"
:
{
"port"
:
"
172.17.5.14
"
,
"host"
:
"
31226
"
,
"port"
:
"
31543
"
,
"host"
:
"
172.17.5.14
"
,
"password"
:
""
,
"db"
:
0
},
...
...
config/apollo.ssr.json
View file @
9decf790
...
...
@@ -9,5 +9,9 @@
"h5ShopHost"
:
"https://tenet-vcc3.liangkebang.net/#"
,
"qiniuUpHost"
:
"https://up-z0.qiniup.com"
,
"qiniuHost"
:
"https://appsync.lkbang.net"
,
"yxmTenantId"
:
560761
"yxmTenantId"
:
560761
,
"appIdMap"
:
{
"560761"
:
"wxe16bf9293671506c"
,
"560867"
:
"wxccb8435d68e8c7d6"
}
}
config/config.default.ts
View file @
9decf790
...
...
@@ -2,6 +2,7 @@ import { EggAppConfig } from 'egg';
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
wxVertify
from
'
./wxVertify
'
;
const
{
redis
,
api
,
qiniu
}
=
require
(
path
.
resolve
(
__dirname
,
'
./apollo.json
'
));
export
default
(
appInfo
:
EggAppConfig
)
=>
{
const
config
:
any
=
{};
...
...
@@ -48,5 +49,11 @@ export default (appInfo: EggAppConfig) => {
enable
:
false
}
};
config
.
redis
=
{
client
:
redis
};
config
.
apollo
=
{
...
api
,
...
qiniu
};
return
config
;
};
config/config.local.ts
View file @
9decf790
...
...
@@ -27,14 +27,6 @@ export default (appInfo: EggAppConfig) => {
browser
:
'
http://localhost:7001/
'
};
exports
.
redis
=
{
client
:
{
port
:
31226
,
// Redis port
host
:
'
172.17.5.14
'
,
// Redis host
password
:
''
,
db
:
0
}
};
return
exports
;
};
config/config.prod.ts
View file @
9decf790
...
...
@@ -3,7 +3,6 @@
*
* prod + default(override)
*/
import
{
Application
,
EggAppConfig
}
from
'
egg
'
;
export
default
(
appInfo
:
EggAppConfig
)
=>
{
...
...
@@ -13,14 +12,5 @@ export default (appInfo: EggAppConfig) => {
dir
:
'
/home/quant_group/logs
'
,
};
exports
.
redis
=
{
client
:
{
port
:
6379
,
// Redis port
host
:
'
front-redis.quantgroups.com
'
,
// Redis host
password
:
'
ln4^ESq80j4nrTMZ
'
,
db
:
0
}
};
return
{...
exports
,
apollo
:
{}};
return
exports
;
};
config/config.sit.ts
View file @
9decf790
import
{
Application
,
EggAppConfig
}
from
'
egg
'
;
const
path
=
require
(
'
path
'
);
const
{
redis
,
api
,
qiniu
}
=
require
(
path
.
resolve
(
__dirname
,
'
./apollo.json
'
));
export
default
(
appInfo
:
EggAppConfig
)
=>
{
const
exports
:
any
=
{};
exports
.
logger
=
{
dir
:
'
/home/quant_group/logs
'
,
};
exports
.
redis
=
{
client
:
redis
};
return
{...
exports
,
apollo
:
{
...
api
,
...
qiniu
}}
;
return
exports
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment