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
1ce30ea1
Commit
1ce30ea1
authored
Jul 22, 2022
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
c7819a02
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
650 additions
and
21 deletions
+650
-21
RB_Assess_Goods.cs
Mall.Model/Entity/Assess/RB_Assess_Goods.cs
+4
-14
RB_Assess_Goods_Extend.cs
Mall.Model/Extend/Assess/RB_Assess_Goods_Extend.cs
+11
-1
AssessModule.cs
Mall.Module.Miai/AssessModule.cs
+215
-0
RB_Assess_GoodsRepository.cs
Mall.Repository/Assess/RB_Assess_GoodsRepository.cs
+6
-4
AppletAssessController.cs
Mall.WebApi/Controllers/Miai/AppletAssessController.cs
+218
-0
AssessController.cs
Mall.WebApi/Controllers/Miai/AssessController.cs
+196
-2
No files found.
Mall.Model/Entity/Assess/RB_Assess_Goods.cs
View file @
1ce30ea1
...
...
@@ -29,9 +29,9 @@ namespace Mall.Model.Entity.Assess
public
int
BrandId
{
get
;
set
;
}
/// <summary>
///
EmpId
///
用户ID
/// </summary>
public
int
Emp
Id
{
get
;
set
;
}
public
int
User
Id
{
get
;
set
;
}
/// <summary>
/// 三组图 (json格式)
...
...
@@ -68,25 +68,15 @@ namespace Mall.Model.Entity.Assess
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateDate
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 修改时间
/// 回复时间
/// </summary>
public
DateTime
Update
Date
{
get
;
set
;
}
public
DateTime
?
Reply
Date
{
get
;
set
;
}
}
}
Mall.Model/Extend/Assess/RB_Assess_Goods_Extend.cs
View file @
1ce30ea1
...
...
@@ -31,11 +31,21 @@ namespace Mall.Model.Extend.Assess
/// <summary>
/// 用户昵称
/// </summary>
public
string
Emp
Name
{
get
;
set
;
}
public
string
User
Name
{
get
;
set
;
}
/// <summary>
/// 用户头像
/// </summary>
public
string
EmpPhoto
{
get
;
set
;
}
/// <summary>
/// 分类名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
/// <summary>
/// 品牌名称
/// </summary>
public
string
BrandName
{
get
;
set
;
}
}
}
Mall.Module.Miai/AssessModule.cs
View file @
1ce30ea1
...
...
@@ -109,5 +109,220 @@ namespace Mall.Module.Miai
}
#
endregion
#
region
品牌
/// <summary>
/// 获取品牌分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Assess_Brand_Extend
>
GetBrandPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Assess_Brand_Extend
demodel
)
{
var
list
=
assess_BrandRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
foreach
(
var
item
in
list
)
{
item
.
BrandImgList
=
new
List
<
AssessBrandImg
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
BrandImg
))
{
item
.
BrandImgList
=
JsonHelper
.
DeserializeObject
<
List
<
AssessBrandImg
>>(
item
.
BrandImg
);
}
}
}
return
list
;
}
/// <summary>
/// 获取品牌列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Assess_Brand_Extend
>
GetBrandList
(
RB_Assess_Brand_Extend
demodel
)
{
var
list
=
assess_BrandRepository
.
GetList
(
demodel
);
if
(
list
.
Any
())
{
foreach
(
var
item
in
list
)
{
item
.
BrandImgList
=
new
List
<
AssessBrandImg
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
BrandImg
))
{
item
.
BrandImgList
=
JsonHelper
.
DeserializeObject
<
List
<
AssessBrandImg
>>(
item
.
BrandImg
);
}
}
}
return
list
;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="brandId"></param>
/// <returns></returns>
public
RB_Assess_Brand_Extend
GetBrandInfo
(
int
brandId
)
{
var
model
=
assess_BrandRepository
.
GetEntity
<
RB_Assess_Brand_Extend
>(
brandId
);
if
(
model
!=
null
)
{
if
(!
string
.
IsNullOrEmpty
(
model
.
BrandImg
))
{
model
.
BrandImgList
=
JsonHelper
.
DeserializeObject
<
List
<
AssessBrandImg
>>(
model
.
BrandImg
);
}
}
return
model
;
}
/// <summary>
/// 新增修改品牌
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
string
SetBrandInfo
(
RB_Assess_Brand_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
var
dmodel
=
assess_BrandRepository
.
GetEntity
(
demodel
.
Id
);
if
(
dmodel
.
Name
!=
demodel
.
Name
)
{
dmodel
.
PinYin
=
StringHelper
.
GetPinyin
(
demodel
.
Name
);
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
PinYin
))
{
dmodel
.
PinYin
=
dmodel
.
PinYin
.
Substring
(
0
,
1
);
}
}
dmodel
.
Name
=
demodel
.
Name
;
dmodel
.
CategoryId
=
demodel
.
CategoryId
;
dmodel
.
Logo
=
demodel
.
Logo
;
dmodel
.
IsHot
=
demodel
.
IsHot
;
dmodel
.
BrandImg
=
demodel
.
BrandImg
;
dmodel
.
MoreDesc
=
demodel
.
MoreDesc
;
dmodel
.
RemarkDesc
=
demodel
.
RemarkDesc
;
dmodel
.
UpdateBy
=
demodel
.
UpdateBy
;
dmodel
.
UpdateDate
=
demodel
.
UpdateDate
;
bool
flag
=
assess_BrandRepository
.
Update
(
dmodel
);
return
flag
?
""
:
"出错了,请联系管理员"
;
}
else
{
demodel
.
PinYin
=
StringHelper
.
GetPinyin
(
demodel
.
Name
);
if
(!
string
.
IsNullOrEmpty
(
demodel
.
PinYin
))
{
demodel
.
PinYin
=
demodel
.
PinYin
.
Substring
(
0
,
1
);
}
bool
flag
=
assess_BrandRepository
.
Insert
(
demodel
)
>
0
;
return
flag
?
""
:
"出错了,请联系管理员"
;
}
}
/// <summary>
/// 删除品牌
/// </summary>
/// <param name="BrandId"></param>
/// <returns></returns>
public
bool
DelBrandInfo
(
int
BrandId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Assess_Brand_Extend
.
Status
),
1
},
{
nameof
(
RB_Assess_Brand_Extend
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Assess_Brand_Extend
.
Id
),
FiledValue
=
BrandId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
assess_BrandRepository
.
Update
(
keyValues
,
wheres
);
}
#
endregion
#
region
我的估价
/// <summary>
/// 获取估价商品分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Assess_Goods_Extend
>
GetGoodsPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Assess_Goods_Extend
demodel
)
{
var
list
=
assess_GoodsRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
foreach
(
var
item
in
list
)
{
item
.
GoodsImgList
=
new
List
<
AssessBrandImg
>();
item
.
MoreImgList
=
new
List
<
AssessBrandImg
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
GoodsImg
))
{
item
.
GoodsImgList
=
JsonHelper
.
DeserializeObject
<
List
<
AssessBrandImg
>>(
item
.
GoodsImg
);
}
if
(!
string
.
IsNullOrEmpty
(
item
.
MoreImg
))
{
item
.
MoreImgList
=
JsonHelper
.
DeserializeObject
<
List
<
AssessBrandImg
>>(
item
.
MoreImg
);
}
}
}
return
list
;
}
/// <summary>
/// 保存估价
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
string
SetGoodsInfo
(
RB_Assess_Goods_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Assess_Goods_Extend
.
GoodsImg
),
demodel
.
GoodsImg
},
{
nameof
(
RB_Assess_Goods_Extend
.
MoreImg
),
demodel
.
MoreImg
},
{
nameof
(
RB_Assess_Goods_Extend
.
Remark
),
demodel
.
Remark
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Assess_Goods_Extend
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
assess_GoodsRepository
.
Update
(
keyValues
,
wheres
);
return
flag
?
""
:
"出错了,请联系管理员"
;
}
else
{
bool
flag
=
assess_GoodsRepository
.
Insert
(
demodel
)
>
0
;
return
flag
?
""
:
"出错了,请联系管理员"
;
}
}
/// <summary>
/// 设置回复
/// </summary>
/// <param name="goodsId"></param>
/// <param name="replyContent"></param>
/// <returns></returns>
public
bool
SetGoodsReply
(
int
goodsId
,
string
replyContent
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Assess_Goods_Extend
.
ReplyContent
),
replyContent
},
{
nameof
(
RB_Assess_Goods_Extend
.
ReplyDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Assess_Goods_Extend
.
Id
),
FiledValue
=
goodsId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
assess_GoodsRepository
.
Update
(
keyValues
,
wheres
);
return
flag
;
}
#
endregion
}
}
\ No newline at end of file
Mall.Repository/Assess/RB_Assess_GoodsRepository.cs
View file @
1ce30ea1
...
...
@@ -39,9 +39,9 @@ namespace Mall.Repository.Assess
{
where
+=
$@" and e.
{
nameof
(
RB_Assess_Goods_Extend
.
BrandId
)}
=
{
dmodel
.
BrandId
}
"
;
}
if
(
dmodel
.
Emp
Id
>
0
)
if
(
dmodel
.
User
Id
>
0
)
{
where
+=
$@" and e.
{
nameof
(
RB_Assess_Goods_Extend
.
EmpId
)}
=
{
dmodel
.
Emp
Id
}
"
;
where
+=
$@" and e.
{
nameof
(
RB_Assess_Goods_Extend
.
UserId
)}
=
{
dmodel
.
User
Id
}
"
;
}
if
(
dmodel
.
IsReply
==
1
)
{
...
...
@@ -51,8 +51,10 @@ namespace Mall.Repository.Assess
where
+=
$" and IFNULL(e.
{
nameof
(
RB_Assess_Goods_Extend
.
ReplyContent
)}
,'') =''"
;
}
string
sql
=
$@"select e.*,u.Name as EmpName,u.Photo as EmpPhoto from RB_Assess_Goods e
inner join rb_member_user u on e.EmpId = u.Id
string
sql
=
$@"select e.*,u.Name as UserName,u.Photo as EmpPhoto,c.Name as CategoryName,b.Name as BrandName from RB_Assess_Goods e
inner join rb_member_user u on e.UserId = u.Id
left join rb_assess_category c on e.CategoryId =c.Id
left join rb_assess_brand b on e.BrandId = b.Id
where
{
where
}
order by e.Id desc"
;
return
GetPage
<
RB_Assess_Goods_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
...
...
Mall.WebApi/Controllers/Miai/AppletAssessController.cs
0 → 100644
View file @
1ce30ea1
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Mall.Common.API
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Mall.Common.Plugin
;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.Module.Miai
;
using
Mall.Model.Extend.Assess
;
using
Mall.Model.Entity.Assess
;
using
Microsoft.AspNetCore.Authorization
;
using
Dnc.Api.Throttle
;
namespace
Mall.WebApi.Controllers.MallBase
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
AppletAssessController
:
BaseController
{
/// <summary>
/// 估价处理类对象
/// </summary>
private
readonly
AssessModule
assessModule
=
new
AssessModule
();
#
region
品牌版块
/// <summary>
/// 获取活动版块列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
30
,
Duration
=
60
)]
public
ApiResult
GetCategoryDropList
()
{
var
req
=
base
.
RequestParm
;
RB_Assess_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Category_Extend
>(
req
.
msg
.
ToString
());
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
Enable
=
1
;
var
list
=
assessModule
.
GetCategoryList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
OrderByDescending
(
x
=>
x
.
Sort
).
ThenBy
(
x
=>
x
.
Id
).
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Image
,
x
.
Sort
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
}));
}
/// <summary>
/// 获取品牌分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
30
,
Duration
=
60
)]
public
ApiResult
GetBrandDropList
()
{
var
req
=
base
.
RequestParm
;
RB_Assess_Brand_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Brand_Extend
>(
req
.
msg
.
ToString
());
demodel
.
MallBaseId
=
req
.
MallBaseId
;
var
list
=
assessModule
.
GetBrandList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Logo
,
x
.
IsHot
,
x
.
BrandImgList
,
x
.
MoreDesc
,
x
.
RemarkDesc
}));
}
/// <summary>
/// 获取品牌详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
30
,
Duration
=
60
)]
public
ApiResult
GetBrandInfo
()
{
var
userInfo
=
base
.
AppletUserInfo
;
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
BrandId
=
parms
.
GetInt
(
"BrandId"
,
0
);
if
(
BrandId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
model
=
assessModule
.
GetBrandInfo
(
BrandId
);
if
(
model
==
null
||
model
.
MallBaseId
!=
userInfo
.
MallBaseId
)
{
return
ApiResult
.
Failed
();
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
CategoryId
,
model
.
Name
,
model
.
Logo
,
model
.
IsHot
,
model
.
BrandImgList
,
model
.
MoreDesc
,
model
.
RemarkDesc
});
}
#
endregion
#
region
回收估价
/// <summary>
/// 我要估价
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
30
,
Duration
=
60
)]
public
ApiResult
SetGoodsInfo
()
{
var
userInfo
=
base
.
AppletUserInfo
;
RB_Assess_Goods_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Assess_Goods_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
if
(
demodel
.
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递分类ID"
);
}
if
(
demodel
.
BrandId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递品牌ID"
);
}
if
(
demodel
.
GoodsImgList
==
null
||
!
demodel
.
GoodsImgList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递组图"
);
}
foreach
(
var
item
in
demodel
.
GoodsImgList
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递组图标题"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
Path
))
{
return
ApiResult
.
ParamIsNull
(
"请传递组图路径"
);
}
}
demodel
.
GoodsImg
=
JsonHelper
.
Serialize
(
demodel
.
GoodsImgList
);
if
(
demodel
.
MoreImgList
==
null
)
{
demodel
.
MoreImgList
=
new
List
<
AssessBrandImg
>();
}
foreach
(
var
item
in
demodel
.
MoreImgList
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递组图标题"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
Path
))
{
return
ApiResult
.
ParamIsNull
(
"请传递组图路径"
);
}
}
demodel
.
MoreImg
=
JsonHelper
.
Serialize
(
demodel
.
MoreImgList
);
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
string
msg
=
assessModule
.
SetGoodsInfo
(
demodel
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 我的估价分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
30
,
Duration
=
60
)]
public
ApiResult
GetMyGoodsPageList
()
{
var
userInfo
=
base
.
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
base
.
RequestParm
.
msg
.
ToString
());
RB_Assess_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Goods_Extend
>(
base
.
RequestParm
.
msg
.
ToString
());
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
UserId
=
userInfo
.
UserId
;
var
list
=
assessModule
.
GetGoodsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
CategoryId
,
x
.
CategoryName
,
x
.
BrandId
,
x
.
BrandName
,
x
.
GoodsImgList
,
x
.
MoreImgList
,
x
.
Remark
,
x
.
ReplyContent
,
ReplyDate
=
x
.
ReplyDate
.
HasValue
?
x
.
ReplyDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Miai/AssessController.cs
View file @
1ce30ea1
...
...
@@ -35,7 +35,7 @@ namespace Mall.WebApi.Controllers.MallBase
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Assess_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Category_Extend
>(
req
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
req
.
uid
)
;
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
var
list
=
assessModule
.
GetCategoryPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
...
...
@@ -61,7 +61,7 @@ namespace Mall.WebApi.Controllers.MallBase
var
req
=
base
.
RequestParm
;
RB_Assess_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Category_Extend
>(
req
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
req
.
uid
)
;
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
Enable
=
1
;
var
list
=
assessModule
.
GetCategoryList
(
demodel
);
...
...
@@ -125,7 +125,201 @@ namespace Mall.WebApi.Controllers.MallBase
#
endregion
#
region
品牌
/// <summary>
/// 获取品牌分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetBrandPageList
()
{
var
req
=
base
.
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Assess_Brand_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Brand_Extend
>(
req
.
msg
.
ToString
());
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
var
list
=
assessModule
.
GetBrandPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Logo
,
x
.
IsHot
,
x
.
BrandImgList
,
x
.
MoreDesc
,
x
.
RemarkDesc
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取品牌详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetBrandInfo
()
{
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
BrandId
=
parms
.
GetInt
(
"BrandId"
,
0
);
if
(
BrandId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
model
=
assessModule
.
GetBrandInfo
(
BrandId
);
if
(
model
==
null
)
{
return
ApiResult
.
Failed
();
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
CategoryId
,
model
.
Name
,
model
.
Logo
,
model
.
IsHot
,
model
.
BrandImgList
,
model
.
MoreDesc
,
model
.
RemarkDesc
});
}
/// <summary>
/// 新增修改品牌
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetBrandInfo
()
{
var
req
=
RequestParm
;
RB_Assess_Brand_Extend
demodel
=
JsonHelper
.
DeserializeObject
<
RB_Assess_Brand_Extend
>(
req
.
msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请传递品牌名称"
);
}
if
(
demodel
.
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递分类ID"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Logo
))
{
return
ApiResult
.
ParamIsNull
(
"请上传品牌Logo图标"
);
}
if
(
demodel
.
BrandImgList
==
null
||
!
demodel
.
BrandImgList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请上传组图"
);
}
foreach
(
var
item
in
demodel
.
BrandImgList
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请上传组图标题"
);
}
if
(
string
.
IsNullOrEmpty
(
item
.
Path
))
{
return
ApiResult
.
ParamIsNull
(
"请传递组图路径"
);
}
}
demodel
.
BrandImg
=
JsonHelper
.
Serialize
(
demodel
.
BrandImgList
);
if
(
string
.
IsNullOrEmpty
(
demodel
.
MoreDesc
))
{
return
ApiResult
.
ParamIsNull
(
"请输入更多描述"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
RemarkDesc
))
{
return
ApiResult
.
ParamIsNull
(
"请输入备注描述"
);
}
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
CreateBy
=
req
.
EmpId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateBy
=
req
.
EmpId
;
string
msg
=
assessModule
.
SetBrandInfo
(
demodel
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 删除品牌
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelBrandInfo
()
{
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
BrandId
=
parms
.
GetInt
(
"BrandId"
,
0
);
if
(
BrandId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
assessModule
.
DelBrandInfo
(
BrandId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
估价回复
/// <summary>
/// 获取估价分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetGoodsPageList
()
{
var
req
=
base
.
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
req
.
msg
.
ToString
());
RB_Assess_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Assess_Goods_Extend
>(
req
.
msg
.
ToString
());
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
var
list
=
assessModule
.
GetGoodsPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
UserId
,
x
.
UserName
,
x
.
CategoryId
,
x
.
CategoryName
,
x
.
BrandId
,
x
.
BrandName
,
x
.
GoodsImgList
,
x
.
MoreImgList
,
x
.
Remark
,
x
.
ReplyContent
,
ReplyDate
=
x
.
ReplyDate
.
HasValue
?
x
.
ReplyDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
,
CreateDate
=
x
.
CreateDate
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 回复消息
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetGoodsReply
()
{
var
req
=
base
.
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
base
.
RequestParm
.
msg
.
ToString
());
int
GoodsId
=
parms
.
GetInt
(
"GoodsId"
,
0
);
string
ReplyContent
=
parms
.
GetStringValue
(
"ReplyContent"
);
if
(
GoodsId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品估价ID"
);
}
if
(
string
.
IsNullOrEmpty
(
ReplyContent
))
{
return
ApiResult
.
ParamIsNull
(
"请传递回复内容"
);
}
bool
flag
=
assessModule
.
SetGoodsReply
(
GoodsId
,
ReplyContent
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
\ No newline at end of file
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