From c3acab1631820764b91d8d339d7fea5be05960d8 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 20 八月 2019 17:31:32 +0800
Subject: [PATCH] 签到

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java |   39 ++++++++++++++++++---------------------
 1 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java
index c98c514..672a63f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskClassServiceImpl.java
@@ -55,12 +55,10 @@
 	@Override
 	public List<IntegralTaskClassVO> getIntegralTaskClassVO(Long uid, long start, int count) {
 		// 鐢ㄦ埛绛惧埌
-		Integer baseGoldCoin = 5;
-		boolean dailySign = false;
-		if (start == 0) { // 绗竴椤电鍒�
+		Integer signState = 0;
+		if (start == 0) {
 			try { 
-				baseGoldCoin = finishedDailySign(uid);
-				dailySign = true;
+				signState = finishedDailySign(uid);
 			} catch (Exception e) {
 				e.printStackTrace();
 			}
@@ -80,15 +78,18 @@
 			if (taskNum == null)
 				continue;
 
-			// 鐩墠鍙湁绛惧埌鍙樼伆
 			UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey();
 			if (uniqueKey == UniqueKeyEnum.dailySign) {
-				taskClassVO.setTotalCoin(baseGoldCoin);
-				taskClassVO.setLightUp(dailySign);
+				if (signState == 0) {
+					taskClassVO.setLightUp(true); // 绛惧埌澶辫触
+				} else if (signState == 1) {
+					taskClassVO.setLightUp(false);
+				} else if (signState == 2) {
+					taskClassVO.setLightUp(false);
+				}
 			} else {
 				taskClassVO.setLightUp(true);
 			}
-			
 			
 			Integer dateType = 1; // 鏌ヨ褰撴棩
 			if (uniqueKey == UniqueKeyEnum.orderReward)
@@ -104,7 +105,7 @@
 			}
 			progress = progress.replace("{宸插畬鎴恾", countFinished + "").replace("{鎬讳换鍔", taskNum + "");
 			
-			if (!dailySign && uniqueKey == UniqueKeyEnum.dailySign) {
+			if (signState == 0 && uniqueKey == UniqueKeyEnum.dailySign) {
 				progress = "鏈鍒�";
 				taskClassVO.setBtnName("绛惧埌");
 			} 
@@ -132,39 +133,34 @@
 	 */
 	@Transactional
 	public Integer finishedDailySign(long uid) throws Exception{
-		Integer baseGoldCoin = 5;
-		
 		IntegralTaskClass taskClass = getByUniqueKey(UniqueKeyEnum.dailySign.name());
 		if (taskClass == null || taskClass.getState() == null || taskClass.getState() != 1)
-			return baseGoldCoin;
+			throw new Exception("鎶涘嚭寮傚父锛氫换鍔″垎绫讳笉瀛樺湪");
 
 		Long cid = taskClass.getId();
-		
 		// 浠婃棩宸茬鍒板畬鎴�
 		if (integralTaskRecordService.isToDaySign(uid, cid))
-			return baseGoldCoin;
+			return 2;
 
 		// 浠诲姟
 		Integer num = integralTaskRecordService.getNowdaySignNum(uid, cid);
 		String uniqueKey = UniqueKeyEnum.dailySign.name() + num;
 		IntegralTask integralTask = integralTaskService.getByCidAndUniqueKey(cid, uniqueKey);
 		if (integralTask == null)
-			return baseGoldCoin;
+			throw new Exception("鎶涘嚭寮傚父锛氫换鍔′笉瀛樺湪");
 
 		UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
 		if (userInfoExtra == null)
-			return baseGoldCoin;
+			throw new Exception("鎶涘嚭寮傚父锛氶澶栦俊鎭笉瀛樺湪");
 
 		UserRank userRank = userInfoExtra.getUserRank();
 		if (userRank == null)
-			return baseGoldCoin;
+			throw new Exception("鎶涘嚭寮傚父锛氱瓑绾т俊鎭笉瀛樺湪");
 
 		Integer goldCoin = integralTask.getGoldCoin();
 		Integer baseDoubleNum = integralTask.getDoubleNum();
 		if (baseDoubleNum != null && baseDoubleNum > 0)
 			goldCoin = goldCoin * baseDoubleNum;
-		
-		baseGoldCoin = goldCoin;
 		
 		// 鏍规嵁绛夌骇璁$畻鏄惁澧炲姞鎴栧姞鍊�
 		Long taskId = integralTask.getId();
@@ -181,7 +177,8 @@
 		}
 		// 鍔犲叆璁板綍
 		integralTaskRecordService.finishedTask(uid, cid, taskId, goldCoin);
-		return baseGoldCoin;
+		
+		return 1;
 	}
 	
 	

--
Gitblit v1.8.0