1
0

6 Коммиты d795452171 ... 1d027748d3

Автор SHA1 Сообщение Дата
  zoujiajian 1d027748d3 Merge branch 'master' into pre 1 неделя назад
  zoujiajian 0b8514c5ed fix 补差价商品特殊处理 1 неделя назад
  zoujiajian 7025a1a104 fix 凭证 1 неделя назад
  zoujiajian e3b8f26165 提供获取奈飞邮箱密码API 1 неделя назад
  zoujiajian 36b6685f75 Merge branch 'codex/multi-quantity-orders' 1 неделя назад
  zoujiajian c0cdef6656 fix 多件商品下单 2 недель назад

+ 2 - 0
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -10,6 +10,8 @@ import java.util.List;
  *创建时间:2022/12/27 18:30
  */
 public interface Constant {
+	/** Internal credential for protected integration endpoints. */
+	String CREDENTIAL_API_KEY = "Glyy6P0vxwh_lgfdigF_KXB9x2RRoetk";
 	/**
 	 * 一天秒数
 	 */

+ 7 - 3
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -475,8 +475,12 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			throw BusinessRuntimeException.getInstance("购买数量必须大于0");
 		}
 		payRequest.setNum(quantity);
-		boolean multiQuantity = quantity > 1 && sku != null && Boolean.TRUE.equals(sku.getIsMultiQuantity());
-		if (quantity > 1 && !multiQuantity) {
+		// 补差价商品的数量表示差价金额,沿用原有的特殊下单流程,不能进入
+		// 普通多件商品的独立票券履约逻辑,也不能被普通 SKU 多件开关拦截。
+		boolean priceDifferenceOrder = goodsDon.getType() != null && goodsDon.getType() == 5;
+		boolean multiQuantity = !priceDifferenceOrder && quantity > 1 && sku != null
+				&& Boolean.TRUE.equals(sku.getIsMultiQuantity());
+		if (quantity > 1 && !priceDifferenceOrder && !multiQuantity) {
 			throw BusinessRuntimeException.getInstance("该规格不支持一次购买多个");
 		}
 		if (multiQuantity) {
@@ -487,7 +491,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			}
 		}
 		//是否是补差价订单
-		if (goodsDon.getType() != null && goodsDon.getType() == 5) {
+		if (priceDifferenceOrder) {
 			return generateDifferOrderDon(payRequest, goodsDon, sku);
 		}
 		if (goodsDon == null || !goodsDon.getStatus()) {

+ 1 - 0
netflix-web/src/main/java/com/cyksj/config/SaTokenConfigure.java

@@ -39,6 +39,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
 						"/manage/account/get/latest/orders",
 						"/manage/account/get/expired/accounts",
 						"/manage/account/put/account",
+						"/manage/account/netflix/credential",
 						"/manage/coupon/get/classificationList",
 						"/manage/coupon/get/couponList",
 						"/manage/order/wx/refund/notify",

+ 10 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/AdminController.java

@@ -30,6 +30,8 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.List;
@@ -297,7 +299,14 @@ public class AdminController {
      * 银河用户token信息
      */
     @GetMapping("/get/yh/user/token")
-    public Result<String> getYhUserToken(Long userId) {
+    public Result<String> getYhUserToken(
+            @RequestHeader(value = "X-API-Key", required = false) String apiKey,
+            @RequestParam Long userId) {
+        if (StrUtil.isBlank(apiKey)
+                || !MessageDigest.isEqual(com.cyksj.common.constant.Constant.CREDENTIAL_API_KEY.getBytes(StandardCharsets.UTF_8),
+                apiKey.getBytes(StandardCharsets.UTF_8))) {
+            throw BusinessRuntimeException.getInstance("凭证无效");
+        }
         StpUserUtil.login(userId);
         return GatewayResponse.SUCCESS.newBuilder().toResult(StpUserUtil.getTokenValue());
     }

+ 36 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -66,6 +66,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -131,6 +133,40 @@ public class CmsAccountController {
 
 	private final EnvCommonService envCommonService;
 
+    @GetMapping("/netflix/credential")
+    public Result<Map<String, String>> getNetflixCredential(
+            @RequestHeader(value = "X-API-Key", required = false) String apiKey,
+            @RequestParam String account) {
+        if (StrUtil.isBlank(apiKey)
+                || !MessageDigest.isEqual(Constant.CREDENTIAL_API_KEY.getBytes(StandardCharsets.UTF_8),
+                apiKey.getBytes(StandardCharsets.UTF_8))) {
+            throw BusinessRuntimeException.getInstance("凭证无效");
+        }
+        if (StrUtil.isBlank(account)) {
+            throw BusinessRuntimeException.getInstance("账号不能为空");
+        }
+        account = account.trim();
+        Account netflixAccount = accountService.getOne(Wrappers.lambdaQuery(Account.class)
+                .eq(Account::getGoodsId, Constant.NETFLIX_GID)
+                .eq(Account::getAccount, account)
+                .select(Account::getAccount, Account::getGptEmailPwd)
+                .last("limit 1"));
+        if (netflixAccount == null) {
+            throw BusinessRuntimeException.getInstance("奈飞账号不存在");
+        }
+
+        Map<String, String> credential = new LinkedHashMap<>(2);
+        credential.put("email", netflixAccount.getAccount());
+        //邮箱密码
+        String gptEmailPwd = netflixAccount.getGptEmailPwd();
+        if (StrUtil.isEmpty(gptEmailPwd)) {
+            SysEmail sysEmail = sysEmailMapper.selectOne(Wrappers.lambdaQuery(SysEmail.class).eq(SysEmail::getEmail, account).last("limit 1"));
+            if (sysEmail != null) gptEmailPwd = sysEmail.getPassword();
+        }
+        credential.put("password", gptEmailPwd);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(credential);
+    }
+
 	@GetMapping("/get")
 	@SaCheckPermission("account:view")
 	public Result<SearchResult<AccountView>> get(String title, Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths, Boolean isMjMirror, String orderNo, Boolean isEmpty) {