diff --git a/ARW.Model/ARW.Model.csproj b/ARW.Model/ARW.Model.csproj
index ddbc471..7500768 100644
--- a/ARW.Model/ARW.Model.csproj
+++ b/ARW.Model/ARW.Model.csproj
@@ -25,7 +25,6 @@
-
diff --git a/ARW.Model/Dto/Business/Custom/Customers/CustomerDto.cs b/ARW.Model/Dto/Business/Custom/Customers/CustomerDto.cs
index 471ba34..50be2be 100644
--- a/ARW.Model/Dto/Business/Custom/Customers/CustomerDto.cs
+++ b/ARW.Model/Dto/Business/Custom/Customers/CustomerDto.cs
@@ -29,6 +29,11 @@ namespace ARW.Model.Dto.Business.Custom.Customers
[Required(ErrorMessage = "小程序openid不能为空")]
public string CustomerXcxOpenid { get; set; }
+ public string CustomerType { get; set; }
+
+ public string CustomerEmail { get; set; }
+
+
[Required(ErrorMessage = "昵称不能为空")]
public string CustomerNickname { get; set; }
diff --git a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
index 4cfdee7..7058e09 100644
--- a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
+++ b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
@@ -2,6 +2,9 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ARW.Model.Models.Business.ShopManager.Shops;
+using MimeKit;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
namespace ARW.Model.Dto.Business.ShopManager.Shops
{
@@ -37,16 +40,12 @@ namespace ARW.Model.Dto.Business.ShopManager.Shops
[Required(ErrorMessage = "简介不能为空")]
public string ShopIntro { get; set; }
- [Required(ErrorMessage = "排序不能为空")]
public int ShopSort { get; set; }
- [Required(ErrorMessage = "销售单量不能为空")]
public int ShopSalesOrderCount { get; set; }
- [Required(ErrorMessage = "审核状态不能为空")]
public int ShopAuditStatus { get; set; }
- [Required(ErrorMessage = "审核人不能为空")]
public long ShopAuditUserGuid { get; set; }
@@ -114,4 +113,35 @@ namespace ARW.Model.Dto.Business.ShopManager.Shops
}
+
+ ///
+ /// 商户店铺查询对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-09
+ ///
+ public class ShopOperatorQueryDto
+ {
+ public long ShopGuid { get; set; }
+
+ }
+
+
+ ///
+ /// 商户店铺编辑对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-09
+ ///
+ public class ShopOperatorEditDto
+ {
+ public long ShopGuid { get; set; }
+
+ public string ShopLogo { get; set; }
+
+ public string ShopName { get; set; }
+
+ public string ShopIntro { get; set; }
+ }
+
}
diff --git a/ARW.Model/Models/Business/Custom/Customers/Customer.cs b/ARW.Model/Models/Business/Custom/Customers/Customer.cs
index 14e6928..76ffb16 100644
--- a/ARW.Model/Models/Business/Custom/Customers/Customer.cs
+++ b/ARW.Model/Models/Business/Custom/Customers/Customer.cs
@@ -91,6 +91,15 @@ namespace ARW.Model.Models.Business.Custom.Customers
public string CustomerXcxOpenid { get; set; }
+ ///
+ /// 描述 : 客户类型(1: 普通用户 2: 商户 )
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "客户类型")]
+ [SugarColumn(ColumnName = "customer_type")]
+ public int CustomerType { get; set; }
+
+
///
/// 描述 :昵称
/// 空值 : false
@@ -108,6 +117,14 @@ namespace ARW.Model.Models.Business.Custom.Customers
[SugarColumn(ColumnName = "customer_mobile_phone_number")]
public string CustomerMobilePhoneNumber { get; set; }
+ ///
+ /// 描述 :电子邮箱
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "电子邮箱")]
+ [SugarColumn(ColumnName = "customer_email")]
+ public string CustomerEmail { get; set; }
+
///
/// 描述 :头像
diff --git a/ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs b/ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs
index ccd24e3..63b19e4 100644
--- a/ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs
+++ b/ARW.Model/Vo/Api/Custom/Customers/CustomerApiVo.cs
@@ -26,6 +26,8 @@ namespace ARW.Model.Vo.Api.Custom.Customers
public string CustomerAvatar { get; set; }
[EpplusTableColumn(Header = "性别")]
public int CustomerGender { get; set; }
+ [EpplusTableColumn(Header = "客户类型")]
+ public int CustomerType { get; set; }
//[EpplusTableColumn(Header = "可用积分")]
diff --git a/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs b/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs
new file mode 100644
index 0000000..b49ef6b
--- /dev/null
+++ b/ARW.Model/Vo/Api/ShopManager/Shops/GoodsCategoryVoApi.cs
@@ -0,0 +1,32 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Api.ShopManager.Shops
+{
+ ///
+ /// 经营类目对象Api
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-13
+ ///
+ public class GoodsCategoryVoApi
+ {
+
+ ///
+ /// 描述 :名称
+ ///
+ public string Label { get; set; }
+
+
+ ///
+ /// 描述 :值
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long Value { get; set; }
+
+
+ }
+
+}
diff --git a/ARW.Model/Vo/Business/Custom/Customers/CustomerVo.cs b/ARW.Model/Vo/Business/Custom/Customers/CustomerVo.cs
index 5343bbb..75bedfe 100644
--- a/ARW.Model/Vo/Business/Custom/Customers/CustomerVo.cs
+++ b/ARW.Model/Vo/Business/Custom/Customers/CustomerVo.cs
@@ -31,7 +31,11 @@ namespace ARW.Model.Vo.Business.Custom.Customers
-
+ ///
+ /// 描述 :客户类型
+ ///
+ [EpplusTableColumn(Header = "客户类型")]
+ public int CustomerType{ get; set; }
@@ -56,6 +60,13 @@ namespace ARW.Model.Vo.Business.Custom.Customers
public string CustomerMobilePhoneNumber { get; set; }
+ ///
+ /// 描述 :电子邮箱
+ ///
+ [EpplusTableColumn(Header = "电子邮箱")]
+ public string CustomerEmail { get; set; }
+
+
///
/// 描述 :头像
///
@@ -66,7 +77,7 @@ namespace ARW.Model.Vo.Business.Custom.Customers
///
/// 描述 :性别(字典)
///
- [EpplusTableColumn(Header = "性别(字典)")]
+ [EpplusTableColumn(Header = "性别")]
public int CustomerGender { get; set; }
diff --git a/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs b/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
index 3376213..6359c1a 100644
--- a/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
+++ b/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
@@ -128,4 +128,75 @@ namespace ARW.Model.Vo.Business.ShopManager.Shops
public string CreateTime { get; set; }
}
+
+
+
+ ///
+ /// 店铺详情展示对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-015
+ ///
+ public class ShopDetailVo
+ {
+
+
+ ///
+ /// 描述 :
+ ///
+ public int ShopId { get; set; }
+
+
+ ///
+ /// 描述 :
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long ShopGuid { get; set; }
+
+ ///
+ /// 描述 :经营类目guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long ShopBusinessCategoryGuid { get; set; }
+
+
+ ///
+ /// 经营类别名称
+ ///
+ public string ShopBusinessCategoryName { get; set; }
+
+
+ ///
+ /// 描述 :图标
+ ///
+ public string ShopLogo { get; set; }
+
+
+ ///
+ /// 描述 :营业执照
+ ///
+ public string ShopBusinessLicense { get; set; }
+
+
+ ///
+ /// 描述 :名称
+ ///
+ public string ShopName { get; set; }
+
+
+ ///
+ /// 描述 :简介
+ ///
+ public string ShopIntro { get; set; }
+
+
+ ///
+ /// 描述 :销售单量
+ ///
+ public int ShopSalesOrderCount { get; set; }
+
+
+ }
+
+
}
diff --git a/ARW.Service/Api/BusinessService/Custom/Customers/CustomerServiceApi.cs b/ARW.Service/Api/BusinessService/Custom/Customers/CustomerServiceApi.cs
index 6429bb3..bf5460b 100644
--- a/ARW.Service/Api/BusinessService/Custom/Customers/CustomerServiceApi.cs
+++ b/ARW.Service/Api/BusinessService/Custom/Customers/CustomerServiceApi.cs
@@ -53,6 +53,7 @@ namespace ARW.Service.Api.BusinessService.Custom.Customers
CustomerMobilePhoneNumber = s.CustomerMobilePhoneNumber,
CustomerAvatar = s.CustomerAvatar,
CustomerGender = s.CustomerGender,
+ CustomerType = s.CustomerType
}).Take(1);
diff --git a/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs b/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
index abd6e75..b389cd1 100644
--- a/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
+++ b/ARW.Service/Api/BusinessService/ShopManager/Shops/ShopServiceApi.cs
@@ -13,6 +13,10 @@ using ARW.Service.Api.IBusinessService.ShopManager.Shops;
using ARW.Model.Dto.Api.ShopManager.Shops;
using ARW.Model.Models.Business.ShopManager.Shops;
using ARW.Model.Vo.Api.ShopManager.Shops;
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
+using ARW.Repository.Business.GoodsManager.GoodsCategorys;
+using ARW.Repository.Business.Custom.Customers;
+using ARW.Model.Models.Business.Custom.Customers;
namespace ARW.Service.Api.BusinessService.ShopManager.Shops
{
@@ -26,15 +30,41 @@ namespace ARW.Service.Api.BusinessService.ShopManager.Shops
public class ShopServiceImplApi : BaseService, IShopServiceApi
{
private readonly ShopRepository _ShopRepository;
+ private readonly GoodsCategoryRepository _GoodsCategoryRepository;
+ private readonly CustomerRepository _CustomerRepository;
- public ShopServiceImplApi(ShopRepository ShopRepository)
+ public ShopServiceImplApi(ShopRepository ShopRepository, GoodsCategoryRepository goodsCategoryRepository, CustomerRepository customerRepository)
{
this._ShopRepository = ShopRepository;
+ _GoodsCategoryRepository = goodsCategoryRepository;
+ _CustomerRepository = customerRepository;
}
#region Api接口代码
+
+ ///
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ ///
+ public async Task> GetFirstGoodsCategoryList()
+ {
+ var query = _GoodsCategoryRepository
+ .Queryable()
+ .Where(s => s.GoodsCategoryParentGuid == 0)
+ .OrderBy(s => s.Update_time, OrderByType.Desc)
+ .Select((s) => new GoodsCategoryVoApi
+ {
+ Label = s.GoodsCategoryName,
+ Value = s.GoodsCategoryGuid,
+ });
+
+ return await query.ToListAsync();
+ }
+
+
///
/// 查询店铺列表(Api)
///
@@ -117,8 +147,24 @@ namespace ARW.Service.Api.BusinessService.ShopManager.Shops
}
else
{
+ // 判断客户类型是否为商户
+ var customer = await _CustomerRepository.GetFirstAsync(s => s.CustomerGuid == model.ShopCustomerGuid);
+ if (customer == null) throw new Exception("找不到该客户");
+ if (customer.CustomerType == 2)
+ {
+ return "您已经是商户";
+ }
+
model.ShopAuditStatus = 1;
+ model.ShopSort = 100;
var response = await _ShopRepository.InsertReturnSnowflakeIdAsync(model);
+
+ // 修改客户类型为 商户(2)
+ await _CustomerRepository.UpdateAsync(f => new Customer
+ {
+ CustomerType = 2
+ }, s => s.CustomerGuid == model.ShopCustomerGuid);
+
return "添加成功!";
}
}
diff --git a/ARW.Service/Api/IBusinessService/ShopManager/Shops/IShopServiceApi.cs b/ARW.Service/Api/IBusinessService/ShopManager/Shops/IShopServiceApi.cs
index 513d7cb..76a218a 100644
--- a/ARW.Service/Api/IBusinessService/ShopManager/Shops/IShopServiceApi.cs
+++ b/ARW.Service/Api/IBusinessService/ShopManager/Shops/IShopServiceApi.cs
@@ -7,6 +7,7 @@ using ARW.Model;
using ARW.Model.Dto.Api.ShopManager.Shops;
using ARW.Model.Models.Business.ShopManager.Shops;
using ARW.Model.Vo.Api.ShopManager.Shops;
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
namespace ARW.Service.Api.IBusinessService.ShopManager.Shops
{
@@ -18,7 +19,13 @@ namespace ARW.Service.Api.IBusinessService.ShopManager.Shops
///
public interface IShopServiceApi : IBaseService
{
- ///
+ ///
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ Task> GetFirstGoodsCategoryList();
+
+ ///
/// 获取店铺分页列表(Api)
///
///
@@ -40,5 +47,6 @@ namespace ARW.Service.Api.IBusinessService.ShopManager.Shops
///
Task AddOrUpdateShop(Shop parm);
+
}
}
diff --git a/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs b/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs
index a089240..2c67e84 100644
--- a/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs
+++ b/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs
@@ -56,6 +56,7 @@ namespace ARW.Service.Business.BusinessService.Custom.Customers
{
CustomerId = s.CustomerId,
CustomerGuid = s.CustomerGuid,
+ CustomerType = s.CustomerType,
CustomerXcxOpenid = s.CustomerXcxOpenid,
CustomerNickname = s.CustomerNickname,
CustomerMobilePhoneNumber = s.CustomerMobilePhoneNumber,
diff --git a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
index 9275b69..02c1b9f 100644
--- a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
+++ b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
@@ -22,6 +22,11 @@ using ARW.Repository.System;
using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
using ARW.Repository.Business.GoodsManager.GoodsCategorys;
using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
+using ARW.Service.System.IService;
+using ARW.Service.System;
+using MimeKit.Encodings;
+using ARW.Model.Dto.Api.ShopManager.Shops;
+using ARW.Model.Vo.Api.ShopManager.Shops;
namespace ARW.Service.Business.BusinessService.ShopManager.Shops
{
@@ -39,13 +44,18 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
private readonly SysUserRepository _SysUserRepository;
private readonly GoodsCategoryRepository _GoodsCategoryRepository;
+ private readonly ISysUserService UserService;
+ private readonly ISysConfigService _SysConfigService;
- public ShopServiceImpl(ShopRepository ShopRepository, CustomerRepository customerRepository, SysUserRepository sysUserRepository, GoodsCategoryRepository goodsCategoryRepository)
+
+ public ShopServiceImpl(ShopRepository ShopRepository, CustomerRepository customerRepository, SysUserRepository sysUserRepository, GoodsCategoryRepository goodsCategoryRepository, ISysUserService userService, ISysConfigService sysConfigService)
{
this._ShopRepository = ShopRepository;
_CustomerRepository = customerRepository;
_SysUserRepository = sysUserRepository;
_GoodsCategoryRepository = goodsCategoryRepository;
+ UserService = userService;
+ _SysConfigService = sysConfigService;
}
#region 业务逻辑代码
@@ -68,7 +78,7 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
.LeftJoin((s, c, d, f) => s.ShopBusinessCategoryGuid == f.GoodsCategoryGuid)
.Where(predicate.ToExpression())
.OrderBy(s => s.ShopSort, OrderByType.Asc)
- .Select((s, c, d,f) => new ShopVo
+ .Select((s, c, d, f) => new ShopVo
{
UserName = c.UserName,
CustomerNickname = d.CustomerNickname,
@@ -218,9 +228,9 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
{
var res = await _ShopRepository.GetFirstAsync(s => s.ShopId == id);
await UseTranAsync(async () =>
- {
- await _ShopRepository.UpdateAsync(f => new Shop { ShopAuditStatus = status, ShopAuditUserGuid = userGuid, Update_time = DateTime.Now, Update_by = userGuid.ToString() }, s => s.ShopId == id);
- });
+ {
+ await _ShopRepository.UpdateAsync(f => new Shop { ShopAuditStatus = status, ShopAuditUserGuid = userGuid, Update_time = DateTime.Now, Update_by = userGuid.ToString() }, s => s.ShopId == id);
+ });
if (res.ShopAuditStatus == 2)
{
var errorRes = $"店铺:【{res.ShopName}】已通过审核!
";
@@ -234,6 +244,37 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
else if (res.ShopAuditStatus == 1)
{
var addStr = $"店铺:【{res.ShopName}】审核通过!
";
+
+ // 分发后台用户账户
+ var customer = await _CustomerRepository.GetFirstAsync(s => s.CustomerGuid == res.ShopCustomerGuid);
+ long[] roleId = new long[] { 3 };
+ int[] postId = Array.Empty();
+ if (UserConstants.NOT_UNIQUE.Equals(UserService.CheckUserNameUnique(customer.CustomerMobilePhoneNumber)))
+ {
+ throw new Exception($"新增用户 '{customer.CustomerMobilePhoneNumber}'失败,登录账号已存在");
+ }
+
+ var initPassword = _SysConfigService.Queryable().First(f => f.ConfigKey == "sys.user.initPassword");
+ var password = NETCore.Encrypt.EncryptProvider.Md5(initPassword.ConfigValue);
+ var user = new SysUser
+ {
+ UserName = customer.CustomerMobilePhoneNumber,
+ NickName = customer.CustomerNickname,
+ Password = password,
+ Avatar = customer.CustomerAvatar,
+ Phonenumber = customer.CustomerMobilePhoneNumber,
+ Sex = customer.CustomerGender.ToString(),
+ Status = "0",
+ RoleIds = roleId,
+ PostIds = postId
+ };
+ var userId = UserService.InsertUser(user);
+ if (userId == 0) throw new Exception($"新增用户 '{customer.CustomerMobilePhoneNumber}'失败");
+ await _ShopRepository.UpdateAsync(f => new Shop
+ {
+ ShopUserId = (int?)userId,
+ }, s => s.ShopId == id);
+
return addStr;
}
return "";
@@ -244,6 +285,35 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
}
}
+
+ ///
+ /// 获取商户店铺详情
+ ///
+ ///
+ ///
+ public Task GetShopOperatorDetail(ShopOperatorQueryDto parm)
+ {
+
+ var query = _ShopRepository
+ .Queryable()
+ .Where(s => s.ShopGuid == parm.ShopGuid)
+ .Select(s => new ShopDetailVo
+ {
+ ShopId = s.ShopId,
+ ShopGuid = s.ShopGuid,
+ ShopBusinessCategoryGuid = s.ShopBusinessCategoryGuid,
+ ShopLogo = s.ShopLogo,
+ ShopBusinessLicense = s.ShopBusinessLicense,
+ ShopName = s.ShopName,
+ ShopIntro = s.ShopIntro,
+ ShopSalesOrderCount = s.ShopSalesOrderCount,
+ }).Take(1);
+
+
+ return query.ToJsonAsync();
+ }
+
+
#endregion
}
diff --git a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
index 631d678..e5d4dbe 100644
--- a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
+++ b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ARW.Model;
+using ARW.Model.Dto.Api.ShopManager.Shops;
using ARW.Model.Dto.Business.ShopManager.Shops;
using ARW.Model.Models.Business.ShopManager.Shops;
using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
@@ -69,5 +70,13 @@ namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
///
Task Audit(int idsArr, int status,long userGuid);
+
+ ///
+ /// 获取商户店铺详情
+ ///
+ ///
+ ///
+ Task GetShopOperatorDetail(ShopOperatorQueryDto parm);
+
}
}
diff --git a/ARW.WebApi/Controllers/Api/ShopManager/Shops/ShopApiController.cs b/ARW.WebApi/Controllers/Api/ShopManager/Shops/ShopApiController.cs
index 1f7a593..67320f3 100644
--- a/ARW.WebApi/Controllers/Api/ShopManager/Shops/ShopApiController.cs
+++ b/ARW.WebApi/Controllers/Api/ShopManager/Shops/ShopApiController.cs
@@ -17,6 +17,8 @@ using Microsoft.AspNetCore.Authorization;
using Geocoding;
using ARW.Model.Dto.Business.ShopManager.Shops;
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
+using ARW.Admin.WebApi.Framework;
namespace ARW.WebApi.Controllers.Api.ShopManager.Shops
{
@@ -43,7 +45,19 @@ namespace ARW.WebApi.Controllers.Api.ShopManager.Shops
///
- /// 获取店铺列表(Api)
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ [HttpGet("getFirstGoodsCategoryList")]
+ public async Task GetFirstGoodsCategoryList()
+ {
+ var res = await _ShopServiceApi.GetFirstGoodsCategoryList();
+
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 获取经营类目(Api)
///
/// 查询参数
///
@@ -70,8 +84,11 @@ namespace ARW.WebApi.Controllers.Api.ShopManager.Shops
if (parm.ShopId != 0) modal = parm.Adapt().ToUpdate(HttpContext);
else modal = parm.Adapt().ToCreate(HttpContext);
- //var res = await _ShopServiceApi.AddOrUpdateShop(modal);
- //return SUCCESS(res);
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ modal.ShopCustomerGuid = user.UserId;
+
+ var res = await _ShopServiceApi.AddOrUpdateShop(modal);
+ return SUCCESS(res);
}
diff --git a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs
index 9476638..5485195 100644
--- a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs
+++ b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs
@@ -61,6 +61,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat
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.CustomerGender = 1;
+ addModal.CustomerType = 1;
addModal.CustomerLastLoginTime = DateTime.Now;
var response = await _customerService.InsertReturnSnowflakeIdAsync(addModal);
if (response == 0)
diff --git a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
index 4822b4b..9f41b1f 100644
--- a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
+++ b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
@@ -16,6 +16,8 @@ using ARW.Model.Vo.Business.ShopManager.Shops;
using Microsoft.AspNetCore.Authorization;
using ARW.Admin.WebApi.Framework;
using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
+using ARW.Model.Vo.Api.ShopManager.Shops;
+using Geocoding;
namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
{
@@ -200,5 +202,63 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
+ #region 商户管理
+
+ ///
+ /// 获取商户店铺详情
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getShopOperatorDetail")]
+ [ActionPermissionFilter(Permission = "business:shopOperator:detail")]
+ public async Task GetShopOperatorDetail([FromQuery] ShopOperatorQueryDto parm)
+ {
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
+ if (shop == null) throw new Exception("当前用户没有店铺!");
+ parm.ShopGuid = shop.ShopGuid;
+
+ var res = await _ShopService.GetShopOperatorDetail(parm);
+
+ if (res != "[]")
+ {
+ res = res.Remove(0, 1);
+ res = res.Substring(0, res.Length - 1);
+ var data = res.FromJSON();
+ return SUCCESS(data);
+ }
+ else
+ {
+ return SUCCESS(res);
+ }
+ }
+
+
+ ///
+ /// 获取商户店铺详情
+ ///
+ /// 查询参数
+ ///
+ [HttpPost("editShopOperatorDetail")]
+ public async Task EditShopOperatorDetail([FromBody] ShopOperatorEditDto parm)
+ {
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
+
+ var res = await _ShopService.UpdateAsync(f => new Shop
+ {
+ ShopName = parm.ShopName,
+ ShopIntro = parm.ShopIntro,
+ ShopLogo = parm.ShopLogo
+ },s => s.ShopGuid == shop.ShopGuid);
+
+ return SUCCESS(res);
+ }
+
+
+ #endregion
+
+
+
}
}
diff --git a/ARW.WebApi/appsettings.json b/ARW.WebApi/appsettings.json
index bffe75a..7c81618 100644
--- a/ARW.WebApi/appsettings.json
+++ b/ARW.WebApi/appsettings.json
@@ -11,7 +11,7 @@
//"conn_db": "server=127.0.0.1;Database= shop_template;Uid=root;Pwd=root;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
"conn_db_type": "8" //数据库类型 MySql = 0, SqlServer = 1
},
- "urls": "http://192.168.1.102:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
+ "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
"corsUrls": "http://localhost:8887", //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
"JwtSettings": {
"Issuer": "ARWAdmin.NET",
@@ -22,7 +22,7 @@
"InitDb": false, //是否初始化db
"DemoMode": false, //是否演示模式
"Upload": {
- "UploadUrl": "http://192.168.1.102:8888", //本地存储资源访问路径
+ "UploadUrl": "http://localhost:8888", //本地存储资源访问路径
"localSavePath": "uploads" //本地上传默认文件存储目录 wwwroot/Uploads/uploads
},
//阿里云存储配置