1;优化浏览器脚本 - 兼容闪购 连锁

2;绑定异常提示
3;文件上传问题处理
This commit is contained in:
wangshuai 2024-07-26 18:01:59 +08:00
parent de74bdbd79
commit b8a0d500d2
5 changed files with 43 additions and 28 deletions

View File

@ -76,6 +76,8 @@ document.addEventListener("mouseup", function(e) {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.responseText === 'true') { if (xhr.responseText === 'true') {
alert('当前授权完成,请直接关闭当前浏览器!') alert('当前授权完成,请直接关闭当前浏览器!')
}else{
alert(xhr.responseText)
} }
} }
} }
@ -93,6 +95,8 @@ document.addEventListener("mouseup", function(e) {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.responseText === 'true') { if (xhr.responseText === 'true') {
alert('当前授权完成,请直接关闭当前浏览器!') alert('当前授权完成,请直接关闭当前浏览器!')
}else{
alert(xhr.responseText)
} }
} }
} }
@ -111,33 +115,37 @@ document.addEventListener("mouseup", function(e) {
var resultOne = confirm('确定要绑定到营销生态系统吗?') var resultOne = confirm('确定要绑定到营销生态系统吗?')
if (resultOne) { if (resultOne) {
var xhr = new XMLHttpRequest() var xhr = new XMLHttpRequest()
xhr.open('POST', 'https://go.shivers.top/prod-api/msg/store_bing', true) xhr.open('POST', 'https://youshi.bj.cn/prod-api/mt/cookies', true)
var sendData = {'bingType': 1, 'cookie': cookies, 'abc': username} //xhr.open('POST', 'http://localhost/dev-api/mt/cookies', true)
xhr.setRequestHeader("Content-Type","application/json")
var sendData = {'bingType': 1, 'cookie': cookies, 'userName': username, 'account': null, 'password': null, 'wmPoiName': wmPoiName}
xhr.send(JSON.stringify(sendData)) xhr.send(JSON.stringify(sendData))
xhr.onreadystatechange = function () { xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) { if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.responseText === 'true') { if (xhr.responseText === 'true') {
alert('当前授权完成,如当前是总账号模式请尽快切换至子门店帐号绑定,目前总账号模式会触发子门店掉线,非总帐号模式请直接关闭当前浏览器!') alert('当前授权完成,如当前是总账号模式请尽快切换至子门店帐号绑定,目前总账号模式会触发子门店掉线,非总帐号模式请直接关闭当前浏览器!')
}else{
alert(xhr.responseText)
} }
} }
} }
} else { } else {
var resultsecond = confirm('确定要绑定到多合一系统吗?') // var resultsecond = confirm('确定要绑定到多合一系统吗?')
if (resultsecond) { // if (resultsecond) {
var xhr = new XMLHttpRequest() // var xhr = new XMLHttpRequest()
xhr.open('POST', 'https://www.shivers.top/prod-api/negative/store_bing', true) // xhr.open('POST', 'https://www.shivers.top/prod-api/negative/store_bing', true)
var sendData = {'bingType': 1, 'cookie': cookies, 'abc': username} // var sendData = {'bingType': 1, 'cookie': cookies, 'abc': username}
xhr.send(JSON.stringify(sendData)) // xhr.send(JSON.stringify(sendData))
xhr.onreadystatechange = function () { // xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) { // if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.responseText === 'true') { // if (xhr.responseText === 'true') {
alert('当前授权完成,如当前是总账号模式请点击确定后切换子门店即可,非总帐号模式请直接关闭当前浏览器!') // alert('当前授权完成,如当前是总账号模式请点击确定后切换子门店即可,非总帐号模式请直接关闭当前浏览器!')
} // }
} // }
} // }
} else { // } else {
systype = '3' // systype = '3'
} // }
} }
} }
} }

View File

