mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:13:26 +08:00
【新增】增加易联云小票打印机后台配置表【CoreCmsPrinter】,取消使用配置文件配置,并且支持多台打印机绑定不同门店,实现不同门店不同打印机打单。
This commit is contained in:
@@ -132,40 +132,6 @@ namespace CoreCms.Net.Configuration
|
|||||||
public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl");
|
public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 易联云打印机================================================================================
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否开启
|
|
||||||
/// </summary>
|
|
||||||
public static readonly bool YiLianYunConfigEnabled = AppSettingsHelper.GetContent("YiLianYunConfig", "Enabled").ObjToBool();
|
|
||||||
/// <summary>
|
|
||||||
/// 应用ID
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigClientId = AppSettingsHelper.GetContent("YiLianYunConfig", "ClientId");
|
|
||||||
/// <summary>
|
|
||||||
/// 应用密钥
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigClientSecret = AppSettingsHelper.GetContent("YiLianYunConfig", "ClientSecret");
|
|
||||||
/// <summary>
|
|
||||||
/// 打印机设备号
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigMachineCode = AppSettingsHelper.GetContent("YiLianYunConfig", "MachineCode");
|
|
||||||
/// <summary>
|
|
||||||
/// 打印机终端密钥
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigMsign = AppSettingsHelper.GetContent("YiLianYunConfig", "Msign");
|
|
||||||
/// <summary>
|
|
||||||
/// 打印机名称
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigPrinterName = AppSettingsHelper.GetContent("YiLianYunConfig", "PrinterName");
|
|
||||||
/// <summary>
|
|
||||||
/// 打印机设置联系方式
|
|
||||||
/// </summary>
|
|
||||||
public static readonly string YiLianYunConfigPhone = AppSettingsHelper.GetContent("YiLianYunConfig", "Phone");
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region HangFire定时任务================================================================================
|
#region HangFire定时任务================================================================================
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 登录账号
|
/// 登录账号
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CoreCms.Net.Configuration;
|
using CoreCms.Net.Configuration;
|
||||||
using CoreCms.Net.RedisMQ.Subscribe;
|
using CoreCms.Net.RedisMQ;
|
||||||
using CoreCms.Net.Utility.Extensions;
|
|
||||||
using InitQ;
|
using InitQ;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CoreCms.Net.Configuration;
|
|
||||||
using CoreCms.Net.RedisMQ.Subscribe;
|
|
||||||
using CoreCms.Net.Utility.Extensions;
|
|
||||||
using InitQ;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Qc.YilianyunSdk;
|
|
||||||
|
|
||||||
namespace CoreCms.Net.Core.Config
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 易联云打印机 启动服务
|
|
||||||
/// </summary>
|
|
||||||
public static class YiLianYunSetup
|
|
||||||
{
|
|
||||||
public static void AddYiLianYunSetup(this IServiceCollection services)
|
|
||||||
{
|
|
||||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
|
||||||
|
|
||||||
if (AppSettingsConstVars.YiLianYunConfigEnabled)
|
|
||||||
{
|
|
||||||
services.AddYilianyunSdk<DefaultYilianyunSdkHook>(opt =>
|
|
||||||
{
|
|
||||||
// 应用ID请自行前往 dev.10ss.net 获取
|
|
||||||
opt.ClientId = AppSettingsConstVars.YiLianYunConfigClientId;
|
|
||||||
opt.ClientSecret = AppSettingsConstVars.YiLianYunConfigClientSecret;
|
|
||||||
opt.YilianyunClientType = YilianyunClientType.自有应用;
|
|
||||||
opt.SaveTokenDirPath = "./App_Data/YiLianYunLogs";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.OpenApi" Version="1.3.2" />
|
<PackageReference Include="Microsoft.OpenApi" Version="1.3.2" />
|
||||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
|
||||||
<PackageReference Include="SqlSugar.IOC" Version="1.8.0" />
|
<PackageReference Include="SqlSugar.IOC" Version="1.8.0" />
|
||||||
<PackageReference Include="sqlSugarCore" Version="5.0.9.1" />
|
<PackageReference Include="sqlSugarCore" Version="5.0.9.1" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.3" />
|
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.3" />
|
||||||
|
|||||||
82
CoreCms.Net.IRepository/Api/ICoreCmsPrinterRepository.cs
Normal file
82
CoreCms.Net.IRepository/Api/ICoreCmsPrinterRepository.cs
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
|
||||||
|
namespace CoreCms.Net.IRepository
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表 工厂接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICoreCmsPrinterRepository : IBaseRepository<CoreCmsPrinter>
|
||||||
|
{
|
||||||
|
#region 重写增删改查操作===========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步插入方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> InsertAsync(CoreCmsPrinter entity);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步更新方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> UpdateAsync(CoreCmsPrinter entity);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写删除指定ID的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取缓存的所有数据==========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缓存的所有数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<List<CoreCmsPrinter>> GetCaChe();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IPageList<CoreCmsPrinter>> QueryPageAsync(
|
||||||
|
Expression<Func<CoreCmsPrinter, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsPrinter, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
69
CoreCms.Net.IServices/Api/ICoreCmsPrinterServices.cs
Normal file
69
CoreCms.Net.IServices/Api/ICoreCmsPrinterServices.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.IServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表 服务工厂接口
|
||||||
|
/// </summary>
|
||||||
|
public interface ICoreCmsPrinterServices : IBaseServices<CoreCmsPrinter>
|
||||||
|
{
|
||||||
|
#region 重写增删改查操作===========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步插入方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> InsertAsync(CoreCmsPrinter entity);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步更新方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> UpdateAsync(CoreCmsPrinter entity);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写删除指定ID的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IPageList<CoreCmsPrinter>> QueryPageAsync(
|
||||||
|
Expression<Func<CoreCmsPrinter, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsPrinter, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
210
CoreCms.Net.Model/Entities/Api/CoreCmsPrinter.cs
Normal file
210
CoreCms.Net.Model/Entities/Api/CoreCmsPrinter.cs
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
using SqlSugar;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表
|
||||||
|
/// </summary>
|
||||||
|
public partial class CoreCmsPrinter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
/// </summary>
|
||||||
|
public CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序列
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "序列")]
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.Int32 id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用名称
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "应用名称")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 应用编码
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "应用编码")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String code { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云应用id
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "易联云应用id")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String clientId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云应用密钥
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "易联云应用密钥")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String clientSecret { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云终端号
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "易联云终端号")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String machineCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云终端密钥
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "易联云终端密钥")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String msign { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机名称
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "打印机名称")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String printerName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 联系电话
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "联系电话")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String phone { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String accessToken { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新access_token所需,有效时间35天
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "更新access_token所需,有效时间35天")]
|
||||||
|
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.String refreshToken { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 令牌的有效时间,单位秒 (30天),注:该模式下可忽略此参数
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "令牌的有效时间,单位秒 (30天),注:该模式下可忽略此参数")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.Int32? expiresIn { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 有效期截止时间
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "有效期截止时间")]
|
||||||
|
public System.DateTime? expiressEndTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 其他参数
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "其他参数")]
|
||||||
|
public System.String parameters { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "创建时间")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.DateTime createTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否默认
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "是否默认")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.Boolean isDefault { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否开启
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "是否开启")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.Boolean isOpen { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 绑定门店
|
||||||
|
/// </summary>
|
||||||
|
[Display(Name = "绑定门店")]
|
||||||
|
[Required(ErrorMessage = "请输入{0}")]
|
||||||
|
|
||||||
|
|
||||||
|
public System.Int32 storeId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
67
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunConfig.cs
Normal file
67
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunConfig.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.ViewModels.YiLianYun
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云全局配置
|
||||||
|
/// </summary>
|
||||||
|
public static class YiLianYunConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 授权相关地址
|
||||||
|
/// </summary>
|
||||||
|
public const string AuthUrl = "https://open-api.10ss.net/oauth/oauth";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取终端状态地址
|
||||||
|
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public const string GetPrintStatusUrl = "https://open-api.10ss.net/printer/getprintstatus";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文本打印地址
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public const string PrintTextUrl = "https://open-api.10ss.net/print/index";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 小票打印模板
|
||||||
|
/// </summary>
|
||||||
|
public static StringBuilder PrintTmpModel(CoreCmsOrder listResult)
|
||||||
|
{
|
||||||
|
var printStr = new StringBuilder();
|
||||||
|
printStr.Append("<center>--" + "支付" + "订单--</center>\r");
|
||||||
|
printStr.Append("................................\r");
|
||||||
|
printStr.Append("<center>-- -</center>\r");
|
||||||
|
printStr.Append("下单时间:" + listResult.createTime + "\r");
|
||||||
|
printStr.Append("订单编号:" + listResult.orderId + "\r");
|
||||||
|
printStr.Append("**************商品**************\r");
|
||||||
|
printStr.Append("<center>--购买明细--</center>\r");
|
||||||
|
|
||||||
|
//printStr.Append("<center>--其他消费--</center>\r");
|
||||||
|
//printStr.Append("餐盒 1 2\r");
|
||||||
|
printStr.Append("................................\r");
|
||||||
|
printStr.Append("积分抵扣:¥" + listResult.pointMoney + "\r");
|
||||||
|
printStr.Append("订单优惠:¥" + listResult.orderDiscountAmount + "\r");
|
||||||
|
printStr.Append("商品优惠:¥" + listResult.goodsDiscountAmount + "\r");
|
||||||
|
printStr.Append("优惠券:¥" + listResult.couponDiscountAmount + "\r");
|
||||||
|
printStr.Append("总价:¥" + listResult.orderAmount + "\r");
|
||||||
|
printStr.Append("*******************************\r");
|
||||||
|
printStr.Append("区域:" + listResult.shipAreaName + "\r");
|
||||||
|
printStr.Append("地址:" + listResult.shipAddress + "\r");
|
||||||
|
printStr.Append("联系:" + listResult.shipName + " " + listResult.shipMobile + "\r");
|
||||||
|
printStr.Append("***************完结*************\r");
|
||||||
|
return printStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
184
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunParam.cs
Normal file
184
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunParam.cs
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.ViewModels.YiLianYun
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云获取accessToken请求实体
|
||||||
|
/// </summary>
|
||||||
|
public class YiLianYunParam
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云颁发给开发者的应用ID 非空值
|
||||||
|
/// </summary>
|
||||||
|
public string client_id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授与方式(固定为'client_credentials')
|
||||||
|
/// </summary>
|
||||||
|
public string grant_type { get; set; } = "client_credentials";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签名 详见API文档列表-接口签名
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string sign { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权权限,传all
|
||||||
|
/// </summary>
|
||||||
|
public string scope { get; set; } = "all";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前服务器时间戳(10位)
|
||||||
|
/// </summary>
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 36位随机用来唯一标记此次调用,响应对象中会包含相同的id。UUID以36字节的字符串表示,
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用Refresh token更新Access Token请求实体
|
||||||
|
/// </summary>
|
||||||
|
public class RefreshYiLianYunToken
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云颁发给开发者的应用ID 非空值
|
||||||
|
/// </summary>
|
||||||
|
public string client_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新access_token所需
|
||||||
|
/// </summary>
|
||||||
|
public string refresh_token { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授与方式(固定为'client_credentials')
|
||||||
|
/// </summary>
|
||||||
|
public string grant_type { get; set; } = "client_credentials";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签名 详见API文档列表-接口签名
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string sign { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权权限,传all
|
||||||
|
/// </summary>
|
||||||
|
public string scope { get; set; } = "all";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前服务器时间戳(10位)
|
||||||
|
/// </summary>
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 36位随机用来唯一标记此次调用,响应对象中会包含相同的id。UUID以36字节的字符串表示,
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用Refresh token更新Access Token请求实体
|
||||||
|
/// </summary>
|
||||||
|
public class GetPrintStatusParam
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云颁发给开发者的应用ID 非空值
|
||||||
|
/// </summary>
|
||||||
|
public string client_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权的token 必要参数
|
||||||
|
/// </summary>
|
||||||
|
public string access_token { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云打印机终端号
|
||||||
|
/// </summary>
|
||||||
|
public string machine_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签名 详见API文档列表-接口签名
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public string sign { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 当前服务器时间戳(10位)
|
||||||
|
/// </summary>
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 36位随机用来唯一标记此次调用,响应对象中会包含相同的id。UUID以36字节的字符串表示,
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打印提交数据
|
||||||
|
/// </summary>
|
||||||
|
public class WordPrintRespone
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 开发者的应用ID,在开放平台创建应用时获得
|
||||||
|
/// </summary>
|
||||||
|
public string client_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 授权的token 必要参数
|
||||||
|
/// </summary>
|
||||||
|
public string access_token { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云打印机终端号
|
||||||
|
/// </summary>
|
||||||
|
public string machine_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 打印内容(需要urlencode),排版指令详见打印机指令
|
||||||
|
/// </summary>
|
||||||
|
public string content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 为 1 时,origin_id 进行幂等处理,请确定 origin_id 的唯一性
|
||||||
|
/// </summary>
|
||||||
|
public int idempotence { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母 ,且在同一个client_id下唯一。详见商户订单号
|
||||||
|
/// </summary>
|
||||||
|
public string origin_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// int
|
||||||
|
/// </summary>
|
||||||
|
public int timestamp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签名 详见API文档列表-接口签名
|
||||||
|
/// </summary>
|
||||||
|
public string sign { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// idUUID4 详见API文档列表-uuid4
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
101
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunResult.cs
Normal file
101
CoreCms.Net.Model/ViewModels/YiLianYun/YiLianYunResult.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.ViewModels.YiLianYun
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 易联云授权返回数据
|
||||||
|
/// </summary>
|
||||||
|
public class YiLianYunAuthResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回状态码
|
||||||
|
/// </summary>
|
||||||
|
public string error { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态码说明
|
||||||
|
/// </summary>
|
||||||
|
public string error_description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集
|
||||||
|
/// </summary>
|
||||||
|
public Body body { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集详情
|
||||||
|
/// </summary>
|
||||||
|
public class Body
|
||||||
|
{
|
||||||
|
public string access_token { get; set; }
|
||||||
|
public string refresh_token { get; set; }
|
||||||
|
public object machine_code { get; set; }
|
||||||
|
public int expires_in { get; set; }
|
||||||
|
public string scope { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取机器在线状态
|
||||||
|
/// </summary>
|
||||||
|
public class YiLianYunGetPrintStatusResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回状态码
|
||||||
|
/// </summary>
|
||||||
|
public string error { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态码说明
|
||||||
|
/// </summary>
|
||||||
|
public string error_description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集
|
||||||
|
/// </summary>
|
||||||
|
public Body body { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集详情
|
||||||
|
/// </summary>
|
||||||
|
public class Body
|
||||||
|
{
|
||||||
|
public string state { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文本打印返回结果集
|
||||||
|
/// </summary>
|
||||||
|
public class YiLianYunGetPrintTextResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 返回状态码
|
||||||
|
/// </summary>
|
||||||
|
public string error { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态码说明
|
||||||
|
/// </summary>
|
||||||
|
public string error_description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集
|
||||||
|
/// </summary>
|
||||||
|
public Body body { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 结果集详情
|
||||||
|
/// </summary>
|
||||||
|
public class Body
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 订单号
|
||||||
|
/// </summary>
|
||||||
|
public string id { get; set; }
|
||||||
|
public string origin_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 售后审核通过后对积分的返还处理
|
/// 售后审核通过后对积分的返还处理
|
||||||
@@ -13,7 +13,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 售后审核通过后处理
|
/// 售后审核通过后处理
|
||||||
@@ -19,7 +19,7 @@ using InitQ.Abstractions;
|
|||||||
using InitQ.Attributes;
|
using InitQ.Attributes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 支付宝支付成功后推送到接口进行数据处理
|
/// 支付宝支付成功后推送到接口进行数据处理
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.12" />
|
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.12" />
|
||||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.12" />
|
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.12" />
|
||||||
<PackageReference Include="InitQ" Version="1.0.0.12" />
|
<PackageReference Include="InitQ" Version="1.0.0.12" />
|
||||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
|
||||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.15.0" />
|
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.15.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using InitQ.Abstractions;
|
|||||||
using InitQ.Attributes;
|
using InitQ.Attributes;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
public class DemoSubscribe : IRedisSubscribe
|
public class DemoSubscribe : IRedisSubscribe
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ using InitQ.Abstractions;
|
|||||||
using InitQ.Attributes;
|
using InitQ.Attributes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 消息推送
|
/// 消息推送
|
||||||
@@ -14,7 +14,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单完结后走代理或分销商提成处理
|
/// 订单完结后走代理或分销商提成处理
|
||||||
@@ -16,7 +16,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 门店订单自动发货
|
/// 门店订单自动发货
|
||||||
@@ -13,7 +13,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 订单完成时,结算该订单
|
/// 订单完成时,结算该订单
|
||||||
266
CoreCms.Net.RedisMQ/OrderPrintSubscribe.cs
Normal file
266
CoreCms.Net.RedisMQ/OrderPrintSubscribe.cs
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Configuration;
|
||||||
|
using CoreCms.Net.IServices;
|
||||||
|
using CoreCms.Net.Loging;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.YiLianYun;
|
||||||
|
using CoreCms.Net.Utility.Helper;
|
||||||
|
using Flurl.Http;
|
||||||
|
using InitQ.Abstractions;
|
||||||
|
using InitQ.Attributes;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.RedisMQ
|
||||||
|
{
|
||||||
|
public class OrderPrintSubscribe : IRedisSubscribe
|
||||||
|
{
|
||||||
|
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||||
|
private readonly ICoreCmsAreaServices _areaServices;
|
||||||
|
private readonly ICoreCmsPrinterServices _coreCmsPrinterServices;
|
||||||
|
|
||||||
|
|
||||||
|
public OrderPrintSubscribe(ICoreCmsOrderItemServices orderItemServices, ICoreCmsAreaServices areaServices, ICoreCmsPrinterServices coreCmsPrinterServices)
|
||||||
|
{
|
||||||
|
_orderItemServices = orderItemServices;
|
||||||
|
_areaServices = areaServices;
|
||||||
|
_coreCmsPrinterServices = coreCmsPrinterServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 订单打印队列
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="msg"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Subscribe(RedisMessageQueueKey.OrderPrint)]
|
||||||
|
private async Task OrderPrint(string msg)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var order = JsonConvert.DeserializeObject<CoreCmsOrder>(msg);
|
||||||
|
if (order == null)
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "订单获取失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CoreCmsPrinter model = null;
|
||||||
|
if (order.storeId > 0)
|
||||||
|
{
|
||||||
|
model = await _coreCmsPrinterServices.QueryByClauseAsync(p => p.storeId == order.storeId && p.isOpen == true, true, true);
|
||||||
|
}
|
||||||
|
model ??= await _coreCmsPrinterServices.QueryByClauseAsync(p => p.isDefault == true && p.isOpen == true, true, true);
|
||||||
|
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "打印机获取失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isNeedToken = false;
|
||||||
|
if (string.IsNullOrEmpty(model.accessToken) || model.expiressEndTime == null)
|
||||||
|
{
|
||||||
|
isNeedToken = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//判断是否过期
|
||||||
|
var dt = DateTime.Now;
|
||||||
|
if (dt >= model.expiressEndTime)
|
||||||
|
{
|
||||||
|
var ts = dt - Convert.ToDateTime(model.expiressEndTime);
|
||||||
|
if (ts.Days > 35)
|
||||||
|
{
|
||||||
|
isNeedToken = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RefreshYiLianYunToken refreshToken = new RefreshYiLianYunToken
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
grant_type = "client_credentials",
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
scope = "all",
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
refreshToken.sign = CommonHelper.Md5For32((refreshToken.client_id + refreshToken.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
var resultData = await YiLianYunConfig.AuthUrl.PostJsonAsync(refreshToken).ReceiveJson<YiLianYunAuthResult>();
|
||||||
|
//将获取到的数据存入数据库
|
||||||
|
if (resultData.error == "0")
|
||||||
|
{
|
||||||
|
model.accessToken = resultData.body.access_token;
|
||||||
|
model.refreshToken = resultData.body.refresh_token;
|
||||||
|
model.expiresIn = resultData.body.expires_in;
|
||||||
|
model.expiressEndTime = DateTime.Now.AddSeconds(resultData.body.expires_in);
|
||||||
|
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
p => new CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
accessToken = resultData.body.access_token,
|
||||||
|
refreshToken = resultData.body.refresh_token,
|
||||||
|
expiresIn = resultData.body.expires_in,
|
||||||
|
expiressEndTime = model.expiressEndTime,
|
||||||
|
parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
}, p => p.clientId == model.clientId && p.clientSecret == model.clientSecret, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "刷新AccessToken:" + resultData.error_description);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNeedToken)
|
||||||
|
{
|
||||||
|
var getToken = new YiLianYunParam
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
grant_type = "client_credentials",
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
scope = "all",
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
getToken.sign = CommonHelper.Md5For32((getToken.client_id + getToken.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
|
||||||
|
var resultData = await YiLianYunConfig.AuthUrl.PostJsonAsync(getToken).ReceiveJson<YiLianYunAuthResult>();
|
||||||
|
//将获取到的数据存入数据库
|
||||||
|
if (resultData.error == "0")
|
||||||
|
{
|
||||||
|
model.accessToken = resultData.body.access_token;
|
||||||
|
model.refreshToken = resultData.body.refresh_token;
|
||||||
|
model.expiresIn = resultData.body.expires_in;
|
||||||
|
model.expiressEndTime = DateTime.Now.AddSeconds(resultData.body.expires_in);
|
||||||
|
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
p => new CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
accessToken = resultData.body.access_token,
|
||||||
|
refreshToken = resultData.body.refresh_token,
|
||||||
|
expiresIn = resultData.body.expires_in,
|
||||||
|
expiressEndTime = model.expiressEndTime,
|
||||||
|
parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
}, p => p.clientId == model.clientId && p.clientSecret == model.clientSecret, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "获取AccessToken:" + resultData.error_description);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取打印机是否在线
|
||||||
|
var statusParam = new GetPrintStatusParam
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
access_token = model.accessToken,
|
||||||
|
machine_code = model.machineCode,
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
statusParam.sign = CommonHelper.Md5For32((statusParam.client_id + statusParam.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
|
||||||
|
var getPrintStatusResult = await YiLianYunConfig.GetPrintStatusUrl.PostJsonAsync(statusParam).ReceiveJson<YiLianYunGetPrintStatusResult>();
|
||||||
|
if (getPrintStatusResult.error != "0")
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "获取打印机在线状态:" + getPrintStatusResult.error_description);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (getPrintStatusResult.body.state)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "获取打印机在线状态:机器未在线");
|
||||||
|
return;
|
||||||
|
case "2":
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "机器缺纸");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var payStr = EnumHelper.GetEnumDescriptionByKey<GlobalEnumVars.PaymentsTypes>(order.paymentCode);
|
||||||
|
var items = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
|
||||||
|
var areas = await _areaServices.GetAreaFullName(order.shipAreaId);
|
||||||
|
order.shipAreaName = areas.status ? areas.data + "" : "";
|
||||||
|
|
||||||
|
var receiptType = order.receiptType switch
|
||||||
|
{
|
||||||
|
(int)GlobalEnumVars.OrderReceiptType.IntraCityService => "同城配送",
|
||||||
|
(int)GlobalEnumVars.OrderReceiptType.Logistics => "物流快递",
|
||||||
|
(int)GlobalEnumVars.OrderReceiptType.SelfDelivery => "门店自提",
|
||||||
|
_ => string.Empty
|
||||||
|
};
|
||||||
|
|
||||||
|
var printStr = new StringBuilder();
|
||||||
|
printStr.Append("<center>--" + receiptType + "订单--</center>\r");
|
||||||
|
printStr.Append("................................\r");
|
||||||
|
printStr.Append("<center>--" + payStr + "--</center>\r");
|
||||||
|
printStr.Append("下单时间:" + order.createTime.ToString("yyyy-MM-dd HH:mm:ss") + "\r");
|
||||||
|
printStr.Append("订单编号:" + order.orderId + "\r");
|
||||||
|
printStr.Append("**************商品**************\r");
|
||||||
|
printStr.Append("<center>--购买明细--</center>\r");
|
||||||
|
|
||||||
|
if (items != null && items.Any())
|
||||||
|
{
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
printStr.Append(item.name + "*" + item.nums + "\r");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//printStr.Append("<center>--其他消费--</center>\r");
|
||||||
|
//printStr.Append("餐盒 1 2\r");
|
||||||
|
printStr.Append("................................\r");
|
||||||
|
printStr.Append("积分抵扣:¥" + order.pointMoney + "\r");
|
||||||
|
printStr.Append("订单优惠:¥" + order.orderDiscountAmount + "\r");
|
||||||
|
printStr.Append("商品优惠:¥" + order.goodsDiscountAmount + "\r");
|
||||||
|
printStr.Append("优惠券:¥" + order.couponDiscountAmount + "\r");
|
||||||
|
printStr.Append("总价:¥" + order.orderAmount + "\r");
|
||||||
|
printStr.Append("*******************************\r");
|
||||||
|
printStr.Append("区域:" + order.shipAreaName + "\r");
|
||||||
|
printStr.Append("地址:" + order.shipAddress + "\r");
|
||||||
|
printStr.Append("联系:" + order.shipName + " " + order.shipMobile + "\r");
|
||||||
|
printStr.Append("***************完结*************\r");
|
||||||
|
|
||||||
|
//小票打印
|
||||||
|
WordPrintRespone wordPrintRespone = new WordPrintRespone
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
access_token = model.accessToken,
|
||||||
|
machine_code = model.machineCode,
|
||||||
|
content = printStr.ToString(),
|
||||||
|
origin_id = order.orderId,
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now)
|
||||||
|
};
|
||||||
|
wordPrintRespone.sign = CommonHelper
|
||||||
|
.Md5For32((wordPrintRespone.client_id + wordPrintRespone.timestamp + model.clientSecret)
|
||||||
|
.ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
wordPrintRespone.id = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
//打印文本:缺少参数!请检查参数信息!!或更改下请求头:Content-Type:application/x-www-form-urlencoded
|
||||||
|
var resultData = await YiLianYunConfig.PrintTextUrl
|
||||||
|
.WithHeader("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.PostUrlEncodedAsync(wordPrintRespone).ReceiveJson<YiLianYunGetPrintTextResult>();
|
||||||
|
//当token返回失败时
|
||||||
|
if (resultData.error != "0")
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "打印文本:" + resultData.error_description);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "打印文本:打印成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "订单打印队列", msg, ex);
|
||||||
|
}
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ using Newtonsoft.Json.Linq;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 微信模板消息【小程序,公众号都走这里】
|
/// 微信模板消息【小程序,公众号都走这里】
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using CoreCms.Net.Configuration;
|
|
||||||
using CoreCms.Net.IServices;
|
|
||||||
using CoreCms.Net.Loging;
|
|
||||||
using CoreCms.Net.Model.Entities;
|
|
||||||
using CoreCms.Net.Utility.Helper;
|
|
||||||
using InitQ.Abstractions;
|
|
||||||
using InitQ.Attributes;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Qc.YilianyunSdk;
|
|
||||||
using LogLevel = NLog.LogLevel;
|
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
|
||||||
{
|
|
||||||
public class OrderPrintSubscribe : IRedisSubscribe
|
|
||||||
{
|
|
||||||
private readonly YilianyunService _yilianyunService;
|
|
||||||
private readonly ICoreCmsApiAccessTokenServices _accessTokenServices;
|
|
||||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
|
||||||
private readonly ICoreCmsAreaServices _areaServices;
|
|
||||||
|
|
||||||
private readonly string _machineCode = AppSettingsConstVars.YiLianYunConfigMachineCode; //设备号
|
|
||||||
private readonly string _msign = AppSettingsConstVars.YiLianYunConfigMsign;// 终端密钥
|
|
||||||
private readonly string _printerName = AppSettingsConstVars.YiLianYunConfigPrinterName; // 打印机名称
|
|
||||||
private readonly string _phone = AppSettingsConstVars.YiLianYunConfigPhone; //手机卡号
|
|
||||||
private readonly bool _enabled = AppSettingsConstVars.YiLianYunConfigEnabled; //是否开启
|
|
||||||
|
|
||||||
|
|
||||||
public OrderPrintSubscribe(YilianyunService yilianyunService, ICoreCmsApiAccessTokenServices accessTokenServices, ICoreCmsOrderItemServices orderItemServices, ICoreCmsAreaServices areaServices)
|
|
||||||
{
|
|
||||||
_yilianyunService = yilianyunService;
|
|
||||||
_accessTokenServices = accessTokenServices;
|
|
||||||
_orderItemServices = orderItemServices;
|
|
||||||
_areaServices = areaServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 订单打印队列
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="msg"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Subscribe(RedisMessageQueueKey.OrderPrint)]
|
|
||||||
private async Task OrderPrint(string msg)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_enabled == false)
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "打印机未开启");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var order = JsonConvert.DeserializeObject<CoreCmsOrder>(msg);
|
|
||||||
if (order == null)
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "订单打印队列", "订单获取失败");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var accessModel = await _accessTokenServices.QueryByClauseAsync(p =>
|
|
||||||
p.code == GlobalEnumVars.ThirdPartyEquipment.YiLianYun.ToString() && p.machineCode == _machineCode);
|
|
||||||
string accessToken;
|
|
||||||
if (accessModel == null)
|
|
||||||
{
|
|
||||||
var onPostAuthTerminal = _yilianyunService.AuthTerminal(_machineCode, _msign, _phone, _printerName);
|
|
||||||
if (onPostAuthTerminal.IsSuccess())
|
|
||||||
{
|
|
||||||
accessToken = onPostAuthTerminal.Body.Access_Token;
|
|
||||||
|
|
||||||
accessModel = new CoreCmsApiAccessToken();
|
|
||||||
accessModel.code = GlobalEnumVars.ThirdPartyEquipment.YiLianYun.ToString();
|
|
||||||
accessModel.name = EnumHelper.GetEnumDescriptionByKey<GlobalEnumVars.ThirdPartyEquipment>(GlobalEnumVars.ThirdPartyEquipment.YiLianYun.ToString());
|
|
||||||
accessModel.machineCode = _machineCode;
|
|
||||||
accessModel.accessToken = onPostAuthTerminal.Body.Access_Token;
|
|
||||||
accessModel.refreshToken = onPostAuthTerminal.Body.Refresh_Token;
|
|
||||||
accessModel.expiresIn = onPostAuthTerminal.Body.Expires_In != null ? Convert.ToInt32(onPostAuthTerminal.Body.Expires_In) : 0;
|
|
||||||
accessModel.expiressEndTime = onPostAuthTerminal.Body.ExpiressEndTime;
|
|
||||||
accessModel.parameters = JsonConvert.SerializeObject(onPostAuthTerminal.Body);
|
|
||||||
accessModel.createTime = DateTime.Now;
|
|
||||||
|
|
||||||
await _accessTokenServices.InsertAsync(accessModel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "易联云重新获取Token失败", JsonConvert.SerializeObject(onPostAuthTerminal));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//判断是否过期
|
|
||||||
var dt = DateTime.Now;
|
|
||||||
if (dt >= accessModel.expiressEndTime)
|
|
||||||
{
|
|
||||||
var ts = dt - Convert.ToDateTime(accessModel.expiressEndTime);
|
|
||||||
|
|
||||||
if (ts.Days > 35)
|
|
||||||
{
|
|
||||||
|
|
||||||
var onPostAuthTerminal = _yilianyunService.AuthTerminal(_machineCode, _msign, _phone, _printerName);
|
|
||||||
if (onPostAuthTerminal.IsSuccess())
|
|
||||||
{
|
|
||||||
accessToken = onPostAuthTerminal.Body.Access_Token;
|
|
||||||
|
|
||||||
accessModel.code = GlobalEnumVars.ThirdPartyEquipment.YiLianYun.ToString();
|
|
||||||
accessModel.name = EnumHelper.GetEnumDescriptionByKey<GlobalEnumVars.ThirdPartyEquipment>(GlobalEnumVars.ThirdPartyEquipment.YiLianYun.ToString());
|
|
||||||
accessModel.machineCode = _machineCode;
|
|
||||||
accessModel.accessToken = onPostAuthTerminal.Body.Access_Token;
|
|
||||||
accessModel.refreshToken = onPostAuthTerminal.Body.Refresh_Token;
|
|
||||||
accessModel.expiresIn = onPostAuthTerminal.Body.Expires_In != null ? Convert.ToInt32(onPostAuthTerminal.Body.Expires_In) : 0;
|
|
||||||
accessModel.expiressEndTime = onPostAuthTerminal.Body.ExpiressEndTime;
|
|
||||||
accessModel.parameters = JsonConvert.SerializeObject(onPostAuthTerminal.Body);
|
|
||||||
accessModel.createTime = DateTime.Now;
|
|
||||||
|
|
||||||
await _accessTokenServices.UpdateAsync(accessModel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "易联云重新获取Token失败", JsonConvert.SerializeObject(onPostAuthTerminal));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = _yilianyunService.RefreshToken(accessModel.machineCode, accessModel.refreshToken);
|
|
||||||
if (result.IsSuccess())
|
|
||||||
{
|
|
||||||
accessToken = result.Body.Access_Token;
|
|
||||||
|
|
||||||
accessModel.accessToken = result.Body.Access_Token;
|
|
||||||
accessModel.refreshToken = result.Body.Refresh_Token;
|
|
||||||
accessModel.expiresIn = result.Body.Expires_In != null ? Convert.ToInt32(result.Body.Expires_In) : 0;
|
|
||||||
accessModel.expiressEndTime = result.Body.ExpiressEndTime;
|
|
||||||
await _accessTokenServices.UpdateAsync(accessModel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "易联云更新Token失败", JsonConvert.SerializeObject(result));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
accessToken = accessModel.accessToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//获取打印机是否在线
|
|
||||||
var printerStatus = string.Empty;
|
|
||||||
var resultOnline = _yilianyunService.PrinterGetStatus(accessModel.accessToken, accessModel.machineCode);
|
|
||||||
if (resultOnline.IsSuccess())
|
|
||||||
{
|
|
||||||
printerStatus = resultOnline.Body.State.ToString();
|
|
||||||
}
|
|
||||||
if (printerStatus == "在线")
|
|
||||||
{
|
|
||||||
var payStr = EnumHelper.GetEnumDescriptionByKey<GlobalEnumVars.PaymentsTypes>(order.paymentCode);
|
|
||||||
var items = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == order.orderId);
|
|
||||||
var areas = await _areaServices.GetAreaFullName(order.shipAreaId);
|
|
||||||
order.shipAreaName = areas.status ? areas.data + "" : "";
|
|
||||||
|
|
||||||
var receiptType = string.Empty;
|
|
||||||
if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService)
|
|
||||||
{
|
|
||||||
receiptType = "同城配送";
|
|
||||||
}
|
|
||||||
else if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.Logistics)
|
|
||||||
{
|
|
||||||
receiptType = "物流快递";
|
|
||||||
}
|
|
||||||
else if (order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
|
|
||||||
{
|
|
||||||
receiptType = "门店自提";
|
|
||||||
}
|
|
||||||
|
|
||||||
var printStr = new StringBuilder();
|
|
||||||
printStr.Append("<center>--" + receiptType + "订单--</center>\r");
|
|
||||||
printStr.Append("................................\r");
|
|
||||||
printStr.Append("<center>--" + payStr + "--</center>\r");
|
|
||||||
printStr.Append("下单时间:" + order.createTime.ToString("yyyy-MM-dd HH:mm:ss") + "\r");
|
|
||||||
printStr.Append("订单编号:" + order.orderId + "\r");
|
|
||||||
printStr.Append("**************商品**************\r");
|
|
||||||
printStr.Append("<center>--购买明细--</center>\r");
|
|
||||||
|
|
||||||
if (items != null && items.Any())
|
|
||||||
{
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
|
||||||
printStr.Append(item.name + "*" + item.nums + "\r");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//printStr.Append("<center>--其他消费--</center>\r");
|
|
||||||
//printStr.Append("餐盒 1 2\r");
|
|
||||||
printStr.Append("................................\r");
|
|
||||||
printStr.Append("积分抵扣:¥" + order.pointMoney + "\r");
|
|
||||||
printStr.Append("订单优惠:¥" + order.orderDiscountAmount + "\r");
|
|
||||||
printStr.Append("商品优惠:¥" + order.goodsDiscountAmount + "\r");
|
|
||||||
printStr.Append("优惠券:¥" + order.couponDiscountAmount + "\r");
|
|
||||||
printStr.Append("总价:¥" + order.orderAmount + "\r");
|
|
||||||
printStr.Append("*******************************\r");
|
|
||||||
printStr.Append("区域:" + order.shipAreaName + "\r");
|
|
||||||
printStr.Append("地址:" + order.shipAddress + "\r");
|
|
||||||
printStr.Append("联系:" + order.shipName + " " + order.shipMobile + "\r");
|
|
||||||
printStr.Append("***************完结*************\r");
|
|
||||||
var onPostPrintText = _yilianyunService.PrintText(accessToken, _machineCode, printStr.ToString());
|
|
||||||
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Trace, LogType.RedisMessageQueue, "易联云打印结果", JsonConvert.SerializeObject(onPostPrintText));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(LogLevel.Trace, LogType.RedisMessageQueue, "易联云机器离线", JsonConvert.SerializeObject(resultOnline));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "订单打印队列", msg, ex);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
await Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -25,7 +25,7 @@ using Newtonsoft.Json;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义交易组件-同步创建售后单
|
/// 自定义交易组件-同步创建售后单
|
||||||
@@ -24,7 +24,7 @@ using NLog;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义交易组件-同步订单确认收货
|
/// 自定义交易组件-同步订单确认收货
|
||||||
@@ -23,7 +23,7 @@ using Newtonsoft.Json;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义交易组件-同步发货信息
|
/// 自定义交易组件-同步发货信息
|
||||||
@@ -23,7 +23,7 @@ using Newtonsoft.Json;
|
|||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义交易组件-同步订单状态(弃用,新版已经取消了同步)
|
/// 自定义交易组件-同步订单状态(弃用,新版已经取消了同步)
|
||||||
@@ -21,7 +21,7 @@ using InitQ.Attributes;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户相关队列操作
|
/// 用户相关队列操作
|
||||||
@@ -13,7 +13,7 @@ using InitQ.Attributes;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
namespace CoreCms.Net.RedisMQ
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 微信支付成功后推送到接口进行数据处理
|
/// 微信支付成功后推送到接口进行数据处理
|
||||||
209
CoreCms.Net.Repository/Api/CoreCmsPrinterRepository.cs
Normal file
209
CoreCms.Net.Repository/Api/CoreCmsPrinterRepository.cs
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Caching.Manual;
|
||||||
|
using CoreCms.Net.Configuration;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
|
using CoreCms.Net.IRepository;
|
||||||
|
using CoreCms.Net.IRepository.UnitOfWork;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Repository
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表 接口实现
|
||||||
|
/// </summary>
|
||||||
|
public class CoreCmsPrinterRepository : BaseRepository<CoreCmsPrinter>, ICoreCmsPrinterRepository
|
||||||
|
{
|
||||||
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
|
public CoreCmsPrinterRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||||
|
{
|
||||||
|
_unitOfWork = unitOfWork;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 实现重写增删改查操作==========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步插入方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">实体数据</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> InsertAsync(CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
entity.createTime = DateTime.Now;
|
||||||
|
var bl = await DbClient.Insertable(entity).RemoveDataCache().ExecuteReturnIdentityAsync() > 0;
|
||||||
|
jm.code = bl ? 0 : 1;
|
||||||
|
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步更新方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var oldModel = await DbClient.Queryable<CoreCmsPrinter>().In(entity.id).SingleAsync();
|
||||||
|
if (oldModel == null)
|
||||||
|
{
|
||||||
|
jm.msg = "不存在此信息";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
//事物处理过程开始
|
||||||
|
//oldModel.id = entity.id;
|
||||||
|
oldModel.name = entity.name;
|
||||||
|
oldModel.code = entity.code;
|
||||||
|
oldModel.clientId = entity.clientId;
|
||||||
|
oldModel.clientSecret = entity.clientSecret;
|
||||||
|
oldModel.machineCode = entity.machineCode;
|
||||||
|
oldModel.msign = entity.msign;
|
||||||
|
oldModel.printerName = entity.printerName;
|
||||||
|
oldModel.phone = entity.phone;
|
||||||
|
//oldModel.accessToken = entity.accessToken;
|
||||||
|
//oldModel.refreshToken = entity.refreshToken;
|
||||||
|
//oldModel.expiresIn = entity.expiresIn;
|
||||||
|
//oldModel.expiressEndTime = entity.expiressEndTime;
|
||||||
|
//oldModel.parameters = entity.parameters;
|
||||||
|
//oldModel.createTime = entity.createTime;
|
||||||
|
oldModel.isDefault = entity.isDefault;
|
||||||
|
oldModel.isOpen = entity.isOpen;
|
||||||
|
oldModel.storeId = entity.storeId;
|
||||||
|
|
||||||
|
//事物处理过程结束
|
||||||
|
var bl = await DbClient.Updateable(oldModel).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||||
|
jm.code = bl ? 0 : 1;
|
||||||
|
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写删除指定ID的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var bl = await DbClient.Deleteable<CoreCmsPrinter>(id).RemoveDataCache().ExecuteCommandHasChangeAsync();
|
||||||
|
jm.code = bl ? 0 : 1;
|
||||||
|
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取缓存的所有数据==========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缓存的所有数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<CoreCmsPrinter>> GetCaChe()
|
||||||
|
{
|
||||||
|
var cache = await DbClient.Queryable<CoreCmsPrinter>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IPageList<CoreCmsPrinter>> QueryPageAsync(Expression<Func<CoreCmsPrinter, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsPrinter, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false)
|
||||||
|
{
|
||||||
|
RefAsync<int> totalCount = 0;
|
||||||
|
List<CoreCmsPrinter> page;
|
||||||
|
if (blUseNoLock)
|
||||||
|
{
|
||||||
|
page = await DbClient.Queryable<CoreCmsPrinter>()
|
||||||
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
|
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsPrinter
|
||||||
|
{
|
||||||
|
id = p.id,
|
||||||
|
name = p.name,
|
||||||
|
code = p.code,
|
||||||
|
clientId = p.clientId,
|
||||||
|
clientSecret = p.clientSecret,
|
||||||
|
machineCode = p.machineCode,
|
||||||
|
msign = p.msign,
|
||||||
|
printerName = p.printerName,
|
||||||
|
phone = p.phone,
|
||||||
|
accessToken = p.accessToken,
|
||||||
|
refreshToken = p.refreshToken,
|
||||||
|
expiresIn = p.expiresIn,
|
||||||
|
expiressEndTime = p.expiressEndTime,
|
||||||
|
parameters = p.parameters,
|
||||||
|
createTime = p.createTime,
|
||||||
|
isDefault = p.isDefault,
|
||||||
|
isOpen = p.isOpen,
|
||||||
|
storeId = p.storeId,
|
||||||
|
|
||||||
|
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page = await DbClient.Queryable<CoreCmsPrinter>()
|
||||||
|
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||||
|
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsPrinter
|
||||||
|
{
|
||||||
|
id = p.id,
|
||||||
|
name = p.name,
|
||||||
|
code = p.code,
|
||||||
|
clientId = p.clientId,
|
||||||
|
clientSecret = p.clientSecret,
|
||||||
|
machineCode = p.machineCode,
|
||||||
|
msign = p.msign,
|
||||||
|
printerName = p.printerName,
|
||||||
|
phone = p.phone,
|
||||||
|
accessToken = p.accessToken,
|
||||||
|
refreshToken = p.refreshToken,
|
||||||
|
expiresIn = p.expiresIn,
|
||||||
|
expiressEndTime = p.expiressEndTime,
|
||||||
|
parameters = p.parameters,
|
||||||
|
createTime = p.createTime,
|
||||||
|
isDefault = p.isDefault,
|
||||||
|
isOpen = p.isOpen,
|
||||||
|
storeId = p.storeId,
|
||||||
|
|
||||||
|
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||||
|
}
|
||||||
|
var list = new PageList<CoreCmsPrinter>(page, pageIndex, pageSize, totalCount);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
97
CoreCms.Net.Services/Api/CoreCmsPrinterServices.cs
Normal file
97
CoreCms.Net.Services/Api/CoreCmsPrinterServices.cs
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Configuration;
|
||||||
|
using CoreCms.Net.IRepository;
|
||||||
|
using CoreCms.Net.IRepository.UnitOfWork;
|
||||||
|
using CoreCms.Net.IServices;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表 接口实现
|
||||||
|
/// </summary>
|
||||||
|
public class CoreCmsPrinterServices : BaseServices<CoreCmsPrinter>, ICoreCmsPrinterServices
|
||||||
|
{
|
||||||
|
private readonly ICoreCmsPrinterRepository _dal;
|
||||||
|
private readonly IUnitOfWork _unitOfWork;
|
||||||
|
|
||||||
|
public CoreCmsPrinterServices(IUnitOfWork unitOfWork, ICoreCmsPrinterRepository dal)
|
||||||
|
{
|
||||||
|
this._dal = dal;
|
||||||
|
base.BaseDal = dal;
|
||||||
|
_unitOfWork = unitOfWork;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 实现重写增删改查操作==========================================================
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步插入方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity">实体数据</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> InsertAsync(CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
return await _dal.InsertAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写异步更新方法方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
return await _dal.UpdateAsync(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写删除指定ID的数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||||
|
{
|
||||||
|
return await _dal.DeleteByIdAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 重写根据条件查询分页数据
|
||||||
|
/// <summary>
|
||||||
|
/// 重写根据条件查询分页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate">判断集合</param>
|
||||||
|
/// <param name="orderByType">排序方式</param>
|
||||||
|
/// <param name="pageIndex">当前页面索引</param>
|
||||||
|
/// <param name="pageSize">分布大小</param>
|
||||||
|
/// <param name="orderByExpression"></param>
|
||||||
|
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IPageList<CoreCmsPrinter>> QueryPageAsync(Expression<Func<CoreCmsPrinter, bool>> predicate,
|
||||||
|
Expression<Func<CoreCmsPrinter, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||||
|
int pageSize = 20, bool blUseNoLock = false)
|
||||||
|
{
|
||||||
|
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
|
||||||
<PackageReference Include="Qiniu" Version="8.2.0" />
|
<PackageReference Include="Qiniu" Version="8.2.0" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
|
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
|
||||||
|
|||||||
@@ -169,6 +169,30 @@ namespace CoreCms.Net.Utility.Helper
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转MD5
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ToMd5(string str)
|
||||||
|
{
|
||||||
|
MD5 md5 = MD5.Create();
|
||||||
|
// 将字符串转换成字节数组
|
||||||
|
byte[] byteOld = Encoding.UTF8.GetBytes(str);
|
||||||
|
// 调用加密方法
|
||||||
|
byte[] byteNew = md5.ComputeHash(byteOld);
|
||||||
|
// 将加密结果转换为字符串
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
foreach (byte b in byteNew)
|
||||||
|
{
|
||||||
|
// 将字节转换成16进制表示的字符串,
|
||||||
|
sb.Append(b.ToString("x2"));
|
||||||
|
}
|
||||||
|
// 返回加密的字符串
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
#region 获取32位md5加密
|
#region 获取32位md5加密
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过创建哈希字符串适用于任何 MD5 哈希函数 (在任何平台) 上创建 32 个字符的十六进制格式哈希字符串
|
/// 通过创建哈希字符串适用于任何 MD5 哈希函数 (在任何平台) 上创建 32 个字符的十六进制格式哈希字符串
|
||||||
@@ -597,6 +621,19 @@ namespace CoreCms.Net.Utility.Helper
|
|||||||
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||||
return Convert.ToInt64(ts.TotalMilliseconds);
|
return Convert.ToInt64(ts.TotalMilliseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取时间戳
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dt"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int GetDateTimeStamp(DateTime dt)
|
||||||
|
{
|
||||||
|
DateTime dateStart = new DateTime(1970, 1, 1, 0, 0, 0);
|
||||||
|
int timeStamp = Convert.ToInt32((dt.ToUniversalTime() - dateStart).TotalSeconds);
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,805 @@
|
|||||||
|
/***********************************************************************
|
||||||
|
* Project: CoreCms
|
||||||
|
* ProjectName: 核心内容管理系统
|
||||||
|
* Web: https://www.corecms.net
|
||||||
|
* Author: 大灰灰
|
||||||
|
* Email: jianweie@163.com
|
||||||
|
* CreateTime: 2022/9/16 20:41:09
|
||||||
|
* Description: 暂无
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Configuration;
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
using CoreCms.Net.Model.Entities.Expression;
|
||||||
|
using CoreCms.Net.Model.FromBody;
|
||||||
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
|
using CoreCms.Net.Filter;
|
||||||
|
using CoreCms.Net.IServices;
|
||||||
|
using CoreCms.Net.Utility.Helper;
|
||||||
|
using CoreCms.Net.Utility.Extensions;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using CoreCms.Net.Model.ViewModels.YiLianYun;
|
||||||
|
using Flurl.Http;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Web.Admin.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 打印机列表
|
||||||
|
///</summary>
|
||||||
|
[Description("打印机列表")]
|
||||||
|
[Route("api/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
[RequiredErrorForAdmin]
|
||||||
|
[Authorize]
|
||||||
|
public class CoreCmsPrinterController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||||
|
private readonly ICoreCmsPrinterServices _coreCmsPrinterServices;
|
||||||
|
private readonly ICoreCmsStoreServices _storeServices;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构造函数
|
||||||
|
///</summary>
|
||||||
|
public CoreCmsPrinterController(IWebHostEnvironment webHostEnvironment
|
||||||
|
, ICoreCmsPrinterServices coreCmsPrinterServices, ICoreCmsStoreServices storeServices)
|
||||||
|
{
|
||||||
|
_webHostEnvironment = webHostEnvironment;
|
||||||
|
_coreCmsPrinterServices = coreCmsPrinterServices;
|
||||||
|
_storeServices = storeServices;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 获取列表============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/GetPageList
|
||||||
|
/// <summary>
|
||||||
|
/// 获取列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("获取列表")]
|
||||||
|
public async Task<AdminUiCallBack> GetPageList()
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||||
|
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||||
|
var where = PredicateBuilder.True<CoreCmsPrinter>();
|
||||||
|
//获取排序字段
|
||||||
|
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||||
|
|
||||||
|
Expression<Func<CoreCmsPrinter, object>> orderEx = orderField switch
|
||||||
|
{
|
||||||
|
"id" => p => p.id,
|
||||||
|
"name" => p => p.name,
|
||||||
|
"code" => p => p.code,
|
||||||
|
"clientId" => p => p.clientId,
|
||||||
|
"clientSecret" => p => p.clientSecret,
|
||||||
|
"machineCode" => p => p.machineCode,
|
||||||
|
"msign" => p => p.msign,
|
||||||
|
"printerName" => p => p.printerName,
|
||||||
|
"phone" => p => p.phone,
|
||||||
|
"accessToken" => p => p.accessToken,
|
||||||
|
"refreshToken" => p => p.refreshToken,
|
||||||
|
"expiresIn" => p => p.expiresIn,
|
||||||
|
"expiressEndTime" => p => p.expiressEndTime,
|
||||||
|
"parameters" => p => p.parameters,
|
||||||
|
"createTime" => p => p.createTime,
|
||||||
|
"isDefault" => p => p.isDefault,
|
||||||
|
"isOpen" => p => p.isOpen,
|
||||||
|
"storeId" => p => p.storeId,
|
||||||
|
_ => p => p.id
|
||||||
|
};
|
||||||
|
|
||||||
|
//设置排序方式
|
||||||
|
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||||
|
var orderBy = orderDirection switch
|
||||||
|
{
|
||||||
|
"asc" => OrderByType.Asc,
|
||||||
|
"desc" => OrderByType.Desc,
|
||||||
|
_ => OrderByType.Desc
|
||||||
|
};
|
||||||
|
//查询筛选
|
||||||
|
|
||||||
|
//序列 int
|
||||||
|
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||||
|
if (id > 0)
|
||||||
|
{
|
||||||
|
where = where.And(p => p.id == id);
|
||||||
|
}
|
||||||
|
//应用名称 nvarchar
|
||||||
|
var name = Request.Form["name"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.name.Contains(name));
|
||||||
|
}
|
||||||
|
//应用编码 nvarchar
|
||||||
|
var code = Request.Form["code"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(code))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.code.Contains(code));
|
||||||
|
}
|
||||||
|
//易联云应用id nvarchar
|
||||||
|
var clientId = Request.Form["clientId"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(clientId))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.clientId.Contains(clientId));
|
||||||
|
}
|
||||||
|
//易联云应用密钥 nvarchar
|
||||||
|
var clientSecret = Request.Form["clientSecret"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(clientSecret))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.clientSecret.Contains(clientSecret));
|
||||||
|
}
|
||||||
|
//易联云终端号 nvarchar
|
||||||
|
var machineCode = Request.Form["machineCode"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(machineCode))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.machineCode.Contains(machineCode));
|
||||||
|
}
|
||||||
|
//易联云终端密钥 nvarchar
|
||||||
|
var msign = Request.Form["msign"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(msign))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.msign.Contains(msign));
|
||||||
|
}
|
||||||
|
//打印机名称 nvarchar
|
||||||
|
var printerName = Request.Form["printerName"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(printerName))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.printerName.Contains(printerName));
|
||||||
|
}
|
||||||
|
//联系电话 nvarchar
|
||||||
|
var phone = Request.Form["phone"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(phone))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.phone.Contains(phone));
|
||||||
|
}
|
||||||
|
//访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存 nvarchar
|
||||||
|
var accessToken = Request.Form["accessToken"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(accessToken))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.accessToken.Contains(accessToken));
|
||||||
|
}
|
||||||
|
//更新access_token所需,有效时间35天 nvarchar
|
||||||
|
var refreshToken = Request.Form["refreshToken"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(refreshToken))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.refreshToken.Contains(refreshToken));
|
||||||
|
}
|
||||||
|
//令牌的有效时间,单位秒 (30天),注:该模式下可忽略此参数 int
|
||||||
|
var expiresIn = Request.Form["expiresIn"].FirstOrDefault().ObjectToInt(0);
|
||||||
|
if (expiresIn > 0)
|
||||||
|
{
|
||||||
|
where = where.And(p => p.expiresIn == expiresIn);
|
||||||
|
}
|
||||||
|
//有效期截止时间 datetime
|
||||||
|
var expiressEndTime = Request.Form["expiressEndTime"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(expiressEndTime))
|
||||||
|
{
|
||||||
|
if (expiressEndTime.Contains("到"))
|
||||||
|
{
|
||||||
|
var dts = expiressEndTime.Split("到");
|
||||||
|
var dtStart = dts[0].Trim().ObjectToDate();
|
||||||
|
where = where.And(p => p.expiressEndTime > dtStart);
|
||||||
|
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||||
|
where = where.And(p => p.expiressEndTime < dtEnd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dt = expiressEndTime.ObjectToDate();
|
||||||
|
where = where.And(p => p.expiressEndTime > dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//其他参数 nvarchar
|
||||||
|
var parameters = Request.Form["parameters"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(parameters))
|
||||||
|
{
|
||||||
|
where = where.And(p => p.parameters.Contains(parameters));
|
||||||
|
}
|
||||||
|
//创建时间 datetime
|
||||||
|
var createTime = Request.Form["createTime"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(createTime))
|
||||||
|
{
|
||||||
|
if (createTime.Contains("到"))
|
||||||
|
{
|
||||||
|
var dts = createTime.Split("到");
|
||||||
|
var dtStart = dts[0].Trim().ObjectToDate();
|
||||||
|
where = where.And(p => p.createTime > dtStart);
|
||||||
|
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||||
|
where = where.And(p => p.createTime < dtEnd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dt = createTime.ObjectToDate();
|
||||||
|
where = where.And(p => p.createTime > dt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//是否默认 bit
|
||||||
|
var isDefault = Request.Form["isDefault"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "true")
|
||||||
|
{
|
||||||
|
where = where.And(p => p.isDefault == true);
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "false")
|
||||||
|
{
|
||||||
|
where = where.And(p => p.isDefault == false);
|
||||||
|
}
|
||||||
|
//是否开启 bit
|
||||||
|
var isOpen = Request.Form["isOpen"].FirstOrDefault();
|
||||||
|
if (!string.IsNullOrEmpty(isOpen) && isOpen.ToLowerInvariant() == "true")
|
||||||
|
{
|
||||||
|
where = where.And(p => p.isOpen == true);
|
||||||
|
}
|
||||||
|
else if (!string.IsNullOrEmpty(isOpen) && isOpen.ToLowerInvariant() == "false")
|
||||||
|
{
|
||||||
|
where = where.And(p => p.isOpen == false);
|
||||||
|
}
|
||||||
|
//绑定门店 int
|
||||||
|
var storeId = Request.Form["storeId"].FirstOrDefault().ObjectToInt(0);
|
||||||
|
if (storeId > 0)
|
||||||
|
{
|
||||||
|
where = where.And(p => p.storeId == storeId);
|
||||||
|
}
|
||||||
|
//获取数据
|
||||||
|
var list = await _coreCmsPrinterServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||||
|
//返回数据
|
||||||
|
jm.data = list;
|
||||||
|
jm.code = 0;
|
||||||
|
jm.count = list.TotalCount;
|
||||||
|
jm.msg = "数据调用成功!";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 首页数据============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/GetIndex
|
||||||
|
/// <summary>
|
||||||
|
/// 首页数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("首页数据")]
|
||||||
|
public async Task<AdminUiCallBack> GetIndex()
|
||||||
|
{
|
||||||
|
//返回数据
|
||||||
|
var jm = new AdminUiCallBack { code = 0 };
|
||||||
|
|
||||||
|
var stores = await _storeServices.QueryAsync(true, true);
|
||||||
|
var thirdPartyEquipment = EnumHelper.EnumToList<GlobalEnumVars.ThirdPartyEquipment>();
|
||||||
|
jm.data = new
|
||||||
|
{
|
||||||
|
stores,
|
||||||
|
thirdPartyEquipment
|
||||||
|
};
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 创建数据============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/GetCreate
|
||||||
|
/// <summary>
|
||||||
|
/// 创建数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("创建数据")]
|
||||||
|
public async Task<AdminUiCallBack> GetCreate()
|
||||||
|
{
|
||||||
|
//返回数据
|
||||||
|
var jm = new AdminUiCallBack { code = 0 };
|
||||||
|
|
||||||
|
var stores = await _storeServices.QueryAsync(true, true);
|
||||||
|
var thirdPartyEquipment = EnumHelper.EnumToList<GlobalEnumVars.ThirdPartyEquipment>();
|
||||||
|
jm.data = new
|
||||||
|
{
|
||||||
|
stores,
|
||||||
|
thirdPartyEquipment
|
||||||
|
};
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 创建提交============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoCreate
|
||||||
|
/// <summary>
|
||||||
|
/// 创建提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("创建提交")]
|
||||||
|
public async Task<AdminUiCallBack> DoCreate([FromBody] CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
var jm = await _coreCmsPrinterServices.InsertAsync(entity);
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 编辑数据============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/GetEdit
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("编辑数据")]
|
||||||
|
public async Task<AdminUiCallBack> GetEdit([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var model = await _coreCmsPrinterServices.QueryByIdAsync(entity.id, false);
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
jm.msg = "不存在此信息";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
jm.code = 0;
|
||||||
|
|
||||||
|
var stores = await _storeServices.QueryAsync(true, true);
|
||||||
|
var thirdPartyEquipment = EnumHelper.EnumToList<GlobalEnumVars.ThirdPartyEquipment>();
|
||||||
|
jm.data = new
|
||||||
|
{
|
||||||
|
model,
|
||||||
|
stores,
|
||||||
|
thirdPartyEquipment
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 编辑提交============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/Edit
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑提交
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("编辑提交")]
|
||||||
|
public async Task<AdminUiCallBack> DoEdit([FromBody] CoreCmsPrinter entity)
|
||||||
|
{
|
||||||
|
var jm = await _coreCmsPrinterServices.UpdateAsync(entity);
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 删除数据============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoDelete/10
|
||||||
|
/// <summary>
|
||||||
|
/// 单选删除
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("单选删除")]
|
||||||
|
public async Task<AdminUiCallBack> DoDelete([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var model = await _coreCmsPrinterServices.ExistsAsync(p => p.id == entity.id);
|
||||||
|
if (!model)
|
||||||
|
{
|
||||||
|
jm.msg = GlobalConstVars.DataisNo;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
jm = await _coreCmsPrinterServices.DeleteByIdAsync(entity.id);
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 刷新Token============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoRefreshToken/10
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新Token
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("刷新Token")]
|
||||||
|
public async Task<AdminUiCallBack> DoRefreshToken([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var model = await _coreCmsPrinterServices.QueryByClauseAsync(p => p.id == entity.id);
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
jm.msg = GlobalConstVars.DataisNo;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshYiLianYunToken refreshToken = new RefreshYiLianYunToken
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
grant_type = "client_credentials",
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
scope = "all",
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
refreshToken.sign = CommonHelper.Md5For32((refreshToken.client_id + refreshToken.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
var resultData = await YiLianYunConfig.AuthUrl.PostJsonAsync(refreshToken).ReceiveJson<YiLianYunAuthResult>();
|
||||||
|
//将获取到的数据存入数据库
|
||||||
|
if (resultData.error == "0")
|
||||||
|
{
|
||||||
|
model.accessToken = resultData.body.access_token;
|
||||||
|
model.refreshToken = resultData.body.refresh_token;
|
||||||
|
model.expiresIn = resultData.body.expires_in;
|
||||||
|
model.expiressEndTime = DateTime.Now.AddSeconds(resultData.body.expires_in);
|
||||||
|
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
p => new CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
accessToken = resultData.body.access_token,
|
||||||
|
refreshToken = resultData.body.refresh_token,
|
||||||
|
expiresIn = resultData.body.expires_in,
|
||||||
|
expiressEndTime = model.expiressEndTime,
|
||||||
|
parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
}, p => p.clientId == model.clientId && p.clientSecret == model.clientSecret, true);
|
||||||
|
|
||||||
|
//await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
// p => new CoreCmsPrinter()
|
||||||
|
// {
|
||||||
|
// accessToken = resultData.body.access_token,
|
||||||
|
// refreshToken = resultData.body.refresh_token,
|
||||||
|
// expiresIn = resultData.body.expires_in,
|
||||||
|
// expiressEndTime = model.expiressEndTime,
|
||||||
|
// parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
// }, p => p.id == model.id, true);
|
||||||
|
|
||||||
|
jm.code = 1;
|
||||||
|
jm.msg = "刷新成功";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jm.msg = "刷新AccessToken:" + resultData.error_description;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 打印测试页============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoPrintTest/10
|
||||||
|
/// <summary>
|
||||||
|
/// 打印测试页
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("打印测试页")]
|
||||||
|
public async Task<AdminUiCallBack> DoPrintTest([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var model = await _coreCmsPrinterServices.QueryByClauseAsync(p => p.id == entity.id);
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
jm.msg = GlobalConstVars.DataisNo;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isNeedToken = false;
|
||||||
|
if (string.IsNullOrEmpty(model.accessToken) || model.expiressEndTime == null)
|
||||||
|
{
|
||||||
|
isNeedToken = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//判断是否过期
|
||||||
|
var dt = DateTime.Now;
|
||||||
|
if (dt >= model.expiressEndTime)
|
||||||
|
{
|
||||||
|
var ts = dt - Convert.ToDateTime(model.expiressEndTime);
|
||||||
|
if (ts.Days > 35)
|
||||||
|
{
|
||||||
|
isNeedToken = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RefreshYiLianYunToken refreshToken = new RefreshYiLianYunToken
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
grant_type = "client_credentials",
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
scope = "all",
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
refreshToken.sign = CommonHelper.Md5For32((refreshToken.client_id + refreshToken.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
var resultData = await YiLianYunConfig.AuthUrl.PostJsonAsync(refreshToken).ReceiveJson<YiLianYunAuthResult>();
|
||||||
|
//将获取到的数据存入数据库
|
||||||
|
if (resultData.error == "0")
|
||||||
|
{
|
||||||
|
model.accessToken = resultData.body.access_token;
|
||||||
|
model.refreshToken = resultData.body.refresh_token;
|
||||||
|
model.expiresIn = resultData.body.expires_in;
|
||||||
|
model.expiressEndTime = DateTime.Now.AddSeconds(resultData.body.expires_in);
|
||||||
|
|
||||||
|
//await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
// p => new CoreCmsPrinter()
|
||||||
|
// {
|
||||||
|
// accessToken = resultData.body.access_token,
|
||||||
|
// refreshToken = resultData.body.refresh_token,
|
||||||
|
// expiresIn = resultData.body.expires_in,
|
||||||
|
// expiressEndTime = model.expiressEndTime,
|
||||||
|
// parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
// }, p => p.id == model.id, true);
|
||||||
|
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
p => new CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
accessToken = resultData.body.access_token,
|
||||||
|
refreshToken = resultData.body.refresh_token,
|
||||||
|
expiresIn = resultData.body.expires_in,
|
||||||
|
expiressEndTime = model.expiressEndTime,
|
||||||
|
parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
}, p => p.clientId == model.clientId && p.clientSecret == model.clientSecret, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jm.msg = "刷新AccessToken:" + resultData.error_description;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNeedToken)
|
||||||
|
{
|
||||||
|
var getToken = new YiLianYunParam
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
grant_type = "client_credentials",
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
scope = "all",
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
getToken.sign = CommonHelper.Md5For32((getToken.client_id + getToken.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
|
||||||
|
var resultData = await YiLianYunConfig.AuthUrl.PostJsonAsync(getToken).ReceiveJson<YiLianYunAuthResult>();
|
||||||
|
//将获取到的数据存入数据库
|
||||||
|
if (resultData.error == "0")
|
||||||
|
{
|
||||||
|
model.accessToken = resultData.body.access_token;
|
||||||
|
model.refreshToken = resultData.body.refresh_token;
|
||||||
|
model.expiresIn = resultData.body.expires_in;
|
||||||
|
model.expiressEndTime = DateTime.Now.AddSeconds(resultData.body.expires_in);
|
||||||
|
|
||||||
|
//await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
// p => new CoreCmsPrinter()
|
||||||
|
// {
|
||||||
|
// accessToken = resultData.body.access_token,
|
||||||
|
// refreshToken = resultData.body.refresh_token,
|
||||||
|
// expiresIn = resultData.body.expires_in,
|
||||||
|
// expiressEndTime = model.expiressEndTime,
|
||||||
|
// parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
// }, p => p.id == model.id, true);
|
||||||
|
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(
|
||||||
|
p => new CoreCmsPrinter()
|
||||||
|
{
|
||||||
|
accessToken = resultData.body.access_token,
|
||||||
|
refreshToken = resultData.body.refresh_token,
|
||||||
|
expiresIn = resultData.body.expires_in,
|
||||||
|
expiressEndTime = model.expiressEndTime,
|
||||||
|
parameters = JsonConvert.SerializeObject(resultData.body)
|
||||||
|
}, p => p.clientId == model.clientId && p.clientSecret == model.clientSecret, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jm.msg = "获取AccessToken:" + resultData.error_description;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取打印机是否在线
|
||||||
|
var statusParam = new GetPrintStatusParam
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
access_token = model.accessToken,
|
||||||
|
machine_code = model.machineCode,
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now),
|
||||||
|
id = Guid.NewGuid().ToString()
|
||||||
|
};
|
||||||
|
statusParam.sign = CommonHelper.Md5For32((statusParam.client_id + statusParam.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
|
||||||
|
var getPrintStatusResult = await YiLianYunConfig.GetPrintStatusUrl.PostJsonAsync(statusParam).ReceiveJson<YiLianYunGetPrintStatusResult>();
|
||||||
|
if (getPrintStatusResult.error != "0")
|
||||||
|
{
|
||||||
|
jm.msg = "获取打印机在线状态:" + getPrintStatusResult.error_description;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (getPrintStatusResult.body.state)
|
||||||
|
{
|
||||||
|
case "0":
|
||||||
|
jm.msg = "机器未在线";
|
||||||
|
return jm;
|
||||||
|
case "2":
|
||||||
|
jm.msg = "机器缺纸";
|
||||||
|
return jm;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
var order = new CoreCmsOrder()
|
||||||
|
{
|
||||||
|
createTime = DateTime.Now,
|
||||||
|
orderId = DateTime.Now.ToLongDateString(),
|
||||||
|
pointMoney = 10,
|
||||||
|
orderDiscountAmount = 0,
|
||||||
|
goodsDiscountAmount = 0,
|
||||||
|
couponDiscountAmount = 0,
|
||||||
|
orderAmount = 199,
|
||||||
|
shipAreaName = "湖南省",
|
||||||
|
shipAddress = "怀化市鹤城区迎丰中路佳慧中央商厦A栋1513-1514(南山田舍)",
|
||||||
|
shipName = "大灰灰",
|
||||||
|
shipMobile = "19145919666"
|
||||||
|
};
|
||||||
|
var printStr = YiLianYunConfig.PrintTmpModel(order);
|
||||||
|
|
||||||
|
//小票打印
|
||||||
|
WordPrintRespone wordPrintRespone = new WordPrintRespone
|
||||||
|
{
|
||||||
|
client_id = model.clientId,
|
||||||
|
access_token = model.accessToken,
|
||||||
|
machine_code = model.machineCode,
|
||||||
|
content = printStr.ToString(),
|
||||||
|
origin_id = order.orderId,
|
||||||
|
timestamp = CommonHelper.GetDateTimeStamp(DateTime.Now)
|
||||||
|
};
|
||||||
|
wordPrintRespone.sign = CommonHelper.Md5For32((wordPrintRespone.client_id + wordPrintRespone.timestamp + model.clientSecret).ToLowerInvariant()).ToLowerInvariant();
|
||||||
|
wordPrintRespone.id = Guid.NewGuid().ToString();
|
||||||
|
|
||||||
|
//打印文本:缺少参数!请检查参数信息!!或更改下请求头:Content-Type:application/x-www-form-urlencoded
|
||||||
|
var resultData = await YiLianYunConfig.PrintTextUrl.WithHeader("Content-Type", "application/x-www-form-urlencoded").PostUrlEncodedAsync(wordPrintRespone).ReceiveJson<YiLianYunGetPrintTextResult>();
|
||||||
|
//当token返回失败时
|
||||||
|
if (resultData.error != "0")
|
||||||
|
{
|
||||||
|
jm.msg = "打印文本:" + resultData.error_description;
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jm.code = 1;
|
||||||
|
jm.msg = "打印成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 预览数据============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/GetDetails/10
|
||||||
|
/// <summary>
|
||||||
|
/// 预览数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("预览数据")]
|
||||||
|
public async Task<AdminUiCallBack> GetDetails([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var model = await _coreCmsPrinterServices.QueryByIdAsync(entity.id, false);
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
jm.msg = "不存在此信息";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
jm.code = 0;
|
||||||
|
|
||||||
|
var stores = await _storeServices.QueryAsync(true, true);
|
||||||
|
var thirdPartyEquipment = EnumHelper.EnumToList<GlobalEnumVars.ThirdPartyEquipment>();
|
||||||
|
jm.data = new
|
||||||
|
{
|
||||||
|
model,
|
||||||
|
stores,
|
||||||
|
thirdPartyEquipment
|
||||||
|
};
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 设置是否默认============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoSetisDefault/10
|
||||||
|
/// <summary>
|
||||||
|
/// 设置是否默认
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("设置是否默认")]
|
||||||
|
public async Task<AdminUiCallBack> DoSetIsDefault([FromBody] FMUpdateBoolDataByIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var oldModel = await _coreCmsPrinterServices.QueryByIdAsync(entity.id, false);
|
||||||
|
if (oldModel == null)
|
||||||
|
{
|
||||||
|
jm.msg = "不存在此信息";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
oldModel.isDefault = (bool)entity.data;
|
||||||
|
|
||||||
|
//判断是否除了自己其他都不是默认
|
||||||
|
var haveOtherDefault = await _coreCmsPrinterServices.ExistsAsync(p => p.isDefault == true && p.id != entity.id);
|
||||||
|
if (haveOtherDefault == false && oldModel.isDefault == false)
|
||||||
|
{
|
||||||
|
jm.msg = "至少有一个要是默认打印机";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bl = await _coreCmsPrinterServices.UpdateAsync(p => new CoreCmsPrinter() { isDefault = oldModel.isDefault }, p => p.id == oldModel.id, true);
|
||||||
|
|
||||||
|
//将其他打印机设置为非默认
|
||||||
|
if (bl && oldModel.isDefault == true)
|
||||||
|
{
|
||||||
|
await _coreCmsPrinterServices.UpdateAsync(p => new CoreCmsPrinter() { isDefault = false }, p => p.id != oldModel.id, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
jm.code = bl ? 0 : 1;
|
||||||
|
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 设置是否开启============================================================
|
||||||
|
// POST: Api/CoreCmsPrinter/DoSetisOpen/10
|
||||||
|
/// <summary>
|
||||||
|
/// 设置是否开启
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Description("设置是否开启")]
|
||||||
|
public async Task<AdminUiCallBack> DoSetIsOpen([FromBody] FMUpdateBoolDataByIntId entity)
|
||||||
|
{
|
||||||
|
var jm = new AdminUiCallBack();
|
||||||
|
|
||||||
|
var oldModel = await _coreCmsPrinterServices.QueryByIdAsync(entity.id, false);
|
||||||
|
if (oldModel == null)
|
||||||
|
{
|
||||||
|
jm.msg = "不存在此信息";
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
oldModel.isOpen = (bool)entity.data;
|
||||||
|
|
||||||
|
var bl = await _coreCmsPrinterServices.UpdateAsync(p => new CoreCmsPrinter() { isOpen = oldModel.isOpen }, p => p.id == oldModel.id);
|
||||||
|
jm.code = bl ? 0 : 1;
|
||||||
|
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||||
|
|
||||||
|
return jm;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,7 +61,6 @@
|
|||||||
<PackageReference Include="NLog" Version="4.7.15" />
|
<PackageReference Include="NLog" Version="4.7.15" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
||||||
<PackageReference Include="NPOI" Version="2.4.1" />
|
<PackageReference Include="NPOI" Version="2.4.1" />
|
||||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
|
||||||
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
|
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.20.0" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.20.0" />
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using CoreCms.Net.Auth;
|
using CoreCms.Net.Auth;
|
||||||
@@ -10,16 +9,15 @@ using CoreCms.Net.Filter;
|
|||||||
using CoreCms.Net.Loging;
|
using CoreCms.Net.Loging;
|
||||||
using CoreCms.Net.Mapping;
|
using CoreCms.Net.Mapping;
|
||||||
using CoreCms.Net.Middlewares;
|
using CoreCms.Net.Middlewares;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Options;
|
||||||
using CoreCms.Net.Swagger;
|
using CoreCms.Net.Swagger;
|
||||||
using Essensoft.Paylink.Alipay;
|
using Essensoft.Paylink.Alipay;
|
||||||
using Essensoft.Paylink.WeChatPay;
|
using Essensoft.Paylink.WeChatPay;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.AspNetCore.Localization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||||
using Microsoft.DotNet.PlatformAbstractions;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
@@ -89,10 +87,10 @@ namespace CoreCms.Net.Web.Admin
|
|||||||
services.AddWeChatPay();
|
services.AddWeChatPay();
|
||||||
|
|
||||||
// <20><> appsettings.json <20><> <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
// <20><> appsettings.json <20><> <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||||
|
//ע<><D7A2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>潫ȡ<E6BDAB><C8A1>ʹ<EFBFBD><CAB9>Paylink<6E><6B>ֱ<EFBFBD><D6B1><EFBFBD>߽ӿ<DFBD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>崦<EFBFBD><E5B4A6><EFBFBD><EFBFBD>
|
||||||
services.Configure<WeChatPayOptions>(Configuration.GetSection("WeChatPay"));
|
services.Configure<WeChatPayOptions>(Configuration.GetSection("WeChatPay"));
|
||||||
services.Configure<AlipayOptions>(Configuration.GetSection("Alipay"));
|
services.Configure<AlipayOptions>(Configuration.GetSection("Alipay"));
|
||||||
|
|
||||||
|
|
||||||
//ע<><D7A2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Žӿ<C5BD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
//ע<><D7A2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Žӿ<C5BD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||||
services.Configure<WeChat.Service.Options.WeChatOptions>(Configuration.GetSection(nameof(WeChat.Service.Options.WeChatOptions)));
|
services.Configure<WeChat.Service.Options.WeChatOptions>(Configuration.GetSection(nameof(WeChat.Service.Options.WeChatOptions)));
|
||||||
|
|
||||||
@@ -106,9 +104,6 @@ namespace CoreCms.Net.Web.Admin
|
|||||||
//Swagger<65>ӿ<EFBFBD><D3BF>ĵ<EFBFBD>ע<EFBFBD><D7A2>
|
//Swagger<65>ӿ<EFBFBD><D3BF>ĵ<EFBFBD>ע<EFBFBD><D7A2>
|
||||||
services.AddAdminSwaggerSetup();
|
services.AddAdminSwaggerSetup();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>ӡ<EFBFBD><D3A1>
|
|
||||||
services.AddYiLianYunSetup();
|
|
||||||
|
|
||||||
//jwt<77><74>Ȩ֧<C8A8><D6A7>ע<EFBFBD><D7A2>
|
//jwt<77><74>Ȩ֧<C8A8><D6A7>ע<EFBFBD><D7A2>
|
||||||
services.AddAuthorizationSetupForAdmin();
|
services.AddAuthorizationSetupForAdmin();
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||||
@@ -141,6 +136,7 @@ namespace CoreCms.Net.Web.Admin
|
|||||||
p.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
p.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ѩ<><D1A9>Ư<EFBFBD><C6AF><EFBFBD>㷨
|
// ѩ<><D1A9>Ư<EFBFBD><C6AF><EFBFBD>㷨
|
||||||
// <20><><EFBFBD><EFBFBD> IdGeneratorOptions <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkerId<49><64>
|
// <20><><EFBFBD><EFBFBD> IdGeneratorOptions <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkerId<49><64>
|
||||||
var options = new IdGeneratorOptions(1);
|
var options = new IdGeneratorOptions(1);
|
||||||
@@ -178,14 +174,13 @@ namespace CoreCms.Net.Web.Admin
|
|||||||
/// <param name="env"></param>
|
/// <param name="env"></param>
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ubuntu Nginx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD>ȡIP<EFBFBD><EFBFBD><EFBFBD>⣨<EFBFBD><EFBFBD>
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ubuntu Nginx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD>ȡIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||||
{
|
{
|
||||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>Ip<49><70><EFBFBD><EFBFBD>
|
// <20><><EFBFBD><EFBFBD>Ip<49><70><EFBFBD><EFBFBD>
|
||||||
app.UseIpLimitMiddle();
|
app.UseIpLimitMiddle();
|
||||||
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD><EBB7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (ע<><EFBFBD><E2BFAA>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>)
|
// <20><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD><EBB7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (ע<><EFBFBD><E2BFAA>Ȩ<EFBFBD>ޣ<EFBFBD><DEA3><EFBFBD>Ȼ<EFBFBD><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>)
|
||||||
|
|||||||
@@ -130,23 +130,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
//易联云打印机设置【很不错的一个网络打印机,价格也很便宜https://www.yilianyun.net/】
|
|
||||||
"YiLianYunConfig": {
|
|
||||||
//是否开启
|
|
||||||
"Enabled": false,
|
|
||||||
//应用id
|
|
||||||
"ClientId": "",
|
|
||||||
//应用密钥 string
|
|
||||||
"ClientSecret": "",
|
|
||||||
//打印机设备号
|
|
||||||
"MachineCode": "",
|
|
||||||
//打印机终端密钥
|
|
||||||
"Msign": "",
|
|
||||||
//打印机名称
|
|
||||||
"PrinterName": "",
|
|
||||||
//打印机设置联系电话
|
|
||||||
"Phone": ""
|
|
||||||
},
|
|
||||||
// 微信支付
|
// 微信支付
|
||||||
// 更多配置,请查看WeChatPayOptions类
|
// 更多配置,请查看WeChatPayOptions类
|
||||||
"WeChatPay": {
|
"WeChatPay": {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ layui.define(['laytpl', 'layer', 'element', 'util'], function (exports) {
|
|||||||
, pageTabs: false //是否开启页面选项卡功能。单页版不推荐开启
|
, pageTabs: false //是否开启页面选项卡功能。单页版不推荐开启
|
||||||
|
|
||||||
, name: '核心商城系统'
|
, name: '核心商城系统'
|
||||||
, version: 'CoreShopProfessional v0.5.5'
|
, version: 'CoreShopProfessional v0.6.0'
|
||||||
, tableName: 'CoreCms' //本地存储表名
|
, tableName: 'CoreCms' //本地存储表名
|
||||||
, MOD_NAME: 'admin' //模块事件名
|
, MOD_NAME: 'admin' //模块事件名
|
||||||
|
|
||||||
|
|||||||
163
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/create.html
Normal file
163
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/create.html
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||||
|
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsPrinter-createForm" id="LAY-app-CoreCmsPrinter-createForm">
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="code" class="layui-form-label layui-form-required">应用编码</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="code" lay-verify="required|verifycode">
|
||||||
|
{{# layui.each(d.params.data.thirdPartyEquipment, function(index, item){ }}
|
||||||
|
<option value="{{ item.title }}">{{ item.title }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="name" class="layui-form-label layui-form-required">应用名称</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="name" lay-verify="required|verifyname">
|
||||||
|
{{# layui.each(d.params.data.thirdPartyEquipment, function(index, item){ }}
|
||||||
|
<option value="{{ item.description }}">{{ item.description }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="clientId" class="layui-form-label layui-form-required">易联云应用id</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="clientId" lay-verType="tips" lay-verify="required|verifyclientId" class="layui-input" lay-reqText="请输入易联云应用id" placeholder="请输入易联云应用id" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
易联云自有应用Id
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="clientSecret" class="layui-form-label layui-form-required">易联云应用密钥</label>
|
||||||
|
<div class="layui-input-inline layui-inline-5">
|
||||||
|
<input name="clientSecret" lay-verType="tips" lay-verify="required|verifyclientSecret" class="layui-input" lay-reqText="请输入易联云应用密钥" placeholder="请输入易联云应用密钥" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
易联云自有应用密钥
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="machineCode" class="layui-form-label layui-form-required">易联云终端号</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="machineCode" lay-verType="tips" lay-verify="required|verifymachineCode" class="layui-input" lay-reqText="请输入易联云终端号" placeholder="请输入易联云终端号" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
打印机背面终端号
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="msign" class="layui-form-label layui-form-required">易联云终端密钥</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="msign" lay-verType="tips" lay-verify="required|verifymsign" class="layui-input" lay-reqText="请输入易联云终端密钥" placeholder="请输入易联云终端密钥" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
打印机背面密钥
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="printerName" class="layui-form-label layui-form-required">打印机名称</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="printerName" lay-verType="tips" lay-verify="required|verifyprinterName" class="layui-input" lay-reqText="请输入打印机名称" placeholder="请输入打印机名称" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
自定义打印机名称
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="phone" class="layui-form-label layui-form-required">联系电话</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="phone" lay-verType="tips" lay-verify="required|verifyphone" class="layui-input" lay-reqText="请输入联系电话" placeholder="请输入联系电话" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
联系电话
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="isDefault" class="layui-form-label layui-form-required">是否默认</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input type="checkbox" lay-filter="switch" name="isDefault" lay-skin="switch" lay-text="开启|关闭">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
所有打印机只允许一个默认
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="isOpen" class="layui-form-label layui-form-required">是否开启</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input type="checkbox" lay-filter="switch" name="isOpen" lay-skin="switch" lay-text="开启|关闭">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="storeId" class="layui-form-label layui-form-required">绑定门店</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="storeId" lay-verify="required|number" >
|
||||||
|
<option value="0" selected="selected">全局使用</option>
|
||||||
|
{{# layui.each(d.params.data.stores, function(index, item){ }}
|
||||||
|
<option value="{{ item.id }}">{{ item.storeName }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
绑定后将走门店打印机
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item text-right core-hidden">
|
||||||
|
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsPrinter-createForm-submit" id="LAY-app-CoreCmsPrinter-createForm-submit" value="确认添加">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var debug = layui.setter.debug;
|
||||||
|
layui.data.done = function (d) {
|
||||||
|
//开启调试情况下获取接口赋值数据
|
||||||
|
if (debug) { console.log(d.params.data); }
|
||||||
|
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||||
|
function () {
|
||||||
|
var $ = layui.$
|
||||||
|
, form = layui.form
|
||||||
|
, admin = layui.admin
|
||||||
|
, laydate = layui.laydate
|
||||||
|
, upload = layui.upload
|
||||||
|
, cropperImg = layui.cropperImg
|
||||||
|
, coreHelper = layui.coreHelper;
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#createTime-CoreCmsPrinter-expiressEndTime',
|
||||||
|
type: 'datetime'
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#createTime-CoreCmsPrinter-createTime',
|
||||||
|
type: 'datetime'
|
||||||
|
});
|
||||||
|
form.verify({
|
||||||
|
|
||||||
|
verifyname: [/^.{0,50}$/, '应用名称最大只允许输入50位字符'],
|
||||||
|
verifycode: [/^.{0,50}$/, '应用编码最大只允许输入50位字符'],
|
||||||
|
verifyclientId: [/^.{0,50}$/, '易联云应用id最大只允许输入50位字符'],
|
||||||
|
verifyclientSecret: [/^.{0,50}$/, '易联云应用密钥最大只允许输入50位字符'],
|
||||||
|
verifymachineCode: [/^.{0,50}$/, '易联云终端号最大只允许输入50位字符'],
|
||||||
|
verifymsign: [/^.{0,50}$/, '易联云终端密钥最大只允许输入50位字符'],
|
||||||
|
verifyprinterName: [/^.{0,50}$/, '打印机名称最大只允许输入50位字符'],
|
||||||
|
verifyphone: [/^.{0,50}$/, '联系电话最大只允许输入50位字符'],
|
||||||
|
verifyaccessToken: [/^.{0,50}$/, '访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存最大只允许输入50位字符'],
|
||||||
|
verifyrefreshToken: [/^.{0,50}$/, '更新access_token所需,有效时间35天最大只允许输入50位字符'],
|
||||||
|
});
|
||||||
|
//重载form
|
||||||
|
form.render(null, 'LAY-app-CoreCmsPrinter-createForm');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
</script>
|
||||||
189
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/details.html
Normal file
189
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/details.html
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||||
|
<table class="layui-table layui-form" lay-filter="LAY-app-CoreCmsPrinter-detailsForm" id="LAY-app-CoreCmsPrinter-detailsForm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="200">
|
||||||
|
<col>
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="id">序列</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.id || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="name">应用名称</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.name || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="code">应用编码</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.code || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="clientId">易联云应用id</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.clientId || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="clientSecret">易联云应用密钥</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.clientSecret || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="machineCode">易联云终端号</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.machineCode || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="msign">易联云终端密钥</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.msign || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="printerName">打印机名称</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.printerName || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="phone">联系电话</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.phone || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="accessToken">访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.accessToken || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="refreshToken">更新access_token所需,有效时间35天</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.refreshToken || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="expiresIn">令牌的有效时间,单位秒 (30天),注:该模式下可忽略此参数</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.expiresIn || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="expiressEndTime">有效期截止时间</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.expiressEndTime || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="parameters">其他参数</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.parameters || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="createTime">创建时间</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.createTime || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="isDefault">是否默认</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" disabled name="isDefault" value="{{d.params.data.model.isDefault}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isDefault" {{ d.params.data.model.isDefault ? 'checked' : '' }}>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="isOpen">是否开启</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" disabled name="isOpen" value="{{d.params.data.model.isOpen}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isOpen" {{ d.params.data.model.isOpen ? 'checked' : '' }}>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label for="storeId">绑定门店</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ d.params.data.model.storeId || '' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var debug = layui.setter.debug;
|
||||||
|
layui.data.done = function (d) {
|
||||||
|
//开启调试情况下获取接口赋值数据
|
||||||
|
if (debug) { console.log(d.params.data); }
|
||||||
|
|
||||||
|
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||||
|
var $ = layui.$
|
||||||
|
, setter = layui.setter
|
||||||
|
, admin = layui.admin
|
||||||
|
, coreHelper = layui.coreHelper
|
||||||
|
, form = layui.form;
|
||||||
|
form.render(null, 'LAY-app-CoreCmsPrinter-detailsForm');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
162
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/edit.html
Normal file
162
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/edit.html
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||||
|
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsPrinter-editForm" id="LAY-app-CoreCmsPrinter-editForm">
|
||||||
|
<input type="hidden" name="id" value="{{d.params.data.model.id || '' }}" />
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="code" class="layui-form-label layui-form-required">应用编码</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="code" lay-verify="required|verifycode">
|
||||||
|
{{# layui.each(d.params.data.thirdPartyEquipment, function(index, item){ }}
|
||||||
|
<option value="{{ item.title }}" {{ item.title== d.params.data.model.code ? 'selected="selected"' : '' }}>{{ item.title }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="name" class="layui-form-label layui-form-required">应用名称</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="name" lay-verify="required|verifyname">
|
||||||
|
{{# layui.each(d.params.data.thirdPartyEquipment, function(index, item){ }}
|
||||||
|
<option value="{{ item.description }}" {{ item.description== d.params.data.model.name ? 'selected="selected"' : '' }}>{{ item.description }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="clientId" class="layui-form-label layui-form-required">易联云应用id</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="clientId" lay-verType="tips" lay-verify="required|verifyclientId" class="layui-input" placeholder="请输入易联云应用id" lay-reqText="请输入易联云应用id" value="{{d.params.data.model.clientId || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
易联云自有应用Id
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="clientSecret" class="layui-form-label layui-form-required">易联云应用密钥</label>
|
||||||
|
<div class="layui-input-inline layui-inline-5">
|
||||||
|
<input name="clientSecret" lay-verType="tips" lay-verify="required|verifyclientSecret" class="layui-input" placeholder="请输入易联云应用密钥" lay-reqText="请输入易联云应用密钥" value="{{d.params.data.model.clientSecret || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
易联云自有应用密钥
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="machineCode" class="layui-form-label layui-form-required">易联云终端号</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="machineCode" lay-verType="tips" lay-verify="required|verifymachineCode" class="layui-input" placeholder="请输入易联云终端号" lay-reqText="请输入易联云终端号" value="{{d.params.data.model.machineCode || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
打印机背面终端号
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="msign" class="layui-form-label layui-form-required">易联云终端密钥</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="msign" lay-verType="tips" lay-verify="required|verifymsign" class="layui-input" placeholder="请输入易联云终端密钥" lay-reqText="请输入易联云终端密钥" value="{{d.params.data.model.msign || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
打印机背面密钥
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="printerName" class="layui-form-label layui-form-required">打印机名称</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="printerName" lay-verType="tips" lay-verify="required|verifyprinterName" class="layui-input" placeholder="请输入打印机名称" lay-reqText="请输入打印机名称" value="{{d.params.data.model.printerName || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
自定义打印机名称
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="phone" class="layui-form-label layui-form-required">联系电话</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input name="phone" lay-verType="tips" lay-verify="required|verifyphone" class="layui-input" placeholder="请输入联系电话" lay-reqText="请输入联系电话" value="{{d.params.data.model.phone || '' }}" />
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
联系电话
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="isDefault" class="layui-form-label layui-form-required">是否默认</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input type="checkbox" lay-filter="switch" name="isDefault" {{ d.params.data.model.isDefault ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-mid">
|
||||||
|
所有打印机只允许一个默认
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="isOpen" class="layui-form-label layui-form-required">是否开启</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<input type="checkbox" lay-filter="switch" name="isOpen" {{ d.params.data.model.isOpen ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="storeId" class="layui-form-label layui-form-required">绑定门店</label>
|
||||||
|
<div class="layui-input-inline layui-inline-4">
|
||||||
|
<select name="storeId" lay-verType="tips" lay-verify="required|number">
|
||||||
|
<option value="0" {{ 0== d.params.data.model.storeId ? 'selected="selected"' : '' }}>全局使用</option>
|
||||||
|
{{# layui.each(d.params.data.stores, function(index, item){ }}
|
||||||
|
<option value="{{ item.id }}" {{ item.id== d.params.data.model.storeId ? 'selected="selected"' : '' }}>{{ item.storeName }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item text-right core-hidden">
|
||||||
|
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsPrinter-editForm-submit" id="LAY-app-CoreCmsPrinter-editForm-submit" value="确认编辑">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
var debug = layui.setter.debug;
|
||||||
|
layui.data.sendParams = function (d) {
|
||||||
|
//开启调试情况下获取接口赋值数据
|
||||||
|
if (debug) { console.log(d.params.data); }
|
||||||
|
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||||
|
function () {
|
||||||
|
var $ = layui.$
|
||||||
|
, form = layui.form
|
||||||
|
, admin = layui.admin
|
||||||
|
, laydate = layui.laydate
|
||||||
|
, upload = layui.upload
|
||||||
|
, cropperImg = layui.cropperImg
|
||||||
|
, coreHelper = layui.coreHelper;
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#editTime-CoreCmsPrinter-expiressEndTime',
|
||||||
|
type: 'datetime'
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#editTime-CoreCmsPrinter-createTime',
|
||||||
|
type: 'datetime'
|
||||||
|
});
|
||||||
|
form.verify({
|
||||||
|
|
||||||
|
verifyname: [/^.{0,50}$/, '应用名称最大只允许输入50位字符'],
|
||||||
|
verifycode: [/^.{0,50}$/, '应用编码最大只允许输入50位字符'],
|
||||||
|
verifyclientId: [/^.{0,50}$/, '易联云应用id最大只允许输入50位字符'],
|
||||||
|
verifyclientSecret: [/^.{0,50}$/, '易联云应用密钥最大只允许输入50位字符'],
|
||||||
|
verifymachineCode: [/^.{0,50}$/, '易联云终端号最大只允许输入50位字符'],
|
||||||
|
verifymsign: [/^.{0,50}$/, '易联云终端密钥最大只允许输入50位字符'],
|
||||||
|
verifyprinterName: [/^.{0,50}$/, '打印机名称最大只允许输入50位字符'],
|
||||||
|
verifyphone: [/^.{0,50}$/, '联系电话最大只允许输入50位字符'],
|
||||||
|
verifyaccessToken: [/^.{0,50}$/, '访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存最大只允许输入50位字符'],
|
||||||
|
verifyrefreshToken: [/^.{0,50}$/, '更新access_token所需,有效时间35天最大只允许输入50位字符'],
|
||||||
|
});
|
||||||
|
//重载form
|
||||||
|
form.render(null, 'LAY-app-CoreCmsPrinter-editForm');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
</script>
|
||||||
392
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/index.html
Normal file
392
CoreCms.Net.Web.Admin/wwwroot/views/shop/printer/index.html
Normal file
@@ -0,0 +1,392 @@
|
|||||||
|
<title>打印机列表</title>
|
||||||
|
<!--当前位置开始-->
|
||||||
|
<div class="layui-card layadmin-header">
|
||||||
|
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||||
|
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--当前位置结束-->
|
||||||
|
<style>
|
||||||
|
/* 重写样式 */
|
||||||
|
</style>
|
||||||
|
<script type="text/html" template lay-type="Post" lay-url="Api/CoreCmsPrinter/GetIndex" lay-done="layui.data.done(d);">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<div class="table-body">
|
||||||
|
<table id="LAY-app-CoreCmsPrinter-tableBox" lay-filter="LAY-app-CoreCmsPrinter-tableBox"></table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/html" id="LAY-app-CoreCmsPrinter-toolbar">
|
||||||
|
<div class="layui-form coreshop-toolbar-search-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label" for="machineCode">易联云终端号</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="machineCode" placeholder="请输入易联云终端号" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label" for="printerName">打印机名称</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<input type="text" name="printerName" placeholder="请输入打印机名称" class="layui-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label" for="isDefault">是否默认</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="isDefault">
|
||||||
|
<option value="">请选择</option>
|
||||||
|
<option value="True">是</option>
|
||||||
|
<option value="False">否</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label" for="isOpen">是否开启</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="isOpen">
|
||||||
|
<option value="">请选择</option>
|
||||||
|
<option value="True">是</option>
|
||||||
|
<option value="False">否</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label" for="storeId">绑定门店</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="storeId" id="storeId">
|
||||||
|
<option value="">请选择绑定门店</option>
|
||||||
|
{{# layui.each(indexData.stores, function(index, item){ }}
|
||||||
|
<option value="{{ item.id }}">{{ item.storeName }}</option>
|
||||||
|
{{# }); }}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsPrinter-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" id="LAY-app-CoreCmsPrinter-pagebar">
|
||||||
|
<div class="layui-btn-container">
|
||||||
|
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/html" id="LAY-app-CoreCmsPrinter-tableBox-bar">
|
||||||
|
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||||
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="printTest">打印测试页</a>
|
||||||
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="refreshToken">刷新AccessToken</a>
|
||||||
|
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||||
|
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsPrinterTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||||
|
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsPrinterTbDelDrop{{d.LAY_INDEX}}"
|
||||||
|
style="max-width: 200px; white-space: normal; min-width: auto; margin-left: 10px;">
|
||||||
|
<div class="dropdown-anchor"></div>
|
||||||
|
<div class="dropdown-popconfirm-title">
|
||||||
|
<i class="layui-icon layui-icon-help"></i>
|
||||||
|
确定要删除吗?
|
||||||
|
</div>
|
||||||
|
<div class="dropdown-popconfirm-btn">
|
||||||
|
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||||
|
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var indexData;
|
||||||
|
var debug = layui.setter.debug;
|
||||||
|
layui.data.done = function (d) {
|
||||||
|
//开启调试情况下获取接口赋值数据
|
||||||
|
if (debug) { console.log(d); }
|
||||||
|
|
||||||
|
indexData = d.data;
|
||||||
|
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||||
|
function () {
|
||||||
|
var $ = layui.$
|
||||||
|
, admin = layui.admin
|
||||||
|
, table = layui.table
|
||||||
|
, form = layui.form
|
||||||
|
, laydate = layui.laydate
|
||||||
|
, setter = layui.setter
|
||||||
|
, coreHelper = layui.coreHelper
|
||||||
|
, util = layui.util
|
||||||
|
, view = layui.view;
|
||||||
|
|
||||||
|
var searchwhere;
|
||||||
|
//监听搜索
|
||||||
|
form.on('submit(LAY-app-CoreCmsPrinter-search)',
|
||||||
|
function (data) {
|
||||||
|
var field = data.field;
|
||||||
|
searchwhere = field;
|
||||||
|
//执行重载
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox', { where: field });
|
||||||
|
});
|
||||||
|
//数据绑定
|
||||||
|
table.render({
|
||||||
|
elem: '#LAY-app-CoreCmsPrinter-tableBox',
|
||||||
|
url: layui.setter.apiUrl + 'Api/CoreCmsPrinter/GetPageList',
|
||||||
|
method: 'POST',
|
||||||
|
toolbar: '#LAY-app-CoreCmsPrinter-toolbar',
|
||||||
|
pagebar: '#LAY-app-CoreCmsPrinter-pagebar',
|
||||||
|
className: 'pagebarbox',
|
||||||
|
defaultToolbar: ['filter', 'print', 'exports'],
|
||||||
|
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||||
|
page: true,
|
||||||
|
limit: 30,
|
||||||
|
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||||
|
text: { none: '暂无相关数据' },
|
||||||
|
cols: [
|
||||||
|
[
|
||||||
|
{ type: "checkbox", fixed: "left" },
|
||||||
|
{ field: 'id', title: '序列', width: 40, sort: false },
|
||||||
|
{ field: 'name', title: '应用名称', sort: false, width: 105 },
|
||||||
|
{ field: 'code', title: '应用编码', sort: false, width: 85 },
|
||||||
|
{ field: 'clientId', title: '易联云应用id', sort: false, width: 90 },
|
||||||
|
{ field: 'clientSecret', title: '易联云应用密钥', sort: false },
|
||||||
|
{ field: 'machineCode', title: '易联云终端号', sort: false, width: 105 },
|
||||||
|
{ field: 'msign', title: '易联云终端密钥', sort: false, width: 105 },
|
||||||
|
{ field: 'printerName', title: '打印机名称', sort: false, width: 105 },
|
||||||
|
{ field: 'phone', title: '联系电话', sort: false, width: 95 },
|
||||||
|
{ field: 'accessToken', title: '访问令牌', sort: false },
|
||||||
|
{ field: 'refreshToken', title: '更新access_token所需', sort: false },
|
||||||
|
//{ field: 'expiresIn', title: '令牌的有效时间', sort: false, width: 105 },
|
||||||
|
{ field: 'expiressEndTime', title: '有效期截止时间', width: 130, sort: false },
|
||||||
|
//{ field: 'parameters', title: '其他参数', sort: false, width: 105 },
|
||||||
|
{ field: 'createTime', title: '创建时间', width: 130, sort: false },
|
||||||
|
{ field: 'isDefault', title: '是否默认', width: 95, templet: '#switch_isDefault', sort: false, unresize: true },
|
||||||
|
{ field: 'isOpen', title: '是否开启', width: 95, templet: '#switch_isOpen', sort: false, unresize: true },
|
||||||
|
{
|
||||||
|
field: 'storeId', title: '绑定门店', sort: false, width: 105, templet: function (data) {
|
||||||
|
for (var i = 0; i < d.data.stores.length; i++) {
|
||||||
|
if (data.storeId == d.data.stores[i].id) {
|
||||||
|
return d.data.stores[i].storeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ width: 352, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsPrinter-tableBox-bar' }
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
//监听排序事件
|
||||||
|
table.on('sort(LAY-app-CoreCmsPrinter-tableBox)', function (obj) {
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox', {
|
||||||
|
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||||
|
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||||
|
orderField: obj.field, //排序字段
|
||||||
|
orderDirection: obj.type //排序方式
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//监听行双击事件
|
||||||
|
table.on('rowDouble(LAY-app-CoreCmsPrinter-tableBox)', function (obj) {
|
||||||
|
//查看详情
|
||||||
|
doDetails(obj);
|
||||||
|
});
|
||||||
|
//头工具栏事件
|
||||||
|
table.on('pagebar(LAY-app-CoreCmsPrinter-tableBox)', function (obj) {
|
||||||
|
var checkStatus = table.checkStatus(obj.config.id);
|
||||||
|
switch (obj.event) {
|
||||||
|
case 'addData':
|
||||||
|
doCreate();
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
//监听工具条
|
||||||
|
table.on('tool(LAY-app-CoreCmsPrinter-tableBox)',
|
||||||
|
function (obj) {
|
||||||
|
if (obj.event === 'detail') {
|
||||||
|
doDetails(obj);
|
||||||
|
} else if (obj.event === 'del') {
|
||||||
|
doDelete(obj);
|
||||||
|
} else if (obj.event === 'edit') {
|
||||||
|
doEdit(obj)
|
||||||
|
} else if (obj.event === 'printTest') {
|
||||||
|
doPrintTest(obj)
|
||||||
|
} else if (obj.event === 'refreshToken') {
|
||||||
|
doRefreshToken(obj)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//执行创建操作
|
||||||
|
function doCreate() {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/GetCreate", null, function (e) {
|
||||||
|
if (e.code === 0) {
|
||||||
|
admin.popup({
|
||||||
|
shadeClose: false,
|
||||||
|
title: '创建数据',
|
||||||
|
area: ['600px', '90%'],
|
||||||
|
id: 'LAY-popup-CoreCmsPrinter-create',
|
||||||
|
success: function (layero, index) {
|
||||||
|
view(this.id).render('shop/printer/create', { data: e.data }).done(function () {
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(LAY-app-CoreCmsPrinter-createForm-submit)',
|
||||||
|
function (data) {
|
||||||
|
var field = data.field; //获取提交的字段
|
||||||
|
|
||||||
|
field.isDefault = field.isDefault == 'on';
|
||||||
|
field.isOpen = field.isOpen == 'on';
|
||||||
|
|
||||||
|
if (debug) { console.log(field); } //开启调试返回数据
|
||||||
|
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoCreate", field, function (e) {
|
||||||
|
console.log(e)
|
||||||
|
if (e.code === 0) {
|
||||||
|
layui.table.reloadData('LAY-app-CoreCmsPrinter-tableBox'); //重载表格
|
||||||
|
layer.close(index); //再执行关闭
|
||||||
|
layer.msg(e.msg);
|
||||||
|
} else {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// 禁止弹窗出现滚动条
|
||||||
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||||
|
}
|
||||||
|
, btn: ['确定', '取消']
|
||||||
|
, yes: function (index, layero) {
|
||||||
|
layero.contents().find("#LAY-app-CoreCmsPrinter-createForm-submit").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//执行编辑操作
|
||||||
|
function doEdit(obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/GetEdit", { id: obj.data.id }, function (e) {
|
||||||
|
if (e.code === 0) {
|
||||||
|
admin.popup({
|
||||||
|
shadeClose: false,
|
||||||
|
title: '编辑数据',
|
||||||
|
area: ['600px', '90%'],
|
||||||
|
id: 'LAY-popup-CoreCmsPrinter-edit',
|
||||||
|
success: function (layero, index) {
|
||||||
|
view(this.id).render('shop/printer/edit', { data: e.data }).done(function () {
|
||||||
|
//监听提交
|
||||||
|
form.on('submit(LAY-app-CoreCmsPrinter-editForm-submit)',
|
||||||
|
function (data) {
|
||||||
|
var field = data.field; //获取提交的字段
|
||||||
|
|
||||||
|
field.isDefault = field.isDefault == 'on';
|
||||||
|
field.isOpen = field.isOpen == 'on';
|
||||||
|
|
||||||
|
if (debug) { console.log(field); } //开启调试返回数据
|
||||||
|
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoEdit", field, function (e) {
|
||||||
|
console.log(e)
|
||||||
|
if (e.code === 0) {
|
||||||
|
layui.table.reloadData('LAY-app-CoreCmsPrinter-tableBox'); //重载表格
|
||||||
|
layer.close(index); //再执行关闭
|
||||||
|
layer.msg(e.msg);
|
||||||
|
} else {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
// 禁止弹窗出现滚动条
|
||||||
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||||
|
}
|
||||||
|
, btn: ['确定', '取消']
|
||||||
|
, yes: function (index, layero) {
|
||||||
|
layero.contents().find("#LAY-app-CoreCmsPrinter-editForm-submit").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//执行预览操作
|
||||||
|
function doDetails(obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/GetDetails", { id: obj.data.id }, function (e) {
|
||||||
|
if (e.code === 0) {
|
||||||
|
admin.popup({
|
||||||
|
shadeClose: false,
|
||||||
|
title: '查看详情',
|
||||||
|
area: ['600px', '90%'],
|
||||||
|
id: 'LAY-popup-CoreCmsPrinter-details',
|
||||||
|
success: function (layero, index) {
|
||||||
|
view(this.id).render('shop/printer/details', { data: e.data }).done(function () {
|
||||||
|
form.render();
|
||||||
|
});
|
||||||
|
// 禁止弹窗出现滚动条
|
||||||
|
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
layer.msg(e.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//执行单个删除
|
||||||
|
function doDelete(obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoDelete", { id: obj.data.id }, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox');
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//打印测试页
|
||||||
|
function doPrintTest(obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoPrintTest", { id: obj.data.id }, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox');
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//刷新token
|
||||||
|
function doRefreshToken(obj) {
|
||||||
|
layer.confirm('确定刷新吗?一天最多20次请求accessToken哦。将影响同一个应用下所有机器哦。', function (index) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoRefreshToken", { id: obj.data.id }, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox');
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//监听 表格复选框操作
|
||||||
|
|
||||||
|
layui.form.on('switch(switch_isDefault)', function (obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoSetisDefault", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox');
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
layui.form.on('switch(switch_isOpen)', function (obj) {
|
||||||
|
coreHelper.Post("Api/CoreCmsPrinter/DoSetisOpen", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||||
|
if (debug) { console.log(e); } //开启调试返回数据
|
||||||
|
table.reloadData('LAY-app-CoreCmsPrinter-tableBox');
|
||||||
|
layer.msg(e.msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//重载form
|
||||||
|
form.render();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--设置是否默认-->
|
||||||
|
<script type="text/html" id="switch_isDefault">
|
||||||
|
<input type="checkbox" name="switch_isDefault" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDefault" {{ d.isDefault ? 'checked' : '' }}>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!--设置是否开启-->
|
||||||
|
<script type="text/html" id="switch_isOpen">
|
||||||
|
<input type="checkbox" name="switch_isOpen" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isOpen" {{ d.isOpen ? 'checked' : '' }}>
|
||||||
|
</script>
|
||||||
|
|
||||||
@@ -64,7 +64,6 @@
|
|||||||
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
<PackageReference Include="Nito.AsyncEx" Version="5.1.2" />
|
||||||
<PackageReference Include="NLog" Version="4.7.15" />
|
<PackageReference Include="NLog" Version="4.7.15" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
||||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
|
||||||
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
|
||||||
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
|
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
|
||||||
<PackageReference Include="Tencent.QCloud.Cos.Sdk" Version="5.4.31" />
|
<PackageReference Include="Tencent.QCloud.Cos.Sdk" Version="5.4.31" />
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Autofac;
|
using Autofac;
|
||||||
using AutoMapper;
|
|
||||||
using CoreCms.Net.Auth;
|
using CoreCms.Net.Auth;
|
||||||
using CoreCms.Net.Configuration;
|
using CoreCms.Net.Configuration;
|
||||||
using CoreCms.Net.Core.AutoFac;
|
using CoreCms.Net.Core.AutoFac;
|
||||||
@@ -12,7 +11,6 @@ using CoreCms.Net.Swagger;
|
|||||||
using CoreCms.Net.Task;
|
using CoreCms.Net.Task;
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Hangfire.Dashboard.BasicAuthorization;
|
using Hangfire.Dashboard.BasicAuthorization;
|
||||||
using InitQ;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@@ -24,12 +22,8 @@ using Microsoft.Extensions.Hosting;
|
|||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using Qc.YilianyunSdk;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CoreCms.Net.RedisMQ.Subscribe;
|
|
||||||
using CoreCms.Net.Utility.Extensions;
|
|
||||||
using CoreCms.Net.WeChat.Service.Mediator;
|
using CoreCms.Net.WeChat.Service.Mediator;
|
||||||
using Essensoft.Paylink.Alipay;
|
using Essensoft.Paylink.Alipay;
|
||||||
using Essensoft.Paylink.WeChatPay;
|
using Essensoft.Paylink.WeChatPay;
|
||||||
@@ -80,12 +74,12 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
//<2F><><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>CORS<52><53>
|
//<2F><><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>CORS<52><53>
|
||||||
services.AddCorsSetup();
|
services.AddCorsSetup();
|
||||||
|
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD>session֧<6E><D6A7>(session<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cache<68><65><EFBFBD>д洢)
|
//<2F><><EFBFBD><EFBFBD>session֧<6E><D6A7>(session<6F><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cache<68><65><EFBFBD>д洢)
|
||||||
services.AddSession();
|
services.AddSession();
|
||||||
// AutoMapper֧<72><D6A7>
|
// AutoMapper֧<72><D6A7>
|
||||||
services.AddAutoMapper(typeof(AutoMapperConfiguration));
|
services.AddAutoMapper(typeof(AutoMapperConfiguration));
|
||||||
|
|
||||||
|
|
||||||
//MediatR<74><52>ֻ<EFBFBD><D6BB>Ҫע<D2AA><D7A2>һ<EFBFBD><D2BB>,ͬ<><CDAC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾Ͳ<C2BE><CDB2><EFBFBD>Ҫע<D2AA><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//MediatR<74><52>ֻ<EFBFBD><D6BB>Ҫע<D2AA><D7A2>һ<EFBFBD><D2BB>,ͬ<><CDAC>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾Ͳ<C2BE><CDB2><EFBFBD>Ҫע<D2AA><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
services.AddMediatR(typeof(TextMessageEventCommand).Assembly);
|
services.AddMediatR(typeof(TextMessageEventCommand).Assembly);
|
||||||
|
|
||||||
@@ -104,6 +98,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
services.Configure<AlipayOptions>(Configuration.GetSection("Alipay"));
|
services.Configure<AlipayOptions>(Configuration.GetSection("Alipay"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ע<><D7A2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Žӿ<C5BD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
//ע<><D7A2><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>Žӿ<C5BD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||||
services.Configure<WeChat.Service.Options.WeChatOptions>(Configuration.GetSection(nameof(WeChat.Service.Options.WeChatOptions)));
|
services.Configure<WeChat.Service.Options.WeChatOptions>(Configuration.GetSection(nameof(WeChat.Service.Options.WeChatOptions)));
|
||||||
|
|
||||||
@@ -117,13 +112,9 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
//Swagger<65>ӿ<EFBFBD><D3BF>ĵ<EFBFBD>ע<EFBFBD><D7A2>
|
//Swagger<65>ӿ<EFBFBD><D3BF>ĵ<EFBFBD>ע<EFBFBD><D7A2>
|
||||||
services.AddClientSwaggerSetup();
|
services.AddClientSwaggerSetup();
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴ<EFBFBD>ӡ<EFBFBD><D3A1>
|
|
||||||
services.AddYiLianYunSetup();
|
|
||||||
|
|
||||||
//ע<><D7A2>Hangfire<72><65>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
//ע<><D7A2>Hangfire<72><65>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||||
services.AddHangFireSetup();
|
services.AddHangFireSetup();
|
||||||
|
|
||||||
|
|
||||||
//<2F><>Ȩ֧<C8A8><D6A7>ע<EFBFBD><D7A2>
|
//<2F><>Ȩ֧<C8A8><D6A7>ע<EFBFBD><D7A2>
|
||||||
services.AddAuthorizationSetupForClient();
|
services.AddAuthorizationSetupForClient();
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
|
||||||
@@ -144,7 +135,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
})
|
})
|
||||||
.AddNewtonsoftJson(p =>
|
.AddNewtonsoftJson(p =>
|
||||||
{
|
{
|
||||||
//<2F><><EFBFBD>ݸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ĸСд <20><>ʹ<EFBFBD><CAB9><EFBFBD>շ<EFBFBD>
|
//<2F><><EFBFBD>ݸ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ĸСд <20><>ʹ<EFBFBD>ô<EFBFBD><EFBFBD>շ<EFBFBD>
|
||||||
p.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
p.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
|
||||||
//<2F><>ʹ<EFBFBD><CAB9><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>ʽ<EFBFBD><CABD>key
|
//<2F><>ʹ<EFBFBD><CAB9><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>ʽ<EFBFBD><CABD>key
|
||||||
//p.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
//p.SerializerSettings.ContractResolver = new DefaultContractResolver();
|
||||||
@@ -154,6 +145,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
p.SerializerSettings.DateFormatString = "yyyy/MM/dd HH:mm:ss";
|
p.SerializerSettings.DateFormatString = "yyyy/MM/dd HH:mm:ss";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ѩ<><D1A9>Ư<EFBFBD><C6AF><EFBFBD>㷨
|
// ѩ<><D1A9>Ư<EFBFBD><C6AF><EFBFBD>㷨
|
||||||
// <20><><EFBFBD><EFBFBD> IdGeneratorOptions <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkerId<49><64>
|
// <20><><EFBFBD><EFBFBD> IdGeneratorOptions <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ<EFBFBD><DAB9>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WorkerId<49><64>
|
||||||
var options = new IdGeneratorOptions(1);
|
var options = new IdGeneratorOptions(1);
|
||||||
@@ -193,7 +185,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
/// <param name="env"></param>
|
/// <param name="env"></param>
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ubuntu Nginx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD>ȡIP<EFBFBD><EFBFBD><EFBFBD>⣨<EFBFBD><EFBFBD>
|
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ubuntu Nginx <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD>ȡIP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||||
{
|
{
|
||||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||||
@@ -256,10 +248,7 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
{
|
{
|
||||||
filter
|
filter
|
||||||
},
|
},
|
||||||
IsReadOnlyFunc = Context =>
|
IsReadOnlyFunc = _ => false
|
||||||
{
|
|
||||||
return false;//<2F>Ƿ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
app.UseHangfireDashboard("/job", options); //<2F><><EFBFBD>Ըı<D4B8>Dashboard<72><64>url
|
app.UseHangfireDashboard("/job", options); //<2F><><EFBFBD>Ըı<D4B8>Dashboard<72><64>url
|
||||||
@@ -267,9 +256,6 @@ namespace CoreCms.Net.Web.WebApi
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//ʹ<><CAB9> Session
|
//ʹ<><CAB9> Session
|
||||||
app.UseSession();
|
app.UseSession();
|
||||||
|
|
||||||
|
|||||||
@@ -130,23 +130,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
//易联云打印机设置【很不错的一个网络打印机,价格也很便宜https://www.yilianyun.net/】
|
|
||||||
"YiLianYunConfig": {
|
|
||||||
//是否开启
|
|
||||||
"Enabled": false,
|
|
||||||
//应用id
|
|
||||||
"ClientId": "",
|
|
||||||
//应用密钥 string
|
|
||||||
"ClientSecret": "",
|
|
||||||
//打印机设备号
|
|
||||||
"MachineCode": "",
|
|
||||||
//打印机终端密钥
|
|
||||||
"Msign": "",
|
|
||||||
//打印机名称
|
|
||||||
"PrinterName": "",
|
|
||||||
//打印机设置联系电话
|
|
||||||
"Phone": ""
|
|
||||||
},
|
|
||||||
// 微信支付
|
// 微信支付
|
||||||
// 更多配置,请查看WeChatPayOptions类
|
// 更多配置,请查看WeChatPayOptions类
|
||||||
"WeChatPay": {
|
"WeChatPay": {
|
||||||
|
|||||||
1
数据库/MySql/20220917/升级脚本/1、修改签到字段类型.sql
Normal file
1
数据库/MySql/20220917/升级脚本/1、修改签到字段类型.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
alter table CoreCmsUserCheckInDetails modify column checkInData date comment '打卡日期';
|
||||||
36
数据库/MySql/20220917/升级脚本/2、创建表CoreCmsPrinter.sql
Normal file
36
数据库/MySql/20220917/升级脚本/2、创建表CoreCmsPrinter.sql
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for CoreCmsPrinter
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `CoreCmsPrinter`;
|
||||||
|
CREATE TABLE `CoreCmsPrinter` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '序列',
|
||||||
|
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用名称',
|
||||||
|
`code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '应用编码',
|
||||||
|
`clientId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '易联云应用id',
|
||||||
|
`clientSecret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '易联云应用密钥',
|
||||||
|
`machineCode` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '易联云终端号',
|
||||||
|
`msign` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '易联云终端密钥',
|
||||||
|
`printerName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '打印机名称',
|
||||||
|
`phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '联系电话',
|
||||||
|
`accessToken` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '访问令牌,API调用时需要,令牌可以重复使用无失效时间,请开发者全局保存',
|
||||||
|
`refreshToken` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新access_token所需,有效时间35天',
|
||||||
|
`expiresIn` int(11) NULL DEFAULT NULL COMMENT '令牌的有效时间,单位秒 (30天),注:该模式下可忽略此参数',
|
||||||
|
`expiressEndTime` datetime(0) NULL DEFAULT NULL COMMENT '有效期截止时间',
|
||||||
|
`parameters` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '其他参数',
|
||||||
|
`createTime` datetime(0) NOT NULL COMMENT '创建时间',
|
||||||
|
`isDefault` bit(4) NOT NULL COMMENT '是否默认',
|
||||||
|
`isOpen` bit(4) NOT NULL COMMENT '是否开启',
|
||||||
|
`storeId` int(11) NOT NULL COMMENT '绑定门店',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '打印机列表' ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Records of CoreCmsPrinter
|
||||||
|
-- ----------------------------
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
BIN
数据库/MySql/20220917/完整脚本/Navicat导出脚本.rar
Normal file
BIN
数据库/MySql/20220917/完整脚本/Navicat导出脚本.rar
Normal file
Binary file not shown.
@@ -1,3 +1,7 @@
|
|||||||
|
2022-09-19
|
||||||
|
【新增】表【CoreCmsPrinter】打印机列表表。
|
||||||
|
【调整】表【CoreCmsUserCheckInDetails】字段【checkInData】数据类型为date。
|
||||||
|
|
||||||
2022-08-19
|
2022-08-19
|
||||||
【调整】表【CoreCmsSms】调整【mobile】字段长度。
|
【调整】表【CoreCmsSms】调整【mobile】字段长度。
|
||||||
|
|
||||||
|
|||||||
104
数据库/SqlServer/20220917/升级脚本/升级脚本-创建表CoreCmsPrinter.sql
Normal file
104
数据库/SqlServer/20220917/升级脚本/升级脚本-创建表CoreCmsPrinter.sql
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
|
||||||
|
/****** Object: Table [dbo].[CoreCmsPrinter] Script Date: 2022/9/17 2:15:13 ******/
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[CoreCmsPrinter](
|
||||||
|
[id] [int] IDENTITY(1,1) NOT NULL,
|
||||||
|
[name] [nvarchar](50) NOT NULL,
|
||||||
|
[code] [nvarchar](50) NOT NULL,
|
||||||
|
[clientId] [nvarchar](50) NOT NULL,
|
||||||
|
[clientSecret] [nvarchar](50) NOT NULL,
|
||||||
|
[machineCode] [nvarchar](50) NOT NULL,
|
||||||
|
[msign] [nvarchar](50) NOT NULL,
|
||||||
|
[printerName] [nvarchar](50) NOT NULL,
|
||||||
|
[phone] [nvarchar](50) NOT NULL,
|
||||||
|
[accessToken] [nvarchar](50) NULL,
|
||||||
|
[refreshToken] [nvarchar](50) NULL,
|
||||||
|
[expiresIn] [int] NULL,
|
||||||
|
[expiressEndTime] [datetime] NULL,
|
||||||
|
[parameters] [nvarchar](max) NULL,
|
||||||
|
[createTime] [datetime] NOT NULL,
|
||||||
|
[isDefault] [bit] NOT NULL,
|
||||||
|
[isOpen] [bit] NOT NULL,
|
||||||
|
[storeId] [int] NOT NULL,
|
||||||
|
CONSTRAINT [PK_CoreCmsPrinter] PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[id] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[CoreCmsPrinter] ADD CONSTRAINT [DF_CoreCmsPrinter_expiresIn] DEFAULT ((0)) FOR [expiresIn]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[CoreCmsPrinter] ADD CONSTRAINT [DF_CoreCmsPrinter_isDefault] DEFAULT ((0)) FOR [isDefault]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[CoreCmsPrinter] ADD CONSTRAINT [DF_CoreCmsPrinter_isOpen] DEFAULT ((0)) FOR [isOpen]
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE [dbo].[CoreCmsPrinter] ADD CONSTRAINT [DF_CoreCmsPrinter_storeId] DEFAULT ((0)) FOR [storeId]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'id'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'name'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ӧ<EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'code'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'clientId'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'clientSecret'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն˺<EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'machineCode'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><EFBFBD><EFBFBD>Կ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'msign'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ӡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'printerName'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ϵ<EFBFBD>绰' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'phone'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>API<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧЧʱ<EFBFBD>䣬<EFBFBD>뿪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'accessToken'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>access_token<EFBFBD><EFBFBD><EFBFBD>裬<EFBFBD><EFBFBD>Чʱ<EFBFBD><EFBFBD>35<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'refreshToken'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>Чʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD> (30<33><30>),ע<><D7A2><EFBFBD><EFBFBD>ģʽ<C4A3>¿ɺ<C2BF><C9BA>Դ˲<D4B4><CBB2><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'expiresIn'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>Ч<EFBFBD>ڽ<EFBFBD>ֹʱ<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'expiressEndTime'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'parameters'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'createTime'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD>Ƿ<EFBFBD>Ĭ<EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'isDefault'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'isOpen'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter', @level2type=N'COLUMN',@level2name=N'storeId'
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD>ӡ<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'CoreCmsPrinter'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
BIN
数据库/SqlServer/20220917/完整数据库/完整bak文件.rar
Normal file
BIN
数据库/SqlServer/20220917/完整数据库/完整bak文件.rar
Normal file
Binary file not shown.
BIN
数据库/SqlServer/20220917/完整数据库/完整脚本.rar
Normal file
BIN
数据库/SqlServer/20220917/完整数据库/完整脚本.rar
Normal file
Binary file not shown.
@@ -1,3 +1,6 @@
|
|||||||
|
2022-09-19
|
||||||
|
【新增】表【CoreCmsPrinter】打印机列表表
|
||||||
|
|
||||||
2022-08-19
|
2022-08-19
|
||||||
【调整】表【CoreCmsSms】调整【mobile】字段长度。
|
【调整】表【CoreCmsSms】调整【mobile】字段长度。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user