Commit f29e3f6d authored by liudong1993's avatar liudong1993

订单

parent 4f370280
...@@ -127,5 +127,74 @@ namespace Mall.CacheManager.User ...@@ -127,5 +127,74 @@ namespace Mall.CacheManager.User
} }
return userInfo; return userInfo;
} }
/// <summary>
/// 设置小程序用户缓存
/// </summary>
/// <param name="model"></param>
public static void AppletUserInfoSet(string cacheKey, AppletUserInfo model, int JwtExpirTime)
{
try
{
TimeSpan ts = GetExpirTime(JwtExpirTime);
redis.StringSet<AppletUserInfo>(cacheKey, model, ts);
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "UserInfoSet缓存设置失败");
}
}
/// <summary>
/// 用户
/// </summary>
private static readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository();
/// <summary>
/// 获取小程序用户登录信息
/// </summary>
/// <param name="UserId">用户Id</param>
/// <returns></returns>
public static AppletUserInfo GetAppletUserLoginInfo(object UserId)
{
string cacheKey = UserModuleCacheKeyConfig.Applet_Login_Info + UserId.ToString();
AppletUserInfo userInfo = null;
try
{
userInfo = redis.StringGet<AppletUserInfo>(cacheKey);
}
catch (Exception ex)
{
LogHelper.Write(ex, "GetAppletUserLoginInfo");
}
if (userInfo == null)
{
Int32.TryParse(UserId.ToString(), out int NewUserId);
if (NewUserId > 0)
{
string token = "";
var umodel = member_UserRepository.GetEntity<RB_Member_User_Extend>(NewUserId);
if (umodel != null)
{
AppletUserInfo obj = new AppletUserInfo
{
MallBaseId = umodel.MallBaseId,
MallName = "",
Mobile = umodel.Moblie,
TenantId = umodel.TenantId,
Name = umodel.Name,
OpenId = umodel.OpenId,
Photo = umodel.Photo,
SecretKey = umodel.SecretKey,
SuperiorId = umodel.SuperiorId ?? 0,
Token = token
};
AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + UserId, obj, Config.JwtExpirTime);
}
}
}
return userInfo;
}
} }
} }
...@@ -18,5 +18,13 @@ namespace Mall.CacheKey ...@@ -18,5 +18,13 @@ namespace Mall.CacheKey
{ {
get { return "Mall_Login_Info_"; } get { return "Mall_Login_Info_"; }
} }
/// <summary>
/// Applet_Login_Info_1(用户id)
/// </summary>
public static string Applet_Login_Info
{
get { return "Applet_Login_Info_"; }
}
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common
{
/// <summary>
/// 小程序用户信息缓存
/// </summary>
public class AppletUserInfo
{
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// 唯一码
/// </summary>
public string OpenId
{
get;
set;
}
/// <summary>
/// 名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 手机号码
/// </summary>
public string Mobile
{
get;
set;
}
/// <summary>
/// 上级id
/// </summary>
public int SuperiorId { get; set; }
/// <summary>
/// 头像
/// </summary>
public string Photo { get; set; }
/// <summary>
/// 商城名称
/// </summary>
public string MallName
{
get;
set;
}
/// <summary>
/// token
/// </summary>
public string Token { get; set; }
/// <summary>
/// SecretKey
/// </summary>
public string SecretKey { get; set; }
}
}
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.Goods
{
/// <summary>
/// 分销订单导出选项枚举
/// </summary>
public enum DistributionOrdersExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[EnumField("所属平台")]
SSPT = 1,
/// <summary>
/// 订单号
/// </summary>
[EnumField("订单号")]
DDH = 2,
/// <summary>
/// 下单用户
/// </summary>
[EnumField("下单用户")]
XDYH = 4,
/// <summary>
/// 商品名
/// </summary>
[EnumField("商品名")]
SPM = 5,
/// <summary>
/// 规格
/// </summary>
[EnumField("规格")]
GG = 6,
/// <summary>
/// 数量
/// </summary>
[EnumField("数量")]
SL = 7,
/// <summary>
/// 货号
/// </summary>
[EnumField("货号")]
HH = 8,
/// <summary>
/// 收件人
/// </summary>
[EnumField("收件人")]
SJR = 10,
/// <summary>
/// 收件人电话
/// </summary>
[EnumField("收件人电话")]
SJRDH = 11,
/// <summary>
/// 收件人地址
/// </summary>
[EnumField("收件人地址")]
SJRDZ = 12,
/// <summary>
/// 总金额
/// </summary>
[EnumField("总金额")]
ZJE = 13,
/// <summary>
/// 实际付款
/// </summary>
[EnumField("实际付款")]
SJFK = 14,
/// <summary>
/// 下单时间
/// </summary>
[EnumField("下单时间")]
XDSJ = 16,
/// <summary>
/// 订单状态
/// </summary>
[EnumField("订单状态")]
DDZT = 17,
/// <summary>
/// 支付方式
/// </summary>
[EnumField("支付方式")]
ZFFS = 18,
/// <summary>
/// 付款状态
/// </summary>
[EnumField("支付状态")]
FKZT = 19,
/// <summary>
/// 付款时间
/// </summary>
[EnumField("支付时间")]
FKSJ = 20,
/// <summary>
/// 备注/表单
/// </summary>
[EnumField("备注/表单")]
BZBD = 21,
/// <summary>
/// 买家留言
/// </summary>
[EnumField("买家留言")]
MJLY = 22,
/// <summary>
/// 自购返利
/// </summary>
[EnumField("自购返利")]
SJBZ = 23,
/// <summary>
/// 一级分销商
/// </summary>
[EnumField("一级分销商")]
YJFXS = 24,
/// <summary>
/// 二级分销商
/// </summary>
[EnumField("二级分销商")]
EJFXS = 25,
/// <summary>
/// 三级分销商
/// </summary>
[EnumField("三级分销商")]
SJFXS = 26,
/// <summary>
/// 一级佣金
/// </summary>
[EnumField("一级佣金")]
YJYJ = 27,
/// <summary>
/// 二级佣金
/// </summary>
[EnumField("二级佣金")]
EJYJ = 28,
/// <summary>
/// 三级佣金
/// </summary>
[EnumField("三级佣金")]
SJYJ = 29
}
}
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.Goods
{
/// <summary>
/// 会员购买导出选项枚举
/// </summary>
public enum MembersToBuyExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[EnumField("所属平台")]
SSPT = 1,
/// <summary>
/// 订单号
/// </summary>
[EnumField("订单号")]
DDH = 2,
/// <summary>
/// 用户昵称
/// </summary>
[EnumField("用户昵称")]
SHDH = 3,
/// <summary>
/// 支付金额
/// </summary>
[EnumField("支付金额")]
XDYH = 4,
/// <summary>
/// 支付日期
/// </summary>
[EnumField("支付日期")]
SPM = 5,
/// <summary>
/// 购买情况
/// </summary>
[EnumField("购买情况")]
GG = 6
}
}
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.Goods
{
/// <summary>
/// 订单列表导出选项枚举
/// </summary>
public enum OrderListExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[EnumField("所属平台")]
SSPT = 1,
/// <summary>
/// 订单号
/// </summary>
[EnumField("订单号")]
DDH = 2,
/// <summary>
/// 商户单号
/// </summary>
[EnumField("商户单号")]
SHDH = 3,
/// <summary>
/// 下单用户
/// </summary>
[EnumField("下单用户")]
XDYH = 4,
/// <summary>
/// 商品名
/// </summary>
[EnumField("商品名")]
SPM = 5,
/// <summary>
/// 规格
/// </summary>
[EnumField("规格")]
GG = 6,
/// <summary>
/// 数量
/// </summary>
[EnumField("数量")]
SL = 7,
/// <summary>
/// 货号
/// </summary>
[EnumField("货号")]
HH = 8,
/// <summary>
/// 成本价
/// </summary>
[EnumField("成本价")]
CBJ = 9,
/// <summary>
/// 收件人
/// </summary>
[EnumField("收件人")]
SJR = 10,
/// <summary>
/// 收件人电话
/// </summary>
[EnumField("收件人电话")]
SJRDH = 11,
/// <summary>
/// 收件人地址
/// </summary>
[EnumField("收件人地址")]
SJRDZ = 12,
/// <summary>
/// 总金额
/// </summary>
[EnumField("总金额")]
ZJE = 13,
/// <summary>
/// 实际付款
/// </summary>
[EnumField("实际付款")]
SJFK = 14,
/// <summary>
/// 运费
/// </summary>
[EnumField("运费")]
YF = 15,
/// <summary>
/// 下单时间
/// </summary>
[EnumField("下单时间")]
XDSJ = 16,
/// <summary>
/// 支付方式
/// </summary>
[EnumField("支付方式")]
ZFFS = 17,
/// <summary>
/// 订单状态
/// </summary>
[EnumField("订单状态")]
DDZT = 18,
/// <summary>
/// 付款状态
/// </summary>
[EnumField("付款状态")]
FKZT = 19,
/// <summary>
/// 付款时间
/// </summary>
[EnumField("付款时间")]
FKSJ = 20,
/// <summary>
/// 发货状态
/// </summary>
[EnumField("发货状态")]
FHZT = 21,
/// <summary>
/// 发货时间
/// </summary>
[EnumField("发货时间")]
FHSJ = 22,
/// <summary>
/// 收货状态
/// </summary>
[EnumField("收货状态")]
SHZT = 23,
/// <summary>
/// 收货时间
/// </summary>
[EnumField("收货时间")]
SHSJ = 24,
/// <summary>
/// 卖家留言
/// </summary>
[EnumField("卖家留言")]
MJLY = 25,
/// <summary>
/// 商家备注
/// </summary>
[EnumField("商家备注")]
SJBZ = 26,
/// <summary>
/// 备注/表单
/// </summary>
[EnumField("备注/表单")]
BZBD = 27
}
}
...@@ -13,9 +13,9 @@ namespace Mall.Common.Enum.Goods ...@@ -13,9 +13,9 @@ namespace Mall.Common.Enum.Goods
public enum OrderTypeEnum public enum OrderTypeEnum
{ {
/// <summary> /// <summary>
/// 商 /// 商
/// </summary> /// </summary>
[EnumField("商")] [EnumField("商")]
Mall = 1, Mall = 1,
/// <summary> /// <summary>
/// 砍价 /// 砍价
......
using Mall.Common.AOP; using Mall.Common.AOP;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User; using Mall.Common.Enum.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -370,5 +371,10 @@ namespace Mall.Model.Entity.Product ...@@ -370,5 +371,10 @@ namespace Mall.Model.Entity.Product
/// 是否加入快速购买 1是 2否 /// 是否加入快速购买 1是 2否
/// </summary> /// </summary>
public int? IsQuickBuy { get; set; } public int? IsQuickBuy { get; set; }
/// <summary>
/// 商品类型
/// </summary>
public OrderTypeEnum? GoodsType { get; set; }
} }
} }
...@@ -56,14 +56,6 @@ namespace Mall.Model.Entity.Product ...@@ -56,14 +56,6 @@ namespace Mall.Model.Entity.Product
set; set;
} }
/// <summary> /// <summary>
/// 订单类型 枚举
/// </summary>
public OrderTypeEnum? OrderType
{
get;
set;
}
/// <summary>
/// 支付方式 枚举 /// 支付方式 枚举
/// </summary> /// </summary>
public OrderPaymentTypeEnum? PaymentWay public OrderPaymentTypeEnum? PaymentWay
...@@ -263,5 +255,37 @@ namespace Mall.Model.Entity.Product ...@@ -263,5 +255,37 @@ namespace Mall.Model.Entity.Product
get; get;
set; set;
} }
/// <summary>
/// 支付时间
/// </summary>
public DateTime? PaymentTime { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public DateTime? DeliveryTime { get; set; }
/// <summary>
/// 收货时间
/// </summary>
public DateTime? ReceivingTime { get; set; }
/// <summary>
/// 是否申请取消订单 1是 2否
/// </summary>
public int? IsApplyForCancel { get; set; }
/// <summary>
/// 历史订单状态
/// </summary>
public int? HistoryOrderStatus { get; set; }
/// <summary>
/// 申请取消订单备注
/// </summary>
public string CancelRemark { get; set; }
/// <summary>
/// 申请取消审核状态 1同意 2拒绝
/// </summary>
public int? ApplyForCancelStatus { get; set; }
/// <summary>
/// 拒绝取消订单得备注
/// </summary>
public string RejectRemark { get; set; }
} }
} }
...@@ -31,6 +31,10 @@ namespace Mall.Model.Entity.Product ...@@ -31,6 +31,10 @@ namespace Mall.Model.Entity.Product
set; set;
} }
/// <summary> /// <summary>
/// 订单明细id
/// </summary>
public int? OrderDetailId { get; set; }
/// <summary>
/// 分销商id /// 分销商id
/// </summary> /// </summary>
public int? UserId public int? UserId
......
using Mall.Common.AOP; using Mall.Common.AOP;
using Mall.Common.Enum.Goods;
using Mall.Common.Enum.User; using Mall.Common.Enum.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -41,7 +42,7 @@ namespace Mall.Model.Entity.Product ...@@ -41,7 +42,7 @@ namespace Mall.Model.Entity.Product
/// <summary> /// <summary>
/// 订单类型 枚举 /// 订单类型 枚举
/// </summary> /// </summary>
public int? OrderType public OrderTypeEnum? OrderType
{ {
get; get;
set; set;
...@@ -158,5 +159,9 @@ namespace Mall.Model.Entity.Product ...@@ -158,5 +159,9 @@ namespace Mall.Model.Entity.Product
get; get;
set; set;
} }
/// <summary>
/// 成本价
/// </summary>
public decimal? CostMoney { get; set; }
} }
} }
...@@ -39,6 +39,10 @@ namespace Mall.Model.Entity.User ...@@ -39,6 +39,10 @@ namespace Mall.Model.Entity.User
set; set;
} }
/// <summary> /// <summary>
/// 手机号码
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 总计佣金 /// 总计佣金
/// </summary> /// </summary>
public decimal? TotalCommission public decimal? TotalCommission
......
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 用户收货地址表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Member_ShippingAddress
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 用户id
/// </summary>
public int? UserId
{
get;
set;
}
/// <summary>
/// 收货人名称
/// </summary>
public string Name
{
get;
set;
}
/// <summary>
/// 联系电话
/// </summary>
public string Mobile
{
get;
set;
}
/// <summary>
/// 国家
/// </summary>
public int? Country
{
get;
set;
}
/// <summary>
/// 省
/// </summary>
public int? Province
{
get;
set;
}
/// <summary>
/// 市
/// </summary>
public int? City
{
get;
set;
}
/// <summary>
/// 区
/// </summary>
public int? District
{
get;
set;
}
/// <summary>
/// 详细地址
/// </summary>
public string Address
{
get;
set;
}
/// <summary>
/// 邮编
/// </summary>
public string PostCode
{
get;
set;
}
/// <summary>
/// 经纬度 英文逗号分隔
/// </summary>
public string Lonlat
{
get;
set;
}
/// <summary>
/// 是否默认 1是 2否
/// </summary>
public int? IsDefault
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime? UpdateDate
{
get;
set;
}
}
}
...@@ -186,5 +186,9 @@ namespace Mall.Model.Entity.User ...@@ -186,5 +186,9 @@ namespace Mall.Model.Entity.User
/// 小程序id /// 小程序id
/// </summary> /// </summary>
public int MallBaseId { get; set; } public int MallBaseId { get; set; }
/// <summary>
/// 秘钥
/// </summary>
public string SecretKey { get; set; }
} }
} }
...@@ -13,6 +13,10 @@ namespace Mall.Model.Extend.Product ...@@ -13,6 +13,10 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_Extend : RB_Goods public class RB_Goods_Extend : RB_Goods
{ {
/// <summary>
/// 排序
/// </summary>
public int? OrderBy { get; set; }
/// <summary> /// <summary>
/// 开始时间 /// 开始时间
/// </summary> /// </summary>
......
...@@ -13,6 +13,21 @@ namespace Mall.Model.Extend.Product ...@@ -13,6 +13,21 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderCommission_Extend : RB_Goods_OrderCommission public class RB_Goods_OrderCommission_Extend : RB_Goods_OrderCommission
{ {
/// <summary>
/// ids
/// </summary>
public string OrderIds { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 手机号码
/// </summary>
public string Mobile { get; set; }
} }
} }
...@@ -13,6 +13,17 @@ namespace Mall.Model.Extend.Product ...@@ -13,6 +13,17 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderDetail_Extend : RB_Goods_OrderDetail public class RB_Goods_OrderDetail_Extend : RB_Goods_OrderDetail
{ {
/// <summary>
/// 订单ids
/// </summary>
public string OrderIds { get; set; }
/// <summary>
/// 图片地址
/// </summary>
public string CoverImagePath { get; set; }
/// <summary>
/// 明细ids
/// </summary>
public string OrderDetailIds { get; set; }
} }
} }
...@@ -13,6 +13,21 @@ namespace Mall.Model.Extend.Product ...@@ -13,6 +13,21 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderExpress_Extend : RB_Goods_OrderExpress public class RB_Goods_OrderExpress_Extend : RB_Goods_OrderExpress
{ {
/// <summary>
/// 订单明细ids
/// </summary>
public List<int> OrderDetailIdList { get; set; }
/// <summary>
/// 订单id
/// </summary>
public int? OrderId { get;set;}
/// <summary>
/// 订单快递ids
/// </summary>
public string OrderExpressIds { get; set; }
/// <summary>
/// 快递名称
/// </summary>
public string ExpressName { get; set; }
} }
} }
...@@ -21,5 +21,41 @@ namespace Mall.Model.Extend.Product ...@@ -21,5 +21,41 @@ namespace Mall.Model.Extend.Product
/// 结束时间 /// 结束时间
/// </summary> /// </summary>
public string EndTime { get; set; } public string EndTime { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string GoodsName { get; set; }
/// <summary>
/// 货号
/// </summary>
public string ProductCode { get; set; }
/// <summary>
/// 订单类型
/// </summary>
public int? OrderType { get; set; }
/// <summary>
/// 明细列表
/// </summary>
public List<RB_Goods_OrderDetail_Extend> DetailList { get; set; }
/// <summary>
/// 订单返佣列表
/// </summary>
public List<RB_Goods_OrderCommission_Extend> OrderCommissionList { get; set; }
/// <summary>
/// 是否发放佣金 1是 2否
/// </summary>
public int? IsOrderCommission { get; set; }
/// <summary>
/// 导出选项
/// </summary>
public List<int> ExcelEnumIds { get; set; }
/// <summary>
/// 区域地址
/// </summary>
public string DistrictAddress { get; set; }
} }
} }
...@@ -41,6 +41,14 @@ namespace Mall.Model.Extend.Product ...@@ -41,6 +41,14 @@ namespace Mall.Model.Extend.Product
get; get;
set; set;
} }
/// <summary>
/// 上1级名称
/// </summary>
public string Parent1Name { get; set; }
/// <summary>
/// 上2级名称
/// </summary>
public string Parent2Name { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -32,10 +32,6 @@ namespace Mall.Model.Extend.User ...@@ -32,10 +32,6 @@ namespace Mall.Model.Extend.User
/// </summary> /// </summary>
public string Photo { get; set; } public string Photo { get; set; }
/// <summary> /// <summary>
/// 手机
/// </summary>
public string Mobile { get; set; }
/// <summary>
/// 等级名称 /// 等级名称
/// </summary> /// </summary>
public string GradeName { get; set; } public string GradeName { get; set; }
......
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 用户收货地址表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Member_ShippingAddress_Extend : RB_Member_ShippingAddress
{
}
}
This diff is collapsed.
...@@ -99,6 +99,164 @@ namespace Mall.Module.Product ...@@ -99,6 +99,164 @@ namespace Mall.Module.Product
private readonly RB_Logistics_RulesRepository logistics_RulesRepository = new RB_Logistics_RulesRepository(); private readonly RB_Logistics_RulesRepository logistics_RulesRepository = new RB_Logistics_RulesRepository();
#region 小程序接口
/// <summary>
/// 获取小程序商品列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetAppletGoodsPageList(int pageIndex, int pageSize, out long count, RB_Goods_Extend demodel)
{
var list = goodsRepository.GetAppletGoodsPageList(pageIndex, pageSize, out count, demodel);
if (list.Any())
{
foreach (var item in list)
{
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<int> CarouselIdList = JsonConvert.DeserializeObject<List<int>>(item.CarouselImage);
//封面图
item.CoverImage = material_InfoRepository.GetEntity(CarouselIdList[0])?.Path ?? "";
}
}
}
return list;
}
/// <summary>
/// 获取小程序商品详情
/// </summary>
/// <param name="goodsId"></param>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public RB_Goods_Extend GetAppletGoodsInfo(int goodsId, int TenantId, int MallBaseId)
{
var model = goodsRepository.GetEntity(goodsId).RefMapperTo<RB_Goods_Extend>();
if (model == null || model.TenantId != TenantId || model.MallBaseId != MallBaseId)
{
return null;
}
model.SpecificationList = new List<RB_Goods_Specification_Extend>();
model.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (model.IsCustomSpecification == 1)
{
model.SpecificationList = goods_SpecificationRepository.GetList(new RB_Goods_Specification_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
if (model.SpecificationList.Any())
{
var svlist = goods_SpecificationValueRepository.GetList(new RB_Goods_SpecificationValue_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
if (svlist.Where(x => x.Image > 0).Any())
{
string imgIds = string.Join(",", svlist.Where(x => x.Image > 0).Select(x => x.Image).Distinct());
var mlist = material_InfoRepository.GetList(new RB_Material_Info_Extend() { MaterialIds = imgIds, TenantId = TenantId, MallBaseId = MallBaseId });
foreach (var item in svlist.Where(x => x.Image > 0))
{
item.ImagePath = mlist.Where(x => x.Id == item.Image).FirstOrDefault()?.Path ?? "";
}
}
foreach (var item in model.SpecificationList)
{
item.SpecificationValueList = svlist.Where(x => x.SpecificationId == item.Id).ToList();
}
}
model.SpecificationPriceList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
model.AreaList = new List<RB_Goods_Area_Extend>();
if (model.IsAreaBuy == 1)
{
model.AreaList = goods_AreaRepository.GetList(new RB_Goods_Area_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
model.DistributionCommissionList = new List<RB_Goods_DistributionCommission_Extend>();
if (model.SeparateDistribution == 1)
{
model.DistributionCommissionList = goods_DistributionCommissionRepository.GetList(new RB_Goods_DistributionCommission_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
model.MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
model.MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsId = goodsId, TenantId = TenantId, MallBaseId = MallBaseId });
}
model.CarouselImageList = new List<RB_ImageCommonModel>();
if (!string.IsNullOrEmpty(model.CarouselImage) && model.CarouselImage != "[]")
{
List<int> CarouselIdList = JsonConvert.DeserializeObject<List<int>>(model.CarouselImage);
//轮播图
var mlist = material_InfoRepository.GetList(new RB_Material_Info_Extend() { MaterialIds = string.Join(",", CarouselIdList), TenantId = TenantId, MallBaseId = MallBaseId });
foreach (var item in CarouselIdList)
{
var cmodel = mlist.Where(x => x.Id == item).FirstOrDefault();
model.CarouselImageList.Add(new RB_ImageCommonModel()
{
Id = item,
Name = cmodel?.Name ?? "",
Path = cmodel?.Path ?? ""
});
}
}
if (model.CustomShareImage > 0)
{
model.CustomShareImagePath = material_InfoRepository.GetEntity(model.CustomShareImage)?.Path ?? "";
}
//服务列表
model.ServiceList = new List<RB_ImageCommonModel>();
if (model.IsDefaultService == 2)
{
if (!string.IsNullOrEmpty(model.GoodsService) && model.GoodsService != "[]")
{
List<int> ServiceIds = JsonConvert.DeserializeObject<List<int>>(model.GoodsService);
var slist = product_ServiceRepository.GetList(new RB_Product_Service_Extend() { ServiceIds = string.Join(",", ServiceIds), TenantId = TenantId, MallBaseId = MallBaseId });
foreach (var item in slist)
{
model.ServiceList.Add(new RB_ImageCommonModel()
{
Id = item.Id,
Name = item.Name
});
}
}
}
else if (model.IsDefaultService == 1) {
var slist = product_ServiceRepository.GetList(new RB_Product_Service_Extend() { IsDefault = 1, TenantId = TenantId, MallBaseId = MallBaseId });
foreach (var item in slist)
{
model.ServiceList.Add(new RB_ImageCommonModel()
{
Id = item.Id,
Name = item.Name
});
}
}
//运费
if (model.FreightId > 0)
{
model.FreightName = logistics_RulesRepository.GetEntity(model.FreightId)?.RulesName ?? "";
}
else
{
model.FreightName = "默认运费";
}
//表单
if (model.FormsId > 0)
{
model.FormsName = "未建表";
}
else
{
model.FormsName = "默认表单";
}
return model;
}
#endregion
#region 素材管理 #region 素材管理
/// <summary> /// <summary>
/// 获取素材分组列表 /// 获取素材分组列表
...@@ -738,6 +896,15 @@ namespace Mall.Module.Product ...@@ -738,6 +896,15 @@ namespace Mall.Module.Product
model.IconPath = mlist.Where(x => x.Id == model.Icon).FirstOrDefault()?.Path ?? ""; model.IconPath = mlist.Where(x => x.Id == model.Icon).FirstOrDefault()?.Path ?? "";
model.BigIconPath = mlist.Where(x => x.Id == model.BigIcon).FirstOrDefault()?.Path ?? ""; model.BigIconPath = mlist.Where(x => x.Id == model.BigIcon).FirstOrDefault()?.Path ?? "";
model.AdvertisingImagePath = mlist.Where(x => x.Id == model.AdvertisingImage).FirstOrDefault()?.Path ?? ""; model.AdvertisingImagePath = mlist.Where(x => x.Id == model.AdvertisingImage).FirstOrDefault()?.Path ?? "";
var p1Model = product_CategoryRepository.GetEntity(model?.ParentId);
if (p1Model != null) {
model.Parent1Name = p1Model.Name;
var p2Model = product_CategoryRepository.GetEntity(p1Model?.ParentId);
if (p2Model != null) {
model.Parent1Name = p2Model.Name;
model.Parent2Name = p1Model.Name;//黄媛媛要求 1表示1级 2表示2级
}
}
return model; return model;
} }
...@@ -1108,7 +1275,7 @@ namespace Mall.Module.Product ...@@ -1108,7 +1275,7 @@ namespace Mall.Module.Product
OperatorEnum=OperatorEnum.Equal OperatorEnum=OperatorEnum.Equal
}, },
}; };
return product_SpecificationRepository.Update(keyValues, wheres); return product_QuickBuyRepository.Update(keyValues, wheres);
} }
#endregion #endregion
...@@ -1288,6 +1455,16 @@ namespace Mall.Module.Product ...@@ -1288,6 +1455,16 @@ namespace Mall.Module.Product
} }
} }
/// <summary>
/// 获取服务详情
/// </summary>
/// <param name="serviceId"></param>
/// <returns></returns>
public RB_Product_Service_Extend GetProductServiceInfo(int serviceId)
{
return product_ServiceRepository.GetEntity(serviceId).RefMapperTo<RB_Product_Service_Extend>();
}
/// <summary> /// <summary>
/// 删除商品服务 /// 删除商品服务
/// </summary> /// </summary>
......
...@@ -65,6 +65,10 @@ namespace Mall.Module.User ...@@ -65,6 +65,10 @@ namespace Mall.Module.User
/// 分销提现 /// 分销提现
/// </summary> /// </summary>
private readonly RB_Distributor_RemitRepository distributor_RemitRepository = new RB_Distributor_RemitRepository(); private readonly RB_Distributor_RemitRepository distributor_RemitRepository = new RB_Distributor_RemitRepository();
/// <summary>
/// 收货地址
/// </summary>
private readonly RB_Member_ShippingAddressRepository member_ShippingAddressRepository = new RB_Member_ShippingAddressRepository();
/// <summary> /// <summary>
...@@ -124,6 +128,51 @@ namespace Mall.Module.User ...@@ -124,6 +128,51 @@ namespace Mall.Module.User
return member_UserRepository.GetEntity(userId).RefMapperTo<RB_Member_User_Extend>(); return member_UserRepository.GetEntity(userId).RefMapperTo<RB_Member_User_Extend>();
} }
/// <summary>
/// 新增用户
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public int AddMemberUserInfo(RB_Member_User_Extend demodel)
{
return member_UserRepository.Insert(demodel);
}
/// <summary>
/// 验证用户是否存在
/// </summary>
/// <param name="openId"></param>
/// <param name="source"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool ValidateUserOpenId(string openId, Common.Enum.User.UserSourceEnum? source, int tenantId, int mallBaseId)
{
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Member_User.Source),
FiledValue=(int)source,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_User.OpenId),
FiledValue=openId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_User.TenantId),
FiledValue=tenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Member_User.MallBaseId),
FiledValue=mallBaseId,
OperatorEnum=OperatorEnum.Equal
},
};
return member_UserRepository.Exists(wheres);
}
/// <summary> /// <summary>
/// 获取列表 /// 获取列表
/// </summary> /// </summary>
...@@ -1035,17 +1084,17 @@ namespace Mall.Module.User ...@@ -1035,17 +1084,17 @@ namespace Mall.Module.User
if (flag) if (flag)
{ {
//更新手机号码 //更新手机号码
Dictionary<string, object> keyValues = new Dictionary<string, object>() { //Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Member_User.Moblie),demodel.Mobile} // { nameof(RB_Member_User.Moblie),demodel.Mobile}
}; //};
List<WhereHelper> wheres = new List<WhereHelper>() { //List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){ // new WhereHelper(){
FiledName=nameof(RB_Member_User.Id), // FiledName=nameof(RB_Member_User.Id),
FiledValue=demodel.UserId, // FiledValue=demodel.UserId,
OperatorEnum=OperatorEnum.Equal // OperatorEnum=OperatorEnum.Equal
} // }
}; //};
member_UserRepository.Update(keyValues, wheres); //member_UserRepository.Update(keyValues, wheres);
} }
return flag; return flag;
} }
...@@ -1508,5 +1557,32 @@ namespace Mall.Module.User ...@@ -1508,5 +1557,32 @@ namespace Mall.Module.User
} }
return flag ? "" : "操作失败"; return flag ? "" : "操作失败";
} }
#region 收货地址
/// <summary>
/// 收货地址分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Member_ShippingAddress_Extend> GetUserShippingAddressPageList(int pageIndex, int pageSize, out long count, RB_Member_ShippingAddress_Extend demodel)
{
return member_ShippingAddressRepository.GetPageList(pageIndex, pageSize, out count, demodel);
}
/// <summary>
/// 收货地址列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Member_ShippingAddress_Extend> GetUserShippingAddressList(RB_Member_ShippingAddress_Extend demodel)
{
return member_ShippingAddressRepository.GetList(demodel);
}
#endregion
} }
} }
...@@ -238,8 +238,14 @@ namespace Mall.Repository ...@@ -238,8 +238,14 @@ namespace Mall.Repository
case OperatorEnum.NotEqual: case OperatorEnum.NotEqual:
sb.AppendFormat(@" AND {0}<>@D{0}", item.FiledName); sb.AppendFormat(@" AND {0}<>@D{0}", item.FiledName);
break; break;
case OperatorEnum.IN:
sb.AppendFormat(@" AND {0} in({1})", item.FiledName, item.FiledValue);
break;
}
if (item.OperatorEnum != OperatorEnum.IN)
{
parameters.Add("D" + item.FiledName, item.FiledValue);
} }
parameters.Add("D" + item.FiledName, item.FiledValue);
} }
return this.Execute(sb.ToString(), parameters, transaction) > 0; return this.Execute(sb.ToString(), parameters, transaction) > 0;
} }
......
...@@ -115,5 +115,86 @@ inner join rb_goods_category c on g.Id=c.GoodsId ...@@ -115,5 +115,86 @@ inner join rb_goods_category c on g.Id=c.GoodsId
where {where} group by g.Id order by g.CreateDate desc"; where {where} group by g.Id order by g.CreateDate desc";
return Get<RB_Goods_Extend>(sql).ToList(); return Get<RB_Goods_Extend>(sql).ToList();
} }
/// <summary>
/// 小程序获取商品列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Extend> GetAppletGoodsPageList(int pageIndex, int pageSize, out long count, RB_Goods_Extend dmodel)
{
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0";
if (dmodel.TenantId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds))
{
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and g.{nameof(RB_Goods_Extend.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.GoodsStatus > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.GoodsStatus)}={dmodel.GoodsStatus}";
}
if (dmodel.GoodsType > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.GoodsType)}={dmodel.GoodsType}";
}
if (dmodel.IsSelectSellOut == 1)
{
where += $@" and g.{nameof(RB_Goods_Extend.InventoryNum)}<=0";
}
if (!string.IsNullOrEmpty(dmodel.CategoryIds))
{
where += $@" and c.{nameof(RB_Goods_Category.CategoryId)} in({dmodel.CategoryIds})";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
}
string orderBy = $" order by g.{nameof(RB_Goods_Extend.Sort)} asc";
if (dmodel.OrderBy == 1)
{//最新
orderBy = $" order by g.{nameof(RB_Goods_Extend.CreateDate)} desc";
}
else if (dmodel.OrderBy == 2)
{
//价格低-高
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} asc";
}
else if (dmodel.OrderBy == 3)
{
//价格高-低
orderBy = $" order by g.{nameof(RB_Goods_Extend.SellingPrice)} desc";
}
else if (dmodel.OrderBy == 4) {
//销量高-低
orderBy = $" order by g.{nameof(RB_Goods_Extend.SalesNum)} desc";
}
string sql = $@"select g.* from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
where {where} group by g.Id {orderBy}";
return GetPage<RB_Goods_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单物流关联仓储层
/// </summary>
public class RB_Goods_ExpressRelevanceRepository : RepositoryBase<RB_Goods_ExpressRelevance>
{
/// <summary>
/// 获取订单明细列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_ExpressRelevance_Extend> GetList(RB_Goods_ExpressRelevance_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_ExpressRelevance.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_ExpressRelevance.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_ExpressRelevance.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderDetailId > 0)
{
where += $@" and {nameof(RB_Goods_ExpressRelevance.OrderDetailId)}={dmodel.OrderDetailId}";
}
if (dmodel.OrderExpressId > 0)
{
where += $@" and {nameof(RB_Goods_ExpressRelevance.OrderExpressId)}={dmodel.OrderExpressId}";
}
string sql = $@"SELECT * FROM RB_Goods_ExpressRelevance where {where} order by Id asc";
return Get<RB_Goods_ExpressRelevance_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单日志仓储层
/// </summary>
public class RB_Goods_LogRepository : RepositoryBase<RB_Goods_Log>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_Log_Extend> GetList(RB_Goods_Log_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_Log.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_Log.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Type > 0)
{
where += $@" and {nameof(RB_Goods_Log.Type)}={dmodel.Type}";
}
if (dmodel.SourceId > 0)
{
where += $@" and {nameof(RB_Goods_Log.SourceId)}={dmodel.SourceId}";
}
string sql = $@"SELECT * FROM RB_Goods_Log where {where} order by Id asc";
return Get<RB_Goods_Log_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单返佣仓储层
/// </summary>
public class RB_Goods_OrderCommissionRepository : RepositoryBase<RB_Goods_OrderCommission>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetList(RB_Goods_OrderCommission_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT * FROM RB_Goods_OrderCommission where {where} order by Id asc";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
/// <summary>
/// 获取用户返佣
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderCommission_Extend> GetListGroupByUser(RB_Goods_OrderCommission_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)}={dmodel.OrderId}";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Goods_OrderCommission.UserId)}={dmodel.UserId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and {nameof(RB_Goods_OrderCommission.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT OrderId,UserId,Grade,SUM(Commission) as Commission FROM RB_Goods_OrderCommission where {where} group by OrderId,UserId,Grade order by Grade asc";
return Get<RB_Goods_OrderCommission_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单明细仓储层
/// </summary>
public class RB_Goods_OrderDetailRepository : RepositoryBase<RB_Goods_OrderDetail>
{
/// <summary>
/// 获取订单明细列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetOrderDetailList(RB_Goods_OrderDetail_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderDetail.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderDetail.MallBaseId)}={dmodel.MallBaseId}";
}
if (!string.IsNullOrEmpty(dmodel.OrderDetailIds))
{
where += $@" and {nameof(RB_Goods_OrderDetail.Id)} in({dmodel.OrderDetailIds})";
}
if (dmodel.OrderId > 0)
{
where += $@" and {nameof(RB_Goods_OrderDetail.OrderId)}={dmodel.OrderId}";
}
if (dmodel.OrderType > 0)
{
where += $@" and {nameof(RB_Goods_OrderDetail.OrderType)}={(int)dmodel.OrderType}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and {nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(dmodel.ProductCode))
{
where += $@" and {nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
}
if (!string.IsNullOrEmpty(dmodel.OrderIds))
{
where += $@" and {nameof(RB_Goods_OrderDetail.OrderId)} in({dmodel.OrderIds})";
}
string sql = $@"SELECT * FROM rb_goods_orderdetail where {where} order by Id asc";
return Get<RB_Goods_OrderDetail_Extend>(sql).ToList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Product;
using Mall.Model.Extend.Product;
using System.Linq;
using Mall.Model.Entity.User;
namespace Mall.Repository.Product
{
/// <summary>
/// 商品订单物流仓储层
/// </summary>
public class RB_Goods_OrderExpressRepository : RepositoryBase<RB_Goods_OrderExpress>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderExpress_Extend> GetList(RB_Goods_OrderExpress_Extend dmodel)
{
string where = $" 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Goods_OrderExpress.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Goods_OrderExpress.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Type > 0)
{
where += $@" and {nameof(RB_Goods_OrderExpress.Type)}={dmodel.Type}";
}
if (dmodel.ExpressId > 0)
{
where += $@" and {nameof(RB_Goods_OrderExpress.ExpressId)}={dmodel.ExpressId}";
}
if (!string.IsNullOrEmpty(dmodel.ExpressNumber))
{
where += $@" and {nameof(RB_Goods_OrderExpress.ExpressNumber)} like '%{dmodel.ExpressNumber}%'";
}
if (!string.IsNullOrEmpty(dmodel.OrderExpressIds)) {
where += $@" and {nameof(RB_Goods_OrderExpress.Id)} in({dmodel.OrderExpressIds})";
}
string sql = $@"SELECT * FROM RB_Goods_OrderExpress where {where} order by Id asc";
return Get<RB_Goods_OrderExpress_Extend>(sql).ToList();
}
}
}
This diff is collapsed.
...@@ -52,7 +52,7 @@ namespace Mall.Repository.User ...@@ -52,7 +52,7 @@ namespace Mall.Repository.User
} }
if (!string.IsNullOrEmpty(dmodel.Mobile)) if (!string.IsNullOrEmpty(dmodel.Mobile))
{ {
where += $@" and u.{nameof(RB_Member_User.Moblie)} like '%{dmodel.Mobile}%'"; where += $@" and di.{nameof(RB_Distributor_Info.Mobile)} like '%{dmodel.Mobile}%'";
} }
string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile from RB_Distributor_Info di string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile from RB_Distributor_Info di
...@@ -146,7 +146,7 @@ where {where} order by di.CreateDate desc"; ...@@ -146,7 +146,7 @@ where {where} order by di.CreateDate desc";
} }
if (!string.IsNullOrEmpty(dmodel.Mobile)) if (!string.IsNullOrEmpty(dmodel.Mobile))
{ {
where += $@" and u.{nameof(RB_Member_User.Moblie)} like '%{dmodel.Mobile}%'"; where += $@" and di.{nameof(RB_Distributor_Info.Mobile)} like '%{dmodel.Mobile}%'";
} }
string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile,u.OrderNum from RB_Distributor_Info di string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile,u.OrderNum from RB_Distributor_Info di
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 用户收货地址仓储层
/// </summary>
public class RB_Member_ShippingAddressRepository : RepositoryBase<RB_Member_ShippingAddress>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_ShippingAddress_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Member_ShippingAddress_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Member_ShippingAddress.Status)}=0 ";
if (dmodel.TenantId > 0) {
where += $@" and {nameof(RB_Member_ShippingAddress.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Member_ShippingAddress.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.IsDefault > 0) {
where += $@" and {nameof(RB_Member_ShippingAddress.IsDefault)} ={(int)dmodel.IsDefault}";
}
if (!string.IsNullOrEmpty(dmodel.Name)) {
where += $@" and {nameof(RB_Member_ShippingAddress.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.UserId > 0) {
where += $@" and {nameof(RB_Member_ShippingAddress.UserId)} ={(int)dmodel.UserId}";
}
string sql = $@"select * from RB_Member_ShippingAddress where {where} order by IsDefault asc,UpdateDate desc";
return GetPage<RB_Member_ShippingAddress_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Member_ShippingAddress_Extend> GetList(RB_Member_ShippingAddress_Extend dmodel)
{
string where = $" 1=1 and {nameof(RB_Member_ShippingAddress.Status)}=0 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Member_ShippingAddress.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Member_ShippingAddress.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.IsDefault > 0)
{
where += $@" and {nameof(RB_Member_ShippingAddress.IsDefault)} ={(int)dmodel.IsDefault}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Member_ShippingAddress.Name)} like '%{dmodel.Name}%'";
}
if (dmodel.UserId > 0)
{
where += $@" and {nameof(RB_Member_ShippingAddress.UserId)} ={(int)dmodel.UserId}";
}
string sql = $@"select * from RB_Member_ShippingAddress where {where} order by IsDefault asc,UpdateDate desc";
return Get<RB_Member_ShippingAddress_Extend>(sql).ToList();
}
}
}
...@@ -4,6 +4,7 @@ using System.Text; ...@@ -4,6 +4,7 @@ using System.Text;
using Mall.Model.Entity.User; using Mall.Model.Entity.User;
using Mall.Model.Extend.User; using Mall.Model.Extend.User;
using System.Linq; using System.Linq;
using Mall.Common.Enum.User;
namespace Mall.Repository.User namespace Mall.Repository.User
{ {
......
...@@ -58,5 +58,35 @@ namespace Mall.WebApi.Controllers ...@@ -58,5 +58,35 @@ namespace Mall.WebApi.Controllers
return userInfo; return userInfo;
} }
} }
public RequestParm AppletRequestParm
{
get
{
#region 读取post参数
var requestMsg = Request.HttpContext.Items[GlobalKey.UserPostInfo];
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (Request.HttpContext.Items[GlobalKey.TokenUserInfo] != null)
{
JObject parms = JObject.Parse(Request.HttpContext.Items[GlobalKey.TokenUserInfo].ToString());
requestParm.uid = parms.GetStringValue("uid");
}
#endregion
//根据token 获取uid
return requestParm;
}
}
/// <summary>
/// 小程序用户缓存
/// </summary>
public AppletUserInfo AppletUserInfo
{
get {
var parm = this.RequestParm;
AppletUserInfo userInfo = UserReidsCache.GetAppletUserLoginInfo(parm.uid);
return userInfo;
}
}
} }
} }
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.Product;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using Mall.Module.Product;
namespace Mall.WebApi.Controllers.MallBase
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletGoodsController : ControllerBase
{
private readonly ProductModule productModule = new ProductModule();
#region 商品分类
/// <summary>
/// 获取商品分类分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryPageList(object requestMsg)
{
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (parms.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.Enabled = 1;
demodel.IsShow = 1;
var list = productModule.GetProductCategoryPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Tier,
x.ParentId,
x.Sort,
x.Icon,
x.IconPath,
x.BigIcon,
x.BigIconPath,
x.AdvertisingImage,
x.AdvertisingImagePath,
x.AdvertisingAddress,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取分类树形结构
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryTreeList(object requestMsg) {
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (parms.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
RB_Product_Category_Extend demodel = JsonConvert.DeserializeObject<RB_Product_Category_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.Enabled = 1;
demodel.IsShow = 1;
var list = productModule.GetProductCategoryTreeList(demodel);
return ApiResult.Success("", list);
}
/// <summary>
/// 获取分类样式
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductCategoryStyleInfo(object requestMsg) {
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (parms.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = productModule.GetProductCategoryStyleInfo(parms.TenantId, parms.MallBaseId);
return ApiResult.Success("", new
{
model.Id,
model.Type,
model.Style,
model.CategoryNum,
model.RowNum,
UpdateDate = model.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")
});
}
#endregion
#region 商品列表
/// <summary>
/// 小程序分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsPageList(object requestMsg) {
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (parms.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.GoodsStatus = 1;//只查询销售中的
var list = productModule.GetAppletGoodsPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Sort,
x.CoverImage,
x.SellingPrice,
x.SalesNum,
x.IsQuickBuy,
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取小程序商品详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsInfo(object requestMsg) {
var req = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (req.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
JObject prams = JObject.Parse(req.msg.ToString());
int GoodsId = prams.GetInt("GoodsId", 0);
if (GoodsId <= 0) {
return ApiResult.ParamIsNull();
}
var model = productModule.GetAppletGoodsInfo(GoodsId, req.TenantId, req.MallBaseId);
return ApiResult.Success("", new
{
model.Id,
model.Name,
model.CarouselImage,
model.VideoAddress,
model.CustomShareTitles,
model.CustomShareImage,
model.CustomShareImagePath,
model.GoodsStatus,
model.InventoryNum,
model.DefaultSpecificationName,
model.IsCustomSpecification,
model.Sort,
model.SellingPrice,
model.OriginalPrice,
model.Unit,
model.CostPrice,
model.IsGoodsNegotiable,
model.SalesNum,
model.GoodsNumbers,
model.GoodsWeight,
model.IsDefaultService,
model.GoodsService,
model.FreightId,
model.FreightName,
model.FormsId,
model.FormsName,
model.LimitBuyGoodsNum,
model.LimitBuyOrderNum,
model.FullNumPinkage,
model.FullMoneyPinkage,
model.IsAreaBuy,
model.IntegralPresent,
model.IntegralPresentType,
model.PointsDeduction,
model.PointsDeductionType,
model.IsMultipleDeduction,
model.GoodsDetails,
model.SeparateDistribution,
model.SeparateDistributionType,
model.SeparateDistributionMoneyType,
model.EnjoyMember,
model.SeparateSetMember,
model.IsQuickBuy,
CategoryList= model.CategoryList.Select(x=>new {
x.Id,
x.CategoryId,
x.CategoryName
}),
SpecificationList= model.SpecificationList.Select(x=>new {
x.Id,
x.EnabledImage,
x.Name,
x.Sort,
SpecificationValueList= x.SpecificationValueList.Select(y=>new {
y.Id,
y.Image,
y.ImagePath,
y.Name,
y.Sort
})
}),
SpecificationPriceList= model.SpecificationPriceList.Select(x=>new {
x.Id,
x.GoodsNumbers,
x.GoodsWeight,
x.InventoryNum,
x.SellingPrice,
x.SpecificationSort
}),
AreaList= model.AreaList.Select(x=>new {
x.Id,
x.AreaId,
x.AreaName,
x.AreaType
}),
DistributionCommissionList= model.DistributionCommissionList.Select(x=>new {
x.Id,
x.DistributorGrade,
x.OneCommission,
x.SpecificationSort,
x.ThreeCommission,
x.TwoCommission
}),
MemberPriceList= model.MemberPriceList.Select(x=>new {
x.Id,
x.MemberGrade,
x.MemberPrice,
x.SpecificationSort
}),
model.CarouselImageList,
model.ServiceList
});
}
#endregion
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -433,6 +433,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -433,6 +433,8 @@ namespace Mall.WebApi.Controllers.MallBase
model.AdvertisingAddress, model.AdvertisingAddress,
model.Enabled, model.Enabled,
model.IsShow, model.IsShow,
model.Parent1Name,
model.Parent2Name,
model.TenantId, model.TenantId,
model.MallBaseId, model.MallBaseId,
CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd") : "" CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd") : ""
...@@ -972,6 +974,29 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -972,6 +974,29 @@ namespace Mall.WebApi.Controllers.MallBase
})); }));
} }
/// <summary>
/// 获取服务详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetProductServiceInfo() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int ServiceId = parms.GetInt("ServiceId", 0);
if (ServiceId <= 0) {
return ApiResult.ParamIsNull();
}
var model = productModule.GetProductServiceInfo(ServiceId);
return ApiResult.Success("",new {
model.Id,
model.Name,
model.Sort,
model.Remark,
model.IsDefault
});
}
/// <summary> /// <summary>
/// 保存修改服务 /// 保存修改服务
/// </summary> /// </summary>
...@@ -1189,6 +1214,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1189,6 +1214,8 @@ namespace Mall.WebApi.Controllers.MallBase
x.Id, x.Id,
x.Name, x.Name,
x.CoverImage, x.CoverImage,
x.SellingPrice,
x.SalesNum,
CategoryList = x.CategoryList.Select(y => new { y.Id, y.CategoryName }) CategoryList = x.CategoryList.Select(y => new { y.Id, y.CategoryName })
}); });
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
...@@ -1389,7 +1416,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1389,7 +1416,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
//验证所有keys //验证所有keys
foreach (var item in KeyList) { foreach (var item in KeyList) {
string keys = item.Substring(1, item.Length - 1); string keys = item[1..];
var pricemodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == keys).FirstOrDefault(); var pricemodel = demodel.SpecificationPriceList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
if (pricemodel == null) { if (pricemodel == null) {
return ApiResult.ParamIsNull("规格价格Key有误"); return ApiResult.ParamIsNull("规格价格Key有误");
...@@ -1439,7 +1466,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1439,7 +1466,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表数量不正确"); return ApiResult.ParamIsNull("分销佣金" + item.Name + "列表数量不正确");
} }
foreach (var qitem in KeyList) { foreach (var qitem in KeyList) {
string keys = qitem.Substring(1, qitem.Length - 1); string keys = qitem[1..];
var gcmodel = gradeList.Where(x => x.SpecificationSort == keys).FirstOrDefault(); var gcmodel = gradeList.Where(x => x.SpecificationSort == keys).FirstOrDefault();
if (gcmodel == null) if (gcmodel == null)
{ {
...@@ -1623,6 +1650,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1623,6 +1650,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
} }
demodel.IsQuickBuy ??= 2; demodel.IsQuickBuy ??= 2;
demodel.GoodsType ??= Common.Enum.Goods.OrderTypeEnum.Mall;
bool flag = productModule.SetProductGoodsInfo(demodel); bool flag = productModule.SetProductGoodsInfo(demodel);
if (flag) if (flag)
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.User;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
using JWT;
using JWT.Algorithms;
using JWT.Serializers;
using Mall.Common.Enum;
using Mall.CacheKey;
namespace Mall.WebApi.Controllers.User
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletLoginController : ControllerBase
{
private readonly UserModule userModule = new UserModule();
/// <summary>
/// 商户小程序处理类
/// </summary>
private readonly MiniProgramModule programModule = new MiniProgramModule();
#region 小程序登录
/// <summary>
/// 登录注册
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
public ApiResult Login(object requestMsg) {
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
RB_Member_User_Extend demodel = JsonConvert.DeserializeObject<RB_Member_User_Extend>(requestParm.msg.ToString());
if (requestParm.TenantId <= 0) {
return ApiResult.ParamIsNull("请传递商户号");
}
if (requestParm.MallBaseId <= 0) {
return ApiResult.ParamIsNull("请传递小程序id");
}
if (!demodel.Source.HasValue) {
return ApiResult.ParamIsNull("请传递来源平台");
}
if (string.IsNullOrEmpty(demodel.OpenId)) {
return ApiResult.ParamIsNull("请传递唯一码");
}
//验证是否新用户
if (!userModule.ValidateUserOpenId(demodel.OpenId, demodel.Source, requestParm.TenantId, requestParm.MallBaseId))
{
//注册新用户
if (string.IsNullOrEmpty(demodel.Name)) {
return ApiResult.ParamIsNull("请传递用户名称");
}
if (string.IsNullOrEmpty(demodel.Photo)) {
return ApiResult.ParamIsNull("请传递用户头像");
}
#region 赋默认值
demodel.AliasName ??= "";
demodel.Moblie ??= "";
demodel.MemberGrade ??= 0;//普通会员
demodel.OrderNum ??= 0;
demodel.CouponsNum ??= 0;
demodel.CardVolumeNum ??= 0;
demodel.Balance ??= 0;
demodel.Integral ??= 0;
demodel.SuperiorId ??= 0;//0表示 总店
demodel.Blacklist ??= 0;
demodel.ContactWay ??= "";
demodel.Remark ??= "";
demodel.TotalConsumption ??= 0;
#endregion
demodel.TenantId = requestParm.TenantId;
demodel.MallBaseId = requestParm.MallBaseId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
demodel.SecretKey = Guid.NewGuid().ToString();
int UserId = userModule.AddMemberUserInfo(demodel);
bool flag = UserId > 0;
if (flag) {
//返回基本信息
TokenUserInfo userInfo = new TokenUserInfo { uid = UserId.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch+Config.JwtExpirTime},
{"mall_userInfo",userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
string token = encoder.Encode(payload, secret);
#endregion
var mmodel = programModule.GetMiniProgramModule(demodel.MallBaseId);
AppletUserInfo appletUserInfo = new AppletUserInfo()
{
MallBaseId = demodel.MallBaseId,
MallName = mmodel?.MallName ?? "",
Mobile = demodel.Moblie,
TenantId = demodel.TenantId,
Name = demodel.Name,
OpenId = demodel.OpenId,
Photo = demodel.Photo,
SecretKey = demodel.SecretKey,
SuperiorId = demodel.SuperiorId ?? 0,
Token = token
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + UserId, appletUserInfo, Config.JwtExpirTime);
return ApiResult.Success("", appletUserInfo);
}
return ApiResult.Failed("注册失败,请联系管理员");
}
else {
//查询用户信息
var umodel = userModule.GetMemberUserPageList(1, 1, out _, new RB_Member_User_Extend() { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, Source = demodel.Source, OpenId = demodel.OpenId }).FirstOrDefault();
if (umodel == null) {
return ApiResult.Failed("未能查询到用户信息");
}
TokenUserInfo userInfo = new TokenUserInfo { uid = umodel.Id.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch + Config.JwtExpirTime},
{"mall_userInfo",userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
string token = encoder.Encode(payload, secret);
#endregion
var mmodel = programModule.GetMiniProgramModule(umodel.MallBaseId);
AppletUserInfo appletUserInfo = new AppletUserInfo()
{
MallBaseId = umodel.MallBaseId,
MallName = mmodel?.MallName ?? "",
Mobile = umodel.Moblie,
TenantId = umodel.TenantId,
Name = umodel.Name,
OpenId = umodel.OpenId,
Photo = umodel.Photo,
SecretKey = umodel.SecretKey,
SuperiorId = umodel.SuperiorId ?? 0,
Token = token
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + umodel.Id, appletUserInfo, Config.JwtExpirTime);
return ApiResult.Success("", appletUserInfo);
}
}
#endregion
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.Common.API;
using Mall.Model.Extend.User;
using Mall.Module.User;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Mall.Common.Plugin;
using Mall.Common.Enum.User;
using Mall.CacheManager.User;
using Newtonsoft.Json.Linq;
using Mall.Common;
namespace Mall.WebApi.Controllers.User
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class AppletUserController : BaseController
{
private readonly UserModule userModule = new UserModule();
#region 收货地址
/// <summary>
/// 获取收货地址分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetUserShippingAddressPageList() {
var req = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(req.msg.ToString());
RB_Member_ShippingAddress_Extend demodel = JsonConvert.DeserializeObject<RB_Member_ShippingAddress_Extend>(req.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
var list = userModule.GetUserShippingAddressPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.Name,
x.Mobile,
x.Country,
x.Province,
x.City,
x.District,
x.Address,
x.PostCode,
x.Lonlat,
x.IsDefault,
UpdateDate = x.UpdateDate.HasValue ? x.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取收货地址列表
/// </summary>
/// <returns></returns>
public ApiResult GetUserShippingAddressList()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
RB_Member_ShippingAddress_Extend demodel = JsonConvert.DeserializeObject<RB_Member_ShippingAddress_Extend>(req.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
var list = userModule.GetUserShippingAddressList(demodel);
return ApiResult.Success("", list.Select(x => new
{
x.Id,
x.Name,
x.Mobile,
x.Country,
x.Province,
x.City,
x.District,
x.Address,
x.PostCode,
x.Lonlat,
x.IsDefault,
UpdateDate = x.UpdateDate.HasValue ? x.UpdateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}));
}
/// <summary>
/// 获取收货地址详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetUserShippingAddressInfo() {
var req = RequestParm;
var userInfo = AppletUserInfo;
JObject parms = JObject.Parse(req.msg.ToString());
int AddressId = parms.GetInt("AddressId", 0);
if (AddressId <= 0) {
return ApiResult.ParamIsNull("请传递收货地址");
}
return ApiResult.Success();
}
#endregion
}
}
\ No newline at end of file
...@@ -15,7 +15,7 @@ using Mall.CacheManager.User; ...@@ -15,7 +15,7 @@ using Mall.CacheManager.User;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Mall.Common; using Mall.Common;
namespace Mall.WebApi.Controllers.MallBase namespace Mall.WebApi.Controllers.User
{ {
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
[ApiExceptionFilter] [ApiExceptionFilter]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment