23
This commit is contained in:
74
MyCode.Project.WebApi/Controllers/CommonController.cs
Normal file
74
MyCode.Project.WebApi/Controllers/CommonController.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using IO.Swagger.Api;
|
||||
using IO.Swagger.Model;
|
||||
using MyCode.Project.Domain.Config;
|
||||
using MyCode.Project.Domain.Message.Act.SendSms;
|
||||
using MyCode.Project.Services;
|
||||
|
||||
using System.Web.Http;
|
||||
|
||||
namespace MyCode.Project.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 测试接口
|
||||
/// </summary>
|
||||
public class CommonController : BaseAPIController
|
||||
{
|
||||
|
||||
private ISmsService _smsService;
|
||||
//private ICommonService _commonService;
|
||||
private IAdminCommonApi _commonApi;
|
||||
|
||||
public CommonController(ISmsService smsService
|
||||
, ICommonService commonService)
|
||||
{
|
||||
_smsService = smsService;
|
||||
//_commonService = commonService;
|
||||
_commonApi = new AsminCommonApi(SystemConfig.NCApiUrl);
|
||||
}
|
||||
|
||||
#region SendCode(发送验证码)
|
||||
|
||||
/// <summary>
|
||||
/// 发送验证码
|
||||
/// </summary>
|
||||
/// <param name="act">发送验证码 操作</param>
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public void SendSmsCode(SendSmsAct act)
|
||||
{
|
||||
this._smsService.SendCodeForMini(act.Mobile, act.Type);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValidateCode(验证手机验证码)
|
||||
/// <summary>
|
||||
/// 验证手机验证码
|
||||
/// </summary>
|
||||
/// <param name="act">验证码 操作</param>
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public void ValidateCode(VerifyCodeAct act)
|
||||
{
|
||||
this._smsService.ValidateCode(act.Mobile, act.Code);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ValidateCode(获取七牛上传凭证)
|
||||
/// <summary>
|
||||
/// 获取七牛上传凭证
|
||||
/// </summary>
|
||||
/// <param name="query">验证码 操作</param>
|
||||
[HttpPost]
|
||||
public string GetQiNiuUploadToken(GetUploadTokenQuery query)
|
||||
{
|
||||
var token = _commonApi.CommonGetUploadToken(query, SystemConfig.NCApiToken);
|
||||
token = token.Replace("\"", "");
|
||||
return token;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user