From 56fcde8c93a1a10bc50fac775e370a2db57f520e Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 20 一月 2026 17:08:30 +0800
Subject: [PATCH] 小程序 接口开发
---
server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java | 75 +++++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 1 deletions(-)
diff --git a/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java b/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
index d7b26b3..b334fb7 100644
--- a/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/dmmall_service/src/main/java/com/doumee/core/utils/Constants.java
@@ -1,15 +1,22 @@
package com.doumee.core.utils;
+import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
+import com.doumee.core.wx.WxMiniConfig;
import com.doumee.dao.business.model.Areas;
import io.swagger.annotations.ApiModelProperty;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+@Slf4j
public class Constants {
public static final String[] ALL_SPELL_LIST_FIRST = new String[]{"A", "B", "C", "D", "E", "F", "G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
@@ -77,6 +84,11 @@
public static final String CASH_EXCHANGE_INTEGRAL_RATA = "CASH_EXCHANGE_INTEGRAL_RATA";//鐜伴噾-绉垎鍏戞崲姣斾緥锛�1鍏冨彲寰楀埌XXX绉垎锛�
+ public static final String MAIL_CONFIG = "MAIL_CONFIG";
+ public static final String FIRST_WEIGHT = "FIRST_WEIGHT";
+ public static final String CONTINUE_WEIGHT = "CONTINUE_WEIGHT";
+ public static final String FIRST_FEE = "FIRST_FEE";
+ public static final String CONTINUE_FEE = "CONTINUE_FEE";
public static final String INITIAL_ROLE = "INITIAL_ROLE";
@@ -132,6 +144,18 @@
public static final String COFFEE_ARTICLE_BACKGROUND = "COFFEE_ARTICLE_BACKGROUND";
public static final String TRANSFER_FILE = "TRANSFER_FILE";
+
+ public static final String INVITE_RULE = "INVITE_RULE";
+
+ public static final String INVITE_IMG = "INVITE_IMG";
+
+ public static final String SHARES_FILE = "SHARES_FILE";
+
+ public static final String INVITE_IMG_URL = "INVITE_IMG_URL";
+
+
+
+
public interface RedisKeys {
@@ -873,7 +897,7 @@
SHOP_ORDER(21,"娑堣垂杩旂Н鍒�","浼氬憳${param}浜ゆ槗鎴愬姛锛岃幏寰�${param1}绉垎",0,0),//${param}鏄电О-鎵嬫満鍙�
- SHOP_ORDER_CANCEL(22,"閫�鍗曟墸闄�","浜ゆ槗閫�娆鹃��鍥烇紝娑堣��100绉垎",0,0),
+ SHOP_ORDER_CANCEL(22,"璁㈠崟鍙栨秷閫�鍥�","璁㈠崟鍙栨秷閫�鍥烇紝閫�鍥�${param}绉垎",0,0),
SHOP_SYSTEM_RECHARGE(23,"绉垎鍙戞斁","骞冲彴濂栧姳锛岃幏寰�${param}绉垎",0,0),
SHOP_SYSTEM_DEDUCT(24,"绉垎鎵i櫎","骞冲彴鎵e噺锛屾秷鑰�${param}绉垎",0,0),
@@ -1176,6 +1200,7 @@
public enum UserActionType {
CHANGE_SHOP(0, "缁忛攢鍟嗘洿鎹�","鐢便��${param1}銆戜簬銆�${param2}銆戯紝杩涜銆愮粡閿�鍟嗘洿鎹€��" ),
+ CHANGE_SALETYPE(1, "缁忛攢鍟嗘洿鎹㈤攢鍞ā寮�","鐢便��${param1}銆戜簬銆�${param2}銆戯紝杩涜銆愰攢鍞ā寮忓彉鏇淬��" ),
;
// 鎴愬憳鍙橀噺
@@ -1222,4 +1247,52 @@
this.info = info;
}
}
+
+
+ public static InputStream generateWxMiniImgStream(String scene, String page, boolean isUsePage) {
+ //鐢熸垚鍥剧墖涓婁紶OSS
+ Map<String,Object> body = new HashMap<>();
+ // 鍦烘櫙鐮侊紝涓庡墠绔害瀹氾紝鏈�缁堟槸闇�瑕佸墠绔В鏋�
+ body.put("scene", scene);
+ // 姝e紡鐗堜负 "release"锛屼綋楠岀増涓� "trial"锛屽紑鍙戠増涓� "develop"銆傞粯璁ゆ槸姝e紡鐗堛��
+ String env_version = "release";
+ body.put("env_version", env_version);
+ if(isUsePage){
+ body.put("page", page);
+ }
+ //body.put("page", "pages/index/index");
+ // 閫忔槑锛屾牴鎹綘鐨勫満鏅嚜琛岃缃産ody鍙傛暟
+ body.put("is_hyaline", true);
+ try {
+ WxMaCodeLineColor codeLineColor = new WxMaCodeLineColor("0","0","0");
+ byte[] bytes = WxMiniConfig.wxMaService.getQrcodeService().createWxaCodeUnlimitBytes
+ (scene,null,false,env_version,300,false,codeLineColor,false);
+ if (bytes !=null) {
+ InputStream inputStream = new ByteArrayInputStream(bytes);
+ /* ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int len = -1;
+ while ((len = inputStream.read(buffer)) != -1) {
+ baos.write(buffer, 0, len);
+ }
+ System.out.println("data:mediatype;base64," + Base64.getEncoder().encodeToString(baos.toByteArray()));*/
+ log.error("鐢熸垚灏忕▼搴忕爜鎴愬姛:============"+inputStream.available());
+ return inputStream;
+ }else{
+ log.error("鐢熸垚灏忕▼搴忕爜澶辫触:============");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("鐢熸垚灏忕▼搴忕爜澶辫触:============"+e.getMessage());
+ }
+ return null;
+ }
+
+
+ public static Integer getInviteCode(String inviteStr){
+ if(StringUtils.isNotBlank(inviteStr)&&inviteStr.startsWith("m_")){
+ return Integer.valueOf(inviteStr.replace("m_",""));
+ }
+ return null;
+ }
}
--
Gitblit v1.9.3