扫码登陆
This commit is contained in:
parent
91649ea2dd
commit
f07d53220a
@ -30,6 +30,7 @@ namespace YD_WeChatApplet.Context
|
|||||||
public DbSet<G_Article> Article { get; set; }
|
public DbSet<G_Article> Article { get; set; }
|
||||||
public DbSet<Ai_SpecialAction> Ai_SpecialAction { get; set; }
|
public DbSet<Ai_SpecialAction> Ai_SpecialAction { get; set; }
|
||||||
public DbSet<Ai_SpecialLevel> Ai_SpecialLevel { get; set; }
|
public DbSet<Ai_SpecialLevel> Ai_SpecialLevel { get; set; }
|
||||||
|
public DbSet<Ai_ScanCodeLogin> Ai_ScanCodeLogin { get; set; }
|
||||||
public DbSet<N_SportsTestCategory> SportsTestCategory { get; set; }
|
public DbSet<N_SportsTestCategory> SportsTestCategory { get; set; }
|
||||||
public DbSet<N_HealthStandards> HealthStandards { get; set; }
|
public DbSet<N_HealthStandards> HealthStandards { get; set; }
|
||||||
public DbSet<N_AreaCategory> AreaCategory { get; set; }
|
public DbSet<N_AreaCategory> AreaCategory { get; set; }
|
||||||
|
34
WeChatApplet/Controllers/FrameworkController.cs
Normal file
34
WeChatApplet/Controllers/FrameworkController.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using YD_WeChatApplet.Api.Services.Interface;
|
||||||
|
using YD_WeChatApplet.Commons.Dto.HomeWork;
|
||||||
|
using YD_WeChatApplet.Commons.Dto.Patriarch;
|
||||||
|
using YD_WeChatApplet.Services;
|
||||||
|
|
||||||
|
namespace YD_WeChatApplet.Api.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 公共接口
|
||||||
|
/// </summary>
|
||||||
|
[ApiController]
|
||||||
|
[ApiExplorerSettings(GroupName = "v1")]
|
||||||
|
[Route("[controller]")]
|
||||||
|
public class FrameworkController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IFrameworkService _frameworkService;
|
||||||
|
public FrameworkController(IFrameworkService frameworkService)
|
||||||
|
{
|
||||||
|
_frameworkService = frameworkService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ai一体机扫描那登录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("ScanCodeLogin")]
|
||||||
|
public async Task<bool> ScanCodeLogin(string code)
|
||||||
|
{
|
||||||
|
return await _frameworkService.ScanCodeLogin(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
WeChatApplet/Services/Impl/FrameworkService.cs
Normal file
41
WeChatApplet/Services/Impl/FrameworkService.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using YD_WeChatApplet.Api.Services.Interface;
|
||||||
|
using YD_WeChatApplet.Api.SmartSportsEntitys;
|
||||||
|
using YD_WeChatApplet.Api.Utilities;
|
||||||
|
using YD_WeChatApplet.Context;
|
||||||
|
|
||||||
|
namespace YD_WeChatApplet.Api.Services.Impl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 公共接口
|
||||||
|
/// </summary>
|
||||||
|
public class FrameworkService : IFrameworkService
|
||||||
|
{
|
||||||
|
public SmartSportsContext _sportsContext;
|
||||||
|
public FrameworkService(SmartSportsContext sportsContext)
|
||||||
|
{
|
||||||
|
_sportsContext = sportsContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ai一体机扫描那登录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<bool> ScanCodeLogin(string code)
|
||||||
|
{
|
||||||
|
var entity = new Ai_ScanCodeLogin()
|
||||||
|
{
|
||||||
|
Code = code,
|
||||||
|
SchoolCode = UserLoginContext.Current.SchoolCode,
|
||||||
|
TeacherId = UserLoginContext.Current.UserId,
|
||||||
|
TeacherPhoneNo = UserLoginContext.Current.PhoneNo,
|
||||||
|
CreateDate = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
await _sportsContext.AddAsync(entity);
|
||||||
|
return await _sportsContext.SaveChangesAsync() > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
WeChatApplet/Services/Interface/IFrameworkService.cs
Normal file
15
WeChatApplet/Services/Interface/IFrameworkService.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
namespace YD_WeChatApplet.Api.Services.Interface
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 公共接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IFrameworkService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ai一体机扫描那登录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> ScanCodeLogin(string code);
|
||||||
|
}
|
||||||
|
}
|
62
WeChatApplet/SmartSportsEntitys/Ai_ScanCodeLogin.cs
Normal file
62
WeChatApplet/SmartSportsEntitys/Ai_ScanCodeLogin.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
namespace YD_WeChatApplet.Api.SmartSportsEntitys
|
||||||
|
{
|
||||||
|
[Table("Ai_ScanCodeLogin")]
|
||||||
|
public class Ai_ScanCodeLogin
|
||||||
|
{
|
||||||
|
[Key]
|
||||||
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
[Display(Description = "主键Id")]
|
||||||
|
[Comment("Id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// AI设备的唯一编码
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "AI设备的唯一编码")]
|
||||||
|
[Comment("AI设备的唯一编码")]
|
||||||
|
[Column(TypeName = "nvarchar(100)")]
|
||||||
|
public string Code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///学校编号
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "学校编号")]
|
||||||
|
[Comment("学校编号")]
|
||||||
|
[Column(TypeName = "nvarchar(100)")]
|
||||||
|
public string SchoolCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///老师Id
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "老师Id")]
|
||||||
|
[Comment("老师Id")]
|
||||||
|
[Column(TypeName = "int")]
|
||||||
|
public int TeacherId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///老师联系方式
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "老师联系方式")]
|
||||||
|
[Comment("老师联系方式")]
|
||||||
|
[Column(TypeName = "nvarchar(20)")]
|
||||||
|
public string TeacherPhoneNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///创建时间
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "创建时间")]
|
||||||
|
[Comment("创建时间")]
|
||||||
|
[Column(TypeName = "datetime")]
|
||||||
|
[Editable(true)]
|
||||||
|
public DateTime? CreateDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ using Autofac;
|
|||||||
using YD_WeChatApplet.Api.Services.Impl;
|
using YD_WeChatApplet.Api.Services.Impl;
|
||||||
using YD_WeChatApplet.Api.AutoMappers;
|
using YD_WeChatApplet.Api.AutoMappers;
|
||||||
using YD_WeChatApplet.Api.Filters;
|
using YD_WeChatApplet.Api.Filters;
|
||||||
|
using YD_WeChatApplet.Api.Services.Interface;
|
||||||
|
|
||||||
namespace YD_WeChatApplet
|
namespace YD_WeChatApplet
|
||||||
{
|
{
|
||||||
@ -66,6 +67,7 @@ namespace YD_WeChatApplet
|
|||||||
services.AddScoped<IClientSideService, ClientSideService>();
|
services.AddScoped<IClientSideService, ClientSideService>();
|
||||||
services.AddScoped<IUserPreferenceService, UserPreferenceService>();
|
services.AddScoped<IUserPreferenceService, UserPreferenceService>();
|
||||||
services.AddScoped<IServerService, ServerService>();
|
services.AddScoped<IServerService, ServerService>();
|
||||||
|
services.AddScoped<IFrameworkService, FrameworkService>();
|
||||||
|
|
||||||
services.AddScoped<ICacheService, RedisCacheService>();
|
services.AddScoped<ICacheService, RedisCacheService>();
|
||||||
services.AddSession();
|
services.AddSession();
|
||||||
@ -279,13 +281,13 @@ namespace YD_WeChatApplet
|
|||||||
//配置HttpContext
|
//配置HttpContext
|
||||||
app.UseStaticHttpContext();
|
app.UseStaticHttpContext();
|
||||||
|
|
||||||
//app.UseSwagger();
|
app.UseSwagger();
|
||||||
//app.UseSwaggerUI(c =>
|
app.UseSwaggerUI(c =>
|
||||||
//{
|
{
|
||||||
// //2个下拉框选项 选择对应的文档
|
//2个下拉框选项 选择对应的文档
|
||||||
// c.SwaggerEndpoint("/swagger/v1/swagger.json", "YD_WeChatApplet.Api");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "YD_WeChatApplet.Api");
|
||||||
// c.RoutePrefix = "";
|
c.RoutePrefix = "";
|
||||||
//});
|
});
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user