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
77d2c9fe
Commit
77d2c9fe
authored
Sep 23, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
5d86f031
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
114 additions
and
268 deletions
+114
-268
WeiXinHelper.cs
Mall.Common/Plugin/WeiXinHelper.cs
+9
-12
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+20
-14
CommerceConsultModule.cs
Mall.Module.TradePavilion/CommerceConsultModule.cs
+1
-1
CompanyModule.cs
Mall.Module.TradePavilion/CompanyModule.cs
+1
-1
UserModule.cs
Mall.Module.User/UserModule.cs
+3
-3
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+2
-2
AppletTradeController.cs
...WebApi/Controllers/TradePavilion/AppletTradeController.cs
+12
-12
TradeController.cs
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
+19
-17
AppletLoginController.cs
Mall.WebApi/Controllers/User/AppletLoginController.cs
+18
-87
SupplierController.cs
Mall.WebApi/Controllers/User/SupplierController.cs
+12
-11
TenantController.cs
Mall.WebApi/Controllers/User/TenantController.cs
+14
-48
ApiFilterAttribute.cs
Mall.WebApi/Filter/ApiFilterAttribute.cs
+3
-4
TokenHelper.cs
Mall.WebApi/Helper/TokenHelper.cs
+0
-56
No files found.
Mall.Common/Plugin/WeiXinHelper.cs
View file @
77d2c9fe
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Net
;
using
System.Text
;
using
System.Text
;
using
System.Xml
;
using
System.Xml
;
namespace
Mall.Common.Plugin
namespace
Mall.Common.Plugin
{
{
/// <summary>
/// 微信帮助类
/// </summary>
public
class
WeiXinHelper
public
class
WeiXinHelper
{
{
static
List
<
WeChatMiniAppMessage
>
weChatMiniAppMessages
=
new
List
<
WeChatMiniAppMessage
>();
static
readonly
List
<
WeChatMiniAppMessage
>
weChatMiniAppMessages
=
new
List
<
WeChatMiniAppMessage
>();
static
WeiXinHelper
()
static
WeiXinHelper
()
{
{
...
@@ -206,10 +207,8 @@ namespace Mall.Common.Plugin
...
@@ -206,10 +207,8 @@ namespace Mall.Common.Plugin
System
.
Net
.
WebResponse
wResp
=
wReq
.
GetResponse
();
System
.
Net
.
WebResponse
wResp
=
wReq
.
GetResponse
();
System
.
IO
.
Stream
respStream
=
wResp
.
GetResponseStream
();
System
.
IO
.
Stream
respStream
=
wResp
.
GetResponseStream
();
// Dim reader As StreamReader = New StreamReader(respStream)
// Dim reader As StreamReader = New StreamReader(respStream)
using
(
System
.
IO
.
StreamReader
reader
=
new
System
.
IO
.
StreamReader
(
respStream
,
Encoding
.
GetEncoding
(
type
)))
using
System.IO.StreamReader
reader
=
new
System
.
IO
.
StreamReader
(
respStream
,
Encoding
.
GetEncoding
(
type
));
{
return
reader
.
ReadToEnd
();
return
reader
.
ReadToEnd
();
}
}
}
catch
(
System
.
Exception
ex
)
catch
(
System
.
Exception
ex
)
{
{
...
@@ -315,7 +314,7 @@ namespace Mall.Common.Plugin
...
@@ -315,7 +314,7 @@ namespace Mall.Common.Plugin
}
}
//采用排序的Dictionary的好处是方便对数据包进行签名,不用再签名之前再做一次排序
//采用排序的Dictionary的好处是方便对数据包进行签名,不用再签名之前再做一次排序
private
SortedDictionary
<
string
,
object
>
m_values
=
new
SortedDictionary
<
string
,
object
>();
private
readonly
SortedDictionary
<
string
,
object
>
m_values
=
new
SortedDictionary
<
string
,
object
>();
/**
/**
* 设置某个字段的值
* 设置某个字段的值
...
@@ -334,8 +333,7 @@ namespace Mall.Common.Plugin
...
@@ -334,8 +333,7 @@ namespace Mall.Common.Plugin
*/
*/
public
object
GetValue
(
string
key
)
public
object
GetValue
(
string
key
)
{
{
object
o
=
null
;
m_values
.
TryGetValue
(
key
,
out
object
o
);
m_values
.
TryGetValue
(
key
,
out
o
);
return
o
;
return
o
;
}
}
...
@@ -346,8 +344,7 @@ namespace Mall.Common.Plugin
...
@@ -346,8 +344,7 @@ namespace Mall.Common.Plugin
*/
*/
public
bool
IsSet
(
string
key
)
public
bool
IsSet
(
string
key
)
{
{
object
o
=
null
;
m_values
.
TryGetValue
(
key
,
out
object
o
);
m_values
.
TryGetValue
(
key
,
out
o
);
if
(
null
!=
o
)
if
(
null
!=
o
)
return
true
;
return
true
;
else
else
...
...
Mall.Module.Product/ProductModule.cs
View file @
77d2c9fe
...
@@ -1341,8 +1341,7 @@ namespace Mall.Module.Product
...
@@ -1341,8 +1341,7 @@ namespace Mall.Module.Product
string
QRPath
=
GetWeiXinQRCode
(
path
,
430
,
mallBaseId
);
string
QRPath
=
GetWeiXinQRCode
(
path
,
430
,
mallBaseId
);
var
umodel
=
member_UserRepository
.
GetEntity
(
userId
);
var
umodel
=
member_UserRepository
.
GetEntity
(
userId
);
var
goodsModel
=
goodsRepository
.
GetEntity
(
goodsId
);
var
goodsModel
=
goodsRepository
.
GetEntity
(
goodsId
);
//商品海报配置信息
var
config
=
new
object
();
//商品信息
//商品信息
var
info
=
new
object
();
var
info
=
new
object
();
var
goodsPoster
=
miniProgram_GoodPosterRepository
.
GetEntityExtRepository
(
new
RB_MiniProgram_GoodPoster_Extend
()
var
goodsPoster
=
miniProgram_GoodPosterRepository
.
GetEntityExtRepository
(
new
RB_MiniProgram_GoodPoster_Extend
()
...
@@ -1350,7 +1349,8 @@ namespace Mall.Module.Product
...
@@ -1350,7 +1349,8 @@ namespace Mall.Module.Product
MallBaseId
=
mallBaseId
,
MallBaseId
=
mallBaseId
,
IsOpenSchool
=
IsOpenSchool
IsOpenSchool
=
IsOpenSchool
});
});
config
=
new
//商品海报配置信息
var
config
=
new
{
{
poster_style
=
goodsPoster
?.
PosterStyleList
??
new
List
<
int
>()
{
1
},
poster_style
=
goodsPoster
?.
PosterStyleList
??
new
List
<
int
>()
{
1
},
image_style
=
goodsPoster
?.
GoodsImgCountList
??
new
List
<
int
>()
{
1
},
image_style
=
goodsPoster
?.
GoodsImgCountList
??
new
List
<
int
>()
{
1
},
...
@@ -8907,7 +8907,7 @@ namespace Mall.Module.Product
...
@@ -8907,7 +8907,7 @@ namespace Mall.Module.Product
/// <returns></returns>
/// <returns></returns>
public
bool
CancelGoodsProxy
(
int
goodsId
,
int
type
,
int
tenantId
,
int
mallBaseId
)
public
bool
CancelGoodsProxy
(
int
goodsId
,
int
type
,
int
tenantId
,
int
mallBaseId
)
{
{
var
plist
=
new
List
<
RB_Goods_Proxy_Extend
>()
;
List
<
RB_Goods_Proxy_Extend
>
plist
;
if
(
type
==
1
)
if
(
type
==
1
)
{
{
plist
=
goods_ProxyRepository
.
GetList
(
new
RB_Goods_Proxy_Extend
()
{
GoodsId
=
goodsId
,
ProxyMallBaseId
=
mallBaseId
,
ProxyTenantId
=
tenantId
});
plist
=
goods_ProxyRepository
.
GetList
(
new
RB_Goods_Proxy_Extend
()
{
GoodsId
=
goodsId
,
ProxyMallBaseId
=
mallBaseId
,
ProxyTenantId
=
tenantId
});
...
@@ -8921,30 +8921,36 @@ namespace Mall.Module.Product
...
@@ -8921,30 +8921,36 @@ namespace Mall.Module.Product
return
false
;
return
false
;
}
}
var
pModel
=
plist
.
FirstOrDefault
();
var
pModel
=
plist
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_Proxy
.
Status
),
1
},
{
nameof
(
RB_Goods_Proxy
.
Status
),
1
},
{
nameof
(
RB_Goods_Proxy
.
Remark
),
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)+
" 取消代理"
}
{
nameof
(
RB_Goods_Proxy
.
Remark
),
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)+
" 取消代理"
}
};
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
new
WhereHelper
(){
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Goods_Proxy
.
Id
),
FiledName
=
nameof
(
RB_Goods_Proxy
.
Id
),
FiledValue
=
pModel
.
Id
,
FiledValue
=
pModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
OperatorEnum
=
OperatorEnum
.
Equal
}
}
};
};
bool
flag
=
goods_ProxyRepository
.
Update
(
keyValues
,
wheres
);
bool
flag
=
goods_ProxyRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
if
(
flag
)
{
{
//删除商品
//删除商品
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
Status
),
1
},
{
nameof
(
RB_Goods
.
Status
),
1
},
{
nameof
(
RB_Goods
.
UpdateDate
),
DateTime
.
Now
}
{
nameof
(
RB_Goods
.
UpdateDate
),
DateTime
.
Now
}
};
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
new
WhereHelper
(){
{
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Goods
.
Id
),
FiledName
=
nameof
(
RB_Goods
.
Id
),
FiledValue
=
pModel
.
ProxyGoodsId
,
FiledValue
=
pModel
.
ProxyGoodsId
,
OperatorEnum
=
OperatorEnum
.
Equal
OperatorEnum
=
OperatorEnum
.
Equal
}
}
};
};
goodsRepository
.
Update
(
keyValues1
,
wheres1
);
goodsRepository
.
Update
(
keyValues1
,
wheres1
);
...
...
Mall.Module.TradePavilion/CommerceConsultModule.cs
View file @
77d2c9fe
...
@@ -355,7 +355,7 @@ namespace Mall.Module.TradePavilion
...
@@ -355,7 +355,7 @@ namespace Mall.Module.TradePavilion
/// <returns></returns>
/// <returns></returns>
public
bool
SetTradeConsultModule
(
RB_Commerce_Consult_Extend
model
)
public
bool
SetTradeConsultModule
(
RB_Commerce_Consult_Extend
model
)
{
{
bool
flag
=
false
;
bool
flag
;
if
(
model
.
Id
>
0
)
if
(
model
.
Id
>
0
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
...
Mall.Module.TradePavilion/CompanyModule.cs
View file @
77d2c9fe
...
@@ -429,7 +429,7 @@ namespace Mall.Module.TradePavilion
...
@@ -429,7 +429,7 @@ namespace Mall.Module.TradePavilion
/// <returns></returns>
/// <returns></returns>
public
int
SetCompanyModule
(
RB_Company_Extend
model
)
public
int
SetCompanyModule
(
RB_Company_Extend
model
)
{
{
int
ID
=
0
;
int
ID
;
if
(
model
.
CompanyId
>
0
)
if
(
model
.
CompanyId
>
0
)
{
{
ID
=
model
.
CompanyId
;
ID
=
model
.
CompanyId
;
...
...
Mall.Module.User/UserModule.cs
View file @
77d2c9fe
...
@@ -4123,7 +4123,7 @@ namespace Mall.Module.User
...
@@ -4123,7 +4123,7 @@ namespace Mall.Module.User
RList
.
Add
(
new
RList
.
Add
(
new
{
{
Sort
=
i
,
Sort
=
i
,
MySelf
=
member
.
Id
==
userId2
?
true
:
false
,
MySelf
=
member
.
Id
==
userId2
,
UserInfo
=
new
UserInfo
=
new
{
{
member
.
Name
,
member
.
Name
,
...
@@ -4256,7 +4256,7 @@ namespace Mall.Module.User
...
@@ -4256,7 +4256,7 @@ namespace Mall.Module.User
CreateDate
=
item
.
CreateDate
.
HasValue
?
item
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
CreateDate
=
item
.
CreateDate
.
HasValue
?
item
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
GeneralizeNum
=
tgNum
,
GeneralizeNum
=
tgNum
,
OrderNum
=
item
.
RealOrderNum
,
OrderNum
=
item
.
RealOrderNum
,
Income
=
item
.
Income
,
item
.
Income
,
});
});
}
}
}
}
...
@@ -5472,7 +5472,7 @@ namespace Mall.Module.User
...
@@ -5472,7 +5472,7 @@ namespace Mall.Module.User
Msg
=
"未配置和平返佣"
Msg
=
"未配置和平返佣"
};
};
}
}
List
<
RB_Distributor_HPCommission_Extend
>
hpcList
=
new
List
<
RB_Distributor_HPCommission_Extend
>()
;
List
<
RB_Distributor_HPCommission_Extend
>
hpcList
;
if
(
string
.
IsNullOrEmpty
(
categoryIds
))
if
(
string
.
IsNullOrEmpty
(
categoryIds
))
{
{
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
Enabled
=
1
,
IsCommon
=
1
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
hpcList
=
distributor_HPCommissionRepository
.
GetList
(
new
RB_Distributor_HPCommission_Extend
()
{
Enabled
=
1
,
IsCommon
=
1
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
77d2c9fe
...
@@ -733,10 +733,10 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -733,10 +733,10 @@ namespace Mall.WebApi.Controllers.MallBase
/// <returns></returns>
/// <returns></returns>
[
HttpGet
]
[
HttpGet
]
[
HttpPost
]
[
HttpPost
]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
public
ApiResult
GetMessageTemplate
()
public
ApiResult
GetMessageTemplate
()
{
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
var
result
=
new
object
();
var
result
=
new
object
();
if
(
RequestParm
.
MiniAppId
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
RequestParm
.
MiniAppId
))
if
(
RequestParm
.
MiniAppId
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
RequestParm
.
MiniAppId
))
{
{
...
...
Mall.WebApi/Controllers/TradePavilion/AppletTradeController.cs
View file @
77d2c9fe
...
@@ -393,12 +393,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -393,12 +393,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
{
query
.
FirstShopNum
=
""
;
query
.
FirstShopNum
=
""
;
}
}
query
.
ShopNum
=
query
.
ShopNum
??
0
;
query
.
ShopNum
??=
0
;
query
.
BuiltUpArea
=
query
.
BuiltUpArea
??
0
;
query
.
BuiltUpArea
??=
0
;
query
.
EndBuiltUpArea
=
query
.
EndBuiltUpArea
??
0
;
query
.
EndBuiltUpArea
??=
0
;
query
.
AreaRequirement
=
query
.
AreaRequirement
??
0
;
query
.
AreaRequirement
??=
0
;
query
.
EndAreaRequirement
=
query
.
EndAreaRequirement
??
0
;
query
.
EndAreaRequirement
??=
0
;
query
.
YeJi
=
query
.
YeJi
??
0
;
query
.
YeJi
??=
0
;
query
.
CreateDate
=
DateTime
.
Now
;
query
.
CreateDate
=
DateTime
.
Now
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
TenantId
=
userInfo
.
TenantId
;
...
@@ -551,12 +551,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -551,12 +551,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
MallBaseId
=
userInfo
.
MallBaseId
;
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
TenantId
=
userInfo
.
TenantId
;
query
.
UpdateDate
=
DateTime
.
Now
;
query
.
UpdateDate
=
DateTime
.
Now
;
query
.
ShopNum
=
query
.
ShopNum
??
0
;
query
.
ShopNum
??=
0
;
query
.
BuiltUpArea
=
query
.
BuiltUpArea
??
0
;
query
.
BuiltUpArea
??=
0
;
query
.
EndBuiltUpArea
=
query
.
EndBuiltUpArea
??
0
;
query
.
EndBuiltUpArea
??=
0
;
query
.
AreaRequirement
=
query
.
AreaRequirement
??
0
;
query
.
AreaRequirement
??=
0
;
query
.
EndAreaRequirement
=
query
.
EndAreaRequirement
??
0
;
query
.
EndAreaRequirement
??=
0
;
query
.
YeJi
=
query
.
YeJi
??
0
;
query
.
YeJi
??=
0
;
var
oldModel
=
carrierModule
.
GetCarrierModel
(
new
RB_Carrier_Extend
()
{
ID
=
query
.
ID
});
var
oldModel
=
carrierModule
.
GetCarrierModel
(
new
RB_Carrier_Extend
()
{
ID
=
query
.
ID
});
if
(
oldModel
==
null
)
{
return
ApiResult
.
Failed
(
"载体不存在"
);
}
if
(
oldModel
==
null
)
{
return
ApiResult
.
Failed
(
"载体不存在"
);
}
if
(
oldModel
.
UserId
!=
userInfo
.
UserId
)
{
return
ApiResult
.
Failed
(
"无法修改此载体"
);
}
if
(
oldModel
.
UserId
!=
userInfo
.
UserId
)
{
return
ApiResult
.
Failed
(
"无法修改此载体"
);
}
...
...
Mall.WebApi/Controllers/TradePavilion/TradeController.cs
View file @
77d2c9fe
...
@@ -793,17 +793,19 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -793,17 +793,19 @@ namespace Mall.WebApi.Controllers.TradePavilion
{
{
foreach
(
var
sItem
in
item
.
SignUserList
)
foreach
(
var
sItem
in
item
.
SignUserList
)
{
{
var
excelColumns
=
new
List
<
ExcelColumn
>(
30
);
var
excelColumns
=
new
List
<
ExcelColumn
>(
30
)
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
item
.
UserName
)
);
{
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
item
.
CompanyStatusStr
)
);
new
ExcelColumn
(
value
:
item
.
UserName
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
item
.
CompanyName
)
);
new
ExcelColumn
(
value
:
item
.
CompanyStatusStr
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
item
.
AuthName
)
);
new
ExcelColumn
(
value
:
item
.
CompanyName
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
CompanyName
));
new
ExcelColumn
(
value
:
item
.
AuthName
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
Nature
));
new
ExcelColumn
(
value
:
sItem
.
CompanyName
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
LinkMan
));
new
ExcelColumn
(
value
:
sItem
.
Nature
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
LinkTel
));
new
ExcelColumn
(
value
:
sItem
.
LinkMan
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
Post
));
new
ExcelColumn
(
value
:
sItem
.
LinkTel
),
excelColumns
.
Add
(
new
ExcelColumn
(
value
:
sItem
.
CountryInfo
));
new
ExcelColumn
(
value
:
sItem
.
Post
),
new
ExcelColumn
(
value
:
sItem
.
CountryInfo
)
};
ExcelDataSource
datarow
=
new
ExcelDataSource
()
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
{
...
@@ -1583,12 +1585,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
...
@@ -1583,12 +1585,12 @@ namespace Mall.WebApi.Controllers.TradePavilion
else
{
else
{
query
.
FirstStoreTest
=
0
;
query
.
FirstStoreTest
=
0
;
}
}
query
.
ShopNum
=
query
.
ShopNum
??
0
;
query
.
ShopNum
??=
0
;
query
.
BuiltUpArea
=
query
.
BuiltUpArea
??
0
;
query
.
BuiltUpArea
??=
0
;
query
.
EndBuiltUpArea
=
query
.
EndBuiltUpArea
??
0
;
query
.
EndBuiltUpArea
??=
0
;
query
.
AreaRequirement
=
query
.
AreaRequirement
??
0
;
query
.
AreaRequirement
??=
0
;
query
.
EndAreaRequirement
=
query
.
EndAreaRequirement
??
0
;
query
.
EndAreaRequirement
??=
0
;
query
.
YeJi
=
query
.
YeJi
??
0
;
query
.
YeJi
??=
0
;
query
.
UpdateDate
=
System
.
DateTime
.
Now
;
query
.
UpdateDate
=
System
.
DateTime
.
Now
;
bool
flag
=
carrierModule
.
SetCarrier
(
query
);
bool
flag
=
carrierModule
.
SetCarrier
(
query
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
...
...
Mall.WebApi/Controllers/User/AppletLoginController.cs
View file @
77d2c9fe
This diff is collapsed.
Click to expand it.
Mall.WebApi/Controllers/User/SupplierController.cs
View file @
77d2c9fe
...
@@ -154,7 +154,6 @@ namespace Mall.WebApi.Controllers.User
...
@@ -154,7 +154,6 @@ namespace Mall.WebApi.Controllers.User
[
HttpPost
]
[
HttpPost
]
public
ApiResult
DelDiscountCoupon
()
public
ApiResult
DelDiscountCoupon
()
{
{
var
parms
=
RequestParm
;
JObject
parmsJob
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
JObject
parmsJob
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
int
Id
=
parmsJob
.
GetInt
(
"Id"
,
0
);
int
Id
=
parmsJob
.
GetInt
(
"Id"
,
0
);
int
BackId
=
parmsJob
.
GetInt
(
"BackId"
,
0
);
int
BackId
=
parmsJob
.
GetInt
(
"BackId"
,
0
);
...
@@ -222,7 +221,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -222,7 +221,7 @@ namespace Mall.WebApi.Controllers.User
var
now
=
new
var
now
=
new
{
{
ID
=
item
.
TenantId
,
ID
=
item
.
TenantId
,
Name
=
item
.
Name
item
.
Name
};
};
result
.
Add
(
now
);
result
.
Add
(
now
);
}
}
...
@@ -310,13 +309,15 @@ namespace Mall.WebApi.Controllers.User
...
@@ -310,13 +309,15 @@ namespace Mall.WebApi.Controllers.User
demodel
.
IsFinance
=
2
;
demodel
.
IsFinance
=
2
;
var
list
=
orderModule
.
GetSupplierOrderList
(
demodel
);
var
list
=
orderModule
.
GetSupplierOrderList
(
demodel
);
var
result
=
new
List
<
RB_Goods_OrderDetail_Extend
>();
var
result
=
new
List
<
RB_Goods_OrderDetail_Extend
>();
RB_Finance_Record_Extend
record
=
new
RB_Finance_Record_Extend
();
RB_Finance_Record_Extend
record
=
new
RB_Finance_Record_Extend
record
.
MallBaseId
=
demodel
.
MallBaseId
;
{
record
.
TenantId
=
demodel
.
TenantId
;
MallBaseId
=
demodel
.
MallBaseId
,
record
.
Type
=
2
;
TenantId
=
demodel
.
TenantId
,
record
.
IsFinanceAll
=
demodel
.
IsSelectAll
;
Type
=
2
,
record
.
CreateDate
=
System
.
DateTime
.
Now
;
IsFinanceAll
=
demodel
.
IsSelectAll
,
record
.
RecordDetailList
=
new
List
<
RB_Finance_RecordDetail_Extend
>();
CreateDate
=
System
.
DateTime
.
Now
,
RecordDetailList
=
new
List
<
RB_Finance_RecordDetail_Extend
>()
};
if
(
list
!=
null
&&
list
.
Any
())
if
(
list
!=
null
&&
list
.
Any
())
{
{
...
@@ -495,10 +496,10 @@ namespace Mall.WebApi.Controllers.User
...
@@ -495,10 +496,10 @@ namespace Mall.WebApi.Controllers.User
var
financeObj
=
new
var
financeObj
=
new
{
{
CreateBy
=
demodel
.
FinanceCreateBy
==
0
?
Config
.
ExpendDirector
:
demodel
.
FinanceCreateBy
.
ToString
(),
CreateBy
=
demodel
.
FinanceCreateBy
==
0
?
Config
.
ExpendDirector
:
demodel
.
FinanceCreateBy
.
ToString
(),
IsPublic
=
demodel
.
IsPublic
,
demodel
.
IsPublic
,
ClientType
=
supplierModel
.
ClientBankAccount
.
Type
,
ClientType
=
supplierModel
.
ClientBankAccount
.
Type
,
ClientID
=
supplierModel
.
BankAccountId
,
ClientID
=
supplierModel
.
BankAccountId
,
CurrencyId
=
financeConfigurineModel
.
CurrencyId
,
financeConfigurineModel
.
CurrencyId
,
WBMoney
=
totalMonry
,
WBMoney
=
totalMonry
,
RB_Branch_Id
=
Config
.
ExpendBranchId
,
RB_Branch_Id
=
Config
.
ExpendBranchId
,
PayDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
PayDate
=
System
.
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
),
...
...
Mall.WebApi/Controllers/User/TenantController.cs
View file @
77d2c9fe
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.Common.API
;
using
Mall.WebApi.Filter
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Cors
;
...
@@ -9,10 +8,7 @@ using Microsoft.AspNetCore.Mvc;
...
@@ -9,10 +8,7 @@ using Microsoft.AspNetCore.Mvc;
using
Mall.Model.Extend.User
;
using
Mall.Model.Extend.User
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
Newtonsoft.Json.Linq
;
using
JWT
;
using
Mall.Common
;
using
Mall.Common
;
using
JWT.Algorithms
;
using
JWT.Serializers
;
using
Mall.Common.Enum
;
using
Mall.Common.Enum
;
using
Mall.CacheManager.User
;
using
Mall.CacheManager.User
;
using
Mall.CacheKey
;
using
Mall.CacheKey
;
...
@@ -23,9 +19,9 @@ using Mall.Module.Product;
...
@@ -23,9 +19,9 @@ using Mall.Module.Product;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Authorization
;
using
Mall.Model.Query
;
using
Mall.Model.Query
;
using
Mall.Model.Extend.AppletWeChat
;
using
Mall.Model.Extend.AppletWeChat
;
using
Mall.AOP
;
using
Mall.Module.User
;
using
Mall.Module.User
;
using
Dnc.Api.Throttle
;
using
Dnc.Api.Throttle
;
using
Mall.WebApi.Helper
;
namespace
Mall.WebApi.Controllers.User
namespace
Mall.WebApi.Controllers.User
{
{
...
@@ -86,7 +82,8 @@ namespace Mall.WebApi.Controllers.User
...
@@ -86,7 +82,8 @@ namespace Mall.WebApi.Controllers.User
private
readonly
Module
.
Property
.
AuthorizeModule
authorizeModule
=
new
Module
.
Property
.
AuthorizeModule
();
private
readonly
Module
.
Property
.
AuthorizeModule
authorizeModule
=
new
Module
.
Property
.
AuthorizeModule
();
#
region
商户信息
#
region
商户信息
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
/// <summary>
/// <summary>
/// 用户登录
/// 用户登录
/// </summary>
/// </summary>
...
@@ -136,7 +133,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -136,7 +133,7 @@ namespace Mall.WebApi.Controllers.User
}
}
catch
catch
{
{
}
}
}
}
#
region
add
by
:
W
2020
-
07
-
06
erp
授权信息
#
region
add
by
:
W
2020
-
07
-
06
erp
授权信息
...
@@ -158,47 +155,14 @@ namespace Mall.WebApi.Controllers.User
...
@@ -158,47 +155,14 @@ namespace Mall.WebApi.Controllers.User
if
(
erpUserInfo
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
erpUserInfo
.
EmLoginMobile
)
&&
erpUserInfo
.
IsLeave
==
0
)
if
(
erpUserInfo
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
erpUserInfo
.
EmLoginMobile
)
&&
erpUserInfo
.
IsLeave
==
0
)
{
{
TokenUserInfo
erpUserInfoToken
=
new
TokenUserInfo
{
uid
=
erpUserInfo
.
EmployeeId
.
ToString
(),
requestFrom
=
Common
.
Enum
.
ApiRequestFromEnum
.
ERP
};
TokenUserInfo
erpUserInfoToken
=
new
TokenUserInfo
{
uid
=
erpUserInfo
.
EmployeeId
.
ToString
(),
requestFrom
=
Common
.
Enum
.
ApiRequestFromEnum
.
ERP
};
#
region
JWT
erptoken
=
ApiTokenHelper
.
CreateToken
(
erpUserInfoToken
);
IDateTimeProvider
erpprovider
=
new
UtcDateTimeProvider
();
var
erpnow
=
erpprovider
.
GetNow
().
AddMinutes
(-
1
);
var
erpunixEpoch
=
new
DateTime
(
1970
,
1
,
1
,
0
,
0
,
0
,
DateTimeKind
.
Utc
);
// or use JwtValidator.UnixEpoch
var
erpsecondsSinceEpoch
=
Math
.
Round
((
erpnow
-
erpunixEpoch
).
TotalSeconds
);
var
erppayload
=
new
Dictionary
<
string
,
object
>
{
{
"iat"
,
erpsecondsSinceEpoch
},
{
"exp"
,
erpsecondsSinceEpoch
+
Config
.
JwtExpirTime
},
{
"userInfo"
,
erpUserInfoToken
}
};
IJwtAlgorithm
erpalgorithm
=
new
HMACSHA256Algorithm
();
IJsonSerializer
erpserializer
=
new
JsonNetSerializer
();
IBase64UrlEncoder
erpurlEncoder
=
new
JwtBase64UrlEncoder
();
IJwtEncoder
erpencoder
=
new
JwtEncoder
(
erpalgorithm
,
erpserializer
,
erpurlEncoder
);
string
erpsecret
=
Config
.
JwtSecretKey
;
erptoken
=
erpencoder
.
Encode
(
erppayload
,
erpsecret
);
#
endregion
}
}
}
}
}
}
#
endregion
#
endregion
TokenUserInfo
userInfo
=
new
TokenUserInfo
{
uid
=
model
.
TenantId
.
ToString
(),
requestFrom
=
ApiRequestFromEnum
.
Web
};
TokenUserInfo
userInfo
=
new
TokenUserInfo
{
uid
=
model
.
TenantId
.
ToString
(),
requestFrom
=
ApiRequestFromEnum
.
Web
};
#
region
JWT
#
region
生成
Token
IDateTimeProvider
provider
=
new
UtcDateTimeProvider
();
string
token
=
ApiTokenHelper
.
CreateToken
(
userInfo
);
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
#
endregion
UserInfo
obj
=
new
UserInfo
UserInfo
obj
=
new
UserInfo
{
{
...
@@ -232,7 +196,8 @@ namespace Mall.WebApi.Controllers.User
...
@@ -232,7 +196,8 @@ namespace Mall.WebApi.Controllers.User
/// 用户注册第一步
/// 用户注册第一步
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
public
ApiResult
SetTenantFirst
()
public
ApiResult
SetTenantFirst
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
@@ -252,7 +217,8 @@ namespace Mall.WebApi.Controllers.User
...
@@ -252,7 +217,8 @@ namespace Mall.WebApi.Controllers.User
/// 用户注册第二步
/// 用户注册第二步
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
public
ApiResult
SetTenantSecond
()
public
ApiResult
SetTenantSecond
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
@@ -285,7 +251,8 @@ namespace Mall.WebApi.Controllers.User
...
@@ -285,7 +251,8 @@ namespace Mall.WebApi.Controllers.User
/// 修改密码账号
/// 修改密码账号
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
[
AllowAnonymous
]
[
RateValve
(
Policy
=
Policy
.
Ip
,
Limit
=
10
,
Duration
=
60
)]
public
ApiResult
UpdateTenantPwd
()
public
ApiResult
UpdateTenantPwd
()
{
{
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
JsonConvert
.
DeserializeObject
<
RB_Tenant_Extend
>(
RequestParm
.
msg
.
ToString
());
...
@@ -1830,7 +1797,7 @@ namespace Mall.WebApi.Controllers.User
...
@@ -1830,7 +1797,7 @@ namespace Mall.WebApi.Controllers.User
var
extModel
=
new
RB_PlugIn_Extend
()
var
extModel
=
new
RB_PlugIn_Extend
()
{
{
TenantId
=
RequestParm
.
TenantId
,
TenantId
=
RequestParm
.
TenantId
,
QPlugTypeStr
=
parms
.
GetStringValue
(
"QPlugTypeStr"
),
QPlugTypeStr
=
parms
.
GetStringValue
(
"QPlugTypeStr"
),
};
};
var
list
=
plugInModule
.
GetPlugInListModule
(
extModel
);
var
list
=
plugInModule
.
GetPlugInListModule
(
extModel
);
var
distinctList
=
list
.
GroupBy
(
qitem
=>
new
{
qitem
.
PlugType
,
qitem
.
GroupName
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
PlugType
,
qitem
.
Key
.
GroupName
});
var
distinctList
=
list
.
GroupBy
(
qitem
=>
new
{
qitem
.
PlugType
,
qitem
.
GroupName
}).
Select
(
qitem
=>
new
{
qitem
.
Key
.
PlugType
,
qitem
.
Key
.
GroupName
});
...
@@ -1995,7 +1962,6 @@ namespace Mall.WebApi.Controllers.User
...
@@ -1995,7 +1962,6 @@ namespace Mall.WebApi.Controllers.User
}
}
#
endregion
#
endregion
#
region
商城首页统计
#
region
商城首页统计
/// <summary>
/// <summary>
...
...
Mall.WebApi/Filter/ApiFilterAttribute.cs
View file @
77d2c9fe
...
@@ -54,11 +54,10 @@ namespace Mall.WebApi.Filter
...
@@ -54,11 +54,10 @@ namespace Mall.WebApi.Filter
});
});
Common
.
Plugin
.
LogHelper
.
Write
(
"OnActionExecuting:"
+
ip
);
Common
.
Plugin
.
LogHelper
.
Write
(
"OnActionExecuting:"
+
ip
);
}
}
//请求参数
JObject
parm
=
new
JObject
();
string
token
=
""
;
string
token
=
""
;
#
region
api
监控日志
#
region
api
监控日志
parm
=
DoApiMonitorLog
(
actionContext
,
ref
token
);
JObject
parm
=
DoApiMonitorLog
(
actionContext
,
ref
token
);
#
endregion
#
endregion
bool
isCheckToken
=
true
;
bool
isCheckToken
=
true
;
var
endpoint
=
actionContext
.
HttpContext
.
Features
.
Get
<
IEndpointFeature
>()?.
Endpoint
;
var
endpoint
=
actionContext
.
HttpContext
.
Features
.
Get
<
IEndpointFeature
>()?.
Endpoint
;
...
@@ -278,7 +277,7 @@ namespace Mall.WebApi.Filter
...
@@ -278,7 +277,7 @@ namespace Mall.WebApi.Filter
data
=
null
data
=
null
});
});
}
}
catch
(
Exception
ex
)
catch
{
{
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
actionContext
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
HttpStatusCode
.
OK
,
HttpStatusCode
.
OK
,
...
...
Mall.WebApi/Helper/TokenHelper.cs
deleted
100644 → 0
View file @
5d86f031
using
JWT
;
using
JWT.Serializers
;
using
Mall.Common.API
;
using
Mall.Common.Plugin
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Mall.WebApi.Helper
{
/// <summary>
/// Token帮助类
/// </summary>
public
class
TokenHelper
{
/// <summary>
/// 生成Token
/// </summary>
/// <returns></returns>
public
static
string
CreateToken
()
{
return
""
;
}
/// <summary>
/// 解析Token
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public
static
TokenUserInfo
ParsingToken
(
string
token
)
{
TokenUserInfo
tokenUser
=
new
TokenUserInfo
();
if
(
string
.
IsNullOrEmpty
(
token
))
{
IJsonSerializer
serializer
=
new
JsonNetSerializer
();
IDateTimeProvider
provider
=
new
UtcDateTimeProvider
();
IJwtValidator
validator
=
new
JwtValidator
(
serializer
,
provider
);
IBase64UrlEncoder
urlEncoder
=
new
JwtBase64UrlEncoder
();
IJwtDecoder
decoder
=
new
JwtDecoder
(
serializer
,
validator
,
urlEncoder
);
string
secret
=
Common
.
Config
.
JwtSecretKey
;
var
json
=
decoder
.
Decode
(
token
,
secret
,
verify
:
true
);
//token为之前生成的字符串
if
(!
string
.
IsNullOrEmpty
(
json
))
{
JObject
jwtJson
=
JObject
.
Parse
(
json
);
var
mall_userInfo
=
JObject
.
Parse
(
jwtJson
.
GetStringValue
(
"mall_userInfo"
));
tokenUser
.
requestFrom
=
(
Common
.
Enum
.
ApiRequestFromEnum
)
mall_userInfo
.
GetInt
(
"requestFrom"
);
tokenUser
.
uid
=
mall_userInfo
.
GetStringValue
(
"uid"
);
}
}
return
tokenUser
;
}
}
}
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