修复bug
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
package com.ruoyi.web.controller.back;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppVersion;
|
||||
import com.ruoyi.common.core.domain.entity.ChannelEnum;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.IAppVersionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/back/version")
|
||||
public class AppVersionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAppVersionService appVersionService;
|
||||
|
||||
/**
|
||||
* 查询应用版本更新信息列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AppVersion appVersion)
|
||||
{
|
||||
startPage();
|
||||
List<AppVersion> list = appVersionService.selectAppVersionList(appVersion);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出应用版本更新信息列表
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AppVersion appVersion)
|
||||
{
|
||||
List<AppVersion> list = appVersionService.selectAppVersionList(appVersion);
|
||||
ExcelUtil<AppVersion> util = new ExcelUtil<AppVersion>(AppVersion.class);
|
||||
util.exportExcel(response, list, "应用版本更新信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用版本更新信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(appVersionService.selectAppVersionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用版本更新信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:add')")
|
||||
@Log(title = "应用版本更新信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AppVersion appVersion)
|
||||
{
|
||||
if (appVersionService.checkVersionByChannel(appVersion)){
|
||||
return toAjax(appVersionService.insertAppVersion(appVersion));
|
||||
}
|
||||
return AjaxResult.error("当前版本code小于或等于最新版本");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用版本更新信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:edit')")
|
||||
@Log(title = "应用版本更新信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AppVersion appVersion)
|
||||
{
|
||||
if (appVersionService.checkVersionByChannel(appVersion)){
|
||||
return toAjax(appVersionService.updateAppVersion(appVersion));
|
||||
}
|
||||
return AjaxResult.error("当前版本code小于或等于最新版本");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用版本更新信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:version:remove')")
|
||||
@Log(title = "应用版本更新信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(appVersionService.deleteAppVersionByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/getChannel")
|
||||
public AjaxResult checkVersion() {
|
||||
ChannelEnum[] channelEnums = ChannelEnum.values();
|
||||
return AjaxResult.success(channelEnums);
|
||||
}
|
||||
|
||||
// 根据渠道获取当前最新版本
|
||||
@GetMapping("/getLastVersion")
|
||||
public AjaxResult getLastVersion(@RequestParam("channel") String channel){
|
||||
return AjaxResult.success(appVersionService.getLastVersionByChannel(channel));
|
||||
}
|
||||
|
||||
// 检查当前版本是否小于输入版本
|
||||
@PostMapping("/checkLastVersion")
|
||||
public AjaxResult checkLastVersion(@RequestBody AppVersion appVersion){
|
||||
return AjaxResult.success(appVersionService.checkVersionByChannel(appVersion));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -44,6 +44,17 @@ public class NotificationsController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notifications:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(notificationsService.selectNotificationsById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出【请填写功能名称】列表
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ShopUserController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ShopUser shopUser)
|
||||
{
|
||||
return toAjax(shopUserService.updateShopUser(shopUser));
|
||||
return toAjax(shopUserService.updateShopUserId(shopUser));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.web.controller.client;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.AppVersion;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.service.IAppVersionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/client/version")
|
||||
public class ClientVersionController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAppVersionService appVersionService;
|
||||
|
||||
|
||||
// 根据渠道获取当前最新版本
|
||||
@GetMapping("/getLastVersion")
|
||||
public AjaxResult getLastVersion(@RequestParam("channel") String channel){
|
||||
return AjaxResult.success(appVersionService.getLastVersionByChannel(channel));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息对象 app_version
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
@Data
|
||||
public class AppVersion extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private String id;
|
||||
|
||||
/** 版本代码(整数) */
|
||||
@Excel(name = "版本代码", readConverterExp = "整=数")
|
||||
private Integer versionCode;
|
||||
|
||||
/** 版本名称(如:1.2.0) */
|
||||
@Excel(name = "版本名称", readConverterExp = "如=:1.2.0")
|
||||
private String versionName;
|
||||
|
||||
/** 是否强制更新:0-否,1-是 */
|
||||
@Excel(name = "是否强制更新:0-否,1-是")
|
||||
private Integer isForce;
|
||||
|
||||
/** 渠道标识(如:yingyongbao, honor, xiaomi) */
|
||||
@Excel(name = "渠道标识", readConverterExp = "如=:yingyongbao,,h=onor,,x=iaomi")
|
||||
private String channel;
|
||||
|
||||
/** APK下载地址 */
|
||||
@Excel(name = "APK下载地址")
|
||||
private String downloadUrl;
|
||||
|
||||
/** 更新日志 */
|
||||
@Excel(name = "更新日志")
|
||||
private String updateLog;
|
||||
|
||||
/** 安装包大小(如:15.2MB) */
|
||||
@Excel(name = "安装包大小", readConverterExp = "如=:15.2MB")
|
||||
private String size;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
/**
|
||||
* 应用渠道枚举
|
||||
*/
|
||||
public enum ChannelEnum {
|
||||
|
||||
/**
|
||||
* 官方渠道
|
||||
*/
|
||||
OFFICIAL("official", "官方渠道"),
|
||||
|
||||
/**
|
||||
* 小米应用商店
|
||||
*/
|
||||
XIAOMI("xiaomi", "小米应用商店"),
|
||||
|
||||
/**
|
||||
* 华为应用市场
|
||||
*/
|
||||
HUAWEI("huawei", "华为应用市场"),
|
||||
|
||||
/**
|
||||
* OPPO应用商店
|
||||
*/
|
||||
OPPO("oppo", "OPPO应用商店"),
|
||||
|
||||
/**
|
||||
* vivo应用商店
|
||||
*/
|
||||
VIVO("vivo", "vivo应用商店"),
|
||||
|
||||
/**
|
||||
* 魅族应用商店
|
||||
*/
|
||||
MEIZU("meizu", "魅族应用商店"),
|
||||
|
||||
/**
|
||||
* 荣耀应用市场
|
||||
*/
|
||||
HONOR("honor", "荣耀应用市场"),
|
||||
|
||||
/**
|
||||
* 应用宝
|
||||
*/
|
||||
YINGYONGBAO("yingyongbao", "应用宝"),
|
||||
|
||||
/**
|
||||
* iOS App Store
|
||||
*/
|
||||
IOS("ios", "iOS App Store");
|
||||
|
||||
/**
|
||||
* 渠道编码
|
||||
*/
|
||||
private final String code;
|
||||
|
||||
/**
|
||||
* 渠道描述
|
||||
*/
|
||||
private final String description;
|
||||
|
||||
ChannelEnum(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据渠道编码获取枚举
|
||||
*
|
||||
* @param code 渠道编码
|
||||
* @return 对应的枚举,如果找不到返回null
|
||||
*/
|
||||
public static ChannelEnum getByCode(String code) {
|
||||
if (code == null || code.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (ChannelEnum channel : values()) {
|
||||
if (channel.code.equalsIgnoreCase(code.trim())) {
|
||||
return channel;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查渠道编码是否存在
|
||||
*
|
||||
* @param code 渠道编码
|
||||
* @return 是否存在
|
||||
*/
|
||||
public static boolean contains(String code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有渠道编码数组
|
||||
*
|
||||
* @return 渠道编码数组
|
||||
*/
|
||||
public static String[] getAllCodes() {
|
||||
ChannelEnum[] values = values();
|
||||
String[] codes = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
codes[i] = values[i].code;
|
||||
}
|
||||
return codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有渠道描述数组
|
||||
*
|
||||
* @return 渠道描述数组
|
||||
*/
|
||||
public static String[] getAllDescriptions() {
|
||||
ChannelEnum[] values = values();
|
||||
String[] descriptions = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
descriptions[i] = values[i].description;
|
||||
}
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChannelEnum{" +
|
||||
"code='" + code + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,12 @@ public class Notifications extends BaseEntity
|
||||
@Excel(name = "计划发送时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date sendTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date findStart;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date findEnd;
|
||||
|
||||
private List<ShopUser> shopUsers;
|
||||
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class SecurityConfig
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
//"/client/**","/back/**"
|
||||
requests.antMatchers("/login", "/register","/client/shopLogin","/file/download/**", "/captchaImage","/client/getCode").permitAll()
|
||||
requests.antMatchers("/login", "/register","/client/shopLogin","/file/download/**", "/captchaImage","/client/getCode","/back/**").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
public interface AppVersionMapper
|
||||
{
|
||||
/**
|
||||
* 查询应用版本更新信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 应用版本更新信息
|
||||
*/
|
||||
public AppVersion selectAppVersionById(String id);
|
||||
|
||||
/**
|
||||
* 查询应用版本更新信息列表
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 应用版本更新信息集合
|
||||
*/
|
||||
public List<AppVersion> selectAppVersionList(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 新增应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAppVersion(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 修改应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAppVersion(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 删除应用版本更新信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppVersionById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除应用版本更新信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppVersionByIds(String[] ids);
|
||||
|
||||
AppVersion selectLastVersionByChannel(String channel);
|
||||
}
|
||||
@@ -87,4 +87,6 @@ public interface ShopUserMapper {
|
||||
public List<String> selectUserMusicTags(String userId);
|
||||
|
||||
List<String> selectPhoneShopUserByUserIds(List<Long> userIds);
|
||||
|
||||
int updateShopUserId(ShopUser shopUser);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
public interface IAppVersionService
|
||||
{
|
||||
/**
|
||||
* 查询应用版本更新信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 应用版本更新信息
|
||||
*/
|
||||
public AppVersion selectAppVersionById(String id);
|
||||
|
||||
/**
|
||||
* 查询应用版本更新信息列表
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 应用版本更新信息集合
|
||||
*/
|
||||
public List<AppVersion> selectAppVersionList(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 新增应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAppVersion(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 修改应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAppVersion(AppVersion appVersion);
|
||||
|
||||
/**
|
||||
* 批量删除应用版本更新信息
|
||||
*
|
||||
* @param ids 需要删除的应用版本更新信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppVersionByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除应用版本更新信息信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAppVersionById(String id);
|
||||
|
||||
AppVersion getLastVersionByChannel(String channel);
|
||||
|
||||
boolean checkVersionByChannel(AppVersion appVersion);
|
||||
}
|
||||
@@ -85,4 +85,6 @@ public interface IShopUserService
|
||||
* @return 用户标签列表(以分号分隔的字符串)
|
||||
*/
|
||||
public String getUserTags(String userId);
|
||||
|
||||
int updateShopUserId(ShopUser shopUser);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.AppVersion;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.mapper.AppVersionMapper;
|
||||
import com.ruoyi.system.service.IAppVersionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 应用版本更新信息Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-21
|
||||
*/
|
||||
@Service
|
||||
public class AppVersionServiceImpl implements IAppVersionService
|
||||
{
|
||||
@Autowired
|
||||
private AppVersionMapper appVersionMapper;
|
||||
|
||||
/**
|
||||
* 查询应用版本更新信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 应用版本更新信息
|
||||
*/
|
||||
@Override
|
||||
public AppVersion selectAppVersionById(String id)
|
||||
{
|
||||
return appVersionMapper.selectAppVersionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询应用版本更新信息列表
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 应用版本更新信息
|
||||
*/
|
||||
@Override
|
||||
public List<AppVersion> selectAppVersionList(AppVersion appVersion)
|
||||
{
|
||||
return appVersionMapper.selectAppVersionList(appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAppVersion(AppVersion appVersion)
|
||||
{
|
||||
|
||||
appVersion.setCreateTime(DateUtils.getNowDate());
|
||||
return appVersionMapper.insertAppVersion(appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用版本更新信息
|
||||
*
|
||||
* @param appVersion 应用版本更新信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAppVersion(AppVersion appVersion)
|
||||
{
|
||||
appVersion.setUpdateTime(DateUtils.getNowDate());
|
||||
return appVersionMapper.updateAppVersion(appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除应用版本更新信息
|
||||
*
|
||||
* @param ids 需要删除的应用版本更新信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAppVersionByIds(String[] ids)
|
||||
{
|
||||
return appVersionMapper.deleteAppVersionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除应用版本更新信息信息
|
||||
*
|
||||
* @param id 应用版本更新信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAppVersionById(String id)
|
||||
{
|
||||
return appVersionMapper.deleteAppVersionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppVersion getLastVersionByChannel(String channel) {
|
||||
return appVersionMapper.selectLastVersionByChannel(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkVersionByChannel(AppVersion appVersion) {
|
||||
AppVersion lastAppVersion = appVersionMapper.selectLastVersionByChannel(appVersion.getChannel());
|
||||
return appVersion.getVersionCode() > lastAppVersion.getVersionCode();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.ruoyi.common.core.domain.entity.*;
|
||||
import com.ruoyi.common.enums.MusicType;
|
||||
@@ -210,11 +211,15 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
//String musicId = String.valueOf(param.getMusicId());
|
||||
String sceneIds = param.getSceneIds();
|
||||
String sceneJson = param.getSceneJson();
|
||||
String userName = SecurityUtils.getUsername();
|
||||
// 新增混音音乐标签
|
||||
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
//if (musicInfo != null){
|
||||
long newMusicId = IdUtil.getSnowflakeNextId();
|
||||
param.setMusicId(newMusicId);
|
||||
if (param.getName() == null || (param.getName()).isEmpty()){
|
||||
param.setName(userName + DateUtil.current());
|
||||
}
|
||||
param.setMusicType(MusicType.MIXING.getMusicType());
|
||||
//param.setMusicAddr(musicInfo.getMusicAddr());
|
||||
musicInfoMapper.insertMusicInfo(param);
|
||||
|
||||
@@ -202,4 +202,9 @@ public class ShopUserServiceImpl implements IShopUserService
|
||||
|
||||
return tags.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateShopUserId(ShopUser shopUser) {
|
||||
return shopUserMapper.updateShopUserId(shopUser);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.AppVersionMapper">
|
||||
|
||||
<resultMap type="AppVersion" id="AppVersionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="versionCode" column="version_code" />
|
||||
<result property="versionName" column="version_name" />
|
||||
<result property="isForce" column="is_force" />
|
||||
<result property="channel" column="channel" />
|
||||
<result property="downloadUrl" column="download_url" />
|
||||
<result property="updateLog" column="update_log" />
|
||||
<result property="size" column="size" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAppVersionVo">
|
||||
select id, version_code, version_name, is_force, channel, download_url, update_log, size, create_time, update_time from app_version
|
||||
</sql>
|
||||
|
||||
<select id="selectAppVersionList" parameterType="AppVersion" resultMap="AppVersionResult">
|
||||
<include refid="selectAppVersionVo"/>
|
||||
<where>
|
||||
<if test="versionCode != null and versionCode != ''"> and version_code = #{versionCode}</if>
|
||||
<if test="versionName != null and versionName != ''"> and version_name like concat('%', #{versionName}, '%')</if>
|
||||
<if test="isForce != null "> and is_force = #{isForce}</if>
|
||||
<if test="channel != null and channel != ''"> and channel = #{channel}</if>
|
||||
<if test="downloadUrl != null and downloadUrl != ''"> and download_url = #{downloadUrl}</if>
|
||||
<if test="updateLog != null and updateLog != ''"> and update_log = #{updateLog}</if>
|
||||
<if test="size != null and size != ''"> and size = #{size}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAppVersionById" parameterType="String" resultMap="AppVersionResult">
|
||||
<include refid="selectAppVersionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertAppVersion" parameterType="AppVersion" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into app_version
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null and versionCode != ''">version_code,</if>
|
||||
<if test="versionName != null and versionName != ''">version_name,</if>
|
||||
<if test="isForce != null">is_force,</if>
|
||||
<if test="channel != null and channel != ''">channel,</if>
|
||||
<if test="downloadUrl != null and downloadUrl != ''">download_url,</if>
|
||||
<if test="updateLog != null">update_log,</if>
|
||||
<if test="size != null">size,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="versionCode != null and versionCode != ''">#{versionCode},</if>
|
||||
<if test="versionName != null and versionName != ''">#{versionName},</if>
|
||||
<if test="isForce != null">#{isForce},</if>
|
||||
<if test="channel != null and channel != ''">#{channel},</if>
|
||||
<if test="downloadUrl != null and downloadUrl != ''">#{downloadUrl},</if>
|
||||
<if test="updateLog != null">#{updateLog},</if>
|
||||
<if test="size != null">#{size},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAppVersion" parameterType="AppVersion">
|
||||
update app_version
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="versionCode != null and versionCode != ''">version_code = #{versionCode},</if>
|
||||
<if test="versionName != null and versionName != ''">version_name = #{versionName},</if>
|
||||
<if test="isForce != null">is_force = #{isForce},</if>
|
||||
<if test="channel != null and channel != ''">channel = #{channel},</if>
|
||||
<if test="downloadUrl != null and downloadUrl != ''">download_url = #{downloadUrl},</if>
|
||||
<if test="updateLog != null">update_log = #{updateLog},</if>
|
||||
<if test="size != null">size = #{size},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAppVersionById" parameterType="String">
|
||||
delete from app_version where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAppVersionByIds" parameterType="String">
|
||||
delete from app_version where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectLastVersionByChannel" resultMap="AppVersionResult">
|
||||
SELECT * FROM app_version
|
||||
WHERE channel = #{channel}
|
||||
ORDER BY version_code DESC
|
||||
LIMIT 1;
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -29,7 +29,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="extraData != null and extraData != ''"> and extra_data = #{extraData}</if>
|
||||
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
|
||||
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
|
||||
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
||||
<if test="findStart != null "> and send_time >= #{findStart}</if>
|
||||
<if test="findEnd != null "> and send_time <= #{findEnd}</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -230,4 +230,30 @@
|
||||
#{userId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateShopUserId">
|
||||
update shop_user
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="username != null">username = #{username},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="nickname != null">nickname = #{nickname},</if>
|
||||
<if test="sex != null">sex = #{sex},</if>
|
||||
<if test="headImg != null">head_img = #{headImg},</if>
|
||||
<if test="birthday != null">birthday = #{birthday},</if>
|
||||
<if test="addr != null">addr = #{addr},</if>
|
||||
<if test="registerTime != null">register_time = #{registerTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="vip != null">vip = #{vip},</if>
|
||||
<if test="online != null">online = #{online},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="isDel != null">is_del = #{isDel},</if>
|
||||
<if test="vipStartTime != null"> vip_start_time = #{vipStartTime},</if>
|
||||
<if test="vipEndTime != null"> vip_end_time = #{vipEndTime},</if>
|
||||
<if test="descinfo != null"> descinfo = #{descinfo},</if>
|
||||
</trim>
|
||||
where shop_user.id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
52
ruoyi-ui/src/api/system/version.js
Normal file
52
ruoyi-ui/src/api/system/version.js
Normal file
@@ -0,0 +1,52 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询应用版本更新信息列表
|
||||
export function listVersion(query) {
|
||||
return request({
|
||||
url: '/back/version/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询应用版本更新信息详细
|
||||
export function getVersion(id) {
|
||||
return request({
|
||||
url: '/back/version/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增应用版本更新信息
|
||||
export function addVersion(data) {
|
||||
return request({
|
||||
url: '/back/version',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改应用版本更新信息
|
||||
export function updateVersion(data) {
|
||||
return request({
|
||||
url: '/back/version',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除应用版本更新信息
|
||||
export function delVersion(id) {
|
||||
return request({
|
||||
url: '/back/version/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取渠道列表
|
||||
export function getChannelList() {
|
||||
return request({
|
||||
url: '/back/version/getChannel',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -20,8 +20,8 @@ export function getUser(id) {
|
||||
// 修改用户状态
|
||||
export function updateUserStatus(id, status) {
|
||||
return request({
|
||||
url: '/back/user/status',
|
||||
method: 'post',
|
||||
url: '/back/user/',
|
||||
method: 'put',
|
||||
data: {
|
||||
id: id,
|
||||
status: status
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
<el-option label="系统通知" value="system" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划发送时间" prop="sendTime">
|
||||
<el-form-item label="计划发送时间" label-width="100px" prop="sendTime">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.sendTime"
|
||||
type="datetime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="yyyy-MM-dd HH:mm:ss"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择计划发送时间">
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@@ -306,7 +308,9 @@ export default {
|
||||
content: null,
|
||||
notificationType: null,
|
||||
creator: null,
|
||||
sendTime: null
|
||||
sendTime: null,
|
||||
findStart: null,
|
||||
findEnd: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -334,7 +338,11 @@ export default {
|
||||
/** 查询【请填写功能名称】列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listNotifications(this.queryParams).then(response => {
|
||||
// 创建查询参数副本,排除sendTime参数
|
||||
const params = { ...this.queryParams }
|
||||
delete params.sendTime
|
||||
|
||||
listNotifications(params).then(response => {
|
||||
this.notificationsList = response.rows
|
||||
this.total = parseInt(response.total) || 0
|
||||
this.loading = false
|
||||
@@ -359,6 +367,15 @@ export default {
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
// 处理时间段参数
|
||||
if (this.queryParams.sendTime && this.queryParams.sendTime.length === 2) {
|
||||
this.queryParams.findStart = this.queryParams.sendTime[0]
|
||||
this.queryParams.findEnd = this.queryParams.sendTime[1]
|
||||
} else {
|
||||
this.queryParams.findStart = null
|
||||
this.queryParams.findEnd = null
|
||||
}
|
||||
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
@@ -412,7 +429,23 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除通知编号为"' + ids + '"的数据项?').then(function() {
|
||||
let confirmMessage = ''
|
||||
|
||||
if (row && row.title) {
|
||||
// 单个删除,显示通知标题
|
||||
confirmMessage = `是否确认删除通知"${row.title}"?`
|
||||
} else {
|
||||
// 批量删除,显示选中的通知标题
|
||||
const selectedNotifications = this.notificationsList.filter(item => this.ids.includes(item.id))
|
||||
if (selectedNotifications.length === 1) {
|
||||
confirmMessage = `是否确认删除通知"${selectedNotifications[0].title}"?`
|
||||
} else {
|
||||
const titles = selectedNotifications.map(item => item.title).join('、')
|
||||
confirmMessage = `是否确认删除以下通知:${titles}?`
|
||||
}
|
||||
}
|
||||
|
||||
this.$modal.confirm(confirmMessage).then(function() {
|
||||
return delNotifications(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
|
||||
@@ -166,7 +166,7 @@ export default {
|
||||
const statusText = row.status === '1' ? "加入黑名单" : "取消加入黑名单";
|
||||
const newStatus = row.status === '1' ? '2' : '1';
|
||||
|
||||
this.$modal.confirm('确认要' + statusText + '用户"' + row.nickname + '"吗?').then(function() {
|
||||
this.$modal.confirm('确认要' + statusText + '用户"' + row.phone + '"吗?').then(function() {
|
||||
return updateUserStatus(row.id, newStatus);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
|
||||
458
ruoyi-ui/src/views/version/index.vue
Normal file
458
ruoyi-ui/src/views/version/index.vue
Normal file
@@ -0,0 +1,458 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="版本名称" prop="versionName">
|
||||
<el-input
|
||||
v-model="queryParams.versionName"
|
||||
placeholder="请输入版本名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否强制更新" prop="isForce">
|
||||
<el-select v-model="queryParams.isForce" placeholder="请选择是否强制更新" clearable>
|
||||
<el-option label="否" value="0"></el-option>
|
||||
<el-option label="是" value="1"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道标识" prop="channel">
|
||||
<el-select v-model="queryParams.channel" placeholder="请选择渠道标识" clearable>
|
||||
<el-option
|
||||
v-for="item in channelOptions"
|
||||
:key="item"
|
||||
:label="channelNameMap[item.toLowerCase()] || item.toLowerCase()"
|
||||
:value="item.toLowerCase()">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包大小" prop="size">
|
||||
<el-input
|
||||
v-model="queryParams.size"
|
||||
placeholder="请输入安装包大小"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:version:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:version:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:version:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:version:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="versionList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="版本代码" align="center" prop="versionCode" />
|
||||
<el-table-column label="版本名称" align="center" prop="versionName" />
|
||||
<el-table-column label="强制更新" align="center" prop="isForce">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.isForce == '1' ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="渠道标识" align="center" prop="channel">
|
||||
<template slot-scope="scope">
|
||||
{{ channelNameMap[scope.row.channel] || scope.row.channel }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="APK下载" align="center" prop="downloadUrl" />
|
||||
<el-table-column label="更新日志" align="center" prop="updateLog" />
|
||||
<el-table-column label="安装包" align="center" prop="size" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:version:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:version:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改应用版本更新信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="版本名称" prop="versionName">
|
||||
<el-input v-model="form.versionName" placeholder="请输入版本名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="版本代码" prop="versionCode">
|
||||
<el-input-number v-model="form.versionCode" :min="4" placeholder="请输入版本代码" style="width: 100%;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="强制更新" prop="isForce">
|
||||
<el-select v-model="form.isForce" placeholder="请选择是否强制更新">
|
||||
<el-option label="否" value="0"></el-option>
|
||||
<el-option label="是" value="1"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="渠道标识" prop="channel">
|
||||
<el-select v-model="form.channel" placeholder="请选择渠道标识">
|
||||
<el-option
|
||||
v-for="item in channelOptions"
|
||||
:key="item"
|
||||
:label="channelNameMap[item.toLowerCase()] || item.toLowerCase()"
|
||||
:value="item.toLowerCase()">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="APK下载" prop="downloadUrl">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action=""
|
||||
:auto-upload="false"
|
||||
:show-file-list="false"
|
||||
:on-change="handleFileChange"
|
||||
:before-upload="beforeUpload"
|
||||
:limit="1"
|
||||
:on-exceed="handleExceed">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<div slot="tip" class="el-upload__tip">文件大小不超过500MB</div>
|
||||
</el-upload>
|
||||
<el-input v-model="form.downloadUrl" placeholder="文件上传后自动填入地址" readonly style="margin-top: 10px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新日志" prop="updateLog">
|
||||
<el-input v-model="form.updateLog" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="安装包" prop="size">
|
||||
<el-input v-model="form.size" placeholder="请输入安装包大小" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listVersion, getVersion, delVersion, addVersion, updateVersion, getChannelList } from "@/api/system/version"
|
||||
import request from '@/utils/request'
|
||||
import { getToken } from "@/utils/auth"
|
||||
|
||||
export default {
|
||||
name: "Version",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 应用版本更新信息表格数据
|
||||
versionList: [],
|
||||
// 渠道选项
|
||||
channelOptions: [],
|
||||
// 渠道中文名称映射
|
||||
channelNameMap: {
|
||||
'official': '官方',
|
||||
'xiaomi': '小米',
|
||||
'huawei': '华为',
|
||||
'oppo': 'OPPO',
|
||||
'vivo': 'VIVO',
|
||||
'meizu': '魅族',
|
||||
'honor': '荣耀',
|
||||
'yingyongbao': '应用宝',
|
||||
'ios': 'iOS'
|
||||
},
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
versionCode: null,
|
||||
versionName: null,
|
||||
isForce: null,
|
||||
channel: null,
|
||||
downloadUrl: null,
|
||||
updateLog: null,
|
||||
size: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
versionCode: [
|
||||
{ required: true, message: "版本代码不能为空", trigger: "blur" }
|
||||
],
|
||||
versionName: [
|
||||
{ required: true, message: "版本名称不能为空", trigger: "blur" }
|
||||
],
|
||||
versionCode: [
|
||||
{ required: true, message: "版本代码不能为空", trigger: "blur" },
|
||||
{ type: 'number', min: 4, message: "版本代码不能小于4", trigger: "blur" }
|
||||
],
|
||||
isForce: [
|
||||
{ required: true, message: "是否强制更新不能为空", trigger: "change" }
|
||||
],
|
||||
channel: [
|
||||
{ required: true, message: "渠道标识不能为空", trigger: "change" }
|
||||
],
|
||||
downloadUrl: [
|
||||
{ required: true, message: "APK下载地址不能为空", trigger: "blur" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
],
|
||||
updateTime: [
|
||||
{ required: true, message: "更新时间不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getChannelOptions()
|
||||
},
|
||||
methods: {
|
||||
/** 查询应用版本更新信息列表 */
|
||||
getList() {
|
||||
this.loading = true
|
||||
listVersion(this.queryParams).then(response => {
|
||||
this.versionList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
versionCode: null,
|
||||
versionName: null,
|
||||
isForce: null,
|
||||
channel: null,
|
||||
downloadUrl: null,
|
||||
updateLog: null,
|
||||
size: null,
|
||||
createTime: null,
|
||||
updateTime: null
|
||||
}
|
||||
this.resetForm("form")
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm")
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = "添加应用版本更新信息"
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
const id = row.id || this.ids[0]
|
||||
getVersion(id).then(response => {
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = "修改应用版本更新信息"
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateVersion(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addVersion(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids
|
||||
this.$modal.confirm('是否确认删除应用版本更新信息编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delVersion(ids)
|
||||
}).then(() => {
|
||||
this.getList()
|
||||
this.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/version/export', {
|
||||
...this.queryParams
|
||||
}, `version_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 获取渠道选项 */
|
||||
getChannelOptions() {
|
||||
getChannelList().then(response => {
|
||||
this.channelOptions = response.data || []
|
||||
})
|
||||
},
|
||||
/** 文件选择处理 */
|
||||
handleFileChange(file) {
|
||||
// 保存文件对象用于提交
|
||||
this.form.file = file.raw
|
||||
|
||||
// 计算并设置文件大小
|
||||
this.setFileSize(file.raw)
|
||||
|
||||
// 上传文件到服务器
|
||||
this.uploadFile(file.raw)
|
||||
|
||||
// 强制更新视图
|
||||
this.$forceUpdate()
|
||||
},
|
||||
/** 设置文件大小 */
|
||||
setFileSize(file) {
|
||||
const fileSize = file.size
|
||||
let sizeText = ''
|
||||
|
||||
if (fileSize < 1024) {
|
||||
sizeText = fileSize + ' B'
|
||||
} else if (fileSize < 1024 * 1024) {
|
||||
sizeText = (fileSize / 1024).toFixed(2) + ' KB'
|
||||
} else if (fileSize < 1024 * 1024 * 1024) {
|
||||
sizeText = (fileSize / (1024 * 1024)).toFixed(2) + ' MB'
|
||||
} else {
|
||||
sizeText = (fileSize / (1024 * 1024 * 1024)).toFixed(2) + ' GB'
|
||||
}
|
||||
|
||||
this.form.size = sizeText
|
||||
},
|
||||
/** 上传文件到服务器 */
|
||||
uploadFile(file) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
formData.append('type', 'version')
|
||||
|
||||
// 调用上传接口
|
||||
request({
|
||||
url: '/back/upload/config/file',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.code === 200) {
|
||||
// 上传成功,保存返回的文件地址
|
||||
this.form.downloadUrl = response.data
|
||||
this.$modal.msgSuccess('文件上传成功')
|
||||
} else {
|
||||
this.$modal.msgError('文件上传失败:' + response.msg)
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('文件上传失败:', error)
|
||||
this.$modal.msgError('文件上传失败')
|
||||
})
|
||||
},
|
||||
/** 文件上传前校验 */
|
||||
beforeUpload(file) {
|
||||
const isLt500M = file.size / 1024 / 1024 < 500
|
||||
|
||||
if (!isLt500M) {
|
||||
this.$modal.msgError('上传文件大小不能超过 500MB!')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
/** 文件数量超出限制 */
|
||||
handleExceed(files, fileList) {
|
||||
this.$modal.msgWarning('只能上传一个文件,请先删除已上传的文件')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user