public object Do_ExchangeHeart(BaseApi baseApi) { ExchangeHeartParam exchangeHeartParam = JsonConvert.DeserializeObject <ExchangeHeartParam>(baseApi.param.ToString()); if (exchangeHeartParam == null) { throw new ApiException(CodeMessage.InvalidParam, "InvalidParam"); } MemberDao memberDao = new MemberDao(); string memberId = Utils.GetMemberID(baseApi.token); RemoteStoreMember remoteStoreMember = memberDao.GetRemoteStoreMember(exchangeHeartParam.storeMemberId); if (remoteStoreMember == null) { throw new ApiException(CodeMessage.RemoteStoreMemberNotExist, "RemoteStoreMemberNotExist"); } MemberInfo memberInfo = memberDao.GetMemberInfo(memberId); int heart = exchangeHeartParam.point / remoteStoreMember.storeRate; exchangeHeartParam.point = exchangeHeartParam.point - (exchangeHeartParam.point % remoteStoreMember.storeRate); int limitAdd = memberDao.GetLimitAdd(remoteStoreMember.storeId, memberId); int todayChangeHeart = memberDao.GetTodayChangeHeart(memberId, remoteStoreMember.storeId); if (todayChangeHeart + heart > remoteStoreMember.exchangeLimit + limitAdd) { throw new ApiException(CodeMessage.OverTheStoreLimit, "OverTheStoreLimit"); } if (!memberDao.AddCommitPoint(memberId, remoteStoreMember, exchangeHeartParam.point, heart, memberInfo.heart)) { throw new ApiException(CodeMessage.ExchangeHeartError, "ExchangeHeartError"); } return(""); }