Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
af6c9caa
Commit
af6c9caa
authored
May 09, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序商品详情
parent
78b54f99
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1194 additions
and
131 deletions
+1194
-131
UserReidsCache.cs
Mall.CacheManager/User/UserReidsCache.cs
+1
-0
AppletUserInfo.cs
Mall.Common/API/AppletUserInfo.cs
+5
-0
RB_Goods.cs
Mall.Model/Entity/Product/RB_Goods.cs
+5
-1
RB_Member_Collection.cs
Mall.Model/Entity/User/RB_Member_Collection.cs
+86
-0
RB_Goods_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Extend.cs
+21
-0
RB_Member_Collection_Extend.cs
Mall.Model/Extend/User/RB_Member_Collection_Extend.cs
+18
-0
RB_Member_ShippingAddress_Extend.cs
Mall.Model/Extend/User/RB_Member_ShippingAddress_Extend.cs
+4
-1
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+178
-9
UserModule.cs
Mall.Module.User/UserModule.cs
+309
-4
RB_GoodsRepository.cs
Mall.Repository/Product/RB_GoodsRepository.cs
+61
-0
RB_Member_CollectionRepository.cs
Mall.Repository/User/RB_Member_CollectionRepository.cs
+82
-0
RB_Member_ShippingAddressRepository.cs
Mall.Repository/User/RB_Member_ShippingAddressRepository.cs
+7
-0
BaseController.cs
Mall.WebApi/Controllers/BaseController.cs
+0
-18
AppletGoodsController.cs
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
+236
-93
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+2
-1
AppletLoginController.cs
Mall.WebApi/Controllers/User/AppletLoginController.cs
+1
-0
AppletUserController.cs
Mall.WebApi/Controllers/User/AppletUserController.cs
+175
-1
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+3
-3
No files found.
Mall.CacheManager/User/UserReidsCache.cs
View file @
af6c9caa
...
...
@@ -182,6 +182,7 @@ namespace Mall.CacheManager.User
MallBaseId
=
umodel
.
MallBaseId
,
MallName
=
""
,
Mobile
=
umodel
.
Moblie
,
UserId
=
NewUserId
,
TenantId
=
umodel
.
TenantId
,
Name
=
umodel
.
Name
,
OpenId
=
umodel
.
OpenId
,
...
...
Mall.Common/API/AppletUserInfo.cs
View file @
af6c9caa
...
...
@@ -29,6 +29,11 @@ namespace Mall.Common
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
UserId
{
get
;
set
;
}
/// <summary>
/// 唯一码
/// </summary>
...
...
Mall.Model/Entity/Product/RB_Goods.cs
View file @
af6c9caa
...
...
@@ -344,7 +344,7 @@ namespace Mall.Model.Entity.Product
set
;
}
/// <summary>
/// 分销佣金类型
1固定金额 2
百分比
/// 分销佣金类型
2固定金额 1
百分比
/// </summary>
public
int
?
SeparateDistributionMoneyType
{
...
...
@@ -371,6 +371,10 @@ namespace Mall.Model.Entity.Product
/// 是否加入快速购买 1是 2否
/// </summary>
public
int
?
IsQuickBuy
{
get
;
set
;
}
/// <summary>
/// 是否畅销 1是 2否
/// </summary>
public
int
?
IsSellWell
{
get
;
set
;
}
/// <summary>
/// 商品类型
...
...
Mall.Model/Entity/User/RB_Member_Collection.cs
0 → 100644
View file @
af6c9caa
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_Collection
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 类型 1商品 2其他
/// </summary>
public
int
?
Type
{
get
;
set
;
}
/// <summary>
/// 商品id
/// </summary>
public
int
?
GoodsId
{
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
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Extend.cs
View file @
af6c9caa
...
...
@@ -13,6 +13,14 @@ namespace Mall.Model.Extend.Product
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_Extend
:
RB_Goods
{
/// <summary>
/// 小程序名称
/// </summary>
public
string
MallName
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
...
...
@@ -86,5 +94,18 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
List
<
RB_Goods_MemberPrice_Extend
>
MemberPriceList
{
get
;
set
;
}
/// <summary>
/// 是否收藏 true/false
/// </summary>
public
bool
Favorite
{
get
;
set
;
}
/// <summary>
/// 快递费用
/// </summary>
public
decimal
Express
{
get
;
set
;
}
/// <summary>
/// 最高分销返佣
/// </summary>
public
decimal
MaxShare
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Member_Collection_Extend.cs
0 → 100644
View file @
af6c9caa
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_Collection_Extend
:
RB_Member_Collection
{
}
}
Mall.Model/Extend/User/RB_Member_ShippingAddress_Extend.cs
View file @
af6c9caa
...
...
@@ -13,6 +13,9 @@ namespace Mall.Model.Extend.User
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Member_ShippingAddress_Extend
:
RB_Member_ShippingAddress
{
/// <summary>
/// 区域地址
/// </summary>
public
string
DistrictAddress
{
get
;
set
;
}
}
}
Mall.Module.Product/ProductModule.cs
View file @
af6c9caa
This diff is collapsed.
Click to expand it.
Mall.Module.User/UserModule.cs
View file @
af6c9caa
This diff is collapsed.
Click to expand it.
Mall.Repository/Product/RB_GoodsRepository.cs
View file @
af6c9caa
...
...
@@ -196,5 +196,66 @@ 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
();
}
/// <summary>
/// 获取会员收藏商品分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetMemberCollectGoodsPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Goods_Extend
dmodel
)
{
string
where
=
$" 1=1 and col.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0"
;
where
+=
$" and col.Type=1 and col.UserId=
{
dmodel
.
UserId
}
and g.
{
nameof
(
RB_Goods_Extend
.
Status
)}
=0 and g.
{
nameof
(
RB_Goods_Extend
.
GoodsStatus
)}
=1"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and col.
{
nameof
(
RB_Goods_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and col.
{
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
.
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
sql
=
$@"select g.* from
rb_member_collection col
inner join RB_Goods g on col.GoodsId=g.Id
inner join rb_goods_category c on g.Id=c.GoodsId
where
{
where
}
group by g.Id order by col.Id desc"
;
return
GetPage
<
RB_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Member_CollectionRepository.cs
0 → 100644
View file @
af6c9caa
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_CollectionRepository
:
RepositoryBase
<
RB_Member_Collection
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Member_Collection_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Member_Collection_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Member_Collection
.
Status
)}
=0 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
Type
)}
=
{
dmodel
.
Type
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
string
sql
=
$@"select * from RB_Member_Collection where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Member_Collection_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Member_Collection_Extend
>
GetList
(
RB_Member_Collection_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Member_Collection
.
Status
)}
=0 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Type
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
Type
)}
=
{
dmodel
.
Type
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_Collection
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
string
sql
=
$@"select * from RB_Member_Collection where
{
where
}
order by Id desc"
;
return
Get
<
RB_Member_Collection_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Member_ShippingAddressRepository.cs
View file @
af6c9caa
...
...
@@ -37,6 +37,9 @@ namespace Mall.Repository.User
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Mobile
))
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
Mobile
)}
like '%
{
dmodel
.
Mobile
}
%'"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
UserId
)}
=
{(
int
)
dmodel
.
UserId
}
"
;
}
...
...
@@ -68,6 +71,10 @@ namespace Mall.Repository.User
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Mobile
))
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
Mobile
)}
like '%
{
dmodel
.
Mobile
}
%'"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Member_ShippingAddress
.
UserId
)}
=
{(
int
)
dmodel
.
UserId
}
"
;
...
...
Mall.WebApi/Controllers/BaseController.cs
View file @
af6c9caa
...
...
@@ -59,24 +59,6 @@ namespace Mall.WebApi.Controllers
}
}
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>
...
...
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
View file @
af6c9caa
This diff is collapsed.
Click to expand it.
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
af6c9caa
...
...
@@ -1408,7 +1408,7 @@ namespace Mall.WebApi.Controllers.MallBase
foreach
(
var
qitem
in
item
.
SpecificationValueList
)
{
for
(
var
j
=
1
;
j
<=
MGBJNum
;
j
++)
{
KeyList
[
KeyIndex
]
=
KeyList
[
KeyIndex
]
+
"
,
"
+
qitem
.
Sort
;
KeyList
[
KeyIndex
]
=
KeyList
[
KeyIndex
]
+
"
:
"
+
qitem
.
Sort
;
KeyIndex
++;
}
}
...
...
@@ -1650,6 +1650,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
demodel
.
IsQuickBuy
??=
2
;
demodel
.
IsSellWell
??=
2
;
demodel
.
GoodsType
??=
Common
.
Enum
.
Goods
.
OrderTypeEnum
.
Mall
;
bool
flag
=
productModule
.
SetProductGoodsInfo
(
demodel
);
...
...
Mall.WebApi/Controllers/User/AppletLoginController.cs
View file @
af6c9caa
...
...
@@ -118,6 +118,7 @@ namespace Mall.WebApi.Controllers.User
MallBaseId
=
demodel
.
MallBaseId
,
MallName
=
mmodel
?.
MallName
??
""
,
Mobile
=
demodel
.
Moblie
,
UserId
=
UserId
,
TenantId
=
demodel
.
TenantId
,
Name
=
demodel
.
Name
,
OpenId
=
demodel
.
OpenId
,
...
...
Mall.WebApi/Controllers/User/AppletUserController.cs
View file @
af6c9caa
...
...
@@ -14,6 +14,7 @@ using Mall.Common.Enum.User;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.Model.Extend.Product
;
namespace
Mall.WebApi.Controllers.User
{
...
...
@@ -38,6 +39,7 @@ namespace Mall.WebApi.Controllers.User
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Member_ShippingAddress_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_ShippingAddress_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
userModule
.
GetUserShippingAddressPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
...
...
@@ -51,6 +53,7 @@ namespace Mall.WebApi.Controllers.User
x
.
Province
,
x
.
City
,
x
.
District
,
x
.
DistrictAddress
,
x
.
Address
,
x
.
PostCode
,
x
.
Lonlat
,
...
...
@@ -71,6 +74,7 @@ namespace Mall.WebApi.Controllers.User
var
userInfo
=
AppletUserInfo
;
RB_Member_ShippingAddress_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_ShippingAddress_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
userModule
.
GetUserShippingAddressList
(
demodel
);
...
...
@@ -83,6 +87,7 @@ namespace Mall.WebApi.Controllers.User
x
.
Province
,
x
.
City
,
x
.
District
,
x
.
DistrictAddress
,
x
.
Address
,
x
.
PostCode
,
x
.
Lonlat
,
...
...
@@ -104,8 +109,177 @@ namespace Mall.WebApi.Controllers.User
if
(
AddressId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递收货地址"
);
}
var
model
=
userModule
.
GetUserShippingAddressInfo
(
AddressId
);
if
(
model
.
TenantId
!=
userInfo
.
TenantId
||
model
.
MallBaseId
!=
userInfo
.
MallBaseId
||
model
.
UserId
!=
userInfo
.
UserId
)
{
return
ApiResult
.
ParamIsNull
(
"未查询到相关信息"
);
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
Name
,
model
.
Mobile
,
model
.
Country
,
model
.
Province
,
model
.
City
,
model
.
District
,
model
.
DistrictAddress
,
model
.
Address
,
model
.
PostCode
,
model
.
Lonlat
,
model
.
IsDefault
});
}
/// <summary>
/// 新增修改地址
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetUserShippingAddress
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Member_ShippingAddress_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Member_ShippingAddress_Extend
>(
req
.
msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请输入收货人"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Mobile
))
{
return
ApiResult
.
ParamIsNull
(
"请输入联系电话"
);
}
if
((
demodel
.
Province
??
0
)
<=
0
||
(
demodel
.
City
??
0
)
<=
0
||
(
demodel
.
District
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择区域"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Address
))
{
return
ApiResult
.
ParamIsNull
(
"请输入详细地址"
);
}
demodel
.
IsDefault
??=
2
;
demodel
.
PostCode
??=
""
;
demodel
.
Lonlat
??=
""
;
demodel
.
Country
??=
2
;
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
demodel
.
Status
=
0
;
bool
flag
=
userModule
.
SetUserShippingAddress
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置地址默认
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetUserShippingAddressDefault
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
AddressId
=
prams
.
GetInt
(
"AddressId"
,
0
);
if
(
AddressId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
return
ApiResult
.
Success
();
bool
flag
=
userModule
.
SetUserShippingAddressDefault
(
AddressId
,
userInfo
.
UserId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除地址
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelUserShippingAddress
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
AddressId
=
prams
.
GetInt
(
"AddressId"
,
0
);
if
(
AddressId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
userModule
.
DelUserShippingAddressDefault
(
AddressId
,
userInfo
.
UserId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
收藏商品
/// <summary>
/// 获取收藏商品分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetUserCollectionPageList
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
req
.
msg
.
ToString
());
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
var
list
=
userModule
.
GetUserCollectionPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
CoverImage
,
x
.
SellingPrice
,
x
.
SalesNum
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 用户收藏/取消收藏商品
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetUserCollectionInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
GoodsId
=
parms
.
GetInt
(
"GoodsId"
,
0
);
if
(
GoodsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
userModule
.
SetUserCollectionInfo
(
GoodsId
,
userInfo
.
UserId
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
af6c9caa
...
...
@@ -106,14 +106,14 @@ namespace Mall.WebApi.Filter
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
new
ApiResult
{
resultCode
=
(
int
)
ResultCode
.
FormRepeatSubmit
,
message
=
"表单重复提交"
,
message
=
"表单重复提交
,请稍后再试
"
,
data
=
null
});
}
else
{
//默认
3
秒钟之内不能重复提交
UserReidsCache
.
Set
(
cachedKey
,
1
,
3
);
//默认
2
秒钟之内不能重复提交
UserReidsCache
.
Set
(
cachedKey
,
1
,
2
);
}
}
catch
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment