Compare commits

...

5 Commits

Author SHA1 Message Date
王鹏
f4673f0613 add 2026-09-16 16:56:33 +08:00
王鹏
ca853b70d2 Refine multi-platform publishing status handling 2026-09-16 16:53:52 +08:00
王鹏
8f387b492b Add technology stack management 2026-09-16 16:53:39 +08:00
王鹏
e7ab83c564 Add custom request management 2026-09-16 16:53:24 +08:00
王鹏
05e04ce021 Add configurable contact page management 2026-09-16 16:53:07 +08:00
30 changed files with 2163 additions and 24 deletions

View File

@@ -0,0 +1,39 @@
package com.ruoyi.web.controller.app;
import com.ruoyi.app.domain.AppContactPage;
import com.ruoyi.app.service.IAppContactService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/app/contact")
public class AppContactController extends BaseController
{
@Autowired
private IAppContactService contactService;
@PreAuthorize("@ss.hasPermi('app:contact:query')")
@GetMapping
public AjaxResult getInfo()
{
return success(contactService.selectAdminContactPage());
}
@PreAuthorize("@ss.hasPermi('app:contact:edit')")
@Log(title = "联系页面配置", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppContactPage page)
{
page.setUpdateBy(getUsername());
return toAjax(contactService.updateContactPage(page));
}
}

View File

@@ -0,0 +1,83 @@
package com.ruoyi.web.controller.app;
import java.util.List;
import com.ruoyi.app.domain.AppCustomRequest;
import com.ruoyi.app.service.IAppCustomRequestService;
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.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 项目定制需求Controller。
*/
@RestController
@RequestMapping("/app/customRequest")
public class AppCustomRequestController extends BaseController
{
@Autowired
private IAppCustomRequestService customRequestService;
@PreAuthorize("isAuthenticated()")
@Log(title = "项目定制需求", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult submit(@RequestBody AppCustomRequest request)
{
return success(customRequestService.submitCustomRequest(request, getUserId()));
}
@PreAuthorize("isAuthenticated()")
@GetMapping("/my")
public TableDataInfo myList()
{
startPage();
return getDataTable(customRequestService.selectMyCustomRequestList(getUserId()));
}
@PreAuthorize("isAuthenticated()")
@GetMapping("/my/{id}")
public AjaxResult myDetail(@PathVariable Long id)
{
AppCustomRequest request = customRequestService.selectAppCustomRequestById(id);
if (request == null || !getUserId().equals(request.getUserId()))
{
return error("定制需求不存在");
}
return success(request);
}
@PreAuthorize("@ss.hasPermi('app:customRequest:list')")
@GetMapping("/list")
public TableDataInfo list(AppCustomRequest request)
{
startPage();
List<AppCustomRequest> list = customRequestService.selectAppCustomRequestList(request);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('app:customRequest:query')")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id)
{
return success(customRequestService.selectAppCustomRequestById(id));
}
@PreAuthorize("@ss.hasPermi('app:customRequest:edit')")
@Log(title = "项目定制需求", businessType = BusinessType.UPDATE)
@PutMapping("/status")
public AjaxResult updateStatus(@RequestBody AppCustomRequest request)
{
request.setUpdateBy(getUsername());
return toAjax(customRequestService.updateCustomRequestStatus(request));
}
}

View File

@@ -0,0 +1,78 @@
package com.ruoyi.web.controller.app;
import java.util.List;
import com.ruoyi.app.domain.AppTechStack;
import com.ruoyi.app.service.IAppTechStackService;
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.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/app/techStack")
public class AppTechStackController extends BaseController
{
@Autowired
private IAppTechStackService techStackService;
/** 小程序可选择的启用技术栈。 */
@GetMapping("/options")
public AjaxResult options()
{
return success(techStackService.selectEnabledAppTechStackList());
}
@PreAuthorize("@ss.hasPermi('app:techStack:list')")
@GetMapping("/list")
public TableDataInfo list(AppTechStack techStack)
{
startPage();
List<AppTechStack> list = techStackService.selectAppTechStackList(techStack);
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('app:techStack:query')")
@GetMapping("/{id}")
public AjaxResult detail(@PathVariable Long id)
{
return success(techStackService.selectAppTechStackById(id));
}
@PreAuthorize("@ss.hasPermi('app:techStack:add')")
@Log(title = "定制技术栈", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody AppTechStack techStack)
{
techStack.setCreateBy(getUsername());
techStack.setUpdateBy(getUsername());
return toAjax(techStackService.insertAppTechStack(techStack));
}
@PreAuthorize("@ss.hasPermi('app:techStack:edit')")
@Log(title = "定制技术栈", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody AppTechStack techStack)
{
techStack.setUpdateBy(getUsername());
return toAjax(techStackService.updateAppTechStack(techStack));
}
@PreAuthorize("@ss.hasPermi('app:techStack:remove')")
@Log(title = "定制技术栈", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(techStackService.deleteAppTechStackByIds(ids));
}
}

View File

@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.app;
import com.ruoyi.app.domain.ShuiYinVo;
import com.ruoyi.app.mapper.AppPunlicMapper;
import com.ruoyi.app.service.IAppContactService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.ISysConfigService;
@@ -20,6 +21,8 @@ public class PublicController extends BaseController {
AppPunlicMapper appPunlicMapper;
@Autowired
private ISysConfigService configService;
@Autowired
private IAppContactService contactService;
/**
* 去水印 key 免费申请联系作者微信:yimoziyuan666
* @return
@@ -76,4 +79,11 @@ public class PublicController extends BaseController {
return map;
}
/** 获取小程序联系页面公开配置。 */
@GetMapping(value = "/contact-page")
public AjaxResult getContactPage()
{
return success(contactService.selectPublicContactPage());
}
}

View File

@@ -3,6 +3,7 @@ qiniu.secret-key=SKfXj0r5zSv2uk54Bc7uh8g88y_00VkxXQpR3_jf
qiniu.bucket=blog
qiniu.zone=zone0
qiniu.domain-of-bucket=img.yidaima.cn
qiniu.upload-host=https://upload.qiniup.com
qiniu.expire-in-seconds=-1
qiniu.picture-style =
# qiniu.picture-style = imageView2/0/q/75|watermark/2/text/ZmVhc3Rjb2RpbmcuY24=/font/5a6L5L2T/fontsize/1600/fill/IzBERDBGNQ==/dissolve/100/gravity/Center/dx/10/dy/10
# qiniu.picture-style = imageView2/0/q/75|watermark/2/text/ZmVhc3Rjb2RpbmcuY24=/font/5a6L5L2T/fontsize/1600/fill/IzBERDBGNQ==/dissolve/100/gravity/Center/dx/10/dy/10

View File

@@ -0,0 +1,42 @@
package com.ruoyi.app.domain;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 小程序联系页面联系方式对象 app_contact_item。
*/
public class AppContactItem extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
private String type;
private String label;
private String value;
private String iconUrl;
private String qrCodeUrl;
/** copy复制,qrcode查看二维码 */
private String actionType;
/** 0启用,1停用 */
private String status;
private Integer sort;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public String getLabel() { return label; }
public void setLabel(String label) { this.label = label; }
public String getValue() { return value; }
public void setValue(String value) { this.value = value; }
public String getIconUrl() { return iconUrl; }
public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; }
public String getQrCodeUrl() { return qrCodeUrl; }
public void setQrCodeUrl(String qrCodeUrl) { this.qrCodeUrl = qrCodeUrl; }
public String getActionType() { return actionType; }
public void setActionType(String actionType) { this.actionType = actionType; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
public Integer getSort() { return sort; }
public void setSort(Integer sort) { this.sort = sort; }
}

View File

@@ -0,0 +1,33 @@
package com.ruoyi.app.domain;
import java.util.ArrayList;
import java.util.List;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 小程序联系页面配置对象 app_contact_page。
*/
public class AppContactPage extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
private String avatarUrl;
private String nickname;
private String bio;
private String backgroundUrl;
private List<AppContactItem> contacts = new ArrayList<>();
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getAvatarUrl() { return avatarUrl; }
public void setAvatarUrl(String avatarUrl) { this.avatarUrl = avatarUrl; }
public String getNickname() { return nickname; }
public void setNickname(String nickname) { this.nickname = nickname; }
public String getBio() { return bio; }
public void setBio(String bio) { this.bio = bio; }
public String getBackgroundUrl() { return backgroundUrl; }
public void setBackgroundUrl(String backgroundUrl) { this.backgroundUrl = backgroundUrl; }
public List<AppContactItem> getContacts() { return contacts; }
public void setContacts(List<AppContactItem> contacts) { this.contacts = contacts; }
}

View File

@@ -0,0 +1,60 @@
package com.ruoyi.app.domain;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目定制需求对象 app_custom_request。
*/
public class AppCustomRequest extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
private String requestNo;
private Long userId;
private String projectName;
private String requirementContent;
private Long techStackId;
/** 保存提交时的技术栈名称,避免后台改名影响历史需求。 */
private String techStackName;
/** 0待审核 1审核中 2已接单 3开发中 4已完成 5审核未通过 */
private Integer status;
private String progressNote;
private Integer pointAmount;
/** 0已扣除 1已退回 */
private Integer pointStatus;
private String rejectReason;
/** 仅用于后台列表展示与查询。 */
private String userName;
private String nickName;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getRequestNo() { return requestNo; }
public void setRequestNo(String requestNo) { this.requestNo = requestNo; }
public Long getUserId() { return userId; }
public void setUserId(Long userId) { this.userId = userId; }
public String getProjectName() { return projectName; }
public void setProjectName(String projectName) { this.projectName = projectName; }
public String getRequirementContent() { return requirementContent; }
public void setRequirementContent(String requirementContent) { this.requirementContent = requirementContent; }
public Long getTechStackId() { return techStackId; }
public void setTechStackId(Long techStackId) { this.techStackId = techStackId; }
public String getTechStackName() { return techStackName; }
public void setTechStackName(String techStackName) { this.techStackName = techStackName; }
public Integer getStatus() { return status; }
public void setStatus(Integer status) { this.status = status; }
public String getProgressNote() { return progressNote; }
public void setProgressNote(String progressNote) { this.progressNote = progressNote; }
public Integer getPointAmount() { return pointAmount; }
public void setPointAmount(Integer pointAmount) { this.pointAmount = pointAmount; }
public Integer getPointStatus() { return pointStatus; }
public void setPointStatus(Integer pointStatus) { this.pointStatus = pointStatus; }
public String getRejectReason() { return rejectReason; }
public void setRejectReason(String rejectReason) { this.rejectReason = rejectReason; }
public String getUserName() { return userName; }
public void setUserName(String userName) { this.userName = userName; }
public String getNickName() { return nickName; }
public void setNickName(String nickName) { this.nickName = nickName; }
}

View File

@@ -0,0 +1,26 @@
package com.ruoyi.app.domain;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 项目定制技术栈对象 app_tech_stack。
*/
public class AppTechStack extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
private String name;
private Integer sort;
/** 0启用 1停用 */
private String status;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Integer getSort() { return sort; }
public void setSort(Integer sort) { this.sort = sort; }
public String getStatus() { return status; }
public void setStatus(String status) { this.status = status; }
}

View File

@@ -0,0 +1,19 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppContactItem;
import com.ruoyi.app.domain.AppContactPage;
import org.apache.ibatis.annotations.Param;
public interface AppContactMapper
{
AppContactPage selectAppContactPage();
List<AppContactItem> selectAppContactItemList(@Param("status") String status);
int upsertAppContactPage(AppContactPage page);
int deleteAllAppContactItems();
int insertAppContactItem(AppContactItem item);
}

View File

@@ -0,0 +1,23 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppCustomRequest;
import org.apache.ibatis.annotations.Param;
/**
* 项目定制需求Mapper接口。
*/
public interface AppCustomRequestMapper
{
AppCustomRequest selectAppCustomRequestById(Long id);
AppCustomRequest selectAppCustomRequestByIdForUpdate(Long id);
List<AppCustomRequest> selectAppCustomRequestList(AppCustomRequest request);
List<AppCustomRequest> selectMyCustomRequestList(@Param("userId") Long userId);
int insertAppCustomRequest(AppCustomRequest request);
int updateAppCustomRequest(AppCustomRequest request);
}

View File

@@ -0,0 +1,22 @@
package com.ruoyi.app.mapper;
import java.util.List;
import com.ruoyi.app.domain.AppTechStack;
import org.apache.ibatis.annotations.Param;
public interface AppTechStackMapper
{
AppTechStack selectAppTechStackById(Long id);
AppTechStack selectAppTechStackByName(@Param("name") String name, @Param("excludeId") Long excludeId);
List<AppTechStack> selectAppTechStackList(AppTechStack techStack);
List<AppTechStack> selectEnabledAppTechStackList();
int insertAppTechStack(AppTechStack techStack);
int updateAppTechStack(AppTechStack techStack);
int deleteAppTechStackByIds(Long[] ids);
}

View File

@@ -0,0 +1,15 @@
package com.ruoyi.app.service;
import com.ruoyi.app.domain.AppContactPage;
public interface IAppContactService
{
/** 查询后台维护用的完整配置。 */
AppContactPage selectAdminContactPage();
/** 查询小程序展示用的启用配置。 */
AppContactPage selectPublicContactPage();
/** 保存页面资料及完整联系方式列表。 */
int updateContactPage(AppContactPage page);
}

View File

@@ -0,0 +1,20 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppCustomRequest;
/**
* 项目定制需求Service接口。
*/
public interface IAppCustomRequestService
{
AppCustomRequest selectAppCustomRequestById(Long id);
List<AppCustomRequest> selectAppCustomRequestList(AppCustomRequest request);
List<AppCustomRequest> selectMyCustomRequestList(Long userId);
AppCustomRequest submitCustomRequest(AppCustomRequest request, Long userId);
int updateCustomRequestStatus(AppCustomRequest request);
}

View File

@@ -0,0 +1,19 @@
package com.ruoyi.app.service;
import java.util.List;
import com.ruoyi.app.domain.AppTechStack;
public interface IAppTechStackService
{
AppTechStack selectAppTechStackById(Long id);
List<AppTechStack> selectAppTechStackList(AppTechStack techStack);
List<AppTechStack> selectEnabledAppTechStackList();
int insertAppTechStack(AppTechStack techStack);
int updateAppTechStack(AppTechStack techStack);
int deleteAppTechStackByIds(Long[] ids);
}

View File

@@ -0,0 +1,152 @@
package com.ruoyi.app.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.ruoyi.app.domain.AppContactItem;
import com.ruoyi.app.domain.AppContactPage;
import com.ruoyi.app.mapper.AppContactMapper;
import com.ruoyi.app.service.IAppContactService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class AppContactServiceImpl implements IAppContactService
{
private static final int MAX_CONTACTS = 30;
@Autowired
private AppContactMapper contactMapper;
@Override
public AppContactPage selectAdminContactPage()
{
return buildContactPage(null);
}
@Override
public AppContactPage selectPublicContactPage()
{
return buildContactPage("0");
}
private AppContactPage buildContactPage(String status)
{
AppContactPage page = contactMapper.selectAppContactPage();
if (page == null)
{
page = defaultPage();
}
page.setContacts(contactMapper.selectAppContactItemList(status));
return page;
}
@Override
@Transactional
public int updateContactPage(AppContactPage page)
{
if (page == null)
{
throw new ServiceException("页面配置不能为空");
}
normalizePage(page);
List<AppContactItem> contacts = page.getContacts();
if (contacts == null)
{
contacts = new ArrayList<>();
page.setContacts(contacts);
}
if (contacts.size() > MAX_CONTACTS)
{
throw new ServiceException("联系方式最多可配置" + MAX_CONTACTS + "条");
}
Date now = new Date();
page.setId(1L);
page.setUpdateTime(now);
contactMapper.upsertAppContactPage(page);
contactMapper.deleteAllAppContactItems();
int index = 0;
for (AppContactItem item : contacts)
{
normalizeItem(item, index++);
item.setId(null);
item.setCreateBy(page.getUpdateBy());
item.setUpdateBy(page.getUpdateBy());
item.setCreateTime(now);
item.setUpdateTime(now);
contactMapper.insertAppContactItem(item);
}
return 1;
}
private void normalizePage(AppContactPage page)
{
page.setAvatarUrl(trimAndCheck(page.getAvatarUrl(), 500, "头像地址"));
page.setNickname(trimAndCheck(page.getNickname(), 100, "昵称"));
page.setBio(trimAndCheck(page.getBio(), 500, "个人简介"));
page.setBackgroundUrl(trimAndCheck(page.getBackgroundUrl(), 500, "背景图地址"));
if (StringUtils.isEmpty(page.getNickname()))
{
throw new ServiceException("昵称不能为空");
}
}
private void normalizeItem(AppContactItem item, int index)
{
if (item == null)
{
throw new ServiceException("第" + (index + 1) + "条联系方式不能为空");
}
item.setType(trimAndCheck(item.getType(), 30, "联系方式类型"));
item.setLabel(trimAndCheck(item.getLabel(), 50, "联系方式名称"));
item.setValue(trimAndCheck(item.getValue(), 500, "联系方式内容"));
item.setIconUrl(trimAndCheck(item.getIconUrl(), 500, "图标地址"));
item.setQrCodeUrl(trimAndCheck(item.getQrCodeUrl(), 500, "二维码地址"));
if (StringUtils.isEmpty(item.getType()))
{
item.setType("custom");
}
if (StringUtils.isEmpty(item.getLabel()))
{
throw new ServiceException("第" + (index + 1) + "条联系方式名称不能为空");
}
if (StringUtils.isEmpty(item.getValue()))
{
throw new ServiceException("第" + (index + 1) + "条联系方式内容不能为空");
}
if (!"qrcode".equals(item.getActionType()) || StringUtils.isEmpty(item.getQrCodeUrl()))
{
item.setActionType("copy");
}
item.setStatus("1".equals(item.getStatus()) ? "1" : "0");
if (item.getSort() == null || item.getSort() < 0)
{
item.setSort((index + 1) * 10);
}
}
private String trimAndCheck(String value, int maxLength, String fieldName)
{
String result = StringUtils.trim(value);
if (result != null && result.length() > maxLength)
{
throw new ServiceException(fieldName + "不能超过" + maxLength + "个字符");
}
return result;
}
private AppContactPage defaultPage()
{
AppContactPage page = new AppContactPage();
page.setId(1L);
page.setAvatarUrl("https://img.yidaima.cn/%E5%A4%B4%E5%83%8F/9b889964f97e4d0c8f52f7b9ec0d04da.jpg");
page.setNickname("Nan Yin");
page.setBio("如果爱意难平,那就把它藏在心底吧!");
return page;
}
}

