增加小程序自动退款开关接口

This commit is contained in:
yuyang 2021-12-28 16:52:10 +08:00
parent 5c29b15928
commit b111ca56df
5 changed files with 59 additions and 0 deletions

View File

@ -288,6 +288,24 @@ public class XhpcAppUserController extends BaseController {
} }
/**
* 设置小程序用户自动退款功能
* @param
*/
@ApiOperation("设置小程序用户自动退款功能")
@PostMapping("/updateIsRefund")
public R<?> updateIsRefund(@RequestBody Map<String, Object> map) {
if(map !=null){
Long userId = Long.parseLong(map.get("userId").toString());
Integer userType = Integer.parseInt(map.get("userType").toString());
Integer isRefund = Integer.parseInt(map.get("isRefund").toString());
return iXhpcAppUserUserService.updateIsRefund(userId,userType,isRefund);
}
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
public static void main(String[] args) { public static void main(String[] args) {
try { try {

View File

@ -72,4 +72,8 @@ public interface XhpcAppUserMapper {
* @return 结果 * @return 结果
*/ */
public XhpcAppUser getAppUserByOpenid(@Param("openid") String openid); public XhpcAppUser getAppUserByOpenid(@Param("openid") String openid);
int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
} }

View File

@ -97,4 +97,10 @@ public interface IXhpcAppUserUserService {
* @return * @return
*/ */
public R<?> logout(String phone, String code); public R<?> logout(String phone, String code);
/**
* 设置小程序用户自动退款功能
* @return
*/
public R<?> updateIsRefund(Long userId, Integer userType,Integer isRefund);
} }

View File

@ -359,4 +359,28 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
redisService.deleteObject("pvToken:" + phone); redisService.deleteObject("pvToken:" + phone);
return R.ok(); return R.ok();
} }
@Override
public R<?> updateIsRefund(Long userId, Integer userType, Integer isRefund) {
if(isRefund>2 || isRefund<0){
return R.fail(HttpStatus.ERROR_STATUS, "参数错误");
}
if(userType==0){
int i = xhpcAppUserMapper.updateUserIsRefund(userId, isRefund);
if(i>0){
return R.ok();
}else{
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
}else if(userType==2){
int i = xhpcAppUserMapper.updateCommunityIsRefund(userId, isRefund);
if(i>0){
return R.ok();
}else{
return R.fail(HttpStatus.ERROR_STATUS, "修改失败");
}
}
return R.fail(HttpStatus.ERROR_STATUS, "参数错误");
}
} }

View File

@ -221,4 +221,11 @@
from xhpc_app_user from xhpc_app_user
WHERE del_flag = 0 and (weixin_open_id = #{openid}or alipay_open_id = #{openid}) LIMIT 1 WHERE del_flag = 0 and (weixin_open_id = #{openid}or alipay_open_id = #{openid}) LIMIT 1
</select> </select>
<update id="updateUserIsRefund">
update xhpc_app_user set is_refund=#{isRefund} where app_user_id=#{userId}
</update>
<update id="updateCommunityIsRefund">
update xhpc_community_personnel set is_refund=#{isRefund} where community_personnel_id=#{userId}
</update>
</mapper> </mapper>