Authored by tanling

fix

... ... @@ -16,6 +16,8 @@ public interface IMiniappMsgFormDAO {
MiniappMsgForm selectLastedAvailabByOrderCode(String orderCode);
MiniappMsgForm selectLastedAvailabByUid(String uid);
int updateByPrimaryKeySelective(MiniappMsgForm record);
int updateByPrimaryKey(MiniappMsgForm record);
... ...
... ... @@ -21,6 +21,17 @@
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectLastedAvailabByUid" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from miniapp_msg_form
where uid = #{uid,jdbcType=VARCHAR}
and available_times > 0
and create_time > unix_timestamp(now()) - 7*24*60*60
order by create_time
limit 1
</select>
<select id="selectByOrderCode" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
... ...
... ... @@ -4,7 +4,7 @@
<parent>
<groupId>com.yoho</groupId>
<artifactId>yoho-starter</artifactId>
<version>1.3.2-SNAPSHOT</version>
<version>1.3.4-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf</groupId>
... ...
... ... @@ -57,8 +57,8 @@ public class MiniServiceAppImpl implements IMiniAppService {
logger.info("Enter sendMiniappMsg. param is {}", reqBO);
// 入口参数 order_code不能为空
if (StringUtils.isBlank(reqBO.getOrderCode())){
logger.warn("sendMiniappMsg orderCode not exist");
if (StringUtils.isBlank(reqBO.getUid())){
logger.warn("sendMiniappMsg uid not exist");
throw new ServiceException(ServiceError.WECHAT_PARAM_ISNULL);
}
... ... @@ -73,7 +73,7 @@ public class MiniServiceAppImpl implements IMiniAppService {
}
// 查询时间(可用次数>1 && 时间在7天之内的消息)
MiniappMsgForm miniappMsgForm = miniappMsgFormDAO.selectLastedAvailabByOrderCode(reqBO.getOrderCode());
MiniappMsgForm miniappMsgForm = miniappMsgFormDAO.selectLastedAvailabByUid(reqBO.getUid());
if (miniappMsgForm == null
|| StringUtils.isBlank(miniappMsgForm.getFormId())
|| StringUtils.isBlank(miniappMsgForm.getOpenId())){
... ... @@ -98,7 +98,7 @@ public class MiniServiceAppImpl implements IMiniAppService {
miniappMsgForm.setAvailableTimes(0);
miniappMsgFormDAO.updateByPrimaryKey(miniappMsgForm);
MiniappMsgForm miniappMsgFormNew = miniappMsgFormDAO.selectLastedAvailabByOrderCode(reqBO.getOrderCode());
MiniappMsgForm miniappMsgFormNew = miniappMsgFormDAO.selectLastedAvailabByUid(reqBO.getUid());
if (miniappMsgForm == null
|| StringUtils.isBlank(miniappMsgForm.getFormId())
... ...