【修复】修复用户签到,判断重复签到后未截断操作并进行回调反馈的情况。

This commit is contained in:
jianweie code
2023-09-02 01:56:43 +08:00
parent 0a07f3e005
commit 8e8d61edfa
2 changed files with 79 additions and 145 deletions

View File

@@ -182,18 +182,18 @@ namespace CoreCms.Net.Services
/// <param name="userId"></param>
public async Task<WebApiCallBack> Sign(int userId)
{
using (var container = _serviceProvider.CreateScope())
{
var _settingServices = container.ServiceProvider.GetService<ICoreCmsSettingServices>();
using var container = _serviceProvider.CreateScope();
var settingServices = container.ServiceProvider.GetService<ICoreCmsSettingServices>();
var jm = new WebApiCallBack();
var res = await IsSign(userId);
if (res.status)
{
jm.msg = "今天已经签到,无需重复签到";
return jm;
}
//获取店铺签到积分设置
var allConfigs = await _settingServices.GetConfigDictionaries();
var allConfigs = await settingServices.GetConfigDictionaries();
var signPointType = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.SignPointType).ObjectToInt();
@@ -279,4 +279,3 @@ namespace CoreCms.Net.Services
}
}
}
}

View File

@@ -1,65 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using CoreCms.Net.Caching.AccressToken;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.WeChat.Service.HttpClients;
using Microsoft.AspNetCore.Authorization;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 微信小程序自定义交易组件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class WeChatTransactionComponentController : ControllerBase
{
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
/// <summary>
///
/// </summary>
/// <param name="weChatApiHttpClientFactory"></param>
public WeChatTransactionComponentController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
{
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
}
#region
/// <summary>
/// 获取用户是否订阅
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> CheckScene(FMIntId entity)
{
var jm = new WebApiCallBack();
//获取小程序认证
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var sceneRequest = new ShopSceneCheckRequest();
sceneRequest.AccessToken = accessToken;
sceneRequest.Scene = entity.id;
var sceneResponse = await client.ExecuteShopSceneCheckAsync(sceneRequest);
jm.status = true;
jm.data = sceneResponse;
return jm;
}
#endregion
}
}