diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
index c0dc81a..7fafd7e 100644
--- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs
+++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
@@ -405,6 +405,21 @@ namespace CoreCms.Net.Configuration
///
public const string Kuaidi100Key = "kuaidi100Key";
+ ///
+ /// 客服H5地址
+ ///
+ public const string CustomerServiceH5Url = "customerServiceH5Url";
+
+ ///
+ /// 客服后台管理地址
+ ///
+ public const string CustomerServiceAdminUrl = "customerServiceAdminUrl";
+
+ ///
+ /// 客服后台地址
+ ///
+ public const string CustomerServiceBackendUrl = "customerServiceBackendUrl";
+
//搜索发现关键字============================================================================
///
diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
index 6491dc2..9091e17 100644
--- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs
+++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
@@ -158,6 +158,11 @@ namespace CoreCms.Net.Configuration
di.Add(SystemSettingConstVars.Kuaidi100Customer, new DictionaryKeyValues() { sKey = "公司编号", sValue = "" });
di.Add(SystemSettingConstVars.Kuaidi100Key, new DictionaryKeyValues() { sKey = "授权key", sValue = "" });
+ // 客服配置
+ di.Add(SystemSettingConstVars.CustomerServiceH5Url, new DictionaryKeyValues() { sKey = "客服H5地址", sValue = "" });
+ di.Add(SystemSettingConstVars.CustomerServiceAdminUrl, new DictionaryKeyValues() { sKey = "客服后台管理地址", sValue = "" });
+ di.Add(SystemSettingConstVars.CustomerServiceBackendUrl, new DictionaryKeyValues() { sKey = "客服后台地址", sValue = "" });
+
//统计代码
di.Add(SystemSettingConstVars.StatisticsCode, new DictionaryKeyValues() { sKey = "百度统计代码", sValue = "" });
//发票开关
diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUser.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUser.cs
index 1189d99..c993663 100644
--- a/CoreCms.Net.Model/Entities/User/CoreCmsUser.cs
+++ b/CoreCms.Net.Model/Entities/User/CoreCmsUser.cs
@@ -142,5 +142,15 @@ namespace CoreCms.Net.Model.Entities
[SugarColumn(ColumnDescription = "删除标志 有数据就是删除")]
[Required(ErrorMessage = "请输入{0}")]
public System.Boolean isDelete { get; set; }
+
+ ///
+ /// 重置余额
+ ///
+ [Display(Name = "重置余额")]
+ [SugarColumn(ColumnDescription = "重置余额")]
+ [Required(ErrorMessage = "请输入{0}")]
+ public System.Decimal reBalance { get; set; }
+
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs
index 0fc8bb9..0769a1d 100644
--- a/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs
+++ b/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs
@@ -133,6 +133,7 @@ namespace CoreCms.Net.Repository
isDelete = p.isDelete,
type = (int)sWeChatInfo.type,
parentNickName = sParentUser.nickName,
+ reBalance= p.reBalance,
childNum = SqlFunc.Subqueryable().Where(o => o.parentId == p.id).Count()
})
.MergeTable().With(SqlWith.Null)
diff --git a/CoreCms.Net.Task/HangfireDispose.cs b/CoreCms.Net.Task/HangfireDispose.cs
index 042d6bb..a09a3b9 100644
--- a/CoreCms.Net.Task/HangfireDispose.cs
+++ b/CoreCms.Net.Task/HangfireDispose.cs
@@ -62,9 +62,12 @@ namespace CoreCms.Net.Task
//每天凌晨5点定期清理7天前操作日志
RecurringJob.AddOrUpdate(s => s.Execute(), "0 0 5 * * ? ", TimeZoneInfo.Local); // 每天5点固定时间清理一次
- //定时刷新获取微信AccessToken
+ //定时刷新获取微信AccessToken
RecurringJob.AddOrUpdate(s => s.Execute(), "0 0/4 * * * ? ", TimeZoneInfo.Local); // 每2分钟刷新获取微信AccessToken
+ //每天5点定时刷新用户余额
+ RecurringJob.AddOrUpdate(s => s.Execute(), "0 0 5 * * ?", TimeZoneInfo.Local);
+
}
#endregion
diff --git a/CoreCms.Net.Task/RefreshUserBalanceJob.cs b/CoreCms.Net.Task/RefreshUserBalanceJob.cs
new file mode 100644
index 0000000..4049c06
--- /dev/null
+++ b/CoreCms.Net.Task/RefreshUserBalanceJob.cs
@@ -0,0 +1,96 @@
+using CoreCms.Net.Caching.AutoMate.RedisCache;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.WeChat.Service.HttpClients;
+using CoreCms.Net.WeChat.Service.Options;
+using Microsoft.Extensions.Options;
+using Newtonsoft.Json;
+using SKIT.FlurlHttpClient.Wechat.Api.Models;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CoreCms.Net.Task
+{
+ ///
+ /// 定时重置用户余额,当用户刷新余额大于0的时候,每天会将用户余额数量设置为刷新余额数量。
+ ///
+ public class RefreshUserBalanceJob
+ {
+
+ private readonly ISysTaskLogServices _taskLogServices;
+ private readonly ICoreCmsUserServices _userServices;
+
+ public RefreshUserBalanceJob(IRedisOperationRepository redisOperationRepository, ISysTaskLogServices taskLogServices, IOptions weChatOptions, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IWeChatAccessTokenServices weChatAccessTokenServices, ICoreCmsUserServices userServices)
+ {
+ _taskLogServices = taskLogServices;
+ _userServices = userServices;
+ }
+
+ public async System.Threading.Tasks.Task Execute()
+ {
+ try
+ {
+ // 查询所有需要刷新余额的用户(reBalance > 0)
+ var users = await _userServices.QueryListByClauseAsync(p => p.reBalance > 0);
+ if (users == null || users.Count == 0)
+ {
+ var emptyLog = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = true,
+ name = "刷新用户余额",
+ parameters = JsonConvert.SerializeObject(new { total = 0, updated = 0, skipped = 0 })
+ };
+ await _taskLogServices.InsertAsync(emptyLog);
+ return;
+ }
+
+ int total = users.Count;
+ int updated = 0;
+ int skipped = 0;
+
+ foreach (var u in users)
+ {
+ var delta = u.reBalance - u.balance;
+ if (delta == 0)
+ {
+ skipped++;
+ continue;
+ }
+
+ var res = await _userServices.UpdateBalance(u.id, delta);
+ if (res != null && res.code == 0)
+ {
+ updated++;
+ }
+ }
+
+ var log = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = true,
+ name = "刷新用户余额",
+ parameters = JsonConvert.SerializeObject(new { total, updated, skipped })
+ };
+ await _taskLogServices.InsertAsync(log);
+ }
+ catch (Exception ex)
+ {
+ //插入日志
+ var model = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = false,
+ name = "刷新用户余额",
+ parameters = JsonConvert.SerializeObject(ex)
+ };
+ await _taskLogServices.InsertAsync(model);
+ }
+ }
+ }
+}
diff --git a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs
index 1d73393..aa733b9 100644
--- a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs
@@ -1583,5 +1583,34 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
+ #region 获取客服后台地址============================================================
+
+ ///
+ /// 获取客服后台管理与客服后台地址
+ ///
+ ///
+ [HttpPost]
+ [Description("获取客服后台地址")]
+ public async Task GetCustomerServiceUrls()
+ {
+ var jm = new AdminUiCallBack();
+
+ var allConfigs = await _settingServices.GetConfigDictionaries();
+ var adminUrl = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CustomerServiceAdminUrl);
+ var backendUrl = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CustomerServiceBackendUrl);
+
+ jm.code = 0;
+ jm.msg = "数据获取正常";
+ jm.data = new
+ {
+ adminUrl,
+ backendUrl
+ };
+
+ return jm;
+ }
+
+ #endregion
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs
index 1be7bb0..523928f 100644
--- a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs
@@ -422,6 +422,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.grade = entity.grade;
oldModel.updataTime = DateTime.Now;
oldModel.status = entity.status;
+ oldModel.reBalance = entity.reBalance;
//事物处理过程结束
var bl = await _coreCmsUserServices.UpdateAsync(oldModel);
jm.code = bl ? 0 : 1;
diff --git a/CoreCms.Net.Web.Admin/Doc.xml b/CoreCms.Net.Web.Admin/Doc.xml
index 7e2e042..82b1b16 100644
--- a/CoreCms.Net.Web.Admin/Doc.xml
+++ b/CoreCms.Net.Web.Admin/Doc.xml
@@ -759,6 +759,12 @@
+
+
+ 获取客服后台管理与客服后台地址
+
+
+
分销商表
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/index.html
index 3d2a4d6..ac45327 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/index.html
@@ -40,16 +40,16 @@
促销
-
-
+
+
- 配送
+ 客服后台管理
-
-
+
+
- 分销商
+ 客服后台
@@ -207,6 +207,37 @@
var util = layui.util;
var laytpl = layui.laytpl;
var carousel = layui.carousel;
+ var csAdminUrl = '';
+ var csBackendUrl = '';
+
+ // 获取客服后台地址并绑定点击事件(未配置则隐藏入口)
+ coreHelper.Post("Api/Tools/GetCustomerServiceUrls", {}, function (res) {
+ if (res && res.code === 0 && res.data) {
+ csAdminUrl = res.data.adminUrl || '';
+ csBackendUrl = res.data.backendUrl || '';
+ if (csAdminUrl) {
+ $('#customerServiceAdminItem').show();
+ }
+ if (csBackendUrl) {
+ $('#customerServiceBackendItem').show();
+ }
+ }
+ });
+
+ $('#customerServiceAdminLink').on('click', function () {
+ if (csAdminUrl) {
+ window.open(csAdminUrl, '_blank');
+ } else {
+ layui.layer.msg('未配置客服后台管理地址');
+ }
+ });
+ $('#customerServiceBackendLink').on('click', function () {
+ if (csBackendUrl) {
+ window.open(csBackendUrl, '_blank');
+ } else {
+ layui.layer.msg('未配置客服后台地址');
+ }
+ });
getBackLog();
ordersEcharts();
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html
index c217d19..78db621 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/setting/index.html
@@ -42,6 +42,7 @@
邀请好友设置
附件设置
其他设置
+ 客服配置
+
@@ -713,7 +742,7 @@
-
+
-
+
-
-
-
-
-
- 允许个人学习研究使用,支持二次开发。
- 允许商业用途,但仅限自运营,如果商用必须保留版权信息,望自觉遵守。
- 不允许对程序代码以任何形式、任何目的的再发行或出售,否则将追究侵权者法律责任。
- 软件受国家计算机软件著作权保护(登记号:2020SR1224749 )。
- 我们的团队水平有限,也是在探索中学习、改进。开源,是为了让认可我们的用户能自由的使用、学习软件的内部架构,让更多的人有机会阅读并发现Bug、对软件项目提出改进意见。
-
-
© 2021 coreshop.cn 版权所有
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/user/login.html b/CoreCms.Net.Web.Admin/wwwroot/views/user/login.html
index 92ebe6e..b9b4d25 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/user/login.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/user/login.html
@@ -7,19 +7,25 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
“是否有核心,由你来确定。”
+
“雨宝庄严”
@@ -28,36 +34,46 @@
-
+
+ 后台管理