fix 修改生成部分内容,添加客户收货地址,添加客户登录逻辑1.0
This commit is contained in:
parent
7432ce4ea8
commit
a1763d5980
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址输入对象
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
public class CustomerAddressDto
|
||||
{
|
||||
|
||||
public int CustomerAddressId { get; set; }
|
||||
|
||||
public long CustomerAddressGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "客户guid不能为空")]
|
||||
public long CustomerAddressCustomerGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "省id不能为空")]
|
||||
public int CustomerAddressProvinceId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "市id不能为空")]
|
||||
public int CustomerAddressCityId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "区id不能为空")]
|
||||
public int CustomerAddressAreaId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "收货人名称不能为空")]
|
||||
public string CustomerAddressName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "收货电话不能为空")]
|
||||
public string CustomerAddressPhone { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "详细地址不能为空")]
|
||||
public string CustomerAddressDetailed { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 客户收货地址查询对象
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
public class CustomerAddressQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public string CustomerAddressName { get; set; }
|
||||
|
||||
public string CustomerAddressPhone { get; set; }
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -88,6 +88,55 @@ namespace ARW.Model.Dto.Business.Customers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 客户微信手机号登录 输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-06
|
||||
/// </summary>
|
||||
public class CustomerLoginDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 手机号Code
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "Code不能为空")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OpenId
|
||||
/// </summary>
|
||||
public string CustomerXcxOpenid { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 客户手机号登录 输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-06
|
||||
/// </summary>
|
||||
public class CustomerPhoneLoginDto
|
||||
{
|
||||
/// <summary>
|
||||
/// OpenId
|
||||
/// </summary>
|
||||
public string CustomerXcxOpenid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "手机号不能为空")]
|
||||
public string PhoneNumber { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "验证码不能为空")]
|
||||
public string VerifyCode { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址,数据实体对象
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
[SugarTable("tb_customer_address")]
|
||||
public class CustomerAddress : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "CustomerAddressId")]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "customer_address_id")]
|
||||
public int CustomerAddressId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "CustomerAddressGuid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "customer_address_guid")]
|
||||
public long CustomerAddressGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :客户guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "客户guid")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "customer_address_customer_guid")]
|
||||
public long CustomerAddressCustomerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :省id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "省id")]
|
||||
[SugarColumn(ColumnName = "customer_address_province_id")]
|
||||
public int CustomerAddressProvinceId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :市id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "市id")]
|
||||
[SugarColumn(ColumnName = "customer_address_city_id")]
|
||||
public int CustomerAddressCityId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :区id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "区id")]
|
||||
[SugarColumn(ColumnName = "customer_address_area_id")]
|
||||
public int CustomerAddressAreaId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :收货人名称
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "收货人名称")]
|
||||
[SugarColumn(ColumnName = "customer_address_name")]
|
||||
public string CustomerAddressName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :收货电话
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "收货电话")]
|
||||
[SugarColumn(ColumnName = "customer_address_phone")]
|
||||
public string CustomerAddressPhone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :详细地址
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "详细地址")]
|
||||
[SugarColumn(ColumnName = "customer_address_detailed")]
|
||||
public string CustomerAddressDetailed { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ namespace ARW.Model.System
|
||||
public long UserId { get; set; }
|
||||
public long DeptId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string UserPhone { get; set; }
|
||||
|
||||
public bool IsApi { get; set; }
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址展示对象
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
public class CustomerAddressVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public int CustomerAddressId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long CustomerAddressGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :客户guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[EpplusIgnore]
|
||||
public long CustomerAddressCustomerGuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户名称
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "客户")]
|
||||
public string CustomerName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :省id
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public int CustomerAddressProvinceId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :市id
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public int CustomerAddressCityId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :区id
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public int CustomerAddressAreaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所在地区
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "所在地区")]
|
||||
public string CustomerAddress { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :收货人名称
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "收货人名称")]
|
||||
public string CustomerAddressName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :收货电话
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "收货电话")]
|
||||
public string CustomerAddressPhone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :详细地址
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "详细地址")]
|
||||
public string CustomerAddressDetailed { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
|
||||
namespace ARW.Repository.Business.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址仓储
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class CustomerAddressRepository : BaseRepository<CustomerAddress>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using ARW.Model;
|
||||
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;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址接口实现类
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ICustomerAddressService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class CustomerAddressServiceImpl : BaseService<CustomerAddress>, ICustomerAddressService
|
||||
{
|
||||
private readonly CustomerAddressRepository _CustomerAddressRepository;
|
||||
private readonly CustomerRepository _CustomerRepository;
|
||||
|
||||
public CustomerAddressServiceImpl(CustomerAddressRepository CustomerAddressRepository, CustomerRepository customerRepository)
|
||||
{
|
||||
this._CustomerAddressRepository = CustomerAddressRepository;
|
||||
_CustomerRepository = customerRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询客户收货地址分页列表
|
||||
/// </summary>
|
||||
public Task<PagedInfo<CustomerAddressVo>> GetCustomerAddressList(CustomerAddressQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<CustomerAddress>();
|
||||
|
||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressName), it => it.CustomerAddressName.Contains(parm.CustomerAddressName));
|
||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerAddressPhone), it => it.CustomerAddressPhone.Contains(parm.CustomerAddressPhone));
|
||||
var query = _CustomerAddressRepository
|
||||
.Queryable()
|
||||
.LeftJoin<Customer>((s, c) => s.CustomerAddressCustomerGuid == c.CustomerGuid)
|
||||
.LeftJoin<Region>((s, c, d) => s.CustomerAddressProvinceId == d.RegionId)
|
||||
.LeftJoin<Region>((s, c, d, f) => s.CustomerAddressCityId == f.RegionId)
|
||||
.LeftJoin<Region>((s, c, d, f, g) => s.CustomerAddressAreaId == g.RegionId)
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select((s, c, d, f, g) => new CustomerAddressVo
|
||||
{
|
||||
CustomerName = c.CustomerNickname,
|
||||
CustomerAddress = d.RegionName + "/" + f.RegionName + "/" + g.RegionName,
|
||||
CustomerAddressId = s.CustomerAddressId,
|
||||
CustomerAddressGuid = s.CustomerAddressGuid,
|
||||
CustomerAddressCustomerGuid = s.CustomerAddressCustomerGuid,
|
||||
CustomerAddressProvinceId = s.CustomerAddressProvinceId,
|
||||
CustomerAddressCityId = s.CustomerAddressCityId,
|
||||
CustomerAddressAreaId = s.CustomerAddressAreaId,
|
||||
CustomerAddressName = s.CustomerAddressName,
|
||||
CustomerAddressPhone = s.CustomerAddressPhone,
|
||||
CustomerAddressDetailed = s.CustomerAddressDetailed,
|
||||
});
|
||||
|
||||
|
||||
return query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改客户收货地址
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateCustomerAddress(CustomerAddress model)
|
||||
{
|
||||
if (model.CustomerAddressId != 0)
|
||||
{
|
||||
var response = await _CustomerAddressRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
var response = await _CustomerAddressRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel数据导出处理
|
||||
/// </summary>
|
||||
public async Task<List<CustomerAddressVo>> HandleExportData(List<CustomerAddressVo> data)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ namespace ARW.Service.Business.BusinessService.Customers
|
||||
var query = _CustomerRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.Create_time,OrderByType.Desc)
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select(s => new CustomerVo
|
||||
{
|
||||
CustomerId = s.CustomerId,
|
||||
@ -105,7 +105,7 @@ namespace ARW.Service.Business.BusinessService.Customers
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Models.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Vo.Business.Custom.CustomerAddresses;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址接口类
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
public interface ICustomerAddressService : IBaseService<CustomerAddress>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取客户收货地址分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<CustomerAddressVo>> GetCustomerAddressList(CustomerAddressQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改客户收货地址
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateCustomerAddress(CustomerAddress parm);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel导出
|
||||
/// </summary>
|
||||
Task<List<CustomerAddressVo>> HandleExportData(List<CustomerAddressVo> data);
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -15,6 +15,8 @@ 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;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
{
|
||||
@ -31,8 +33,6 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
private readonly OptionsSetting _jwtSettings;
|
||||
|
||||
|
||||
static string session_key = "";
|
||||
static string openId = "";
|
||||
public WeChatLoginController(WeChatLogin weChat, ICustomerService customerService, IOptions<OptionsSetting> jwtSettings)
|
||||
{
|
||||
_weChat = weChat;
|
||||
@ -41,54 +41,72 @@ namespace ARW.WebApi.Controllers.Api.Wechat
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册小程序客户
|
||||
/// 登录/注册小程序客户
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Login")]
|
||||
public IActionResult AddCustomer([FromBody] CustomerDto parm)
|
||||
public async Task<IActionResult> Login([FromBody] CustomerLoginDto parm)
|
||||
{
|
||||
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
if (parm == null)
|
||||
{
|
||||
throw new CustomException("请求参数错误");
|
||||
}
|
||||
|
||||
var addModal = parm.Adapt<Customer>().ToCreate(HttpContext);
|
||||
|
||||
var user = _customerService.GetFirst(s => s.CustomerXcxOpenid == parm.CustomerXcxOpenid);
|
||||
var user = await _customerService.GetFirstAsync(s => s.CustomerXcxOpenid == parm.CustomerXcxOpenid);
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
|
||||
var response = _customerService.InsertReturnSnowflakeId(addModal);
|
||||
addModal.CustomerMobilePhoneNumber = await GetUserPhoneNumber(parm.Code);
|
||||
var response = await _customerService.InsertReturnSnowflakeIdAsync(addModal);
|
||||
if (response == 0)
|
||||
{
|
||||
throw new CustomException("添加失败!");
|
||||
}
|
||||
|
||||
var newUser = _customerService.GetFirst(s => s.CustomerGuid == response);
|
||||
if (newUser != null)
|
||||
{
|
||||
LoginUser loginUser = new LoginUser
|
||||
{
|
||||
UserId = newUser.CustomerGuid,
|
||||
UserName = newUser.CustomerNickname,
|
||||
IsApi = true,
|
||||
};
|
||||
var jwt = JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser), _jwtSettings.JwtSettings);
|
||||
return SUCCESS(jwt);
|
||||
user = await _customerService.GetFirstAsync(s => s.CustomerGuid == response);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
LoginUser loginUser = new LoginUser
|
||||
{
|
||||
UserId = user.CustomerGuid,
|
||||
UserName = user.CustomerNickname,
|
||||
UserPhone = user.CustomerMobilePhoneNumber,
|
||||
IsApi = true,
|
||||
};
|
||||
var jwt = JwtUtil.GenerateJwtToken(JwtUtil.AddClaims(loginUser), _jwtSettings.JwtSettings);
|
||||
return SUCCESS(jwt);
|
||||
}
|
||||
|
||||
return SUCCESS("666");
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户手机号
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetUserPhoneNumber(string code)
|
||||
{
|
||||
try
|
||||
{
|
||||
var Appid = AppSettings.GetConfig("SenparcWeixinSetting:TenPayV3_AppId");
|
||||
var result = await BusinessApi.GetUserPhoneNumberAsync(Appid, code);
|
||||
if (result.phone_info != null)
|
||||
{
|
||||
return result.phone_info.phoneNumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("获取手机号报错:"+ result);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("获取手机号报错:" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ using Senparc.CO2NET.HttpUtility;
|
||||
using Senparc.Weixin.TenPayV3.Apis;
|
||||
using static Infrastructure.WeChat.TenPay.Pay;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
using Senparc.Weixin.Open.WxOpenAPIs;
|
||||
using Senparc.Weixin.WxOpen.AdvancedAPIs.WxApp;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
{
|
||||
|
@ -0,0 +1,132 @@
|
||||
using Infrastructure;
|
||||
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.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;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Custom.CustomerAddresses
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户收货地址控制器
|
||||
///
|
||||
/// @author admin
|
||||
/// @date 2023-06-05
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class CustomerAddressController : BaseController
|
||||
{
|
||||
private readonly ICustomerAddressService _CustomerAddressService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="CustomerAddressService">客户收货地址服务</param>
|
||||
public CustomerAddressController(ICustomerAddressService CustomerAddressService)
|
||||
{
|
||||
_CustomerAddressService = CustomerAddressService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取客户收货地址列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getCustomerAddressList")]
|
||||
[ActionPermissionFilter(Permission = "business:customeraddress:list")]
|
||||
public async Task<IActionResult> GetCustomerAddressList([FromQuery] CustomerAddressQueryDto parm)
|
||||
{
|
||||
var res = await _CustomerAddressService.GetCustomerAddressList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改客户收货地址
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateCustomerAddress")]
|
||||
[ActionPermissionFilter(Permission = "business:customeraddress:addOrUpdate")]
|
||||
[Log(Title = "添加或修改客户收货地址", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateCustomerAddress([FromBody] CustomerAddressDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new CustomerAddress();
|
||||
if (parm.CustomerAddressId != 0) modal = parm.Adapt<CustomerAddress>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<CustomerAddress>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _CustomerAddressService.AddOrUpdateCustomerAddress(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除客户收货地址
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:customeraddress: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 = _CustomerAddressService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导出客户收货地址
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Log(Title = "客户收货地址导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||||
[HttpGet("exportCustomerAddress")]
|
||||
[ActionPermissionFilter(Permission = "business:customeraddress:export")]
|
||||
public async Task<IActionResult> ExportExcel([FromQuery] CustomerAddressQueryDto parm)
|
||||
{
|
||||
parm.PageSize = 10000;
|
||||
var list = await _CustomerAddressService.GetCustomerAddressList(parm);
|
||||
var data = list.Result;
|
||||
|
||||
// 选中数据
|
||||
if (!string.IsNullOrEmpty(parm.ids))
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(parm.ids);
|
||||
var selectDataList = new List<CustomerAddressVo>();
|
||||
foreach (var item in idsArr)
|
||||
{
|
||||
var select_data = data.Where(s => s.CustomerAddressId == item).First();
|
||||
selectDataList.Add(select_data);
|
||||
}
|
||||
data = selectDataList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 导出数据处理
|
||||
var handleData = await _CustomerAddressService.HandleExportData(data);
|
||||
|
||||
string sFileName = ExportExcel(handleData, "CustomerAddress", "客户收货地址列表");
|
||||
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -48,9 +48,9 @@ var senparcWeixinSetting = builder.Services.BuildServiceProvider().GetRequiredSe
|
||||
register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value);//微信全局注册,必须!
|
||||
|
||||
// 小程序
|
||||
await AccessTokenContainer.RegisterAsync("wx34436769371ceb7c", "8ded49f94c8e607de7cc4244639d4666");
|
||||
await AccessTokenContainer.RegisterAsync("wx8b03fffabbbfe804", "ef5845d854c1111cd842bb54481be0c1");
|
||||
// 公众号
|
||||
await AccessTokenContainer.RegisterAsync("wx99caf571c9fb1cc5", "61100d9c4fff5acf97517f0c8799e2e2");
|
||||
await AccessTokenContainer.RegisterAsync("wxa515d1bd73d06294", "c97d2e3ded5f6a7c86a4bbee3f1ab3ab");
|
||||
|
||||
// 添加WeChat单例服务
|
||||
builder.Services.AddSingleton<WeChatLogin>(new WeChatLogin("wxf3f7f286bfbb7dfa", "c2a02e478d9f0683d8dafec646c3d2ca"));
|
||||
|
@ -27,11 +27,11 @@
|
||||
},
|
||||
//阿里云存储配置
|
||||
"AARWYUN_OSS": {
|
||||
"REGIONID": "oss-cn-shenzhen.aliyuncs.com",
|
||||
"REGIONID": "oss-cn-hongkong.aliyuncs.com",
|
||||
"KEY": "LTAI5tLGSBenBxmdvZB4TpVg",
|
||||
"SECRET": "OR1kPyaOAP7q4zEtsmEqepZcyWG1yh",
|
||||
"bucketName": "aerwen",
|
||||
"domainUrl": "http://119.23.54.43/oss" //访问资源域名
|
||||
"bucketName": "arw",
|
||||
"domainUrl": "arw.oss-cn-hongkong.aliyuncs.com" //访问资源域名
|
||||
},
|
||||
//阿里云短信配置
|
||||
"AARWYUN_MSG": {
|
||||
@ -134,12 +134,12 @@
|
||||
//公众号
|
||||
"Token": "63_I_BSEoa_qwlHgGSVxLmyNylHJ11ejzc9_WiWPRt64sDetCJe9CLU9YwVbL-VoAjqCH0Pg5QElGL4p_B2z63SKG9jj-dRPp-BD1gpiaAe6uxrwocfFeX4JXepvgcRAGhACAHQW",
|
||||
"EncodingAESKey": "", //公众号解密秘钥
|
||||
"WeixinAppId": "wx99caf571c9fb1cc5", //公众号AppId
|
||||
"WeixinAppSecret": "61100d9c4fff5acf97517f0c8799e2e2", //公众号秘钥
|
||||
"WeixinAppId": "wxa515d1bd73d06294", //公众号AppId
|
||||
"WeixinAppSecret": "c97d2e3ded5f6a7c86a4bbee3f1ab3ab", //公众号秘钥
|
||||
|
||||
//微信支付V3
|
||||
"TenPayV3_AppId": "wx34436769371ceb7c", // 小程序AppId
|
||||
"TenPayV3_AppSecret": "8ded49f94c8e607de7cc4244639d4666", // 小程序AppSecret
|
||||
"TenPayV3_AppId": "wx8b03fffabbbfe804", // 小程序AppId
|
||||
"TenPayV3_AppSecret": "ef5845d854c1111cd842bb54481be0c1", // 小程序AppSecret
|
||||
"TenPayV3_SubAppId": "", //子小程序AppId,没有可留空
|
||||
"TenPayV3_SubAppSecret": "", //子小程序AppSecret,没有可留空
|
||||
"TenPayV3_MchId": "1626418383", //商户号
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" label-width="68px" v-show="showSearch"
|
||||
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" v-show="showSearch"
|
||||
@submit.prevent>
|
||||
$foreach(column in genTable.Columns)
|
||||
$set(labelName = "")
|
||||
|
Loading…
Reference in New Issue
Block a user