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
7f51726e
Commit
7f51726e
authored
Aug 07, 2020
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
251221d3
d11ee0d9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
20 deletions
+146
-20
HttpHelper.cs
Mall.Common/Plugin/HttpHelper.cs
+15
-6
WeiXinHelper.cs
Mall.Common/Plugin/WeiXinHelper.cs
+54
-11
RB_Goods_Log.cs
Mall.Model/Entity/Product/RB_Goods_Log.cs
+1
-1
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+46
-0
RB_Goods_OrderIntroductionRepository.cs
...epository/Product/RB_Goods_OrderIntroductionRepository.cs
+4
-0
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+2
-2
OrderController.cs
Mall.WebApi/Controllers/Product/OrderController.cs
+24
-0
No files found.
Mall.Common/Plugin/HttpHelper.cs
View file @
7f51726e
...
...
@@ -132,12 +132,21 @@ namespace Mall.Common.Plugin
{
HttpWebRequest
req
=
(
HttpWebRequest
)
WebRequest
.
Create
(
url
);
req
.
Method
=
"POST"
;
req
.
ContentType
=
"application/octet-stream"
;
req
.
ContentLength
=
Encoding
.
UTF8
.
GetByteCount
(
postDataStr
);
Stream
myRequestStream
=
req
.
GetRequestStream
();
StreamWriter
myStreamWriter
=
new
StreamWriter
(
myRequestStream
,
Encoding
.
GetEncoding
(
"gb2312"
));
myStreamWriter
.
Write
(
postDataStr
);
myStreamWriter
.
Close
();
req
.
ContentType
=
"application/x-www-form-urlencoded"
;
//req.Headers.Add("Accept", "application/json");
//req.Headers.Add("Content-Type", "application/json");
byte
[]
data
=
Encoding
.
UTF8
.
GetBytes
(
postDataStr
);
req
.
ContentLength
=
data
.
Length
;
using
(
Stream
reqStream
=
req
.
GetRequestStream
())
{
reqStream
.
Write
(
data
,
0
,
data
.
Length
);
reqStream
.
Close
();
}
HttpWebResponse
rsp
=
(
HttpWebResponse
)
req
.
GetResponse
();
if
(
string
.
IsNullOrWhiteSpace
(
rsp
.
CharacterSet
))
...
...
Mall.Common/Plugin/WeiXinHelper.cs
View file @
7f51726e
...
...
@@ -10,6 +10,27 @@ namespace Mall.Common.Plugin
{
public
class
WeiXinHelper
{
static
List
<
WeChatMiniAppMessage
>
weChatMiniAppMessages
=
new
List
<
WeChatMiniAppMessage
>();
static
WeiXinHelper
()
{
// //(拼团失败通知) 980(拼团成功通知)
weChatMiniAppMessages
.
Add
(
new
WeChatMiniAppMessage
()
{
Tid
=
"1953"
,
Title
=
"拼团失败通知"
,
KidList
=
new
List
<
int
>()
{
1
,
2
,
3
},
SceneDesc
=
""
,
});
weChatMiniAppMessages
.
Add
(
new
WeChatMiniAppMessage
()
{
Tid
=
"980"
,
Title
=
"拼团成功通知"
,
KidList
=
new
List
<
int
>()
{
1
,
2
,
3
},
SceneDesc
=
""
,
});
}
/// <summary>
/// 获取微信用户OpenId
...
...
@@ -40,9 +61,14 @@ namespace Mall.Common.Plugin
return
openid
;
}
public
static
string
GetWeChatAccessToken
(
string
AppId
,
string
AppSecret
)
/// <summary>
/// 获取微信订阅消息模板
/// </summary>
/// <param name="AppId"></param>
/// <param name="AppSecret"></param>
/// <returns></returns>
public
static
List
<
WeChatMiniAppMessage
>
GetWeChatTemplateMessage
(
string
AppId
,
string
AppSecret
)
{
string
returnStr
=
""
;
string
result
=
""
;
string
access_token
=
""
;
try
...
...
@@ -57,23 +83,35 @@ namespace Mall.Common.Plugin
}
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
))
string
addTemplate
=
string
.
Format
(
"https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token={0}"
,
access_token
);
foreach
(
var
item
in
weChatMiniAppMessages
)
{
JObject
jObj
=
JObject
.
Parse
(
result
);
result
=
""
;
string
newParameters
=
string
.
Format
(
"tid={0}"
,
item
.
Tid
);
if
(
item
.
KidList
!=
null
&&
item
.
KidList
.
Count
>
0
)
{
int
index
=
0
;
foreach
(
var
subItem
in
item
.
KidList
)
{
newParameters
+=
string
.
Format
(
"&kidList[{0}]={1}"
,
index
,
subItem
);
index
++;
}
}
newParameters
+=
string
.
Format
(
"&sceneDesc={0}"
,
item
.
Title
);
result
=
Common
.
Plugin
.
HttpHelper
.
HttpPostStr
(
addTemplate
,
newParameters
);
if
(!
string
.
IsNullOrWhiteSpace
(
result
))
{
JObject
jObj
=
JObject
.
Parse
(
result
);
item
.
MessageTemplateId
=
jObj
[
"priTmplId"
].
ToString
();
}
}
//1953(拼团失败通知) 980(拼团成功通知)
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"GetWeChatAccessToken:result="
+
result
);
}
return
returnStr
;
return
weChatMiniAppMessages
;
}
}
...
...
@@ -101,6 +139,11 @@ namespace Mall.Common.Plugin
/// 服务场景描述,15个字以内
/// </summary>
public
string
SceneDesc
{
get
;
set
;
}
/// <summary>
/// 模板消息Id
/// </summary>
public
string
MessageTemplateId
{
get
;
set
;
}
}
/// <summary>
...
...
Mall.Model/Entity/Product/RB_Goods_Log.cs
View file @
7f51726e
...
...
@@ -31,7 +31,7 @@ namespace Mall.Model.Entity.Product
set
;
}
/// <summary>
/// 来源类型 1订单 2商品
/// 来源类型 1订单 2商品
3推荐返佣
/// </summary>
public
int
?
Type
{
...
...
Mall.Module.Product/OrderModule.cs
View file @
7f51726e
...
...
@@ -9273,6 +9273,52 @@ namespace Mall.Module.Product
return
RList
;
}
/// <summary>
/// 设置推荐供应商返佣
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="commission"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetRecommendOrdersCommission
(
int
orderDetailId
,
decimal
commission
,
int
tenantId
,
int
mallBaseId
,
int
empId
)
{
var
introductionModel
=
goods_OrderIntroductionRepository
.
GetList
(
new
RB_Goods_OrderIntroduction_Extend
()
{
OrderDetailId
=
orderDetailId
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
}).
FirstOrDefault
();
if
(
introductionModel
==
null
)
{
return
false
;
}
if
(
introductionModel
.
CommissionState
!=
1
)
{
return
false
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_OrderIntroduction
.
Commission
),
commission
},
{
nameof
(
RB_Goods_OrderIntroduction
.
Remark
),(
introductionModel
.
Remark
??
""
)+
" "
+
"修改返佣:由"
+
(
introductionModel
.
Commission
??
0
)
+
"=>"
+
commission
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_OrderIntroduction
.
Id
),
FiledValue
=
introductionModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
goods_OrderIntroductionRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
)
{
//记录日志
goods_LogRepository
.
Insert
(
new
RB_Goods_Log
()
{
Content
=
empId
+
" 修改推荐供应商返佣:由"
+
(
introductionModel
.
Commission
??
0
)
+
"=>"
+
commission
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
mallBaseId
,
SourceId
=
introductionModel
.
Id
,
TenantId
=
tenantId
,
Type
=
3
});
return
true
;
}
else
{
return
false
;
}
}
#
endregion
#
region
供应商订单商品信息
...
...
Mall.Repository/Product/RB_Goods_OrderIntroductionRepository.cs
View file @
7f51726e
...
...
@@ -43,6 +43,10 @@ namespace Mall.Repository.Product
{
where
+=
$@" and oc.
{
nameof
(
RB_Goods_OrderIntroduction
.
OrderId
)}
in(
{
dmodel
.
OrderIds
}
)"
;
}
if
(
dmodel
.
OrderDetailId
>
0
)
{
where
+=
$@" and oc.
{
nameof
(
RB_Goods_OrderIntroduction
.
OrderDetailId
)}
=
{
dmodel
.
OrderDetailId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
IntroductionIds
))
{
where
+=
$@" and oc.
{
nameof
(
RB_Goods_OrderIntroduction
.
Id
)}
in(
{
dmodel
.
IntroductionIds
}
)"
;
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
7f51726e
...
...
@@ -592,13 +592,13 @@ namespace Mall.WebApi.Controllers.MallBase
public
ApiResult
GetMessageTemplate
()
{
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
msg
.
ToString
());
string
result
=
""
;
var
result
=
new
object
()
;
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
.
GetWeChat
AccessToken
(
miniProgram
.
MiniAppId
,
miniProgram
.
MiniAppSecret
);
result
=
Common
.
Plugin
.
WeiXinHelper
.
GetWeChat
TemplateMessage
(
miniProgram
.
MiniAppId
,
miniProgram
.
MiniAppSecret
);
}
}
return
ApiResult
.
Success
(
data
:
result
);
...
...
Mall.WebApi/Controllers/Product/OrderController.cs
View file @
7f51726e
...
...
@@ -1768,6 +1768,30 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 设置推荐分销
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetRecommendOrdersCommission
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
OrderDetailId
=
parms
.
GetInt
(
"OrderDetailId"
,
0
);
decimal
Commission
=
parms
.
GetDecimal
(
"Commission"
);
if
(
OrderDetailId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递订单明细id"
);
}
bool
flag
=
orderModule
.
SetRecommendOrdersCommission
(
OrderDetailId
,
Commission
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
推荐供应商
...
...
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