View File

@@ -0,0 +1,171 @@
package com.ruoyi.app.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.app.domain.AppCustomRequest;
import com.ruoyi.app.domain.AppIntegralRecord;
import com.ruoyi.app.domain.AppTechStack;
import com.ruoyi.app.mapper.AppCustomRequestMapper;
import com.ruoyi.app.mapper.AppIntegralRecordMapper;
import com.ruoyi.app.mapper.AppTechStackMapper;
import com.ruoyi.app.service.IAppCustomRequestService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 项目定制需求Service业务层处理。
*/
@Service
public class AppCustomRequestServiceImpl implements IAppCustomRequestService
{
private static final int SUBMIT_POINTS = 99;
private static final int STATUS_REJECTED = 5;
private static final int POINT_DEDUCTED = 0;
private static final int POINT_REFUNDED = 1;
@Autowired
private AppCustomRequestMapper customRequestMapper;
@Autowired
private AppIntegralRecordMapper integralRecordMapper;
@Autowired
private AppTechStackMapper techStackMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Override
public AppCustomRequest selectAppCustomRequestById(Long id)
{
return customRequestMapper.selectAppCustomRequestById(id);
}
@Override
public List<AppCustomRequest> selectAppCustomRequestList(AppCustomRequest request)
{
return customRequestMapper.selectAppCustomRequestList(request);
}
@Override
public List<AppCustomRequest> selectMyCustomRequestList(Long userId)
{
return customRequestMapper.selectMyCustomRequestList(userId);
}
@Override
@Transactional
public AppCustomRequest submitCustomRequest(AppCustomRequest request, Long userId)
{
String projectName = StringUtils.trim(request.getProjectName());
String requirementContent = StringUtils.trim(request.getRequirementContent());
if (StringUtils.isEmpty(projectName) || projectName.length() < 2 || projectName.length() > 30)
{
throw new ServiceException("项目名称需填写2至30个字");
}
if (StringUtils.isEmpty(requirementContent) || requirementContent.length() < 20 || requirementContent.length() > 500)
{
throw new ServiceException("项目需求需填写20至500个字");
}
if (request.getTechStackId() == null)
{
throw new ServiceException("请选择技术栈");
}
AppTechStack techStack = techStackMapper.selectAppTechStackById(request.getTechStackId());
if (techStack == null || !"0".equals(techStack.getStatus()))
{
throw new ServiceException("所选技术栈已停用,请重新选择");
}
if (sysUserMapper.delIntegralByUserId(SUBMIT_POINTS, userId) != 1)
{
throw new ServiceException("积分不足,提交需求需要99积分");
}
Date now = DateUtils.getNowDate();
request.setRequestNo("DZ" + DateUtils.dateTimeNow() + IdUtils.fastSimpleUUID().substring(0, 6).toUpperCase());
request.setUserId(userId);
request.setProjectName(projectName);
request.setRequirementContent(requirementContent);
request.setTechStackName(techStack.getName());
request.setStatus(0);
request.setProgressNote("需求已提交,等待平台审核");
request.setPointAmount(SUBMIT_POINTS);
request.setPointStatus(POINT_DEDUCTED);
request.setRejectReason(null);
request.setCreateBy(String.valueOf(userId));
request.setCreateTime(now);
request.setUpdateBy(String.valueOf(userId));
request.setUpdateTime(now);
if (customRequestMapper.insertAppCustomRequest(request) != 1)
{
throw new ServiceException("需求提交失败,请重试");
}
insertIntegralRecord(request, 1L, "定制需求提交");
return request;
}
@Override
@Transactional
public int updateCustomRequestStatus(AppCustomRequest update)
{
if (update.getId() == null || update.getStatus() == null || update.getStatus() < 0 || update.getStatus() > 5)
{
throw new ServiceException("需求状态不正确");
}
AppCustomRequest current = customRequestMapper.selectAppCustomRequestByIdForUpdate(update.getId());
if (current == null)
{
throw new ServiceException("定制需求不存在");
}
if (POINT_REFUNDED == current.getPointStatus() && update.getStatus() != STATUS_REJECTED)
{
throw new ServiceException("该需求已退回积分,不能恢复为其他状态");
}
if (update.getStatus() == STATUS_REJECTED && StringUtils.isEmpty(StringUtils.trim(update.getRejectReason())))
{
throw new ServiceException("审核不通过时必须填写原因");
}
current.setStatus(update.getStatus());
current.setProgressNote(StringUtils.trim(update.getProgressNote()));
current.setUpdateBy(update.getUpdateBy());
current.setUpdateTime(DateUtils.getNowDate());
if (update.getStatus() == STATUS_REJECTED)
{
current.setRejectReason(StringUtils.trim(update.getRejectReason()));
if (POINT_DEDUCTED == current.getPointStatus())
{
if (sysUserMapper.addIntegralByUserId(current.getPointAmount(), current.getUserId()) != 1)
{
throw new ServiceException("积分退回失败,请重试");
}
insertIntegralRecord(current, 0L, "定制需求退回");
current.setPointStatus(POINT_REFUNDED);
}
}
else
{
current.setRejectReason("");
}
return customRequestMapper.updateAppCustomRequest(current);
}
private void insertIntegralRecord(AppCustomRequest request, Long isAdd, String source)
{
AppIntegralRecord record = new AppIntegralRecord();
record.setSource(source);
record.setIsAdd(isAdd);
record.setIntegralNumber(request.getPointAmount().longValue());
record.setUserId(request.getUserId());
record.setIntegralTime(new Date());
if (integralRecordMapper.insertAppIntegralRecord(record) != 1)
{
throw new ServiceException("积分流水记录失败,请重试");
}
}
}

View File

@@ -0,0 +1,85 @@
package com.ruoyi.app.service.impl;
import java.util.List;
import com.ruoyi.app.domain.AppTechStack;
import com.ruoyi.app.mapper.AppTechStackMapper;
import com.ruoyi.app.service.IAppTechStackService;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AppTechStackServiceImpl implements IAppTechStackService
{
@Autowired
private AppTechStackMapper techStackMapper;
@Override
public AppTechStack selectAppTechStackById(Long id)
{
return techStackMapper.selectAppTechStackById(id);
}
@Override
public List<AppTechStack> selectAppTechStackList(AppTechStack techStack)
{
return techStackMapper.selectAppTechStackList(techStack);
}
@Override
public List<AppTechStack> selectEnabledAppTechStackList()
{
return techStackMapper.selectEnabledAppTechStackList();
}
@Override
public int insertAppTechStack(AppTechStack techStack)
{
normalizeAndValidate(techStack);
techStack.setCreateTime(DateUtils.getNowDate());
techStack.setUpdateTime(DateUtils.getNowDate());
return techStackMapper.insertAppTechStack(techStack);
}
@Override
public int updateAppTechStack(AppTechStack techStack)
{
if (techStack.getId() == null)
{
throw new ServiceException("技术栈不存在");
}
normalizeAndValidate(techStack);
techStack.setUpdateTime(DateUtils.getNowDate());
return techStackMapper.updateAppTechStack(techStack);
}
@Override
public int deleteAppTechStackByIds(Long[] ids)
{
return techStackMapper.deleteAppTechStackByIds(ids);
}
private void normalizeAndValidate(AppTechStack techStack)
{
String name = StringUtils.trim(techStack.getName());
if (StringUtils.isEmpty(name) || name.length() > 50)
{
throw new ServiceException("技术栈名称需填写1至50个字");
}
if (techStackMapper.selectAppTechStackByName(name, techStack.getId()) != null)
{
throw new ServiceException("技术栈名称已存在");
}
techStack.setName(name);
if (techStack.getSort() == null || techStack.getSort() < 0)
{
techStack.setSort(0);
}
if (!"1".equals(techStack.getStatus()))
{
techStack.setStatus("0");
}
}
}

View File

