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
567511e9
Commit
567511e9
authored
Aug 06, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
f4e1b522
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
133 additions
and
6 deletions
+133
-6
WeiXinHelper.cs
Mall.Common/Plugin/WeiXinHelper.cs
+62
-0
RB_GroupBuyConfig_Extend.cs
Mall.Model/Extend/User/RB_GroupBuyConfig_Extend.cs
+28
-0
GroupBuyConfigModule.cs
Mall.Module.User/GroupBuyConfigModule.cs
+5
-3
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+23
-0
GroupBuyController.cs
Mall.WebApi/Controllers/Product/GroupBuyController.cs
+8
-0
ApiExceptionFilterAttribute.cs
Mall.WebApi/Filter/ApiExceptionFilterAttribute.cs
+7
-3
No files found.
Mall.Common/Plugin/WeiXinHelper.cs
View file @
567511e9
...
@@ -39,6 +39,68 @@ namespace Mall.Common.Plugin
...
@@ -39,6 +39,68 @@ namespace Mall.Common.Plugin
}
}
return
openid
;
return
openid
;
}
}
public
static
string
GetWeChatAccessToken
(
string
AppId
,
string
AppSecret
)
{
string
returnStr
=
""
;
string
result
=
""
;
string
access_token
=
""
;
try
{
//请求路径
string
url
=
string
.
Format
(
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"
,
AppId
,
AppSecret
);
result
=
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
url
);
if
(
result
!=
null
&&
!
string
.
IsNullOrEmpty
(
result
))
{
JObject
jObj
=
JObject
.
Parse
(
result
);
access_token
=
jObj
[
"access_token"
].
ToString
();
}
if
(!
string
.
IsNullOrWhiteSpace
(
access_token
))
{
result
=
""
;
string
templateUrl
=
string
.
Format
(
"https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token={0}"
,
access_token
);
result
=
Common
.
Plugin
.
HttpHelper
.
HttpGet
(
templateUrl
);
returnStr
=
result
;
if
(
result
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
result
))
{
JObject
jObj
=
JObject
.
Parse
(
result
);
}
//1953(拼团失败通知) 980(拼团成功通知)
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"GetWeChatAccessToken:result="
+
result
);
}
return
returnStr
;
}
}
/// <summary>
/// 微信小程序订阅消息实体
/// </summary>
public
class
WeChatMiniAppMessage
{
/// <summary>
/// 模板标题Id
/// </summary>
public
string
Tid
{
get
;
set
;
}
/// <summary>
/// 模板名称
/// </summary>
public
string
Title
{
get
;
set
;
}
/// <summary>
/// 开发者自行组合好的模板关键词列表
/// </summary>
public
List
<
int
>
KidList
{
get
;
set
;
}
/// <summary>
/// 服务场景描述,15个字以内
/// </summary>
public
string
SceneDesc
{
get
;
set
;
}
}
}
/// <summary>
/// <summary>
...
...
Mall.Model/Extend/User/RB_GroupBuyConfig_Extend.cs
View file @
567511e9
...
@@ -13,6 +13,34 @@ namespace Mall.Model.Extend.User
...
@@ -13,6 +13,34 @@ namespace Mall.Model.Extend.User
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_GroupBuyConfig_Extend
:
RB_GroupBuyConfig
public
class
RB_GroupBuyConfig_Extend
:
RB_GroupBuyConfig
{
{
/// <summary>
/// 支付方式[online_pay-线上支付,huodao-货到付款,balance-余额支付]
/// </summary>
public
List
<
string
>
Payment_TypeList
{
get
{
if
(!
string
.
IsNullOrWhiteSpace
(
this
.
Payment_Type
))
{
return
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
this
.
Payment_Type
);
}
return
new
List
<
string
>();
}
}
/// <summary>
/// 发货方式[express-快递配送,offline-到店自提,city-同城配送]
/// </summary>
public
List
<
string
>
Send_TypeList
{
get
{
if
(!
string
.
IsNullOrWhiteSpace
(
this
.
Send_Type
))
{
return
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
string
>>(
this
.
Send_Type
);
}
return
new
List
<
string
>();
}
}
}
}
}
}
\ No newline at end of file
Mall.Module.User/GroupBuyConfigModule.cs
View file @
567511e9
...
@@ -40,8 +40,8 @@ namespace Mall.Module.User
...
@@ -40,8 +40,8 @@ namespace Mall.Module.User
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Member_Price
),
extModel
.
Is_Member_Price
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Member_Price
),
extModel
.
Is_Member_Price
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Integral
),
extModel
.
Is_Integral
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Integral
),
extModel
.
Is_Integral
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
RuleText
),
extModel
.
RuleText
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
RuleText
),
extModel
.
RuleText
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
Goods_Poster
),
extModel
.
Goods_Poster
},
//
{nameof(RB_GroupBuyConfig_Extend.Goods_Poster),extModel.Goods_Poster },
{
nameof
(
RB_GroupBuyConfig_Extend
.
Advertisement
),
extModel
.
Advertisement
},
//
{nameof(RB_GroupBuyConfig_Extend.Advertisement),extModel.Advertisement },
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Advertisement
),
extModel
.
Is_Advertisement
},
{
nameof
(
RB_GroupBuyConfig_Extend
.
Is_Advertisement
),
extModel
.
Is_Advertisement
},
};
};
flag
=
groupBuyConfigRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_GroupBuyConfig_Extend
.
GroupByConfigId
),
extModel
.
GroupByConfigId
));
flag
=
groupBuyConfigRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_GroupBuyConfig_Extend
.
GroupByConfigId
),
extModel
.
GroupByConfigId
));
...
@@ -90,7 +90,9 @@ namespace Mall.Module.User
...
@@ -90,7 +90,9 @@ namespace Mall.Module.User
/// <returns></returns>
/// <returns></returns>
public
RB_GroupBuyConfig_Extend
GetGroupBuyConfigModule
(
RB_GroupBuyConfig_Extend
query
)
public
RB_GroupBuyConfig_Extend
GetGroupBuyConfigModule
(
RB_GroupBuyConfig_Extend
query
)
{
{
return
groupBuyConfigRepository
.
GetGroupBuyConfigRepository
(
query
);
var
extModel
=
groupBuyConfigRepository
.
GetGroupBuyConfigRepository
(
query
);
return
extModel
;
}
}
}
}
}
}
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
567511e9
...
@@ -582,6 +582,29 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -582,6 +582,29 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
Success
(
data
:
openId
);
return
ApiResult
.
Success
(
data
:
openId
);
}
}
/// <summary>
/// 获取用户信息
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetMessageTemplate
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
string
result
=
""
;
if
(
RequestParm
.
MiniAppId
!=
null
&&
!
string
.
IsNullOrWhiteSpace
(
RequestParm
.
MiniAppId
))
{
var
miniProgram
=
programModule
.
GetMiniProgramModule
(
new
Model
.
Extend
.
User
.
RB_MiniProgram_Extend
()
{
MiniAppId
=
RequestParm
.
MiniAppId
});
if
(
miniProgram
!=
null
&&
miniProgram
.
MallBaseId
>
0
)
{
result
=
Common
.
Plugin
.
WeiXinHelper
.
GetWeChatAccessToken
(
miniProgram
.
MiniAppId
,
miniProgram
.
MiniAppSecret
);
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
/// <summary>
/// 获取用户信息
/// 获取用户信息
...
...
Mall.WebApi/Controllers/Product/GroupBuyController.cs
View file @
567511e9
...
@@ -32,6 +32,14 @@ namespace Mall.WebApi.Controllers.Product
...
@@ -32,6 +32,14 @@ namespace Mall.WebApi.Controllers.Product
var
extModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_GroupBuyConfig_Extend
>(
RequestParm
.
msg
.
ToString
());
var
extModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_GroupBuyConfig_Extend
>(
RequestParm
.
msg
.
ToString
());
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
MallBaseId
=
RequestParm
.
MallBaseId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
extModel
.
TenantId
=
RequestParm
.
TenantId
;
if
(
extModel
.
Payment_TypeList
!=
null
&&
extModel
.
Payment_TypeList
.
Count
>
0
)
{
extModel
.
Payment_Type
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
extModel
.
Payment_TypeList
);
}
if
(
extModel
.
Send_TypeList
!=
null
&&
extModel
.
Send_TypeList
.
Count
>
0
)
{
extModel
.
Send_Type
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
extModel
.
Send_TypeList
);
}
var
flag
=
groupBuyConfigModule
.
SetGroupBuyConfigModule
(
extModel
);
var
flag
=
groupBuyConfigModule
.
SetGroupBuyConfigModule
(
extModel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
...
...
Mall.WebApi/Filter/ApiExceptionFilterAttribute.cs
View file @
567511e9
...
@@ -5,6 +5,7 @@ using Mall.Common.API;
...
@@ -5,6 +5,7 @@ using Mall.Common.API;
using
Mall.Common.Plugin
;
using
Mall.Common.Plugin
;
using
System.Net
;
using
System.Net
;
using
System.Net.Http
;
using
System.Net.Http
;
using
System
;
namespace
Mall.WebApi.Filter
namespace
Mall.WebApi.Filter
{
{
...
@@ -34,17 +35,20 @@ namespace Mall.WebApi.Filter
...
@@ -34,17 +35,20 @@ namespace Mall.WebApi.Filter
if
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
]
!=
null
)
if
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
]
!=
null
)
{
{
LogHelper
.
Error
(
$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
,请求参数:
{
JsonConvert
.
SerializeObject
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
].
ToString
())}
"
,
context
.
Exception
);
LogHelper
.
Error
(
$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
,请求参数:
{
JsonConvert
.
SerializeObject
(
context
.
HttpContext
.
Items
[
GlobalKey
.
UserPostInfo
].
ToString
())}
"
,
context
.
Exception
);
Console
.
WriteLine
(
context
.
Exception
);
}
}
else
{
else
{
LogHelper
.
Error
(
$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
"
,
context
.
Exception
);
LogHelper
.
Error
(
$"ApiExceptionFilterAttribute_InvokeServiceMethod请求地址:
{
Config
.
GetFilePath
(
context
.
HttpContext
.
Request
.
GetAbsoluteUri
())}
"
,
context
.
Exception
);
Console
.
WriteLine
(
context
.
Exception
);
}
}
var
robj
=
new
ApiResult
()
var
robj
=
new
ApiResult
()
{
{
resultCode
=
(
int
)
ResultCode
.
AbnormalServer
,
resultCode
=
(
int
)
ResultCode
.
AbnormalServer
,
message
=
"服务器繁忙,请稍后再试"
,
message
=
"服务器繁忙,请稍后再试"
,
data
=
null
data
=
null
};
;
};
context
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
robj
);
context
.
Result
=
new
Microsoft
.
AspNetCore
.
Mvc
.
JsonResult
(
robj
);
}
}
}
}
...
...
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