OEM 增加提现记录 申请 审核
No files matched your search
@@ -1,10 +1,14 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36221.1 d17.14
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.9.12105.275 stable
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KJD_WebService", "KJD_WebService\KJD_WebService.csproj", "{A6C03FE1-142A-4C97-99A9-67FD915836B6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".test", ".test", "{AA240C1D-D687-4BC5-A195-4FA708BC7568}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServiceTest", "test\WebServiceTest\WebServiceTest.csproj", "{348EB476-1813-419E-910F-0D27E58B3D19}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -15,10 +19,17 @@ Global
|
||||
{A6C03FE1-142A-4C97-99A9-67FD915836B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A6C03FE1-142A-4C97-99A9-67FD915836B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A6C03FE1-142A-4C97-99A9-67FD915836B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{348EB476-1813-419E-910F-0D27E58B3D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{348EB476-1813-419E-910F-0D27E58B3D19}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{348EB476-1813-419E-910F-0D27E58B3D19}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{348EB476-1813-419E-910F-0D27E58B3D19}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{348EB476-1813-419E-910F-0D27E58B3D19} = {AA240C1D-D687-4BC5-A195-4FA708BC7568}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {373F414C-6CDF-49C0-B074-A7D07D7B82B7}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL
|
||||
{
|
||||
public class ImageService
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 接收Base64图片并保存
|
||||
/// </summary>
|
||||
public static string SaveBase64Image(string base64String, string fileName = "", int maxsize = 5 * 1024 * 1024)
|
||||
{
|
||||
string savePath = string.Empty;
|
||||
// 1. 验证请求
|
||||
if (string.IsNullOrWhiteSpace(base64String))
|
||||
return savePath;
|
||||
|
||||
try
|
||||
{
|
||||
// 2. 处理Base64字符串(去除可能的前缀)
|
||||
// 如果包含 data:image/xxx;base64, 前缀则去掉
|
||||
if (base64String.Contains(","))
|
||||
{
|
||||
base64String = base64String.Substring(base64String.IndexOf(",") + 1);
|
||||
}
|
||||
|
||||
// 3. 转换为字节数组
|
||||
byte[] imageBytes = Convert.FromBase64String(base64String);
|
||||
|
||||
// 4. 验证图片格式(可选)
|
||||
if (!IsValidImage(imageBytes))
|
||||
return savePath;
|
||||
|
||||
// 5. 检查大小(限制5MB)
|
||||
if (imageBytes.Length > maxsize)
|
||||
return savePath;
|
||||
|
||||
// 6. 生成文件名并保存
|
||||
string extension = GetImageExtension(imageBytes);
|
||||
if (string.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = $"{DateTime.Now:yyyyMMdd_HHmmss}_{Guid.NewGuid():N}";
|
||||
}
|
||||
fileName += extension;
|
||||
string RelativePath = Path.Combine("upload");
|
||||
string uploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RelativePath);
|
||||
|
||||
if (!Directory.Exists(uploadFolder))
|
||||
Directory.CreateDirectory(uploadFolder);
|
||||
|
||||
string filePath = Path.Combine(uploadFolder, fileName);
|
||||
File.WriteAllBytes(filePath, imageBytes);
|
||||
savePath = "/" + Path.Combine(RelativePath, fileName).Replace("\\", "/");
|
||||
// 7. 返回
|
||||
return savePath;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return savePath;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return savePath;
|
||||
}
|
||||
}
|
||||
public static bool IsValidImage(string base64String)
|
||||
{
|
||||
if (string.IsNullOrEmpty(base64String)) return false;
|
||||
byte[] imageBytes = Convert.FromBase64String(base64String);
|
||||
return IsValidImage(imageBytes);
|
||||
}
|
||||
/// <summary>
|
||||
/// 验证图片格式(检查文件头魔数)
|
||||
/// </summary>
|
||||
private static bool IsValidImage(byte[] bytes)
|
||||
{
|
||||
if (bytes.Length < 8) return false;
|
||||
|
||||
// JPEG: FF D8 FF
|
||||
if (bytes[0] == 0xFF && bytes[1] == 0xD8 && bytes[2] == 0xFF)
|
||||
return true;
|
||||
|
||||
// PNG: 89 50 4E 47
|
||||
if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47)
|
||||
return true;
|
||||
|
||||
// GIF: 47 49 46 38
|
||||
if (bytes[0] == 0x47 && bytes[1] == 0x49 && bytes[2] == 0x46 && bytes[3] == 0x38)
|
||||
return true;
|
||||
|
||||
// BMP: 42 4D
|
||||
if (bytes[0] == 0x42 && bytes[1] == 0x4D)
|
||||
return true;
|
||||
|
||||
// WebP: 52 49 46 46
|
||||
if (bytes[0] == 0x52 && bytes[1] == 0x49 && bytes[2] == 0x46 && bytes[3] == 0x46)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据文件头获取扩展名
|
||||
/// </summary>
|
||||
private static string GetImageExtension(byte[] bytes)
|
||||
{
|
||||
if (bytes.Length < 4) return ".jpg";
|
||||
|
||||
if (bytes[0] == 0xFF && bytes[1] == 0xD8 && bytes[2] == 0xFF)
|
||||
return ".jpg";
|
||||
if (bytes[0] == 0x89 && bytes[1] == 0x50 && bytes[2] == 0x4E && bytes[3] == 0x47)
|
||||
return ".png";
|
||||
if (bytes[0] == 0x47 && bytes[1] == 0x49 && bytes[2] == 0x46 && bytes[3] == 0x38)
|
||||
return ".gif";
|
||||
if (bytes[0] == 0x42 && bytes[1] == 0x4D)
|
||||
return ".bmp";
|
||||
if (bytes[0] == 0x52 && bytes[1] == 0x49 && bytes[2] == 0x46 && bytes[3] == 0x46)
|
||||
return ".webp";
|
||||
|
||||
return ".jpg"; // 默认
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL.WXXD.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// 提现状态:0待审核 1审核通过 2审核拒绝 3打款中 4已打款 5打款失败 6已取消
|
||||
/// </summary>
|
||||
public enum OemWithdrawalStatus
|
||||
{
|
||||
Pending = 0, //待审核
|
||||
Approved = 1, //审核通过
|
||||
Rejected = 2, //审核拒绝
|
||||
Paying = 3, //打款中
|
||||
Paid = 4, //已打款
|
||||
PayFailed = 5, //打款失败
|
||||
Cancelled = 6, //已取消
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OEM 提现记录 DTO
|
||||
/// </summary>
|
||||
public class OemWithdrawalDto
|
||||
{
|
||||
/// <summary>提现单号(业务唯一号)</summary>
|
||||
public string withdrawal_no { get; set; }
|
||||
/// <summary>关联oem_id</summary>
|
||||
public string oem_id { get; set; }
|
||||
/// <summary>贴牌名称</summary>
|
||||
public string oem_name { get; set; }
|
||||
/// <summary>发起提现的用户/商户ID</summary>
|
||||
public string apply_user_name { get; set; }
|
||||
|
||||
/// <summary>申请提现金额(分)</summary>
|
||||
public long amount { get; set; }
|
||||
/// <summary>手续费(分)</summary>
|
||||
public long fee { get; set; }
|
||||
/// <summary>实际到账金额(分) = amount - fee</summary>
|
||||
public long actual_amount { get; set; }
|
||||
/// <summary>提现前余额快照(分)</summary>
|
||||
public long balance_before { get; set; }
|
||||
/// <summary>提现后余额快照(分)</summary>
|
||||
public long balance_after { get; set; }
|
||||
|
||||
/// <summary>提现方式:1银行卡 2支付宝 3微信 4其他</summary>
|
||||
public int withdrawal_type { get; set; }
|
||||
/// <summary>提现方式名称</summary>
|
||||
public string withdrawal_type_string { get; set; }
|
||||
|
||||
/// <summary>收款人姓名</summary>
|
||||
public string account_name { get; set; }
|
||||
/// <summary>收款账号(卡号/账号)</summary>
|
||||
public string account_no { get; set; }
|
||||
/// <summary>开户行</summary>
|
||||
public string bank_name { get; set; }
|
||||
/// <summary>开户支行</summary>
|
||||
public string bank_branch { get; set; }
|
||||
|
||||
/// <summary>状态:0待审核 1审核通过 2审核拒绝 3打款中 4已打款 5打款失败 6已取消</summary>
|
||||
public int status { get; set; }
|
||||
/// <summary>状态名称</summary>
|
||||
public string status_string { get; set; }
|
||||
|
||||
/// <summary>审核人ID</summary>
|
||||
public string audit_by { get; set; }
|
||||
/// <summary>审核时间</summary>
|
||||
public DateTime? audit_time { get; set; }
|
||||
/// <summary>审核备注/拒绝原因</summary>
|
||||
public string audit_remark { get; set; }
|
||||
|
||||
/// <summary>打款成功时间</summary>
|
||||
public DateTime? pay_time { get; set; }
|
||||
/// <summary>打款渠道/支付流水来源</summary>
|
||||
public string pay_channel { get; set; }
|
||||
/// <summary>第三方打款流水号</summary>
|
||||
public string pay_trade_no { get; set; }
|
||||
/// <summary>打款失败原因</summary>
|
||||
public string fail_reason { get; set; }
|
||||
|
||||
/// <summary>备注</summary>
|
||||
public string remark { get; set; }
|
||||
/// <summary>发起提现时的客户端IP</summary>
|
||||
public string client_ip { get; set; }
|
||||
|
||||
/// <summary>创建时间</summary>
|
||||
public DateTime created_at { get; set; }
|
||||
/// <summary>更新时间</summary>
|
||||
public DateTime updated_at { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OEM 提现记录分页结果
|
||||
/// </summary>
|
||||
public class OemWithdrawalPageResultDto
|
||||
{
|
||||
public List<OemWithdrawalDto> list { get; set; }
|
||||
public int count { get; set; }
|
||||
/// <summary>
|
||||
/// 贴牌账户余额信息(可提现/冻结/累计返利/累计提现)
|
||||
/// </summary>
|
||||
public List<OemWithdrawalBalanceDto> balances { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OEM 贴牌账户余额信息
|
||||
/// </summary>
|
||||
public class OemWithdrawalBalanceDto
|
||||
{
|
||||
public long oem_id { get; set; }
|
||||
public string oem_code { get; set; }
|
||||
public string oem_name { get; set; }
|
||||
/// <summary>当前可提现(分)</summary>
|
||||
public long available_balance { get; set; }
|
||||
/// <summary>冻结金额(分)</summary>
|
||||
public long frozen_balance { get; set; }
|
||||
/// <summary>历史累计返利(分)</summary>
|
||||
public long total_rebate_amount { get; set; }
|
||||
/// <summary>历史累计提现(分)</summary>
|
||||
public long total_withdraw_amount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL.WXXD.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// OEM 提现审核请求
|
||||
/// </summary>
|
||||
public class OemWithdrawalAuditRequest : SignRequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 提现单号
|
||||
/// </summary>
|
||||
public string withdrawal_no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审核结果:1审核通过 2审核拒绝
|
||||
/// </summary>
|
||||
public int audit_result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 审核备注/拒绝原因
|
||||
/// </summary>
|
||||
public string audit_remark { get; set; }
|
||||
/// <summary>
|
||||
/// 打款流水号
|
||||
/// </summary>
|
||||
public string pay_trade_no { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL.WXXD.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// OEM 提现记录查询请求
|
||||
/// </summary>
|
||||
public class OemWithdrawalQueryRequest: SignRequestBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 贴牌编号(可选)
|
||||
/// </summary>
|
||||
public string oem_ids { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提现单号(可选)
|
||||
/// </summary>
|
||||
public string withdrawal_no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(可选):0待审核 1审核通过 2审核拒绝 3打款中 4已打款 5打款失败 6已取消
|
||||
/// </summary>
|
||||
public int? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建开始时间 yyyy-MM-dd HH:mm:ss(可选)
|
||||
/// </summary>
|
||||
public string start_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建结束时间 yyyy-MM-dd HH:mm:ss(可选)
|
||||
/// </summary>
|
||||
public string end_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 页码,从1开始,默认1
|
||||
/// </summary>
|
||||
public int page { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 每页数量,默认20
|
||||
/// </summary>
|
||||
public int page_size { get; set; } = 20;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL.WXXD.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// 提现方式:1银行卡 2支付宝 3微信 4其他
|
||||
/// </summary>
|
||||
public enum WithdrawalType
|
||||
{
|
||||
Bank = 1,
|
||||
Alipay = 2,
|
||||
WeChat = 3,
|
||||
Other = 4,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OEM 申请提现请求
|
||||
/// </summary>
|
||||
public class OemWithdrawalRequest : SignRequestBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 贴牌编号(可选)
|
||||
/// </summary>
|
||||
public string oem_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 申请提现金额(分)
|
||||
/// </summary>
|
||||
public long amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提现方式:1银行卡 2支付宝 3微信 4其他
|
||||
/// </summary>
|
||||
public WithdrawalType withdrawal_type { get; set; } = WithdrawalType.Bank;
|
||||
|
||||
/// <summary>
|
||||
/// 收款人姓名
|
||||
/// </summary>
|
||||
public string account_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收款账号(卡号/账号)
|
||||
/// </summary>
|
||||
public string account_no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开户行(银行卡时使用)
|
||||
/// </summary>
|
||||
public string bank_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开户支行
|
||||
/// </summary>
|
||||
public string bank_branch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace KJD_Web.BLL.WXXD.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// 卡名请求
|
||||
/// </summary>
|
||||
public class SignRequestBase
|
||||
{
|
||||
public string time { get; set; }
|
||||
public string code { get; set; }
|
||||
public string code_version { get; set; }
|
||||
public string version { get; set; }
|
||||
public string user_name { get; set; }
|
||||
public string path { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using KJD_Web.Model.WxModel;
|
||||
using KJD_Web.BLL.WXXD.Dtos;
|
||||
using KJD_Web.BLL.WXXD.Requests;
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.Model.WxModel;
|
||||
using KJD_Web.Utils;
|
||||
using NaiBa.Util.Extension;
|
||||
using NaiBa.Util.Helper;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
@@ -10,130 +15,777 @@ using System.Web;
|
||||
|
||||
namespace KJD_Web.BLL.WXXD
|
||||
{
|
||||
public class WXOemManage
|
||||
{
|
||||
public string AddMdyOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
public class WXOemManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 手续费
|
||||
/// </summary>
|
||||
const long fee = 0;
|
||||
public string AddMdyOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
var oem_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
var oem_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_name")?.Replace("'", "\\'"));
|
||||
var oem_owner = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_owner")?.Replace("'", "\\'"));
|
||||
if (oem_id.IsNullOrEmpty() || oem_name.IsNullOrEmpty())
|
||||
return "{\"code\":500,\"msg\":\"oem信息不能为空\"}";
|
||||
var oem_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
var oem_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_name")?.Replace("'", "\\'"));
|
||||
var oem_owner = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_owner")?.Replace("'", "\\'"));
|
||||
if (oem_id.IsNullOrEmpty() || oem_name.IsNullOrEmpty())
|
||||
return "{\"code\":500,\"msg\":\"oem信息不能为空\"}";
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "INSERT INTO wxxd.oem (oem_id,oem_name,oem_owner) VALUES('" + oem_id + "','" + oem_name + "','" + oem_owner + "')" +
|
||||
"ON DUPLICATE KEY UPDATE oem_name=VALUES(oem_name),oem_owner=VALUES(oem_owner);";
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "INSERT INTO wxxd.oem (oem_id,oem_name,oem_owner) VALUES('" + oem_id + "','" + oem_name + "','" + oem_owner + "')" +
|
||||
"ON DUPLICATE KEY UPDATE oem_name=VALUES(oem_name),oem_owner=VALUES(oem_owner);";
|
||||
|
||||
var rst = mySql.ExecuteAffectedRows(sql);
|
||||
mySql.Close();
|
||||
var rst = mySql.ExecuteAffectedRows(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\",\"affected_rows\":" + rst + "}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\",\"affected_rows\":" + rst + "}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string DelOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
public string DelOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'"));
|
||||
var oem_id = (RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
if (oem_id.IsNullOrEmpty() && id.IsNullOrEmpty())
|
||||
return "{\"code\":500,\"msg\":\"oem信息不能为空\"}";
|
||||
var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'"));
|
||||
var oem_id = (RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
if (oem_id.IsNullOrEmpty() && id.IsNullOrEmpty())
|
||||
return "{\"code\":500,\"msg\":\"oem信息不能为空\"}";
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "UPDATE wxxd.oem SET is_del=1 WHERE id=" + id + " or oem_id='" + oem_id + "'";
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "UPDATE wxxd.oem SET is_del=1 WHERE id=" + id + " or oem_id='" + oem_id + "'";
|
||||
|
||||
var rst = mySql.ExecuteAffectedRows(sql);
|
||||
mySql.Close();
|
||||
var rst = mySql.ExecuteAffectedRows(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
return "{\"code\":200,\"msg\":\"success\"}";
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
public string GetOem(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!WXUserManage.GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
var timeCalc = DateTime.Now;
|
||||
var oem_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
var oem_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_name")?.Replace("'", "\\'"));
|
||||
var oem_owner = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_owner")?.Replace("'", "\\'"));
|
||||
var timeCalc = DateTime.Now;
|
||||
var oem_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'"));
|
||||
var oem_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_name")?.Replace("'", "\\'"));
|
||||
var oem_owner = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "oem_owner")?.Replace("'", "\\'"));
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "SELECT * FROM wxxd.oem WHERE is_del=0";
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "SELECT * FROM wxxd.oem WHERE is_del=0";
|
||||
|
||||
string where = "";
|
||||
if (!string.IsNullOrEmpty(oem_id))
|
||||
where += " and oem_id in ('" + oem_id.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(oem_name))
|
||||
where += " and oem_name in ('" + oem_name.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(oem_owner))
|
||||
where += " and oem_owner in ('" + oem_owner.Replace(",", "','") + "')";
|
||||
string where = "";
|
||||
if (!string.IsNullOrEmpty(oem_id))
|
||||
where += " and oem_id in ('" + oem_id.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(oem_name))
|
||||
where += " and oem_name in ('" + oem_name.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(oem_owner))
|
||||
where += " and oem_owner in ('" + oem_owner.Replace(",", "','") + "')";
|
||||
|
||||
sql += where;
|
||||
sql += " ORDER BY add_time DESC;";
|
||||
sql += where;
|
||||
sql += " ORDER BY add_time DESC;";
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
List<oem> productLst = new List<oem>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
oem prod = new oem
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
oem_icon = null,
|
||||
oem_id = row["oem_id"].ParseToString(),
|
||||
add_time = row["add_time"].ParseToString().ParseToDateTime(),
|
||||
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
|
||||
oem_img = null,
|
||||
oem_name = row["oem_name"].ParseToString(),
|
||||
oem_owner = row["oem_owner"].ParseToString(),
|
||||
};
|
||||
productLst.Add(prod);
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + -1 + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
List<oem> productLst = new List<oem>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
oem prod = new oem
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
oem_icon = null,
|
||||
oem_id = row["oem_id"].ParseToString(),
|
||||
add_time = row["add_time"].ParseToString().ParseToDateTime(),
|
||||
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
|
||||
oem_img = null,
|
||||
oem_name = row["oem_name"].ParseToString(),
|
||||
oem_owner = row["oem_owner"].ParseToString(),
|
||||
available_balance = row.Table.Columns.Contains("available_balance") ? row["available_balance"].ParseToLong() : 0,
|
||||
frozen_balance = row.Table.Columns.Contains("frozen_balance") ? row["frozen_balance"].ParseToLong() : 0,
|
||||
total_rebate_amount = row.Table.Columns.Contains("total_rebate_amount") ? row["total_rebate_amount"].ParseToLong() : 0,
|
||||
total_withdraw_amount = row.Table.Columns.Contains("total_withdraw_amount") ? row["total_withdraw_amount"].ParseToLong() : 0,
|
||||
};
|
||||
productLst.Add(prod);
|
||||
}
|
||||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
var data = JsonUtils.SerializeObjectToString(productLst, jsonSetting);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + -1 + ",\"seconds\":" + seconds + "}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OEM 提现记录查询(分页)
|
||||
/// </summary>
|
||||
/// <param name="request">查询请求</param>
|
||||
/// <returns></returns>
|
||||
public string OemWithdrawals(OemWithdrawalQueryRequest request)
|
||||
{
|
||||
Result ret = Result.ArgumentNull();
|
||||
|
||||
try
|
||||
{
|
||||
if (request == null || request.user_name.IsNullOrEmpty())
|
||||
throw new Exception("参数错误:缺少用户名");
|
||||
|
||||
List<string> oemIdLst = new List<string>();
|
||||
var user = new WXUserManage().GetUserByUserName(request.user_name);
|
||||
if (user.sa_level != 1)//非管理员 判断 是否Oem 管理员
|
||||
{
|
||||
var oems = GetOems(new List<string> { request.user_name });
|
||||
if (oems == null || oems.Any() == false)
|
||||
{
|
||||
throw new Exception("错误的账号");
|
||||
}
|
||||
oemIdLst.AddRange(oems.Select(a => a.oem_id).ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(request.oem_ids))
|
||||
{
|
||||
oemIdLst.AddRange(request.oem_ids.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int page = request.page <= 0 ? 1 : request.page;
|
||||
int page_size = request.page_size <= 0 ? 20 : request.page_size;
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string where = " WHERE w.is_deleted=0";
|
||||
if (oemIdLst.Any())
|
||||
where += " AND w.oem_id IN ('" + string.Join("','", oemIdLst) + "')";
|
||||
if (!request.withdrawal_no.IsNullOrEmpty())
|
||||
where += " AND w.withdrawal_no='" + MysqlUtils.ReplaceSqlSpecial(request.withdrawal_no) + "'";
|
||||
if (request.status.HasValue)
|
||||
where += " AND w.status=" + request.status.Value;
|
||||
if (!request.start_time.IsNullOrEmpty())
|
||||
where += " AND w.created_at >= '" + MysqlUtils.ReplaceSqlSpecial(request.start_time) + "'";
|
||||
if (!request.end_time.IsNullOrEmpty())
|
||||
where += " AND w.created_at <= '" + MysqlUtils.ReplaceSqlSpecial(request.end_time) + "'";
|
||||
|
||||
string countSql = "SELECT COUNT(*) FROM wxxd.oem_withdrawal w" + where;
|
||||
int count = mySql.ExecuteFirstInt(countSql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
throw new Exception(mySql.Message);
|
||||
|
||||
string sql = "SELECT w.*, o.oem_name FROM wxxd.oem_withdrawal w " +
|
||||
"LEFT JOIN wxxd.oem o ON w.oem_id = o.oem_id" + where +
|
||||
" ORDER BY w.id DESC LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size + ";";
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
|
||||
throw new Exception(mySql.Message);
|
||||
|
||||
List<OemWithdrawalDto> list = new List<OemWithdrawalDto>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
list.Add(BuildOemWithdrawalDto(row));
|
||||
}
|
||||
|
||||
//// 贴牌账户余额信息
|
||||
//List<OemWithdrawalBalanceDto> balanceLst = oems.Where(x => oemIdLst.Contains(x.id)).Select(x => new OemWithdrawalBalanceDto
|
||||
//{
|
||||
// oem_id = x.id,
|
||||
// oem_code = x.oem_id,
|
||||
// oem_name = x.oem_name,
|
||||
// available_balance = x.available_balance,
|
||||
// frozen_balance = x.frozen_balance,
|
||||
// total_rebate_amount = x.total_rebate_amount,
|
||||
// total_withdraw_amount = x.total_withdraw_amount,
|
||||
//}).ToList();
|
||||
ret = new PageResult();
|
||||
ret.Code = 200;
|
||||
ret.Msg = "success";
|
||||
ret.Data = list;
|
||||
(ret as PageResult).Total = count;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ret = Result.Failure(ex.Message);
|
||||
}
|
||||
return JsonUtils.SerializeObjectToString(ret, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算Oem 流水
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string SettleOemFlows(SignRequestBase request)
|
||||
{
|
||||
Result ret = Result.ArgumentNull();
|
||||
|
||||
try
|
||||
{
|
||||
if (request == null || request.user_name.IsNullOrEmpty())
|
||||
throw new Exception("参数错误:缺少用户名");
|
||||
|
||||
|
||||
var oems = GetOems(new List<string> { request.user_name });
|
||||
if (oems == null || oems.Any() == false)
|
||||
{
|
||||
throw new Exception("错误的账号");
|
||||
}
|
||||
oem oemInfo = oems.First();
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn, true);
|
||||
this.SettleOemFlows(mySql, oemInfo.oem_id);
|
||||
|
||||
oems = GetOems(new List<string> { request.user_name });
|
||||
if (oems == null || oems.Any() == false)
|
||||
{
|
||||
throw new Exception("错误的账号");
|
||||
}
|
||||
oemInfo = oems.First();
|
||||
ret.Code = 200;
|
||||
ret.Msg = "success";
|
||||
ret.Data = new
|
||||
{
|
||||
oemInfo.available_balance,
|
||||
oemInfo.total_rebate_amount,
|
||||
oemInfo.total_withdraw_amount,
|
||||
};
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ret = Result.Failure(ex.Message);
|
||||
}
|
||||
return JsonUtils.SerializeObjectToString(ret, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// OEM 申请提现
|
||||
/// 申请时先把该用户未结算(settlement=0)的流水 oem_amount 汇总结算到 oem 账户
|
||||
/// (available_balance 可提现、total_rebate_amount 累计返利),并把流水标记 settlement=1。
|
||||
/// 每次只允许一笔进行中的提现(状态0待审核/1审核通过/3打款中)。
|
||||
/// </summary>
|
||||
/// <param name="request">申请提现请求</param>
|
||||
/// <returns></returns>
|
||||
public string ApplyOemWithdrawal(OemWithdrawalRequest request)
|
||||
{
|
||||
Result ret = Result.ArgumentNull();
|
||||
string client_ip = "";
|
||||
try
|
||||
{
|
||||
if (request == null || request.user_name.IsNullOrEmpty())
|
||||
throw new Exception("参数错误:缺少用户名");
|
||||
if (request.amount <= 0)
|
||||
throw new Exception("提现金额必须大于0");
|
||||
if (fee < 0)
|
||||
throw new Exception("手续费不能为负数");
|
||||
if (request.amount <= fee)
|
||||
throw new Exception("提现金额必须大于手续费");
|
||||
if (request.withdrawal_type != WithdrawalType.Bank &&
|
||||
request.withdrawal_type != WithdrawalType.Alipay &&
|
||||
request.withdrawal_type != WithdrawalType.WeChat &&
|
||||
request.withdrawal_type != WithdrawalType.Other)
|
||||
throw new Exception("提现方式不合法");
|
||||
if (request.account_no.IsNullOrEmpty())
|
||||
throw new Exception("收款账号不能为空");
|
||||
|
||||
var oems = GetOems(new List<string> { request.user_name });
|
||||
if (oems == null || oems.Any() == false)
|
||||
{
|
||||
throw new Exception("错误的账号");
|
||||
}
|
||||
|
||||
oem oemInfo = null;
|
||||
if (!request.oem_id.IsNullOrEmpty())
|
||||
{
|
||||
oemInfo = oems.FirstOrDefault(x => x.oem_id == request.oem_id);
|
||||
if (oemInfo == null)
|
||||
throw new Exception("未找到该贴牌信息");
|
||||
}
|
||||
else
|
||||
{
|
||||
oemInfo = oems.First();
|
||||
}
|
||||
|
||||
//// 收款人姓名默认取贴牌名称
|
||||
//if (request.account_name.IsNullOrEmpty())
|
||||
request.account_name = oemInfo.oem_name;
|
||||
|
||||
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn, true);
|
||||
try
|
||||
{
|
||||
// 每次只能处理一笔提现申请
|
||||
string sql = "SELECT COUNT(*) FROM wxxd.oem_withdrawal WHERE oem_id='" + oemInfo.oem_id +
|
||||
"' AND status IN (" + (int)OemWithdrawalStatus.Pending + "," + (int)OemWithdrawalStatus.Approved + "," + (int)OemWithdrawalStatus.Paying + ")" +
|
||||
" AND is_deleted=0";
|
||||
int processingCount = mySql.ExecuteFirstInt(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
throw new Exception(mySql.Message);
|
||||
if (processingCount > 0)
|
||||
throw new Exception("存在进行中的提现申请,请等待审核完成后再次申请");
|
||||
|
||||
///申请编号
|
||||
string withdrawal_no = "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + RandomUtils.GetNumber(4);
|
||||
//保存图片
|
||||
if (ImageService.IsValidImage(request.account_no))
|
||||
{
|
||||
string savePath = ImageService.SaveBase64Image(request.account_no, fileName: withdrawal_no);
|
||||
request.account_no = savePath;
|
||||
}
|
||||
|
||||
|
||||
// 结算未结算流水到oem账户(独立方法,写oem金额与改流水状态在同一事务内)
|
||||
long settled_fen = SettleOemFlows(mySql, oemInfo.oem_id);
|
||||
|
||||
// 重新读取结算后的账户余额(分)
|
||||
sql = "SELECT available_balance FROM wxxd.oem WHERE id=" + oemInfo.id;
|
||||
var oemRow = mySql.ExecuteDataTableRow(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || oemRow == null)
|
||||
throw new Exception("获取账户余额失败");
|
||||
|
||||
long available_fen = oemRow["available_balance"].ParseToLong();
|
||||
if (available_fen < request.amount)
|
||||
throw new Exception("可提现余额不足");
|
||||
|
||||
long amount_fen = request.amount;
|
||||
long fee_fen = fee;
|
||||
long actual_fen = amount_fen - fee_fen;
|
||||
long balance_after_fen = available_fen - amount_fen;
|
||||
|
||||
// 冻结:扣减可提现,增加冻结金额(乐观锁)
|
||||
sql = "UPDATE wxxd.oem SET available_balance=available_balance-" + amount_fen +
|
||||
", frozen_balance=frozen_balance+" + amount_fen +
|
||||
" WHERE id=" + oemInfo.id + " AND available_balance>=" + amount_fen;
|
||||
var freezeRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || freezeRst <= 0)
|
||||
throw new Exception("冻结余额失败,账户余额已发生变化,请刷新后重试");
|
||||
|
||||
string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
sql = "INSERT INTO wxxd.oem_withdrawal " +
|
||||
"(withdrawal_no,oem_id,apply_user_name,amount,fee,actual_amount,balance_before,balance_after," +
|
||||
"withdrawal_type,account_name,account_no,bank_name,bank_branch," +
|
||||
"status,audit_by,audit_time,audit_remark,remark,client_ip,version,is_deleted,created_at,updated_at) VALUES (" +
|
||||
"'" + withdrawal_no + "','" + oemInfo.oem_id + "','" + MysqlUtils.ReplaceSqlSpecial(request.user_name) + "'," +
|
||||
amount_fen + "," + fee_fen + "," + actual_fen + "," + available_fen + "," + balance_after_fen + "," +
|
||||
(int)request.withdrawal_type + ",'" + MysqlUtils.ReplaceSqlSpecial(request.account_name) + "','" + MysqlUtils.ReplaceSqlSpecial(request.account_no) + "'," +
|
||||
"'" + MysqlUtils.ReplaceSqlSpecial(request.bank_name) + "','" + MysqlUtils.ReplaceSqlSpecial(request.bank_branch) + "'," +
|
||||
(int)OemWithdrawalStatus.Pending + ",'',NULL,NULL," +
|
||||
"'" + MysqlUtils.ReplaceSqlSpecial(request.remark) + "','" + MysqlUtils.ReplaceSqlSpecial(client_ip) + "',0,0,'" + now + "','" + now + "');";
|
||||
|
||||
long insertId = mySql.ExecuteInsertId(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || insertId <= 0)
|
||||
throw new Exception("创建提现记录失败");
|
||||
|
||||
mySql.Commit();
|
||||
|
||||
ret.Code = 200;
|
||||
ret.Msg = "success";
|
||||
ret.Data = new { withdrawal_no = withdrawal_no, id = insertId, balance_after = balance_after_fen, actual_amount = actual_fen };
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
mySql.RollBack();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
mySql.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ret = Result.Failure(ex.Message);
|
||||
}
|
||||
return JsonUtils.SerializeObjectToString(ret, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// OEM 提现审核
|
||||
/// 审核通过:冻结金额转历史累计提现;审核拒绝:冻结金额退回可提现余额。
|
||||
/// </summary>
|
||||
/// <param name="request">审核请求</param>
|
||||
/// <returns></returns>
|
||||
public string AuditOemWithdrawal(OemWithdrawalAuditRequest request)
|
||||
{
|
||||
Result ret = Result.ArgumentNull();
|
||||
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(request.withdrawal_no))
|
||||
throw new Exception("参数错误:缺少提现单号");
|
||||
if (request.audit_result != (int)OemWithdrawalStatus.Approved && request.audit_result != (int)OemWithdrawalStatus.Rejected)
|
||||
throw new Exception("审核结果不合法:1审核通过 2审核拒绝");
|
||||
if (request.user_name.IsNullOrEmpty())
|
||||
throw new Exception("审核人不能为空");
|
||||
var user = new WXUserManage().GetUserByUserName(request.user_name);
|
||||
if (user.sa_level != 1)
|
||||
{
|
||||
throw new Exception("无权限审核");
|
||||
}
|
||||
string audit_remark = HtmlUtils.UrlDecodeUtf8(request.audit_remark);
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn, true);
|
||||
try
|
||||
{
|
||||
string sql = "SELECT * FROM wxxd.oem_withdrawal WHERE withdrawal_no='" + request.withdrawal_no + "' AND is_deleted=0";
|
||||
var row = mySql.ExecuteDataTableRow(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || row == null)
|
||||
throw new Exception("提现记录不存在");
|
||||
|
||||
int status = row["status"].ParseToInt();
|
||||
if (status != (int)OemWithdrawalStatus.Pending)
|
||||
{
|
||||
throw new Exception("当前状态不可审核");
|
||||
}
|
||||
|
||||
//保存图片
|
||||
if (ImageService.IsValidImage(request.pay_trade_no))
|
||||
{
|
||||
string savePath = ImageService.SaveBase64Image(request.pay_trade_no, fileName: "C" + request.withdrawal_no);
|
||||
request.pay_trade_no = savePath;
|
||||
}
|
||||
|
||||
|
||||
string oem_id = row["oem_id"].ParseToString();
|
||||
long amount_fen = row["amount"].ParseToLong();
|
||||
string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 更新oem账户余额
|
||||
if (request.audit_result == (int)OemWithdrawalStatus.Approved)
|
||||
{
|
||||
// 审核通过:冻结金额减少,历史累计提现增加
|
||||
sql = "UPDATE wxxd.oem SET frozen_balance=frozen_balance-" + amount_fen +
|
||||
", total_withdraw_amount=total_withdraw_amount+" + amount_fen +
|
||||
" WHERE oem_id='" + oem_id + "' AND frozen_balance>=" + amount_fen;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 审核拒绝:冻结金额减少,退回可提现余额
|
||||
sql = "UPDATE wxxd.oem SET frozen_balance=frozen_balance-" + amount_fen +
|
||||
", available_balance=available_balance+" + amount_fen +
|
||||
" WHERE oem_id='" + oem_id + "' AND frozen_balance>=" + amount_fen;
|
||||
}
|
||||
var oemRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || oemRst <= 0)
|
||||
throw new Exception("更新账户余额失败");
|
||||
if (request.audit_result == 1) request.audit_result = (int)OemWithdrawalStatus.Paid; //已付款
|
||||
sql = "UPDATE wxxd.oem_withdrawal SET status=" + request.audit_result +
|
||||
",audit_by='" + MysqlUtils.ReplaceSqlSpecial(request.user_name) +
|
||||
"',audit_time='" + now +
|
||||
"',audit_remark='" + MysqlUtils.ReplaceSqlSpecial(audit_remark) +
|
||||
"',updated_at='" + now +
|
||||
"',pay_time='" + now +
|
||||
"',pay_trade_no='" + request.pay_trade_no +
|
||||
"' WHERE withdrawal_no='" + request.withdrawal_no + "' AND status=" + (int)OemWithdrawalStatus.Pending + ";";
|
||||
|
||||
var updateRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || updateRst <= 0)
|
||||
throw new Exception("审核失败,请刷新后重试");
|
||||
|
||||
mySql.Commit();
|
||||
|
||||
ret.Code = 200;
|
||||
ret.Msg = request.audit_result == (int)OemWithdrawalStatus.Approved ? "审核通过" : "审核拒绝";
|
||||
ret.Data = new { withdrawal_no = request.withdrawal_no, status = request.audit_result };
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
mySql.RollBack();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
mySql.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ret = Result.Failure(ex.Message);
|
||||
}
|
||||
return JsonUtils.SerializeObjectToString(ret, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结算流水到oem账户(独立方法)。
|
||||
/// 根据 oem_id(贴牌编号) 找到该oem下所有账户(wxxd.user.oem_id 匹配),
|
||||
/// 然后按流水id升序遍历 wxxd.user_payment_record 中未结算(settlement=0)流水,按公式计算:
|
||||
/// type=20:amount - 2.2
|
||||
/// type=26:amount - 2.5
|
||||
/// type=16:oem_amount
|
||||
/// type=31:oem_amount
|
||||
/// type=23:- amount(同一个订单(order_id)只能减少一次)
|
||||
/// 各项金额之和为总金额(元),写入 oem.available_balance(当前可提现);
|
||||
/// 其中正数部分累计到 oem.total_rebate_amount(历史累计返利)。
|
||||
/// 写oem金额与更新流水settlement=1在同一个事务内执行(由调用方开启的事务)。
|
||||
/// </summary>
|
||||
/// <param name="mySql">事务连接(调用方已开启事务)</param>
|
||||
/// <param name="oemIdCode">贴牌编号(wxxd.oem.oem_id / wxxd.user.oem_id)</param>
|
||||
/// <param name="oemDbId">wxxd.oem.id 数字主键</param>
|
||||
/// <returns>本次结算总金额(分)</returns>
|
||||
private long SettleOemFlows(MysqlUtils mySql, string oem_id)
|
||||
{
|
||||
if (oem_id.IsNullOrEmpty())
|
||||
return 0;
|
||||
|
||||
// 1. 找到该oem下所有账户
|
||||
string sql = "SELECT user_name FROM wxxd.`user` WHERE oem_id='" + MysqlUtils.ReplaceSqlSpecial(oem_id) + "'";
|
||||
var userDt = mySql.ExecuteDataTable(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || userDt == null || userDt.Rows.Count == 0)
|
||||
return 0;
|
||||
|
||||
List<string> userLst = userDt.Rows.Cast<DataRow>()
|
||||
.Select(r => r["user_name"].ParseToString())
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
if (userLst.Count == 0)
|
||||
return 0;
|
||||
|
||||
// 2. 该oem所有账户的未结算流水,按id升序
|
||||
sql = "SELECT * FROM wxxd.user_payment_record WHERE user_name IN ('" + string.Join("','", userLst) + "')" +
|
||||
" AND type IN (20,23,26,16,31) AND settlement=0 AND is_deleted=0 ORDER BY id ASC";
|
||||
var flowDt = mySql.ExecuteDataTable(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || flowDt == null || flowDt.Rows.Count == 0)
|
||||
return 0;
|
||||
|
||||
decimal total_amount = 0m; // 总金额(元)
|
||||
decimal rebate_amount = 0m; // 正数部分(累计返利)
|
||||
HashSet<string> deductedOrderSet = new HashSet<string>(); // type=23 已扣减的订单
|
||||
List<long> settleIdLst = new List<long>(); // 参与结算的流水id
|
||||
|
||||
foreach (DataRow row in flowDt.Rows)
|
||||
{
|
||||
int type = row["type"].ParseToInt();
|
||||
decimal amount = row["amount"].ParseToDecimal();
|
||||
decimal oem_amount = row["oem_amount"].ParseToDecimal();
|
||||
long flowId = row["id"].ParseToLong();
|
||||
|
||||
decimal itemAmount = 0m;
|
||||
if (type == 20)
|
||||
itemAmount = amount - 2.2m;
|
||||
else if (type == 26)
|
||||
itemAmount = amount - 2.5m;
|
||||
else if (type == 16)
|
||||
itemAmount = oem_amount;
|
||||
else if (type == 31)
|
||||
itemAmount = oem_amount;
|
||||
else if (type == 23)
|
||||
{
|
||||
// 同一个订单只能减少一次
|
||||
string orderId = row["order_id"].ParseToString();
|
||||
if (orderId.IsNullOrEmpty() || deductedOrderSet.Contains(orderId))
|
||||
continue;
|
||||
deductedOrderSet.Add(orderId);
|
||||
itemAmount = -(amount - 2.2m);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue; // 其他类型不计入
|
||||
}
|
||||
|
||||
total_amount += itemAmount;
|
||||
rebate_amount += itemAmount;
|
||||
|
||||
settleIdLst.Add(flowId);
|
||||
}
|
||||
|
||||
if (settleIdLst.Count == 0)
|
||||
return 0;
|
||||
long total_fen = (long)Math.Round(total_amount * 100m);
|
||||
long rebate_fen = (long)Math.Round(rebate_amount * 100m);
|
||||
string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 3. 写oem金额 + 更新流水状态(同一事务)
|
||||
sql = "UPDATE wxxd.oem SET available_balance=available_balance+" + total_fen +
|
||||
", total_rebate_amount=total_rebate_amount+" + rebate_fen +
|
||||
" WHERE oem_id='" + oem_id + "'";
|
||||
var oemRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || oemRst <= 0)
|
||||
throw new Exception("结算流水到账户失败");
|
||||
|
||||
sql = "UPDATE wxxd.user_payment_record SET settlement=1,settlement_time='" + now + "' WHERE id IN (" + string.Join(",", settleIdLst) + ")";
|
||||
var flowRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || flowRst <= 0)
|
||||
throw new Exception("标记流水结算失败");
|
||||
|
||||
return total_fen;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将数据行转换为提现记录DTO
|
||||
/// </summary>
|
||||
private OemWithdrawalDto BuildOemWithdrawalDto(DataRow row)
|
||||
{
|
||||
int withdrawal_type = row["withdrawal_type"].ParseToInt();
|
||||
int status = row["status"].ParseToInt();
|
||||
return new OemWithdrawalDto
|
||||
{
|
||||
withdrawal_no = row["withdrawal_no"].ParseToString(),
|
||||
oem_id = row["oem_id"].ParseToString(),
|
||||
oem_name = row.Table.Columns.Contains("oem_name") ? row["oem_name"].ParseToString() : "",
|
||||
apply_user_name = row["apply_user_name"].ParseToString(),
|
||||
amount = row["amount"].ParseToLong(),
|
||||
fee = row["fee"].ParseToLong(),
|
||||
actual_amount = row["actual_amount"].ParseToLong(),
|
||||
balance_before = row["balance_before"].ParseToLong(),
|
||||
balance_after = row["balance_after"].ParseToLong(),
|
||||
withdrawal_type = withdrawal_type,
|
||||
withdrawal_type_string = GetWithdrawalTypeString(withdrawal_type),
|
||||
account_name = row["account_name"].ParseToString(),
|
||||
account_no = row["account_no"].ParseToString(),
|
||||
bank_name = row["bank_name"].ParseToString(),
|
||||
bank_branch = row["bank_branch"].ParseToString(),
|
||||
status = status,
|
||||
status_string = GetWithdrawalStatusString(status),
|
||||
audit_by = row["audit_by"].ParseToString(),
|
||||
audit_time = row["audit_time"] == DBNull.Value ? (DateTime?)null : row["audit_time"].ParseToString().ParseToDateTime(),
|
||||
audit_remark = row["audit_remark"].ParseToString(),
|
||||
pay_time = row["pay_time"] == DBNull.Value ? (DateTime?)null : row["pay_time"].ParseToString().ParseToDateTime(),
|
||||
pay_channel = row["pay_channel"].ParseToString(),
|
||||
pay_trade_no = row["pay_trade_no"].ParseToString(),
|
||||
fail_reason = row["fail_reason"].ParseToString(),
|
||||
remark = row["remark"].ParseToString(),
|
||||
client_ip = row["client_ip"].ParseToString(),
|
||||
created_at = row["created_at"].ParseToString().ParseToDateTime(),
|
||||
updated_at = row["updated_at"].ParseToString().ParseToDateTime(),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提现方式名称
|
||||
/// </summary>
|
||||
private string GetWithdrawalTypeString(int withdrawal_type)
|
||||
{
|
||||
switch (withdrawal_type)
|
||||
{
|
||||
case (int)WithdrawalType.Bank: return "银行卡";
|
||||
case (int)WithdrawalType.Alipay: return "支付宝";
|
||||
case (int)WithdrawalType.WeChat: return "微信";
|
||||
case (int)WithdrawalType.Other: return "其他";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 提现状态名称
|
||||
/// </summary>
|
||||
private string GetWithdrawalStatusString(int status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case (int)OemWithdrawalStatus.Pending: return "待审核";
|
||||
case (int)OemWithdrawalStatus.Approved: return "审核通过";
|
||||
case (int)OemWithdrawalStatus.Rejected: return "审核拒绝";
|
||||
case (int)OemWithdrawalStatus.Paying: return "打款中";
|
||||
case (int)OemWithdrawalStatus.Paid: return "已打款";
|
||||
case (int)OemWithdrawalStatus.PayFailed: return "打款失败";
|
||||
case (int)OemWithdrawalStatus.Cancelled: return "已取消";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
private List<oem> GetOems(IEnumerable<string> oem_owners)
|
||||
{
|
||||
List<oem> productLst = new List<oem>();
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
string sql = "SELECT * FROM wxxd.oem WHERE is_del=0";
|
||||
|
||||
string where = "";
|
||||
if (oem_owners?.Any() ?? false)
|
||||
where += $" and oem_owner in ('{string.Join("','", oem_owners)}')";
|
||||
|
||||
sql += where;
|
||||
sql += " ORDER BY add_time DESC;";
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(mySql.Message) || dt == null)
|
||||
{
|
||||
return productLst;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
oem prod = new oem
|
||||
{
|
||||
id = row["id"].ParseToInt(),
|
||||
oem_icon = null,
|
||||
oem_id = row["oem_id"].ParseToString(),
|
||||
add_time = row["add_time"].ParseToString().ParseToDateTime(),
|
||||
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
|
||||
oem_img = null,
|
||||
oem_name = row["oem_name"].ParseToString(),
|
||||
oem_owner = row["oem_owner"].ParseToString(),
|
||||
available_balance = row.Table.Columns.Contains("available_balance") ? row["available_balance"].ParseToLong() : 0,
|
||||
frozen_balance = row.Table.Columns.Contains("frozen_balance") ? row["frozen_balance"].ParseToLong() : 0,
|
||||
total_rebate_amount = row.Table.Columns.Contains("total_rebate_amount") ? row["total_rebate_amount"].ParseToLong() : 0,
|
||||
total_withdraw_amount = row.Table.Columns.Contains("total_withdraw_amount") ? row["total_withdraw_amount"].ParseToLong() : 0,
|
||||
};
|
||||
productLst.Add(prod);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return productLst;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
@@ -108,6 +108,7 @@
|
||||
<Compile Include="BLL\BXX\BXXUserManage.cs" />
|
||||
<Compile Include="BLL\DYXD\DYShopManage.cs" />
|
||||
<Compile Include="BLL\DYXD\DYUserManage.cs" />
|
||||
<Compile Include="BLL\ImageService.cs" />
|
||||
<Compile Include="BLL\KJD\OrderManage.cs" />
|
||||
<Compile Include="BLL\KJD\PriceManage.cs" />
|
||||
<Compile Include="BLL\KJD\ProductThirdManage.cs" />
|
||||
@@ -116,6 +117,11 @@
|
||||
<Compile Include="BLL\KJD\ToolManage.cs" />
|
||||
<Compile Include="BLL\KJD\UpdateManage.cs" />
|
||||
<Compile Include="BLL\KJD\UserManage.cs" />
|
||||
<Compile Include="BLL\WXXD\Dtos\OemWithdrawalDto.cs" />
|
||||
<Compile Include="BLL\WXXD\Requests\OemWithdrawalAuditRequest.cs" />
|
||||
<Compile Include="BLL\WXXD\Requests\OemWithdrawalQueryRequest.cs" />
|
||||
<Compile Include="BLL\WXXD\Requests\OemWithdrawalRequest.cs" />
|
||||
<Compile Include="BLL\WXXD\Requests\SignRequestBase.cs" />
|
||||
<Compile Include="BLL\WXXD\WXExpressOptimizeManage.cs" />
|
||||
<Compile Include="BLL\WXXD\WXOemManage.cs" />
|
||||
<Compile Include="BLL\WXXD\WXOrderManage.cs" />
|
||||
|
||||
@@ -44,4 +44,10 @@ namespace KJD_Web.Model
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class PageResult : Result
|
||||
{
|
||||
public int Page { get; set; }
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,36 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.Model.WxModel
|
||||
{
|
||||
public class oem
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string oem_id { get; set; }
|
||||
public string oem_name { get; set; }
|
||||
public string oem_owner { get; set; }
|
||||
public string oem_icon { get; set; }
|
||||
public string oem_img { get; set; }
|
||||
public DateTime add_time { get; set; }
|
||||
public DateTime mdy_time { get; set; }
|
||||
}
|
||||
public class oem
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string oem_id { get; set; }
|
||||
public string oem_name { get; set; }
|
||||
public string oem_owner { get; set; }
|
||||
public string oem_icon { get; set; }
|
||||
public string oem_img { get; set; }
|
||||
public DateTime add_time { get; set; }
|
||||
public DateTime mdy_time { get; set; }
|
||||
/// <summary>
|
||||
/// 当前可提现
|
||||
/// </summary>
|
||||
public long available_balance { get; set; }
|
||||
/// <summary>
|
||||
/// 冻结金额
|
||||
/// </summary>
|
||||
public long frozen_balance { get; set; }
|
||||
/// <summary>
|
||||
/// 历史累计返利
|
||||
/// </summary>
|
||||
public long total_rebate_amount { get; set; }
|
||||
/// <summary>
|
||||
/// 历史累计提现
|
||||
/// </summary>
|
||||
public long total_withdraw_amount { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -14,10 +14,14 @@ namespace KJD_Web.Model.WxModel
|
||||
|
||||
public int? type { get; set; }
|
||||
/// <summary>
|
||||
/// 充值或花费的金额(元)
|
||||
/// 金额(元)
|
||||
/// </summary>
|
||||
public decimal amount { get; set; }
|
||||
/// <summary>
|
||||
/// 归属oem用户的金额(元)
|
||||
/// </summary>
|
||||
public decimal oem_amount { get; set; }
|
||||
/// <summary>
|
||||
/// 充值或花费后的当前账户余额(元)
|
||||
/// </summary>
|
||||
public decimal balance { get; set; }
|
||||
@@ -65,5 +69,13 @@ namespace KJD_Web.Model.WxModel
|
||||
/// 扣款的对方账户名称
|
||||
/// </summary>
|
||||
public string counterparty_account_name { get; set; }
|
||||
/// <summary>
|
||||
/// OEM是否结算 0未结算 1已结算
|
||||
/// </summary>
|
||||
public int? settlement { get; set; }
|
||||
/// <summary>
|
||||
/// 退款流水号 外采&订单号
|
||||
/// </summary>
|
||||
public string refund_flow_no { get; set; }
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 166 KiB |
@@ -1,6 +1,7 @@
|
||||
using KJD_Web.BLL.BXX;
|
||||
using KJD_Web.BLL.BXX;
|
||||
using KJD_Web.BLL.WXXD;
|
||||
using KJD_Web.Utils;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -11,296 +12,344 @@ using System.Web.Services;
|
||||
|
||||
namespace KJD_Web
|
||||
{
|
||||
/// <summary>
|
||||
/// UserService 的摘要说明
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://tempuri.org/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[System.ComponentModel.ToolboxItem(false)]
|
||||
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
|
||||
// [System.Web.Script.Services.ScriptService]
|
||||
public class WXUserService : System.Web.Services.WebService
|
||||
{
|
||||
[WebMethod]
|
||||
public string hello_world()
|
||||
{
|
||||
return "Hello World";
|
||||
}
|
||||
/// <summary>
|
||||
/// UserService 的摘要说明
|
||||
/// </summary>
|
||||
[WebService(Namespace = "http://tempuri.org/")]
|
||||
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
||||
[System.ComponentModel.ToolboxItem(false)]
|
||||
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
|
||||
// [System.Web.Script.Services.ScriptService]
|
||||
public class WXUserService : System.Web.Services.WebService
|
||||
{
|
||||
[WebMethod]
|
||||
public string hello_world()
|
||||
{
|
||||
return "Hello World";
|
||||
}
|
||||
|
||||
private string GetRequestJsonString()
|
||||
{
|
||||
Context.Response.ContentType = "text/html;charset=utf-8";
|
||||
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
|
||||
private string GetRequestJsonString()
|
||||
{
|
||||
Context.Response.ContentType = "text/html;charset=utf-8";
|
||||
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
|
||||
|
||||
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
|
||||
{
|
||||
// 还原数据流
|
||||
byte[] b = new byte[s.Length];
|
||||
s.Read(b, 0, (int)s.Length);
|
||||
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
|
||||
if (string.IsNullOrEmpty(jsonText))
|
||||
{
|
||||
var qs = HttpContext.Current.Request.QueryString;
|
||||
if (qs != null && qs.Keys.Count > 0)
|
||||
{
|
||||
jsonText = "{";
|
||||
foreach (var key in qs.Keys)
|
||||
{
|
||||
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
|
||||
}
|
||||
jsonText = jsonText.TrimEnd(';') + "}";
|
||||
}
|
||||
}
|
||||
return jsonText;
|
||||
}
|
||||
}
|
||||
//GetE57Authorization
|
||||
[WebMethod]
|
||||
public void get_e57_authorization()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
|
||||
{
|
||||
// 还原数据流
|
||||
byte[] b = new byte[s.Length];
|
||||
s.Read(b, 0, (int)s.Length);
|
||||
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
|
||||
if (string.IsNullOrEmpty(jsonText))
|
||||
{
|
||||
var qs = HttpContext.Current.Request.QueryString;
|
||||
if (qs != null && qs.Keys.Count > 0)
|
||||
{
|
||||
jsonText = "{";
|
||||
foreach (var key in qs.Keys)
|
||||
{
|
||||
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
|
||||
}
|
||||
jsonText = jsonText.TrimEnd(';') + "}";
|
||||
}
|
||||
}
|
||||
return jsonText;
|
||||
}
|
||||
}
|
||||
//GetE57Authorization
|
||||
[WebMethod]
|
||||
public void get_e57_authorization()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetE57Authorization(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetE57Authorization(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void user_login()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void user_login()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().CheckUserLogin(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().CheckUserLogin(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void change_password()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void change_password()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().ChangePassword(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().ChangePassword(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void get_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetSubUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetSubUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void update_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateSubUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateSubUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void add_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void add_sub_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().AddSubUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().AddSubUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void delete_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void delete_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().DelUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().DelUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_all_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void get_all_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetAllUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetAllUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void update_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void add_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void add_user()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().AddUser(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().AddUser(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_user_points()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void update_user_points()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUserPoints(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUserPoints(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_user_points()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void get_user_points()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserPoints(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserPoints(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_user_balance()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void update_user_balance()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUserBalance(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateUserBalance(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_user_balance()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void get_user_balance()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserBalance(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserBalance(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_wx_sale_assistant_cookie()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void get_wx_sale_assistant_cookie()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetWxSaleAssistantCookie(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetWxSaleAssistantCookie(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void update_wx_sale_assistant_cookie()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void update_wx_sale_assistant_cookie()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateWxSaleAssistantCookie(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateWxSaleAssistantCookie(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_top_up_qrcode()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void update_top_up_qrcode()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateTopUpQrcode(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().UpdateTopUpQrcode(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_top_up_qrcode()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_top_up_qrcode()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetTopUpQrcode(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetTopUpQrcode(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void add_mdy_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
[WebMethod]
|
||||
public void add_mdy_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().AddMdyOem(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().AddMdyOem(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void del_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void del_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().DelOem(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().DelOem(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void get_oem()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().GetOem(jsontext);
|
||||
var result = jsontext;
|
||||
result = new WXOemManage().GetOem(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void oem_withdrawals()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
var request = jsontext.ParseToObject<KJD_Web.BLL.WXXD.Requests.OemWithdrawalQueryRequest>();
|
||||
result = new WXOemManage().OemWithdrawals(request);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void oem_settle_flows()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
var request = jsontext.ParseToObject<KJD_Web.BLL.WXXD.Requests.SignRequestBase>();
|
||||
result = new WXOemManage().SettleOemFlows(request);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void apply_oem_withdrawal()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
var request = jsontext.ParseToObject<KJD_Web.BLL.WXXD.Requests.OemWithdrawalRequest>();
|
||||
result = new WXOemManage().ApplyOemWithdrawal(request);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
[WebMethod]
|
||||
public void oem_audit_withdrawal()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
var request = jsontext.ParseToObject<KJD_Web.BLL.WXXD.Requests.OemWithdrawalAuditRequest>();
|
||||
result = new WXOemManage().AuditOemWithdrawal(request);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
-->
|
||||
<configuration>
|
||||
<connectionStrings>
|
||||
<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;"/>
|
||||
<!--<add name="ConnKJD" connectionString="Server=localhost;Port=3306;Database=mysql;Uid=root;Pwd=123456;"/>-->
|
||||
<!--<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;"/>-->
|
||||
<add name="ConnKJD" connectionString="Server=localhost;Port=3306;Database=mysql;Uid=root;Pwd=123456;"/>
|
||||
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;"/>
|
||||
<add name="UpdateVersion" connectionString="525"/>
|
||||
<add name="UpdateFileDir" connectionString="C:\inetpub\wwwroot\kjd_update"/>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
有关如何配置 ASP.NET 应用程序的详细信息,请访问
|
||||
https://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
<configuration>
|
||||
<connectionStrings>
|
||||
<add name="ConnKJD" connectionString="Server=localhost;Port=3306;Database=mysql;Uid=root;Pwd=123456;"/>
|
||||
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;"/>
|
||||
<add name="UpdateVersion" connectionString="525"/>
|
||||
<add name="UpdateFileDir" connectionString="C:\inetpub\wwwroot\kjd_update"/>
|
||||
<add name="UpdateNewUrl" connectionString="http://weidian.e57.cn/kjd_update/"/>
|
||||
<add name="UpdateExe" connectionString="http://1.13.195.131:9000/Download/Update.exe"/>
|
||||
<add name="UpdateExeChk" connectionString="CE4A009B7AA330314F03EEA0C3AB23F9"/>
|
||||
<add name="LowVersion" connectionString="523"/>
|
||||
<add name="LimitVersion" connectionString="823"/>
|
||||
<add name="GetReturnPackage" connectionString="true"/>
|
||||
<add name="GetWXRecommendHotProd" connectionString="true"/>
|
||||
<add name="GetWXRecommendHotProdOncePerDay" connectionString="false"/>
|
||||
<add name="GetWXRecommendHotProdMinViewUv" connectionString="200"/>
|
||||
<add name="GetWXRecommendHotProdInterval" connectionString="3"/>
|
||||
<add name="IsKeepBase64UploadImgFile" connectionString="0"/>
|
||||
<add name="UpdateWxFindOrderFileDir" connectionString="C:\inetpub\wwwroot\find_order_update"/>
|
||||
<add name="UpdateWxFindOrderUrl" connectionString="http://weidian.e57.cn/find_order_update/"/>
|
||||
<add name="WxFindOrderLimitVersion" connectionString="172"/>
|
||||
<add name="WxFindOrderLowVersion" connectionString="99"/>
|
||||
</connectionStrings>
|
||||
<!--
|
||||
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
|
||||
|
||||
可在 <httpRuntime> 标记上设置以下特性。
|
||||
<system.Web>
|
||||
<httpRuntime targetFramework="4.5.2" />
|
||||
</system.Web>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.6.2"/>
|
||||
<!--<customErrors mode="Off"/>-->
|
||||
<httpRuntime targetFramework="4.5.2" requestValidationMode="2.0"/>
|
||||
<webServices>
|
||||
<protocols>
|
||||
<add name="HttpGet"/>
|
||||
<add name="HttpPost"/>
|
||||
<add name="Documentation"/>
|
||||
</protocols>
|
||||
</webServices>
|
||||
<pages controlRenderingCompatibilityVersion="4.0"/>
|
||||
<!--<machineKey validation="3DES" validationKey="319B474B1D2B7A87C996B280450BB36506A95AEDF9B51211" decryption="3DES" decryptionKey="280450BB36319B474C996B506A95AEDF9B51211B1D2B7A87" />-->
|
||||
<machineKey validation="SHA1" validationKey="319A374B1D2B7A87C996B280450BB46506A95AEDF9B51212" decryption="3DES" decryptionKey="2B0B50BB36319B474C996B506A95AEDF9B51211B1D2B7A88"/>
|
||||
</system.web>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="9.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.webServer>
|
||||
<directoryBrowse enabled="true"/>
|
||||
<staticContent>
|
||||
<mimeMap fileExtension=".asmx" mimeType="application/octet-stream"/>
|
||||
</staticContent>
|
||||
</system.webServer>
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
</configuration>
|
||||
@@ -0,0 +1,100 @@
|
||||
using KJD_Web.BLL.WXXD;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace WebServiceTest
|
||||
{
|
||||
public class Tests
|
||||
{
|
||||
const string UserName = "13388889999";
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetOemWithdrawalsTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
WXOemManage manage = new WXOemManage();
|
||||
string ret = manage.OemWithdrawals(new KJD_Web.BLL.WXXD.Requests.OemWithdrawalQueryRequest
|
||||
{
|
||||
user_name = "18990991234",
|
||||
});
|
||||
Console.WriteLine(ret);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
Assert.Pass();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SettleOemFlowsTest()
|
||||
{
|
||||
WXOemManage manage = new WXOemManage();
|
||||
var ret = manage.SettleOemFlows(new KJD_Web.BLL.WXXD.Requests.OemWithdrawalRequest
|
||||
{
|
||||
user_name = "13388889999",
|
||||
|
||||
});
|
||||
Console.WriteLine(ret);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase("15266666666")]
|
||||
[TestCase("15698175212")]
|
||||
[TestCase("18238114231")]
|
||||
[TestCase("15870095938")]
|
||||
[TestCase("13388889999")]
|
||||
[TestCase("13860701921")]
|
||||
[TestCase("15907090308")]
|
||||
[TestCase("17837688880")]
|
||||
[TestCase("13682525364")]
|
||||
[TestCase("13048056467")]
|
||||
[TestCase("18317672222")]
|
||||
[TestCase("18500143331")]
|
||||
[TestCase("17318585555")]
|
||||
[TestCase("13459139999")]
|
||||
[TestCase("15206200631")]
|
||||
[TestCase("18737568536")]
|
||||
[TestCase("18949822610")]
|
||||
[TestCase("18165955361")]
|
||||
[TestCase("18556577919")]
|
||||
public void ApplyOemWithdrawalTest(string name)
|
||||
{
|
||||
WXOemManage manage = new WXOemManage();
|
||||
var ret = manage.ApplyOemWithdrawal(new KJD_Web.BLL.WXXD.Requests.OemWithdrawalRequest
|
||||
{
|
||||
user_name = name,
|
||||
amount = 10,
|
||||
withdrawal_type = KJD_Web.BLL.WXXD.Requests.WithdrawalType.Alipay,
|
||||
account_name = UserName,
|
||||
account_no = "https://qr.alipay.com/fkx17983kv07mbwpyz8jt81",
|
||||
});
|
||||
Console.WriteLine(ret);
|
||||
}
|
||||
[Test]
|
||||
public void AuditOemWithdrawalTest()
|
||||
{
|
||||
WXOemManage manage = new WXOemManage();
|
||||
var ret = manage.AuditOemWithdrawal(new KJD_Web.BLL.WXXD.Requests.OemWithdrawalAuditRequest
|
||||
{
|
||||
withdrawal_no = "TX202608261403434589545",
|
||||
audit_by = UserName,
|
||||
audit_result = 1
|
||||
});
|
||||
Console.WriteLine(ret);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetUser()
|
||||
{
|
||||
var user = new WXUserManage().GetUserByUserName("18990991234");
|
||||
Console.WriteLine(user.sa_level);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net462</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>12</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\KJD_WebService\KJD_WebService.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Configuration" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="NUnit.Framework" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||