@@ -0,0 +1,74 @@
<?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.app.mapper.AppContactMapper">
<resultMap type="AppContactPage" id="AppContactPageResult">
<result property="id" column="id" />
<result property="avatarUrl" column="avatar_url" />
<result property="nickname" column="nickname" />
<result property="bio" column="bio" />
<result property="backgroundUrl" column="background_url" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap type="AppContactItem" id="AppContactItemResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="label" column="label" />
<result property="value" column="contact_value" />
<result property="iconUrl" column="icon_url" />
<result property="qrCodeUrl" column="qr_code_url" />
<result property="actionType" column="action_type" />
<result property="status" column="status" />
<result property="sort" column="sort" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<select id="selectAppContactPage" resultMap="AppContactPageResult">
select id, avatar_url, nickname, bio, background_url,
create_by, create_time, update_by, update_time
from app_contact_page
where id = 1
</select>
<select id="selectAppContactItemList" resultMap="AppContactItemResult">
select id, type, label, contact_value, icon_url, qr_code_url, action_type,
status, sort, create_by, create_time, update_by, update_time
from app_contact_item
<if test="status != null and status != ''">where status = #{status}</if>
order by sort asc, id asc
</select>
<insert id="upsertAppContactPage" parameterType="AppContactPage">
insert into app_contact_page
(id, avatar_url, nickname, bio, background_url, create_by, create_time, update_by, update_time)
values
(1, #{avatarUrl}, #{nickname}, #{bio}, #{backgroundUrl},
#{updateBy}, #{updateTime}, #{updateBy}, #{updateTime})
on duplicate key update
avatar_url = values(avatar_url), nickname = values(nickname), bio = values(bio),
background_url = values(background_url), update_by = values(update_by),
update_time = values(update_time)
</insert>
<delete id="deleteAllAppContactItems">
delete from app_contact_item
</delete>
<insert id="insertAppContactItem" parameterType="AppContactItem" useGeneratedKeys="true" keyProperty="id">
insert into app_contact_item
(type, label, contact_value, icon_url, qr_code_url, action_type, status, sort,
create_by, create_time, update_by, update_time)
values
(#{type}, #{label}, #{value}, #{iconUrl}, #{qrCodeUrl}, #{actionType}, #{status}, #{sort},
#{createBy}, #{createTime}, #{updateBy}, #{updateTime})
</insert>
</mapper>

View File

@@ -0,0 +1,102 @@
<?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.app.mapper.AppCustomRequestMapper">
<resultMap type="AppCustomRequest" id="AppCustomRequestResult">
<result property="id" column="id" />
<result property="requestNo" column="request_no" />
<result property="userId" column="user_id" />
<result property="projectName" column="project_name" />
<result property="requirementContent" column="requirement_content" />
<result property="techStackId" column="tech_stack_id" />
<result property="techStackName" column="tech_stack_name" />
<result property="status" column="status" />
<result property="progressNote" column="progress_note" />
<result property="pointAmount" column="point_amount" />
<result property="pointStatus" column="point_status" />
<result property="rejectReason" column="reject_reason" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectAppCustomRequestVo">
select r.id, r.request_no, r.user_id, r.project_name, r.requirement_content,
r.tech_stack_id, r.tech_stack_name,
r.status, r.progress_note, r.point_amount, r.point_status, r.reject_reason,
r.create_by, r.create_time, r.update_by, r.update_time,
u.user_name, u.nick_name
from app_custom_request r
left join sys_user u on u.user_id = r.user_id
</sql>
<select id="selectAppCustomRequestById" parameterType="Long" resultMap="AppCustomRequestResult">
<include refid="selectAppCustomRequestVo" />
where r.id = #{id}
</select>
<select id="selectAppCustomRequestByIdForUpdate" parameterType="Long" resultMap="AppCustomRequestResult">
select id, request_no, user_id, project_name, requirement_content,
tech_stack_id, tech_stack_name, status,
progress_note, point_amount, point_status, reject_reason,
create_by, create_time, update_by, update_time
from app_custom_request
where id = #{id}
for update
</select>
<select id="selectAppCustomRequestList" parameterType="AppCustomRequest" resultMap="AppCustomRequestResult">
<include refid="selectAppCustomRequestVo" />
<where>
<if test="requestNo != null and requestNo != ''">and r.request_no like concat('%', #{requestNo}, '%')</if>
<if test="projectName != null and projectName != ''">and r.project_name like concat('%', #{projectName}, '%')</if>
<if test="techStackName != null and techStackName != ''">and r.tech_stack_name like concat('%', #{techStackName}, '%')</if>
<if test="status != null">and r.status = #{status}</if>
<if test="pointStatus != null">and r.point_status = #{pointStatus}</if>
<if test="userId != null">and r.user_id = #{userId}</if>
<if test="userName != null and userName != ''">
and (u.user_name like concat('%', #{userName}, '%') or u.nick_name like concat('%', #{userName}, '%'))
</if>
<if test="params.beginTime != null and params.beginTime != ''">
and date_format(r.create_time, '%Y%m%d') &gt;= date_format(#{params.beginTime}, '%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
and date_format(r.create_time, '%Y%m%d') &lt;= date_format(#{params.endTime}, '%Y%m%d')
</if>
</where>
order by r.update_time desc, r.id desc
</select>
<select id="selectMyCustomRequestList" resultMap="AppCustomRequestResult">
<include refid="selectAppCustomRequestVo" />
where r.user_id = #{userId}
order by r.update_time desc, r.id desc
</select>
<insert id="insertAppCustomRequest" parameterType="AppCustomRequest" useGeneratedKeys="true" keyProperty="id">
insert into app_custom_request
(request_no, user_id, project_name, requirement_content, tech_stack_id, tech_stack_name, status, progress_note,
point_amount, point_status, reject_reason, create_by, create_time, update_by, update_time)
values
(#{requestNo}, #{userId}, #{projectName}, #{requirementContent}, #{techStackId}, #{techStackName}, #{status}, #{progressNote},
#{pointAmount}, #{pointStatus}, #{rejectReason}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
</insert>
<update id="updateAppCustomRequest" parameterType="AppCustomRequest">
update app_custom_request
<set>
<if test="status != null">status = #{status},</if>
<if test="progressNote != null">progress_note = #{progressNote},</if>
<if test="pointStatus != null">point_status = #{pointStatus},</if>
<if test="rejectReason != null">reject_reason = #{rejectReason},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = #{updateTime}
</set>
where id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,68 @@
<?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.app.mapper.AppTechStackMapper">
<resultMap type="AppTechStack" id="AppTechStackResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="sort" column="sort" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectAppTechStackVo">
select id, name, sort, status, remark, create_by, create_time, update_by, update_time
from app_tech_stack
</sql>
<select id="selectAppTechStackById" parameterType="Long" resultMap="AppTechStackResult">
<include refid="selectAppTechStackVo" /> where id = #{id}
</select>
<select id="selectAppTechStackByName" resultMap="AppTechStackResult">
<include refid="selectAppTechStackVo" />
where name = #{name}
<if test="excludeId != null">and id != #{excludeId}</if>
limit 1
</select>
<select id="selectAppTechStackList" parameterType="AppTechStack" resultMap="AppTechStackResult">
<include refid="selectAppTechStackVo" />
<where>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
order by sort asc, id asc
</select>
<select id="selectEnabledAppTechStackList" resultMap="AppTechStackResult">
<include refid="selectAppTechStackVo" />
where status = '0'
order by sort asc, id asc
</select>
<insert id="insertAppTechStack" parameterType="AppTechStack" useGeneratedKeys="true" keyProperty="id">
insert into app_tech_stack (name, sort, status, remark, create_by, create_time, update_by, update_time)
values (#{name}, #{sort}, #{status}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
</insert>
<update id="updateAppTechStack" parameterType="AppTechStack">
update app_tech_stack
<set>
name = #{name}, sort = #{sort}, status = #{status},
remark = #{remark}, update_by = #{updateBy}, update_time = #{updateTime}
</set>
where id = #{id}
</update>
<delete id="deleteAppTechStackByIds" parameterType="Long">
delete from app_tech_stack where id in
<foreach item="id" collection="array" open="(" separator="," close=")">#{id}</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,9 @@
import request from '@/utils/request'
export function getContactConfig() {
return request({ url: '/app/contact', method: 'get' })
}
export function updateContactConfig(data) {
return request({ url: '/app/contact', method: 'put', data })
}

View File

@@ -0,0 +1,24 @@
import request from '@/utils/request'
export function listCustomRequest(query) {
return request({
url: '/app/customRequest/list',
method: 'get',
params: query
})
}
export function getCustomRequest(id) {
return request({
url: '/app/customRequest/' + id,
method: 'get'
})
}
export function updateCustomRequestStatus(data) {
return request({
url: '/app/customRequest/status',
method: 'put',
data: data
})
}

View File

@@ -0,0 +1,21 @@
import request from '@/utils/request'
export function listTechStack(query) {
return request({ url: '/app/techStack/list', method: 'get', params: query })
}
export function getTechStack(id) {
return request({ url: '/app/techStack/' + id, method: 'get' })
}
export function addTechStack(data) {
return request({ url: '/app/techStack', method: 'post', data })
}
export function updateTechStack(data) {
return request({ url: '/app/techStack', method: 'put', data })
}
export function delTechStack(ids) {
return request({ url: '/app/techStack/' + ids, method: 'delete' })
}

View File

@@ -0,0 +1,270 @@
<template>
<div v-loading="loading" class="app-container contact-config">
<el-alert
title="这里保存后,小程序会动态展示启用的联系方式;页面导航标题保持现状。"
type="info"
:closable="false"
show-icon
class="page-alert"
/>
<el-form ref="form" :model="form" :rules="rules" label-width="96px">
<el-card shadow="never" class="config-card">
<div slot="header" class="card-header">
<div>
<div class="card-title">页面资料</div>
<div class="card-desc">配置头像、昵称和简介,背景图不上传时使用默认渐变背景。</div>
</div>
</div>
<el-row :gutter="28">
<el-col :xs="24" :sm="12">
<el-form-item label="头像" prop="avatarUrl">
<image-upload v-model="form.avatarUrl" :limit="1" :file-size="5" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12">
<el-form-item label="顶部背景图" prop="backgroundUrl">
<image-upload v-model="form.backgroundUrl" :limit="1" :file-size="8" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="28">
<el-col :xs="24" :sm="12">
<el-form-item label="昵称" prop="nickname">
<el-input v-model.trim="form.nickname" maxlength="100" show-word-limit placeholder="请输入昵称" />
</el-form-item>
</el-col>
<el-col :xs="24" :sm="12">
<el-form-item label="个人简介" prop="bio">
<el-input v-model.trim="form.bio" maxlength="500" show-word-limit placeholder="请输入个人简介" />
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-card shadow="never" class="config-card">
<div slot="header" class="card-header">
<div>
<div class="card-title">联系方式</div>
<div class="card-desc">可新增、删除、启停和排序;未上传图标时小程序会使用对应类型的文字图标。</div>
</div>
<el-button type="primary" plain icon="el-icon-plus" size="small" @click="addContact">新增联系方式</el-button>
</div>
<el-table :data="form.contacts" border row-key="rowKey" empty-text="暂无联系方式,请点击右上角新增">
<el-table-column label="排序" width="90" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.sort" :min="0" :max="9999" :controls="false" size="small" />
</template>
</el-table-column>
<el-table-column label="类型" width="130">
<template slot-scope="scope">
<el-select v-model="scope.row.type" size="small" @change="applyTypePreset(scope.row)">
<el-option v-for="item in contactTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</template>
</el-table-column>
<el-table-column label="显示名称" min-width="145">
<template slot-scope="scope">
<el-input v-model.trim="scope.row.label" maxlength="50" size="small" placeholder="如:微信" />
</template>
</el-table-column>
<el-table-column label="联系内容" min-width="220">
<template slot-scope="scope">
<el-input v-model.trim="scope.row.value" maxlength="500" size="small" placeholder="账号、邮箱或网址" />
</template>
</el-table-column>
<el-table-column label="点击操作" width="130">
<template slot-scope="scope">
<el-select v-model="scope.row.actionType" size="small">
<el-option label="复制内容" value="copy" />
<el-option label="查看二维码" value="qrcode" :disabled="!scope.row.qrCodeUrl" />
</el-select>
</template>
</el-table-column>
<el-table-column label="自定义图标" width="112" align="center">
<template slot-scope="scope">
<image-upload v-model="scope.row.iconUrl" class="compact-uploader" :limit="1" :file-size="2" :is-show-tip="false" />
</template>
</el-table-column>
<el-table-column label="二维码" width="112" align="center">
<template slot-scope="scope">
<image-upload v-model="scope.row.qrCodeUrl" class="compact-uploader" :limit="1" :file-size="5" :is-show-tip="false" />
</template>
</el-table-column>
<el-table-column label="状态" width="90" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" />
</template>
</el-table-column>
<el-table-column label="操作" width="80" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="text" class="danger-button" @click="removeContact(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<div class="save-bar">
<el-button type="primary" icon="el-icon-check" :loading="saving" @click="submitForm">保存配置</el-button>
</div>
</el-form>
</div>
</template>
<script>
import { getContactConfig, updateContactConfig } from '@/api/app/contact'
export default {
name: 'ContactConfig',
data() {
return {
loading: false,
saving: false,
rowSequence: 0,
contactTypes: [
{ label: 'QQ', value: 'qq' },
{ label: '微信', value: 'wechat' },
{ label: '邮箱', value: 'email' },
{ label: '博客/网站', value: 'blog' },
{ label: '自定义', value: 'custom' }
],
form: this.emptyForm(),
rules: {
nickname: [{ required: true, message: '请输入昵称', trigger: 'blur' }]
}
}
},
created() {
this.loadConfig()
},
methods: {
emptyForm() {
return { id: 1, avatarUrl: '', nickname: '', bio: '', backgroundUrl: '', contacts: [] }
},
loadConfig() {
this.loading = true
getContactConfig().then(response => {
const data = response.data || this.emptyForm()
data.contacts = (data.contacts || []).map(item => this.withRowKey(item))
this.form = data
}).finally(() => { this.loading = false })
},
withRowKey(item) {
this.rowSequence += 1
return Object.assign({
id: undefined,
type: 'custom',
label: '',
value: '',
iconUrl: '',
qrCodeUrl: '',
actionType: 'copy',
status: '0',
sort: this.rowSequence * 10
}, item, { rowKey: `contact-${this.rowSequence}` })
},
addContact() {
if (this.form.contacts.length >= 30) {
this.$modal.msgWarning('最多可配置30条联系方式')
return
}
this.form.contacts.push(this.withRowKey({ sort: (this.form.contacts.length + 1) * 10 }))
},
removeContact(index) {
this.form.contacts.splice(index, 1)
},
applyTypePreset(row) {
const labels = { qq: 'QQ', wechat: '微信', email: '邮箱', blog: '博客' }
if (labels[row.type] && !row.label) row.label = labels[row.type]
if (row.type === 'email' || row.type === 'blog') row.actionType = 'copy'
},
validateContacts() {
for (let i = 0; i < this.form.contacts.length; i += 1) {
const item = this.form.contacts[i]
if (!item.label) return `第${i + 1}条联系方式缺少显示名称`
if (!item.value) return `第${i + 1}条联系方式缺少联系内容`
if (item.actionType === 'qrcode' && !item.qrCodeUrl) return `第${i + 1}条联系方式选择了二维码操作,但尚未上传二维码`
}
return ''
},
submitForm() {
this.$refs.form.validate(valid => {
if (!valid) return
const message = this.validateContacts()
if (message) {
this.$modal.msgWarning(message)
return
}
this.saving = true
const payload = JSON.parse(JSON.stringify(this.form))
payload.contacts.forEach(item => { delete item.rowKey })
updateContactConfig(payload).then(() => {
this.$modal.msgSuccess('保存成功')
this.loadConfig()
}).finally(() => { this.saving = false })
})
}
}
}
</script>
<style scoped lang="scss">
.contact-config {
padding-bottom: 84px;
}
.page-alert {
margin-bottom: 18px;
}
.config-card {
margin-bottom: 18px;
border-radius: 8px;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.card-title {
color: #303133;
font-size: 16px;
font-weight: 600;
}
.card-desc {
margin-top: 6px;
color: #909399;
font-size: 13px;
}
.danger-button {
color: #f56c6c;
}
.save-bar {
position: sticky;
z-index: 20;
bottom: 0;
display: flex;
justify-content: flex-end;
margin: 0 -20px -84px;
padding: 14px 24px;
border-top: 1px solid #ebeef5;
background: rgba(255, 255, 255, 0.96);
box-shadow: 0 -4px 14px rgba(31, 45, 61, 0.06);
}
::v-deep .compact-uploader .el-upload--picture-card,
::v-deep .compact-uploader .el-upload-list--picture-card .el-upload-list__item {
width: 58px;
height: 58px;
line-height: 58px;
margin: 0;
}
::v-deep .compact-uploader .el-upload-list--picture-card .el-upload-list__item-actions {
font-size: 14px;
}
::v-deep .el-input-number {
width: 62px;
}
@media (max-width: 992px) {
.card-header { align-items: flex-start; gap: 16px; }
}
</style>

View File

@@ -0,0 +1,262 @@
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="82px">
<el-form-item label="需求单号" prop="requestNo">
<el-input v-model="queryParams.requestNo" placeholder="请输入需求单号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="技术栈" prop="techStackName">
<el-input v-model="queryParams.techStackName" placeholder="请输入技术栈" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="用户" prop="userName">
<el-input v-model="queryParams.userName" placeholder="账号或昵称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="需求状态" prop="status">
<el-select v-model="queryParams.status" placeholder="全部状态" clearable>
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="积分状态" prop="pointStatus">
<el-select v-model="queryParams.pointStatus" placeholder="全部状态" clearable>
<el-option label="已扣除" :value="0" />
<el-option label="已退回" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="提交时间">
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</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">
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="requestList">
<el-table-column label="需求单号" prop="requestNo" min-width="205" show-overflow-tooltip />
<el-table-column label="用户" min-width="150">
<template slot-scope="scope">
<div>{{ scope.row.nickName || scope.row.userName || '-' }}</div>
<div class="secondary-text">{{ scope.row.userName || '-' }} / ID: {{ scope.row.userId }}</div>
</template>
</el-table-column>
<el-table-column label="项目名称" prop="projectName" min-width="180" show-overflow-tooltip />
<el-table-column label="技术栈" prop="techStackName" min-width="185" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.techStackName || '-' }}</template>
</el-table-column>
<el-table-column label="项目需求" prop="requirementContent" min-width="250" show-overflow-tooltip />
<el-table-column label="状态" align="center" width="120">
<template slot-scope="scope">
<el-tag :type="statusType(scope.row.status)" size="small">{{ statusLabel(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column label="积分" align="center" width="105">
<template slot-scope="scope">
<span :class="scope.row.pointStatus === 1 ? 'point-refunded' : ''">
{{ scope.row.pointAmount }} / {{ scope.row.pointStatus === 1 ? '已退' : '已扣' }}
</span>
</template>
</el-table-column>
<el-table-column label="当前进度" prop="progressNote" min-width="210" show-overflow-tooltip />
<el-table-column label="更新时间" prop="updateTime" width="165" />
<el-table-column label="操作" align="center" width="145" fixed="right">
<template slot-scope="scope">
<el-button v-hasPermi="['app:customRequest:query']" type="text" icon="el-icon-view" size="mini" @click="handleView(scope.row)">详情</el-button>
<el-button v-if="scope.row.status !== 5" v-hasPermi="['app:customRequest:edit']" type="text" icon="el-icon-edit" size="mini" @click="handleUpdate(scope.row)">更新</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="定制需求详情" :visible.sync="detailOpen" width="760px" append-to-body>
<el-descriptions v-if="detail.id" :column="2" border>
<el-descriptions-item label="需求单号" :span="2">{{ detail.requestNo }}</el-descriptions-item>
<el-descriptions-item label="用户昵称">{{ detail.nickName || '-' }}</el-descriptions-item>
<el-descriptions-item label="用户账号">{{ detail.userName || '-' }}</el-descriptions-item>
<el-descriptions-item label="项目名称" :span="2">{{ detail.projectName }}</el-descriptions-item>
<el-descriptions-item label="技术栈" :span="2">{{ detail.techStackName || '-' }}</el-descriptions-item>
<el-descriptions-item label="项目需求" :span="2">
<div class="requirement-detail">{{ detail.requirementContent }}</div>
</el-descriptions-item>
<el-descriptions-item label="当前状态">
<el-tag :type="statusType(detail.status)" size="small">{{ statusLabel(detail.status) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="积分状态">{{ detail.pointAmount }}积分 / {{ detail.pointStatus === 1 ? '已退回' : '已扣除' }}</el-descriptions-item>
<el-descriptions-item label="当前进度" :span="2">{{ detail.progressNote || '-' }}</el-descriptions-item>
<el-descriptions-item v-if="detail.rejectReason" label="未通过原因" :span="2">{{ detail.rejectReason }}</el-descriptions-item>
<el-descriptions-item label="提交时间">{{ detail.createTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ detail.updateTime || '-' }}</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer"><el-button @click="detailOpen = false">关闭</el-button></div>
</el-dialog>
<el-dialog title="更新需求状态" :visible.sync="updateOpen" width="560px" append-to-body>
<el-form ref="updateForm" :model="form" :rules="rules" label-width="100px">
<el-form-item label="项目名称"><span>{{ form.projectName }}</span></el-form-item>
<el-form-item label="技术栈"><span>{{ form.techStackName || '-' }}</span></el-form-item>
<el-form-item label="新状态" prop="status">
<el-select v-model="form.status" placeholder="请选择状态" style="width: 100%" @change="handleStatusChange">
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" :disabled="form.pointStatus === 1 && item.value !== 5" />
</el-select>
</el-form-item>
<el-form-item v-if="form.status !== 5" label="进度说明" prop="progressNote">
<el-input v-model="form.progressNote" type="textarea" :rows="4" maxlength="300" show-word-limit placeholder="这段内容会展示给用户" />
</el-form-item>
<el-form-item v-if="form.status === 5" label="未通过原因" prop="rejectReason">
<el-input v-model="form.rejectReason" type="textarea" :rows="3" maxlength="300" show-word-limit placeholder="必填,保存后自动退回99积分" />
</el-form-item>
<el-alert v-if="form.status === 5 && form.pointStatus === 0" title="保存后将自动退回99积分,此操作不能撤销。" type="warning" :closable="false" show-icon />
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="updateOpen = false">取消</el-button>
<el-button type="primary" :loading="submitting" @click="submitUpdate">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getCustomRequest, listCustomRequest, updateCustomRequestStatus } from '@/api/app/customRequest'
export default {
name: 'CustomRequest',
data() {
return {
loading: false,
submitting: false,
showSearch: true,
total: 0,
requestList: [],
dateRange: [],
detailOpen: false,
updateOpen: false,
detail: {},
form: {},
statusOptions: [
{ value: 0, label: '待审核' },
{ value: 1, label: '审核中' },
{ value: 2, label: '已接单' },
{ value: 3, label: '开发中' },
{ value: 4, label: '已完成' },
{ value: 5, label: '审核未通过' }
],
statusProgressDefaults: {
0: '需求已提交,等待平台审核',
1: '平台正在审核您的项目需求',
2: '项目需求已通过审核,平台已接单',
3: '项目正在开发中,请耐心等待',
4: '项目已开发完成,请联系南音查看演示成果',
5: '需求审核未通过,99积分已退回'
},
queryParams: {
pageNum: 1,
pageSize: 10,
requestNo: undefined,
projectName: undefined,
techStackName: undefined,
userName: undefined,
status: undefined,
pointStatus: undefined
},
rules: {
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
progressNote: [{ required: true, message: '请填写进度说明', trigger: 'blur' }],
rejectReason: [{ required: true, message: '请填写审核未通过原因', trigger: 'blur' }]
}
}
},
created() { this.getList() },
methods: {
getList() {
this.loading = true
listCustomRequest(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.requestList = response.rows || []
this.total = response.total || 0
}).finally(() => { this.loading = false })
},
handleQuery() { this.queryParams.pageNum = 1; this.getList() },
resetQuery() { this.dateRange = []; this.resetForm('queryForm'); this.handleQuery() },
handleView(row) {
getCustomRequest(row.id).then(response => { this.detail = response.data; this.detailOpen = true })
},
handleUpdate(row) {
getCustomRequest(row.id).then(response => {
const data = response.data
this.form = {
id: data.id,
projectName: data.projectName,
techStackName: data.techStackName,
status: data.status,
pointStatus: data.pointStatus,
progressNote: data.progressNote || '',
rejectReason: data.rejectReason || ''
}
this.updateOpen = true
this.$nextTick(() => { if (this.$refs.updateForm) this.$refs.updateForm.clearValidate() })
})
},
handleStatusChange(status) {
this.form.progressNote = this.statusProgressDefaults[status] || ''
if (status !== 5) this.form.rejectReason = ''
this.$nextTick(() => {
if (this.$refs.updateForm) this.$refs.updateForm.clearValidate(['progressNote', 'rejectReason'])
})
},
submitUpdate() {
this.$refs.updateForm.validate(valid => {
if (!valid) return
const doUpdate = () => {
this.submitting = true
const updateData = Object.assign({}, this.form, {
progressNote: String(this.form.progressNote || '').trim(),
rejectReason: this.form.status === 5 ? String(this.form.rejectReason || '').trim() : ''
})
updateCustomRequestStatus(updateData).then(() => {
this.$modal.msgSuccess(this.form.status === 5 && this.form.pointStatus === 0 ? '已拒绝并退回99积分' : '状态更新成功')
this.updateOpen = false
this.getList()
}).finally(() => { this.submitting = false })
}
if (this.form.status === 5 && this.form.pointStatus === 0) {
this.$modal.confirm('确认审核不通过并退回99积分吗?退款后不能恢复为其他状态。').then(doUpdate).catch(() => {})
} else {
doUpdate()
}
})
},
statusLabel(status) {
const item = this.statusOptions.find(option => option.value === status)
return item ? item.label : '未知状态'
},
statusType(status) {
return { 0: 'info', 1: 'warning', 2: 'success', 3: 'primary', 4: 'success', 5: 'danger' }[status] || 'info'
}
}
}
</script>
<style scoped>
.secondary-text { margin-top: 2px; color: #909399; font-size: 12px; }
.point-refunded { color: #2b9660; }
.requirement-detail { white-space: pre-wrap; line-height: 1.7; }
</style>

View File

@@ -0,0 +1,155 @@
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="80px">
<el-form-item label="技术栈" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入技术栈名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="全部状态" clearable>
<el-option label="启用" value="0" />
<el-option label="停用" value="1" />
</el-select>
</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 v-hasPermi="['app:techStack:add']" type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['app:techStack:edit']" type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate()">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button v-hasPermi="['app:techStack:remove']" type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete()">删除</el-button>
</el-col>
<right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="techStackList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="技术栈名称" prop="name" min-width="220" />
<el-table-column label="排序" prop="sort" width="100" align="center" />
<el-table-column label="状态" width="100" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'" size="small">{{ scope.row.status === '0' ? '启用' : '停用' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark" min-width="240" show-overflow-tooltip />
<el-table-column label="更新时间" prop="updateTime" width="165" />
<el-table-column label="操作" width="140" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-hasPermi="['app:techStack:edit']" type="text" icon="el-icon-edit" size="mini" @click="handleUpdate(scope.row)">修改</el-button>
<el-button v-hasPermi="['app:techStack:remove']" type="text" icon="el-icon-delete" size="mini" @click="handleDelete(scope.row)">删除</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="520px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="技术栈名称" prop="name">
<el-input v-model="form.name" maxlength="50" show-word-limit placeholder="例如:UniApp + Spring Boot" />
</el-form-item>
<el-form-item label="显示排序" prop="sort">
<el-input-number v-model="form.sort" :min="0" :max="9999" controls-position="right" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">停用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" :rows="3" maxlength="500" show-word-limit 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 { addTechStack, delTechStack, getTechStack, listTechStack, updateTechStack } from '@/api/app/techStack'
export default {
name: 'TechStack',
data() {
return {
loading: false,
showSearch: true,
ids: [],
single: true,
multiple: true,
total: 0,
techStackList: [],
open: false,
title: '',
queryParams: { pageNum: 1, pageSize: 10, name: undefined, status: undefined },
form: {},
rules: {
name: [{ required: true, message: '请输入技术栈名称', trigger: 'blur' }],
sort: [{ required: true, message: '请输入显示排序', trigger: 'blur' }],
status: [{ required: true, message: '请选择状态', trigger: 'change' }]
}
}
},
created() { this.getList() },
methods: {
getList() {
this.loading = true
listTechStack(this.queryParams).then(response => {
this.techStackList = response.rows || []
this.total = response.total || 0
}).finally(() => { this.loading = false })
},
reset() {
this.form = { id: undefined, name: '', sort: 0, status: '0', remark: '' }
this.resetForm('form')
},
cancel() { this.open = false; this.reset() },
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.title = '新增技术栈'; this.open = true },
handleUpdate(row) {
this.reset()
const id = row && row.id ? row.id : this.ids[0]
getTechStack(id).then(response => {
this.form = response.data
this.title = '修改技术栈'
this.open = true
})
},
submitForm() {
this.$refs.form.validate(valid => {
if (!valid) return
const request = this.form.id ? updateTechStack(this.form) : addTechStack(this.form)
request.then(() => {
this.$modal.msgSuccess(this.form.id ? '修改成功' : '新增成功')
this.open = false
this.getList()
})
})
},
handleDelete(row) {
const ids = row && row.id ? row.id : this.ids
this.$modal.confirm('确认删除选中的技术栈吗?历史需求中的技术栈名称不会受影响。').then(() => delTechStack(ids)).then(() => {
this.$modal.msgSuccess('删除成功')
this.getList()
}).catch(() => {})
}
}
}
</script>

View File

@@ -26,7 +26,14 @@
<el-card shadow="never" class="publish-card">
<div class="list-toolbar">
<el-form ref="queryForm" :model="queryParams" :inline="true" size="small" class="query-form">
<el-form
ref="queryForm"
:model="queryParams"
:inline="true"
size="small"
class="query-form"
@submit.native.prevent="handleQuery"
>
<el-form-item prop="codeName">
<el-input
v-model="queryParams.codeName"
@@ -34,7 +41,6 @@
clearable
placeholder="搜索项目名称"
prefix-icon="el-icon-search"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
@@ -491,13 +497,11 @@ export default {
},
mounted() {
window.addEventListener('YIDAIMA_EXTENSION_READY', this.handleExtensionReady)
window.addEventListener('YIDAIMA_PUBLISH_STATUS', this.handleExtensionStatus)
window.addEventListener('YIDAIMA_PUBLISH_ACCEPTED', this.handlePublishAccepted)
this.pingExtension()
},
beforeDestroy() {
window.removeEventListener('YIDAIMA_EXTENSION_READY', this.handleExtensionReady)
window.removeEventListener('YIDAIMA_PUBLISH_STATUS', this.handleExtensionStatus)
window.removeEventListener('YIDAIMA_PUBLISH_ACCEPTED', this.handlePublishAccepted)
if (this.extensionTimer) clearTimeout(this.extensionTimer)
},
@@ -573,7 +577,7 @@ export default {
this.handleQuery()
},
statusMeta(status) {
return status === 'SUCCEEDED' ? PUBLISHED_STATUS_META : UNPUBLISHED_STATUS_META
return status ? PUBLISHED_STATUS_META : UNPUBLISHED_STATUS_META
},
isEmptyPublishTime(value) {
return !value || String(value).indexOf('1970-01-01') === 0
@@ -594,24 +598,6 @@ export default {
this.extensionConnected = true
this.extensionVersion = detail.version || ''
},
handleExtensionStatus(event) {
const detail = event && event.detail
if (!detail || detail.source !== 'yidaima-publisher-extension') return
this.getList()
if (detail.status === 'READY_TO_PUBLISH') {
this.$notify.success({
title: '资料填写完成',
message: '请在' + (PLATFORM_NAMES[detail.platform] || '平台') + '页面检查后手动发布',
duration: 6000
})
} else if (detail.status === 'FAILED' || detail.status === 'LOGIN_REQUIRED') {
this.$notify.warning({
title: detail.status === 'FAILED' ? '发布准备失败' : '需要登录',
message: detail.message || '请前往平台页面处理',
duration: 6000
})
}
},
handlePublishAccepted(event) {
const detail = event && event.detail
if (!detail || detail.source !== 'yidaima-publisher-extension') return

95
sql/contact_page.sql Normal file
View File

@@ -0,0 +1,95 @@
-- 小程序“关注我们”页面配置及后台菜单。
CREATE TABLE IF NOT EXISTS `app_contact_page` (
`id` bigint NOT NULL COMMENT '配置主键,固定为1',
`avatar_url` varchar(500) DEFAULT NULL COMMENT '头像地址',
`nickname` varchar(100) NOT NULL COMMENT '昵称',
`bio` varchar(500) DEFAULT NULL COMMENT '个人简介',
`background_url` varchar(500) DEFAULT NULL COMMENT '背景图地址,为空使用页面渐变背景',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序联系页面配置';
CREATE TABLE IF NOT EXISTS `app_contact_item` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '联系方式主键',
`type` varchar(30) NOT NULL DEFAULT 'custom' COMMENT '类型:qq/wechat/email/blog/custom',
`label` varchar(50) NOT NULL COMMENT '显示名称',
`contact_value` varchar(500) NOT NULL COMMENT '联系方式内容',
`icon_url` varchar(500) DEFAULT NULL COMMENT '自定义图标地址',
`qr_code_url` varchar(500) DEFAULT NULL COMMENT '二维码地址',
`action_type` varchar(20) NOT NULL DEFAULT 'copy' COMMENT '操作:copy/qrcode',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '状态:0启用,1停用',
`sort` int NOT NULL DEFAULT 0 COMMENT '显示排序',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `idx_app_contact_item_status_sort` (`status`, `sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='小程序联系方式';
INSERT INTO `app_contact_page`
(`id`, `avatar_url`, `nickname`, `bio`, `background_url`, `create_by`, `create_time`, `update_by`, `update_time`)
SELECT
1,
'https://img.yidaima.cn/%E5%A4%B4%E5%83%8F/9b889964f97e4d0c8f52f7b9ec0d04da.jpg',
'Nan Yin', '如果爱意难平,那就把它藏在心底吧!', NULL, 'admin', NOW(), '', NULL
WHERE NOT EXISTS (SELECT 1 FROM `app_contact_page` WHERE `id` = 1);
SET @contact_seed_needed := (SELECT COUNT(*) = 0 FROM `app_contact_item`);
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'qq', 'QQ', '594458910', NULL, 'https://img.yidaima.cn/feast/qq_qrcode.jpg', 'qrcode', '0', 10, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'wechat', '微信', 'forfeastcoding', NULL, 'https://img.yidaima.cn/feast/wx_qrcode.jpg', 'qrcode', '0', 20, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'email', '邮箱', '594458910@qq.com', NULL, NULL, 'copy', '0', 30, 'admin', NOW()
WHERE @contact_seed_needed = 1;
INSERT INTO `app_contact_item`
(`type`, `label`, `contact_value`, `icon_url`, `qr_code_url`, `action_type`, `status`, `sort`, `create_by`, `create_time`)
SELECT 'blog', '博客', 'http://www.yidaima.cn/', NULL, NULL, 'copy', '0', 40, 'admin', NOW()
WHERE @contact_seed_needed = 1;
SET @contact_parent_id := COALESCE(
(SELECT parent_id FROM sys_menu WHERE perms = 'app:resource:list' LIMIT 1),
(SELECT parent_id FROM sys_menu WHERE perms = 'app:article:list' LIMIT 1),
0
);
SET @contact_order_num := COALESCE(
(SELECT MAX(order_num) + 1 FROM sys_menu WHERE parent_id = @contact_parent_id),
1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT
'联系页面配置', @contact_parent_id, @contact_order_num,
'contact', 'app/contact/index', '', 1, 0,
'C', '0', '0', 'app:contact:query', 'phone', 'admin', NOW(), '', NULL,
'维护小程序关注页面资料和联系方式'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:contact:query');
SET @contact_menu_id := (
SELECT menu_id FROM sys_menu WHERE perms = 'app:contact:query' LIMIT 1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '联系页面修改', @contact_menu_id, 1, '', '', '', 1, 0,
'F', '0', '0', 'app:contact:edit', '#', 'admin', NOW(), '', NULL, ''
WHERE @contact_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:contact:edit');

175
sql/custom_request.sql Normal file
View File

@@ -0,0 +1,175 @@
-- 项目定制需求(99积分提交,审核不通过自动退回)
-- 可重复执行菜单部分;建表仅在表不存在时执行。
CREATE TABLE IF NOT EXISTS `app_tech_stack` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(50) NOT NULL COMMENT '技术栈名称',
`sort` int NOT NULL DEFAULT 0 COMMENT '显示排序',
`status` char(1) NOT NULL DEFAULT '0' COMMENT '0启用 1停用',
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_app_tech_stack_name` (`name`),
KEY `idx_app_tech_stack_status_sort` (`status`, `sort`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目定制技术栈表';
INSERT INTO `app_tech_stack` (`name`, `sort`, `status`, `remark`, `create_by`, `create_time`)
SELECT 'UniApp + Spring Boot', 1, '0', '适合跨端小程序项目', 'admin', NOW()
WHERE NOT EXISTS (SELECT 1 FROM `app_tech_stack` WHERE `name` = 'UniApp + Spring Boot');
INSERT INTO `app_tech_stack` (`name`, `sort`, `status`, `remark`, `create_by`, `create_time`)
SELECT 'Vue + Spring Boot', 2, '0', '适合管理系统和Web项目', 'admin', NOW()
WHERE NOT EXISTS (SELECT 1 FROM `app_tech_stack` WHERE `name` = 'Vue + Spring Boot');
INSERT INTO `app_tech_stack` (`name`, `sort`, `status`, `remark`, `create_by`, `create_time`)
SELECT '微信小程序原生 + Spring Boot', 3, '0', '适合微信原生小程序项目', 'admin', NOW()
WHERE NOT EXISTS (SELECT 1 FROM `app_tech_stack` WHERE `name` = '微信小程序原生 + Spring Boot');
INSERT INTO `app_tech_stack` (`name`, `sort`, `status`, `remark`, `create_by`, `create_time`)
SELECT '其他(请在需求中说明)', 99, '0', '未确定或需要其他技术栈', 'admin', NOW()
WHERE NOT EXISTS (SELECT 1 FROM `app_tech_stack` WHERE `name` = '其他(请在需求中说明)');
CREATE TABLE IF NOT EXISTS `app_custom_request` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`request_no` varchar(32) NOT NULL COMMENT '需求单号',
`user_id` bigint NOT NULL COMMENT '用户ID',
`project_name` varchar(30) NOT NULL COMMENT '项目名称',
`requirement_content` varchar(500) NOT NULL COMMENT '项目需求',
`tech_stack_id` bigint DEFAULT NULL COMMENT '技术栈ID',
`tech_stack_name` varchar(50) DEFAULT NULL COMMENT '提交时技术栈名称',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '0待审核 1审核中 2已接单 3开发中 4已完成 5审核未通过',
`progress_note` varchar(300) DEFAULT NULL COMMENT '当前进度说明',
`point_amount` int NOT NULL DEFAULT 99 COMMENT '提交扣除积分',
`point_status` tinyint NOT NULL DEFAULT 0 COMMENT '0已扣除 1已退回',
`reject_reason` varchar(300) DEFAULT NULL COMMENT '审核未通过原因',
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_custom_request_no` (`request_no`),
KEY `idx_custom_request_user_time` (`user_id`, `update_time`),
KEY `idx_custom_request_status_time` (`status`, `update_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目定制需求表';
-- 兼容已经创建过 app_custom_request 的数据库。
SET @tech_stack_id_exists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'app_custom_request' AND COLUMN_NAME = 'tech_stack_id'
);
SET @tech_stack_id_sql := IF(
@tech_stack_id_exists = 0,
'ALTER TABLE `app_custom_request` ADD COLUMN `tech_stack_id` bigint DEFAULT NULL COMMENT ''技术栈ID'' AFTER `requirement_content`',
'SELECT 1'
);
PREPARE tech_stack_id_stmt FROM @tech_stack_id_sql;
EXECUTE tech_stack_id_stmt;
DEALLOCATE PREPARE tech_stack_id_stmt;
SET @tech_stack_name_exists := (
SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'app_custom_request' AND COLUMN_NAME = 'tech_stack_name'
);
SET @tech_stack_name_sql := IF(
@tech_stack_name_exists = 0,
'ALTER TABLE `app_custom_request` ADD COLUMN `tech_stack_name` varchar(50) DEFAULT NULL COMMENT ''提交时技术栈名称'' AFTER `tech_stack_id`',
'SELECT 1'
);
PREPARE tech_stack_name_stmt FROM @tech_stack_name_sql;
EXECUTE tech_stack_name_stmt;
DEALLOCATE PREPARE tech_stack_name_stmt;
SET @custom_request_parent_id := COALESCE(
(SELECT parent_id FROM sys_menu WHERE perms = 'app:resource:list' LIMIT 1),
(SELECT parent_id FROM sys_menu WHERE perms = 'app:article:list' LIMIT 1),
0
);
SET @custom_request_order_num := COALESCE(
(SELECT MAX(order_num) + 1 FROM sys_menu WHERE parent_id = @custom_request_parent_id),
1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT
'项目定制', @custom_request_parent_id, @custom_request_order_num,
'customRequest', 'app/customRequest/index', '', 1, 0,
'C', '0', '0', 'app:customRequest:list', 'form', 'admin', NOW(), '', NULL,
'项目定制需求管理'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:customRequest:list');
SET @custom_request_menu_id := (
SELECT menu_id FROM sys_menu WHERE perms = 'app:customRequest:list' LIMIT 1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '定制需求查询', @custom_request_menu_id, 1, '', '', '', 1, 0,
'F', '0', '0', 'app:customRequest:query', '#', 'admin', NOW(), '', NULL, ''
WHERE @custom_request_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:customRequest:query');
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '定制状态修改', @custom_request_menu_id, 2, '', '', '', 1, 0,
'F', '0', '0', 'app:customRequest:edit', '#', 'admin', NOW(), '', NULL, ''
WHERE @custom_request_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:customRequest:edit');
SET @tech_stack_order_num := COALESCE(
(SELECT MAX(order_num) + 1 FROM sys_menu WHERE parent_id = @custom_request_parent_id),
1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT
'技术栈管理', @custom_request_parent_id, @tech_stack_order_num,
'techStack', 'app/techStack/index', '', 1, 0,
'C', '0', '0', 'app:techStack:list', 'tree-table', 'admin', NOW(), '', NULL,
'项目定制技术栈管理'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:techStack:list');
SET @tech_stack_menu_id := (
SELECT menu_id FROM sys_menu WHERE perms = 'app:techStack:list' LIMIT 1
);
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '技术栈查询', @tech_stack_menu_id, 1, '', '', '', 1, 0,
'F', '0', '0', 'app:techStack:query', '#', 'admin', NOW(), '', NULL, ''
WHERE @tech_stack_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:techStack:query');
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '技术栈新增', @tech_stack_menu_id, 2, '', '', '', 1, 0,
'F', '0', '0', 'app:techStack:add', '#', 'admin', NOW(), '', NULL, ''
WHERE @tech_stack_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:techStack:add');
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '技术栈修改', @tech_stack_menu_id, 3, '', '', '', 1, 0,
'F', '0', '0', 'app:techStack:edit', '#', 'admin', NOW(), '', NULL, ''
WHERE @tech_stack_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:techStack:edit');
INSERT INTO sys_menu
(menu_name, parent_id, order_num, path, component, query, is_frame, is_cache,
menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '技术栈删除', @tech_stack_menu_id, 4, '', '', '', 1, 0,
'F', '0', '0', 'app:techStack:remove', '#', 'admin', NOW(), '', NULL, ''
WHERE @tech_stack_menu_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE perms = 'app:techStack:remove');