feat 修改规范,添加登录逻辑
This commit is contained in:
parent
50007e260b
commit
960984831e
@ -15,10 +15,14 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ARW.Common
|
||||
{
|
||||
public class AliyunMsgHelper
|
||||
public static class AliyunMsgHelper
|
||||
{
|
||||
|
||||
public static void SendMsgCode(string phone)
|
||||
/// <summary>
|
||||
/// 发送手机验证码
|
||||
/// </summary>
|
||||
/// <param name="phone"></param>
|
||||
public static void SendPhoneMsgCode(string phone)
|
||||
{
|
||||
var accessKeyId = AppSettings.GetConfig("AARWYUN_MSG:accessKeyId");
|
||||
var accessSecret = AppSettings.GetConfig("AARWYUN_MSG:accessSecret");
|
||||
@ -53,10 +57,6 @@ namespace ARW.Common
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
catch (ClientException e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
37
ARW.Model/Dto/Api/Custom/Customers/CustomerApiDto.cs
Normal file
37
ARW.Model/Dto/Api/Custom/Customers/CustomerApiDto.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Model.Dto.Api.Custom.Customers
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 小程序客户查询对象Api
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-07
|
||||
/// </summary>
|
||||
public class CustomerQueryDtoApi : PagerInfo
|
||||
{
|
||||
public string CustomerXcxOpenid { get; set; }
|
||||
public string CustomerNickname { get; set; }
|
||||
public string CustomerMobilePhoneNumber { get; set; }
|
||||
public DateTime? BeginCustomerLastLoginTime { get; set; }
|
||||
public DateTime? EndCustomerLastLoginTime { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 小程序客户详情输入对象Api
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-07
|
||||
/// </summary>
|
||||
public class CustomerDtoApi
|
||||
{
|
||||
[Required(ErrorMessage = "CustomerGuid不能为空")]
|
||||
public long CustomerGuid { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Customers
|
||||
namespace ARW.Model.Dto.Business.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户输入对象
|
||||
@ -139,4 +137,14 @@ namespace ARW.Model.Dto.Business.Customers
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class SendPhoneDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "手机号不能为空")]
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Regions
|
||||
namespace ARW.Model.Dto.Business.Custom.Regions
|
||||
{
|
||||
/// <summary>
|
||||
/// 省市区数据表输入对象
|
@ -4,7 +4,7 @@ using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Customers
|
||||
namespace ARW.Model.Models.Business.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户,数据实体对象
|
@ -4,7 +4,7 @@ using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Regions
|
||||
namespace ARW.Model.Models.Business.Custom.Regions
|
||||
{
|
||||
/// <summary>
|
||||
/// 省市区数据表,数据实体对象
|
33
ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs
Normal file
33
ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Api.Custom.Customers
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 小程序客户详情展示对象Api
|
||||
/// </summary>
|
||||
public class CustomerApiDetailsVo
|
||||
{
|
||||
[EpplusIgnore]
|
||||
public int CustomerId { get; set; }
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long CustomerGuid { get; set; }
|
||||
[EpplusTableColumn(Header = "小程序openid")]
|
||||
public string CustomerXcxOpenid { get; set; }
|
||||
[EpplusTableColumn(Header = "昵称")]
|
||||
public string CustomerNickname { get; set; }
|
||||
[EpplusTableColumn(Header = "手机号")]
|
||||
public string CustomerMobilePhoneNumber { get; set; }
|
||||
[EpplusTableColumn(Header = "头像")]
|
||||
public string CustomerAvatar { get; set; }
|
||||
[EpplusTableColumn(Header = "性别")]
|
||||
public int CustomerGender { get; set; }
|
||||
|
||||
//[EpplusTableColumn(Header = "可用积分")]
|
||||
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Customers
|
||||
namespace ARW.Model.Vo.Business.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户展示对象
|
@ -1,11 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Regions
|
||||
namespace ARW.Model.Vo.Business.Custom.Regions
|
||||
{
|
||||
/// <summary>
|
||||
/// 省市区数据表展示对象
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Repository.Business.Customers
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using ARW.Model.Models.Business.Custom.Regions;
|
||||
|
||||
namespace ARW.Repository.Business.Regions
|
||||
{
|
||||
|
@ -0,0 +1,66 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Service.Api.IBusinessService.Custom.Customers;
|
||||
using ARW.Model.Dto.Api.Custom.Customers;
|
||||
using ARW.Model.Vo.Api.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Repository.Business.Customers;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户接口实现类Api
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-07
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ICustomerServiceApi), ServiceLifetime = LifeTime.Transient)]
|
||||
public class CustomerServiceImplApi : BaseService<Customer>, ICustomerServiceApi
|
||||
{
|
||||
private readonly CustomerRepository _CustomerRepository;
|
||||
|
||||
public CustomerServiceImplApi(CustomerRepository CustomerRepository)
|
||||
{
|
||||
this._CustomerRepository = CustomerRepository;
|
||||
}
|
||||
|
||||
#region Api接口代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询小程序客户详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> GetCustomerDetails(CustomerDtoApi parm)
|
||||
{
|
||||
|
||||
var query = _CustomerRepository
|
||||
.Queryable()
|
||||
.Where(s => s.CustomerGuid == parm.CustomerGuid)
|
||||
.Select(s => new CustomerApiDetailsVo
|
||||
{
|
||||
CustomerId = s.CustomerId,
|
||||
CustomerGuid = s.CustomerGuid,
|
||||
CustomerXcxOpenid = s.CustomerXcxOpenid,
|
||||
CustomerNickname = s.CustomerNickname,
|
||||
CustomerMobilePhoneNumber = s.CustomerMobilePhoneNumber,
|
||||
CustomerAvatar = s.CustomerAvatar,
|
||||
CustomerGender = s.CustomerGender,
|
||||
}).Take(1);
|
||||
|
||||
|
||||
return query.ToJsonAsync();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Api.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Model.Vo.Api.Custom.Customers;
|
||||
|
||||
namespace ARW.Service.Api.IBusinessService.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户接口类Api
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-07
|
||||
/// </summary>
|
||||
public interface ICustomerServiceApi : IBaseService<Customer>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取小程序客户详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetCustomerDetails(CustomerDtoApi parm);
|
||||
|
||||
}
|
||||
}
|
@ -12,11 +12,11 @@ using ARW.Repository;
|
||||
using ARW.Repository.Business.Custom.CustomerAddresses;
|
||||
using ARW.Service.Business.IBusinessService.Custom.CustomerAddresses;
|
||||
using ARW.Model.Dto.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Vo.Business.Custom.CustomerAddresses;
|
||||
using ARW.Repository.Business.Customers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Models.Business.Custom.Regions;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Custom.CustomerAddresses
|
||||
{
|
||||
|
@ -11,9 +11,9 @@ using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Customers;
|
||||
using ARW.Service.Business.IBusinessService.Customers;
|
||||
using ARW.Model.Dto.Business.Customers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Vo.Business.Customers;
|
||||
using ARW.Model.Dto.Business.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Model.Vo.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Customers
|
||||
{
|
||||
|
@ -11,9 +11,9 @@ using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Regions;
|
||||
using ARW.Service.Business.IBusinessService.Regions;
|
||||
using ARW.Model.Dto.Business.Regions;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using ARW.Model.Vo.Business.Regions;
|
||||
using ARW.Model.Dto.Business.Custom.Regions;
|
||||
using ARW.Model.Models.Business.Custom.Regions;
|
||||
using ARW.Model.Vo.Business.Custom.Regions;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Regions
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ using ARW.Service.Business.IBusinessService.SubscribeTasks;
|
||||
using ARW.Model.Dto.Business.SubscribeTasks;
|
||||
using ARW.Model.Models.Business.SubscribeTasks;
|
||||
using ARW.Model.Vo.Business.SubscribeTasks;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.SubscribeTasks
|
||||
{
|
||||
|
@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.Customers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Vo.Business.Customers;
|
||||
using ARW.Model.Dto.Business.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Model.Vo.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.Customers
|
||||
{
|
||||
|
@ -4,9 +4,9 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.Regions;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using ARW.Model.Vo.Business.Regions;
|
||||
using ARW.Model.Dto.Business.Custom.Regions;
|
||||
using ARW.Model.Models.Business.Custom.Regions;
|
||||
using ARW.Model.Vo.Business.Custom.Regions;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.Regions
|
||||
{
|
||||
|
@ -0,0 +1,60 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Dto.Api.Custom.Customers;
|
||||
using ARW.Service.Api.IBusinessService.Custom.Customers;
|
||||
using ARW.Model.Vo.Api.Custom.Customers;
|
||||
using Geocoding;
|
||||
using Infrastructure;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Custom.Customers
|
||||
{
|
||||
/// <summary>
|
||||
/// 小程序客户控制器Api
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-07
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("api/[controller]")]
|
||||
public class CustomerApiController : BaseController
|
||||
{
|
||||
private readonly ICustomerServiceApi _CustomerServiceApi;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="CustomerServiceApi">小程序客户小程序客户Api服务</param>
|
||||
public CustomerApiController(ICustomerServiceApi CustomerServiceApi)
|
||||
{
|
||||
_CustomerServiceApi = CustomerServiceApi;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取Customer详情(Api)
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getCustomerDetails")]
|
||||
public async Task<IActionResult> GetCustomerDetails([FromQuery] CustomerDtoApi parm)
|
||||
{
|
||||
if (parm == null) throw new CustomException("参数错误!");
|
||||
|
||||
var res = await _CustomerServiceApi.GetCustomerDetails(parm);
|
||||
|
||||
if (res != "[]")
|
||||
{
|
||||
res = res.Remove(0, 1);
|
||||
res = res.Substring(0, res.Length - 1);
|
||||
var data = res.FromJSON<CustomerApiDetailsVo>();
|
||||
return SUCCESS(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
return SUCCESS(res);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,92 +0,0 @@
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Customers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Service.Business.IBusinessService.Customers;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.My
|
||||
{
|
||||
/// <summary>
|
||||
/// 我的控制器
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("api/[controller]")]
|
||||
public class MyController : BaseController
|
||||
{
|
||||
|
||||
private readonly ICustomerService _CustomerService;
|
||||
|
||||
public MyController(ICustomerService customerService)
|
||||
{
|
||||
_CustomerService = customerService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息(通过Guid)
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getCustomer")]
|
||||
public IActionResult GetCustomer([FromQuery] CustomerDto parm)
|
||||
{
|
||||
var res = _CustomerService.GetFirst(s => s.CustomerXcxOpenid == parm.CustomerXcxOpenid);
|
||||
if (res == null)
|
||||
throw new CustomException("用户不存在");
|
||||
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改小程序客户
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateCustomer")]
|
||||
[ActionPermissionFilter(Permission = "business:customer:addOrUpdate")]
|
||||
[Log(Title = "添加或修改小程序客户", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public IActionResult AddOrUpdateCustomer([FromBody] CustomerDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var updateModal = parm.Adapt<Customer>().ToUpdate(HttpContext);
|
||||
var addModal = parm.Adapt<Customer>().ToCreate(HttpContext);
|
||||
|
||||
if (parm.CustomerId != 0)
|
||||
{
|
||||
var response = _CustomerService.UpdateAsync(updateModal);
|
||||
return SUCCESS("修改成功!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var response = _CustomerService.InsertReturnSnowflakeIdAsync(addModal);
|
||||
return SUCCESS("添加成功!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除小程序客户
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:customer:delete")]
|
||||
[Log(Title = "小程序客户删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _CustomerService.Delete(idsArr);
|
||||
return ToResponse(response, "删除成功!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
using ARW.Model.Dto.Business.Customers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.System;
|
||||
using ARW.Service.Business.IBusinessService.Customers;
|
||||
using Infrastructure.WeChat.Login;
|
||||
@ -10,13 +8,14 @@ using Infrastructure;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Net;
|
||||
using Senparc.Weixin.WxOpen.AdvancedAPIs.WxApp.Business.JsonResult;
|
||||
using Senparc.Weixin.WxOpen;
|
||||
using Senparc.Weixin;
|
||||
using Senparc.Weixin.CommonAPIs;
|
||||
using Senparc.Weixin.Open.WxOpenAPIs;
|
||||
using Senparc.Weixin.WxOpen.AdvancedAPIs.WxApp;
|
||||
using ARW.Common;
|
||||
using ARW.Model.System.Dto;
|
||||
using SixLabors.Shapes;
|
||||
using ARW.Model.Dto.Business.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Service.System;
|
||||
using Infrastructure.Attribute;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
{
|
||||
@ -54,11 +53,14 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
}
|
||||
|
||||
var addModal = parm.Adapt<Customer>().ToCreate(HttpContext);
|
||||
var user = await _customerService.GetFirstAsync(s => s.CustomerXcxOpenid == parm.CustomerXcxOpenid);
|
||||
addModal.CustomerMobilePhoneNumber = await GetUserPhoneNumber(parm.Code);
|
||||
var user = await _customerService.GetFirstAsync(s => s.CustomerMobilePhoneNumber == addModal.CustomerMobilePhoneNumber);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
addModal.CustomerMobilePhoneNumber = await GetUserPhoneNumber(parm.Code);
|
||||
addModal.CustomerAvatar = "https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png";
|
||||
addModal.CustomerNickname = "用户" + addModal.CustomerMobilePhoneNumber.Substring(addModal.CustomerMobilePhoneNumber.Length - 4); ;
|
||||
addModal.CustomerLastLoginTime = DateTime.Now;
|
||||
var response = await _customerService.InsertReturnSnowflakeIdAsync(addModal);
|
||||
if (response == 0)
|
||||
{
|
||||
@ -76,11 +78,35 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
IsApi = true,
|
||||
};
|
||||
var jwt = JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser), _jwtSettings.JwtSettings);
|
||||
return SUCCESS(jwt);
|
||||
var dic = new Dictionary<string, object>
|
||||
{
|
||||
{ "jwt", jwt },
|
||||
{ "user", user }
|
||||
};
|
||||
|
||||
return SUCCESS(dic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Log(Title = "退出登录")]
|
||||
[HttpPost("logout")]
|
||||
public IActionResult LogOut()
|
||||
{
|
||||
var userid = HttpContext.GetUId();
|
||||
var name = HttpContext.GetName();
|
||||
|
||||
CacheService.RemoveUserPerms(GlobalConstant.UserPermKEY + userid);
|
||||
return SUCCESS(new { name, id = userid });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户手机号
|
||||
/// </summary>
|
||||
@ -98,7 +124,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("获取手机号报错:"+ result);
|
||||
throw new Exception("获取手机号报错:" + result);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -108,5 +134,54 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送手机验证码
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("sendPhoneCode")]
|
||||
public IActionResult PostEmailCode([FromBody] SendPhoneDto dto)
|
||||
{
|
||||
//var code = Tools.GetNumCode(4);
|
||||
AliyunMsgHelper.SendPhoneMsgCode(dto.PhoneNumber);
|
||||
|
||||
//CacheHelper.SetCache(user.UserId.ToString() + "emailCode", code, 5);
|
||||
|
||||
//var emailCode = CacheHelper.GetCache(user.UserId.ToString() + "emailCode");
|
||||
//Console.WriteLine(user.UserId.ToString() + ":" + emailCode);
|
||||
|
||||
return SUCCESS("发送成功!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过邮箱修改密码
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("changePwByEmail")]
|
||||
public IActionResult ChangePwByEmail([FromBody] ChangePwByEmailDto dto)
|
||||
{
|
||||
//var user = sysUserService.SelectUserByEmail(dto.Email);
|
||||
//var emailCode = (string)CacheHelper.GetCache(user.UserId.ToString() + "emailCode");
|
||||
|
||||
//if (emailCode == null)
|
||||
//{
|
||||
// throw new CustomException("验证码已过期,请重新获取!");
|
||||
//}
|
||||
|
||||
//if (dto.code == emailCode)
|
||||
//{
|
||||
// sysUserService.ResetPwd(user.UserId, dto.Password);
|
||||
// return SUCCESS("密码重置成功");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// throw new CustomException("验证码错误,请重试!");
|
||||
//}
|
||||
return SUCCESS("");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,10 @@ using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Custom.CustomerAddresses;
|
||||
using ARW.Service.Business.IBusinessService.Custom.CustomerAddresses;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Vo.Business.Custom.CustomerAddresses;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Custom.CustomerAddresses
|
||||
{
|
||||
|
@ -3,19 +3,15 @@ using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Customers;
|
||||
using ARW.Service.Business.IBusinessService.Customers;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
using ARW.Model.Vo.Business.Customers;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Model.Vo.Business.Custom.Customers;
|
||||
using ARW.Model.Dto.Business.Custom.Customers;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Custom.Customers
|
||||
{
|
||||
|
@ -8,14 +8,13 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Regions;
|
||||
using ARW.Service.Business.IBusinessService.Regions;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.Regions;
|
||||
using ARW.Model.Vo.Business.Regions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
using ARW.Model.Dto.Business.Custom.Regions;
|
||||
using ARW.Model.Models.Business.Custom.Regions;
|
||||
using ARW.Model.Vo.Business.Custom.Regions;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Custom.Regions
|
||||
{
|
||||
|
@ -8,7 +8,6 @@ using System.Text;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Model.System;
|
||||
using ARW.Service.System;
|
||||
using ARW.Model.Models.Business.Customers;
|
||||
|
||||
namespace ARW.Admin.WebApi.Framework
|
||||
{
|
||||
|
@ -36,8 +36,8 @@
|
||||
//阿里云短信配置
|
||||
"AARWYUN_MSG": {
|
||||
"signName": "阿里云短信测试",
|
||||
"accessKeyId": "LTAI5tLGSBenBxmdvZB4TpVg",
|
||||
"accessSecret": "OR1kPyaOAP7q4zEtsmEqepZcyWG1yh",
|
||||
"accessKeyId": "LTAI5tDcXaqVHv1z7uqM4zSz",
|
||||
"accessSecret": "3ggZMDx8ardkSbEJSIybIsqwk0z9tm",
|
||||
"templateCode": "SMS_154950909"
|
||||
},
|
||||
"gen": {
|
||||
|
Loading…
Reference in New Issue
Block a user