|
发表于 2021-5-4 20:24:40
|
显示全部楼层
本帖最后由 northlan 于 2021-5-4 20:27 编辑
同时监控所有 first_gid=5 的产品,显示上由于不能换行,就管它呢,反正有弹窗提醒。
另外这个url不知道跟购买页面有没啥区别,我看上面产品的价格不对应。
弹窗逻辑是 总量不等于上次请求的总量。
- var url = presetPageUrl;
- var highlight = lastReturn.highlight;
- var popup = lastReturn.popup;
- var content = lastReturn.content;
- var extra = lastReturn.extra | 0;
- popup = false;
- highlight = true;
- content = '';
- if (queryResult.status != 200) {
- popup = true;
- content += '查询失败!';
- } else {
- const products = []
- let sum = 0
- queryResult.products.forEach(it => {
- const {
- name,
- qty
- } = it
- products.push(`${name}:【${qty}】`)
- sum += qty
- });
- content = products.join('| ')
-
- if (extra != sum) {
- popup = true;
- }
- extra = sum;
- }
- return {
- 'highlight': highlight,
- 'popup': popup,
- 'url': url,
- 'content': content,
- 'extra': extra
- };
复制代码
展示效果这样
洛杉矶LAX1: 【0】| 洛杉矶LAX2:【0】
如果要取消这个中文,改这个就行
- products.push(`${name.replace('洛杉矶','')}:【${qty}】`)
复制代码 |
|