Bläddra i källkod

Merge branch 'gift_card_func' into pre

zoujiajian 2 år sedan
förälder
incheckning
989b8a6167

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/mapper/GiftCardUserRecordMapper.java

@@ -14,6 +14,6 @@ import java.math.BigDecimal;
  *创建时间:2023/8/28 12:01
  */
 public interface GiftCardUserRecordMapper extends BaseMapper<GiftCardUserRecord> {
-	@Update("update gift_card_user_record set remain_crash = remain_crash + #{addCash},is_used = 0 where id = #{gcId} and remain_crash = #{remainCash}")
+	@Update("update gift_card_user_record set remain_cash = remain_cash + #{addCash},is_used = 0 where id = #{gcId} and remain_cash = #{remainCash}")
 	Integer updateGiftCardRemainCash(@Param("gcId") Long gcId, @Param("addCash") BigDecimal addCash, @Param("remainCash") BigDecimal remainCash);
 }

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -527,7 +527,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		if (!giftCardUserRecord.getIsPay()) {
 			throw BusinessRuntimeException.getInstance("无效礼品卡,好友未购买");
 		}
-		if (giftCardUserRecord.getUserId().equals(userId)) {
+		List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
+		if (relationUserIdList.contains(userId)) {
 			throw BusinessRuntimeException.getInstance("无法领取自己购买的礼品卡");
 		}
 		if (giftCardUserRecord.getToUserId() != 0 && !giftCardUserRecord.getToUserId().equals(userId)) {
@@ -556,7 +557,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 					log.info("礼品卡id:{}虚拟车票skuId:{}不存在", giftCardUserRecord.getId(), gcSkuId);
 					throw BusinessRuntimeException.getInstance("该礼品卡对应的虚拟卡不存在,请联系客服");
 				}
-				List<Long> relationUserIdList = userBindRelationService.getRelationUserIdList(userId, null);
 				if (relationId != null) {
 					GroupsRelation groupsRelation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
 							.in(GroupsRelation::getUserId, relationUserIdList)

+ 24 - 0
netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java

@@ -215,6 +215,30 @@ public class AuthorizationController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(wxAuthUrl);
     }
 
+    /**
+     * 不同域名跳转 微信授权登录
+     */
+    @GetMapping("/do/wx/authLogin/")
+    public Result<String> doWxAuthorize(Long sharedId, Integer dsType, Long popularizeId, String dsCode, String type, String loginUrl, String callbackType, String callback) throws Exception {
+        Long mappingId = SEQUENCE.nextId();
+        if (StrUtil.isEmpty(loginUrl)) {
+            loginUrl = wxOpenPlatYHLXLoginConfig.getLoginUrl();
+        }
+        if (StrUtil.isNotBlank(type)) {
+            loginUrl = String.format("https://nf.video/%s/web", type);
+        }
+        redisService.set(mappingId.toString(), loginUrl, 60 * 60 * 24L);
+        if (StrUtil.isNotBlank(dsCode)) {
+            dsCode = dsCode.trim();
+        }
+        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId).setDsCode(dsCode)
+                .setCk(callback)
+                .setCt(callbackType);
+        String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
+        String wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getRedirectUri());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(wxAuthUrl);
+    }
+
     /**
      * 网页微信授权后跳转
      */