@ -4,14 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
@ -26,6 +26,7 @@ import com.ruoyi.framework.config.ServerConfig;
* *
* @author ruoyi * @author ruoyi
*/ */
@Api(tags = "通用")
@RestController @RestController
@RequestMapping("/common") @RequestMapping("/common")
public class CommonController public class CommonController
@ -43,6 +44,7 @@ public class CommonController
* @param fileName 文件名称 * @param fileName 文件名称
* @param delete 是否删除 * @param delete 是否删除
*/ */
@ApiOperation("download")
@GetMapping("/download") @GetMapping("/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{ {
@ -72,8 +74,9 @@ public class CommonController
/** /**
* 通用上传请求单个 * 通用上传请求单个
*/ */
@PostMapping("/upload") @ApiOperation("upload")
public AjaxResult uploadFile(MultipartFile file) throws Exception @PostMapping(value = "/upload", produces = MediaType.APPLICATION_JSON_VALUE)
public AjaxResult uploadFile(@RequestParam("file")MultipartFile file) throws Exception
{ {
try try
{ {

View File

@ -7,7 +7,7 @@ ruoyi:
# 版权年份 # 版权年份
copyrightYear: 2024 copyrightYear: 2024
# 文件路径 示例( Windows配置 F:/home/youshi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置 F:/home/youshi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /home/ruoyi/uploadPath profile: F:/home/youshi/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 验证码类型 math 数字计算 char 字符验证 # 验证码类型 math 数字计算 char 字符验证

View File

@ -138,6 +138,7 @@ public class SecurityConfig
.antMatchers("/test/**").permitAll() .antMatchers("/test/**").permitAll()
.antMatchers("/eleme/message_receive").permitAll() .antMatchers("/eleme/message_receive").permitAll()
.antMatchers(HttpMethod.GET,"/mt/getReturnInfo").permitAll() .antMatchers(HttpMethod.GET,"/mt/getReturnInfo").permitAll()
.antMatchers("/common/**").permitAll()
// .antMatchers("/mt/**").permitAll() // .antMatchers("/mt/**").permitAll()
// .antMatchers("/ai/**").permitAll() // .antMatchers("/ai/**").permitAll()

View File

@ -103,6 +103,9 @@ public class MeituanServiceImpl implements IMeituanService {
BusAgentInfo busAgentInfo = new BusAgentInfo(); BusAgentInfo busAgentInfo = new BusAgentInfo();
busAgentInfo.setAgentAccount(cookie.getUserName()); busAgentInfo.setAgentAccount(cookie.getUserName());
List<BusAgentInfo> list1 = iBusAgentInfoService.selectBusAgentInfoList(busAgentInfo); List<BusAgentInfo> list1 = iBusAgentInfoService.selectBusAgentInfoList(busAgentInfo);
if(list1.size() == 0){
return "授权失败,代理账号不存在!";
}
Date date = new Date(); Date date = new Date();
if (list.size() == 0) { if (list.size() == 0) {
storeInfo.setBindId(list1.get(0).getId()); storeInfo.setBindId(list1.get(0).getId());
@ -144,7 +147,7 @@ public class MeituanServiceImpl implements IMeituanService {
if (!cookie.getUserName().equals(list.get(0).getBindUser())) { if (!cookie.getUserName().equals(list.get(0).getBindUser())) {
// 如果未删除 不可以继续绑定 // 如果未删除 不可以继续绑定
if(!"3".equals(list.get(0).getSelfDeliveryStatus())){ if(!"3".equals(list.get(0).getSelfDeliveryStatus())){
throw new ServiceException("授权失败,已绑定其他代理账号!"); return "授权失败,已绑定其他代理账号!";
} }
// 如果已删除 可以继续绑定 // 如果已删除 可以继续绑定
storeInfo = list.get(0); storeInfo = list.get(0);
@ -195,7 +198,7 @@ public class MeituanServiceImpl implements IMeituanService {
busStoreInfoService.updateBusStoreInfo(storeInfo); busStoreInfoService.updateBusStoreInfo(storeInfo);
} }
} else { } else {
throw new ServiceException("授权失败,请重试!"); return "授权失败,请联系管理员!";
} }
// 触发爬取店铺信息 // 触发爬取店铺信息
getCommentsOne(storeInfo); getCommentsOne(storeInfo);