更新框架,增加云库搜索模块

This commit is contained in:
chfei committed 2026-09-18 18:40:10 +08:00
1 parent 8526e5e0d2
commit f2caec6083
192 files changed
+3626 -804

No files matched your search

+53
View File
@@ -0,0 +1,53 @@
using StoreHub.KJDWebService.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Commons
{
public class BaseClass
{
public static string BuildPDDObjString(string file, bool IsLoginDef = false)
{
string LoginApiUrl = "http://1.13.195.131:9001";
string MainPath = "kuajingda";
return LoginApiUrl + "/bxx_" + file + "?obj=" + MainPath + "/bxx_" + file;
}
public static int TimeDifferent = 0;
public static int VersionCount = 99999999;
public static int CompanyId = 1;
public static string CompanyName = "1";
public static string UserKey = "1";
public static string Mobile = "18888888888";
public static string UserName = "18888888888";
public static string ShopId = "18888888888";
public static string ShopName = "18888888888";
}
public class UserLogin
{
/// <summary>
/// 获取签名字符串,新版
/// </summary>
/// <returns></returns>
public static string GetSignaturex()
{
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName);
}
public static string GetSignaturex(string shopId, string shopName)
{
if (string.IsNullOrEmpty(shopId))
shopId = "11111111";
if (string.IsNullOrEmpty(shopName))
shopName = "wx11111111";
int time = TimeUtils.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
string time1 = EncrypUtil.Encryption(time);
return "time=" + time + "&code=" + time1 + "&NbCodeVersion=1" + "&version=" + BaseClass.VersionCount +
"&company_id=" + BaseClass.CompanyId + "&company=" + HtmlUtils.UrlEncodeUtf8(BaseClass.CompanyName) +
"&user_name=" + BaseClass.UserName + "&user_key=" + BaseClass.UserKey + "&mobile=" + BaseClass.Mobile +
"&sid=" + shopId + "&shop=" + HtmlUtils.UrlEncodeUtf8(shopName);
}
}
}
+60
View File
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace StoreHub.KJDWebService.Commons
{
public class EncrypUtil
{
/// <summary>
/// 加密算法
/// </summary>
/// <param name="s">加密字符串</param>
/// <returns></returns>
public static string Encryption(int s)
{
string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD";
return GetMd5(sign);
}
/// <summary>
/// MD5加密
/// </summary>
/// <param name="instring"></param>
/// <returns></returns>
public static string GetMd5(string instring)
{
byte[] result = Encoding.Default.GetBytes(instring.Trim());
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
return BitConverter.ToString(output).Replace("-", "");
}
/// <summary>
/// 获取文件MD5值
/// </summary>
/// <param name="FilePath"></param>
/// <returns></returns>
public static string GetFileMd5(string FilePath)
{
try
{
FileStream get_file = new FileStream(FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
System.Security.Cryptography.MD5CryptoServiceProvider get_md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] hash_byte = get_md5.ComputeHash(get_file);
string resule = System.BitConverter.ToString(hash_byte);
resule = resule.Replace("-", "");
get_file.Close();
return resule;
}
catch (Exception e)
{
return e.ToString();
}
}
}
}
@@ -0,0 +1,705 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using NaiBa.Util.Helper;
using Newtonsoft.Json;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
#region 转换为long
/// <summary>
/// 将object转换为long,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static long ParseToLong(this object obj)
{
if (obj == null)
return 0L;
try
{
string str = obj.ParseToString();
if (string.IsNullOrEmpty(str))
{
return 0;
}
return long.Parse(str);
}
catch
{
return 0L;
}
}
public static long? ParseToNullableLong(this object obj)
{
if (obj == null)
return null;
try
{
string str = obj.ParseToString();
if (string.IsNullOrEmpty(str))
{
return null;
}
return long.Parse(str);
}
catch
{
return null;
}
}
/// <summary>
/// 将object转换为long,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static long ParseToLong(this string str, long defaultValue)
{
if (str == null)
return defaultValue;
try
{
return long.Parse(str);
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为int
/// <summary>
/// 将object转换为int,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static int ParseToInt(this object str)
{
if (str == null)
return 0;
try
{
return Convert.ToInt32(str);
}
catch
{
return 0;
}
}
public static int? ParseToNullableInt(this object str)
{
if (str == null)
return null;
try
{
return Convert.ToInt32(str);
}
catch
{
return null;
}
}
public static int DecimalPointParseToInt(this object str)
{
try
{
string temp = str.ParseToString();
int i = temp.IndexOf('.');
if (i > 0)
{
temp = temp.Substring(0, i);
}
return Convert.ToInt32(temp);
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为int,若转换失败,则返回指定值。不抛出异常。
/// null返回默认值
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static int ParseToInt(this object str, int defaultValue)
{
if (str == null)
{
return defaultValue;
}
try
{
return Convert.ToInt32(str);
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为short
/// <summary>
/// 将object转换为short,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static short ParseToShort(this object obj)
{
try
{
return short.Parse(obj.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为short,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static short ParseToShort(this object str, short defaultValue)
{
try
{
return short.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
#endregion
#region 转换为demical
/// <summary>
/// 将object转换为demical,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static decimal ParseToDecimal(this object str, decimal defaultValue)
{
try
{
return decimal.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
/// <summary>
/// 将object转换为demical,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static decimal ParseToDecimal(this object str)
{
try
{
return decimal.Parse(str.ToString());
}
catch
{
return 0;
}
}
public static decimal? ParseToNullableDecimal(this object str)
{
try
{
return decimal.Parse(str.ToString());
}
catch
{
return null;
}
}
#endregion
#region 转化为bool
/// <summary>
/// 将object转换为bool,若转换失败,则返回false。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool ParseToBool(this object str)
{
try
{
if (str is null)
return false;
return bool.Parse(str.ToString());
}
catch
{
return false;
}
}
/// <summary>
/// 将object转换为bool,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool ParseToBool(this object str, bool result)
{
try
{
return bool.Parse(str.ToString());
}
catch
{
return result;
}
}
#endregion
#region 转换为float
/// <summary>
/// 将object转换为float,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static float ParseToFloat(this object str)
{
try
{
return float.Parse(str.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为float,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static float ParseToFloat(this object str, float result)
{
try
{
return float.Parse(str.ToString());
}
catch
{
return result;
}
}
#endregion
#region 转换为Guid
/// <summary>
/// 将string转换为Guid,若转换失败,则返回Guid.Empty。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static Guid ParseToGuid(this string str)
{
try
{
return new Guid(str);
}
catch
{
return Guid.Empty;
}
}
#endregion
#region 转换为DateTime
public static DateTime? ParseToDateTimeNullable(this string str)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return null;
}
try
{
return DateTime.Parse(str);
}
catch
{
}
if (str.Contains("年") && str.Contains("月") && str.Contains("日") && !str.Contains("周"))
str = str.Replace("年", "-").Replace("月", "-").Replace("日", "").Replace("时", ":").Replace("分", ":").Replace("秒", "").Trim(' ', ':');
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return null;
}
}
/// <summary>
/// 将string转换为DateTime,若转换失败,则返回日期最小值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static DateTime ParseToDateTime(this string str)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return DateTime.MinValue;
}
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return DateTime.MinValue;
}
}
/// <summary>
/// 将string转换为DateTime,若转换失败,则返回默认值。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static DateTime ParseToDateTime(this string str, DateTime? defaultValue)
{
try
{
if (string.IsNullOrWhiteSpace(str))
{
return defaultValue.GetValueOrDefault();
}
if (str.Contains("-") || str.Contains("/"))
{
return DateTime.Parse(str);
}
else
{
int length = str.Length;
switch (length)
{
case 4:
return DateTime.ParseExact(str, "yyyy", System.Globalization.CultureInfo.CurrentCulture);
case 6:
return DateTime.ParseExact(str, "yyyyMM", System.Globalization.CultureInfo.CurrentCulture);
case 8:
return DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
case 10:
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
case 12:
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
case 14:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
default:
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
}
}
}
catch
{
return defaultValue.GetValueOrDefault();
}
}
#endregion
#region 转换为string
/// <summary>
/// 将object转换为string,若转换失败,则返回""。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static string ParseToString(this object obj)
{
try
{
if (obj == null)
{
return string.Empty;
}
else
{
if (obj is DateTime)
return (obj as DateTime?).Value.ToString("yyyy-MM-dd HH:mm:ss");
return obj.ToString();
}
}
catch
{
return string.Empty;
}
}
public static string ParseToNullableString(this object obj)
{
try
{
if (obj == null)
{
return null;
}
else
{
if (obj is DateTime)
return (obj as DateTime?).Value.ToString("yyyy-MM-dd HH:mm:ss");
return obj.ToString();
}
}
catch
{
return null;
}
}
public static string ParseToStrings<T>(this object obj, string split = ",")
{
try
{
var list = obj as IEnumerable<T>;
if (list != null)
{
return string.Join(split, list);
}
else
{
return obj.ToString();
}
}
catch
{
return string.Empty;
}
}
#endregion
#region 转换为double
/// <summary>
/// 将object转换为double,若转换失败,则返回0。不抛出异常。
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static double ParseToDouble(this object obj)
{
try
{
return double.Parse(obj.ToString());
}
catch
{
return 0;
}
}
/// <summary>
/// 将object转换为double,若转换失败,则返回指定值。不抛出异常。
/// </summary>
/// <param name="str"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public static double ParseToDouble(this object str, double defaultValue)
{
try
{
return double.Parse(str.ToString());
}
catch
{
return defaultValue;
}
}
#endregion
#region 字符串转指定类型Array
public static T[] SplitToArray<T>(this string value, string split = ",")
{
if (string.IsNullOrEmpty(value))
{
return default(T[]);
}
var arr = value.Split(new string[] { split }, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToArray();
return arr;
}
public static T[] SplitToArray<T>(this string value, string[] split)
{
if (string.IsNullOrEmpty(value))
{
return default(T[]);
}
var arr = value.Split(split, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToArray();
return arr;
}
#endregion
#region 字符串转指定类型List
public static List<T> SplitToList<T>(this string value, string split = ",")
{
if (string.IsNullOrEmpty(value))
{
return new List<T>();
}
var list = value.Split(new string[] { split }, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToList();
return list;
}
public static List<T> SplitToList<T>(this string value, string[] split)
{
if (string.IsNullOrEmpty(value))
{
return new List<T>();
}
var list = value.Split(split, StringSplitOptions.RemoveEmptyEntries).CastSuper<T>().ToList();
return list;
}
#endregion
#region 强制转换类型
/// <summary>
/// 强制转换类型
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <param name="source"></param>
/// <returns></returns>
public static IEnumerable<TResult> CastSuper<TResult>(this IEnumerable source)
{
foreach (object item in source)
{
yield return (TResult)Convert.ChangeType(item, typeof(TResult));
}
}
#endregion
#region Object转换为Json
public static string ParseToJson(this object obj)
{
return JsonConvert.SerializeObject(obj);
}
#endregion
#region Json转为Object
public static T ParseToObject<T>(this string json)
{
if (string.IsNullOrEmpty(json))
{
return Activator.CreateInstance<T>();
}
return JsonConvert.DeserializeObject<T>(json);
}
#endregion
#region 深拷贝(克隆出一个新对象,拷贝对象里面的数据和子对象)
public static T DeepClone<T>(this T o)
{
return o.ParseToJson().ParseToObject<T>();
// 这种方式在用 Obfuscator 的时候有问题
//using (MemoryStream stream = new MemoryStream())
//{
// BinaryFormatter formatter = new BinaryFormatter();
// formatter.Serialize(stream, o);
// stream.Position = 0;
// return (T)formatter.Deserialize(stream);
//}
}
#endregion
#region 浅拷贝(拷贝对象里面的数据[property and field],但不拷贝对象里面的子对象)
public static void ShadowClone<T1, T2>(this T1 source, ref T2 destination)
{
var sourceMembers = ReflectionHelper.GetMembers(source.GetType());
var destinationMembers = ReflectionHelper.GetMembers(destination.GetType());
// Copy data from source to destination
foreach (var sourceMember in sourceMembers)
{
if (!ReflectionHelper.CanRead(sourceMember))
{
continue;
}
var destinationMember = destinationMembers.FirstOrDefault(x => x.Name.ToLower() == sourceMember.Name.ToLower());
if (destinationMember == null || !ReflectionHelper.CanWrite(destinationMember))
{
continue;
}
ReflectionHelper.SetObjectValue(ref destination, destinationMember, ReflectionHelper.GetMemberValue(source, sourceMember));
}
}
#endregion
}
}
@@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
#region 枚举成员转成dictionary类型
/// <summary>
/// 转成dictionary类型
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static Dictionary<int, string> EnumToDictionary(this Type enumType)
{
Dictionary<int, string> dictionary = new Dictionary<int, string>();
Type typeDescription = typeof(DescriptionAttribute);
FieldInfo[] fields = enumType.GetFields();
int sValue = 0;
string sText = string.Empty;
foreach (FieldInfo field in fields)
{
if (field.FieldType.IsEnum)
{
sValue = ((int)enumType.InvokeMember(field.Name, BindingFlags.GetField, null, null, null));
object[] arr = field.GetCustomAttributes(typeDescription, true);
if (arr.Length > 0)
{
DescriptionAttribute da = (DescriptionAttribute)arr[0];
sText = da.Description;
}
else
{
sText = field.Name;
}
dictionary.Add(sValue, sText);
}
}
return dictionary.OrderBy(p => p.Key).ToDictionary(p => p.Key, p => p.Value);
}
/// <summary>
/// 枚举成员转成键值对Json字符串
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static string EnumToDictionaryString(this Type enumType)
{
List<KeyValuePair<int, string>> dictionaryList = EnumToDictionary(enumType).ToList();
var sJson = JsonConvert.SerializeObject(dictionaryList);
return sJson;
}
#endregion
#region 根据类型获取枚举的描述
/// <summary>
/// 获取枚举值对应的描述
/// </summary>
/// <param name="enumType"></param>
/// <returns></returns>
public static string GetDescription(this System.Enum enumType)
{
FieldInfo EnumInfo = enumType.GetType().GetField(enumType.ToString());
if (EnumInfo != null)
{
DescriptionAttribute[] EnumAttributes = (DescriptionAttribute[])EnumInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (EnumAttributes.Length > 0)
{
return EnumAttributes[0].Description;
}
}
return enumType.ToString();
}
#endregion
#region 根据值获取枚举的描述
public static string GetDescriptionByEnum<T>(this object obj)
{
var tEnum = System.Enum.Parse(typeof(T), obj.ParseToString()) as System.Enum;
var description = tEnum.GetDescription();
return description;
}
#endregion
#region 根据描述获取枚举值
public static int GetEnumValueByDescription<T>(this string description)
{
Dictionary<int, string> dict = typeof(T).EnumToDictionary();
int value = dict.Where(p => p.Value == description).Select(p => p.Key).FirstOrDefault();
return value;
}
#endregion
#region 根据枚举名称获取值
public static int GetEnumValueByName<T>(this string name)
{
return (int)System.Enum.Parse(typeof(T), name);
}
#endregion
#region 根据枚举值获取名称
public static object GetEnumNameByValue<T>(this int value)
{
return System.Enum.ToObject(typeof(T), value);
}
#endregion
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
public static Exception GetOriginalException(this Exception ex)
{
if (ex.InnerException == null) return ex;
return ex.InnerException.GetOriginalException();
}
}
}
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace NaiBa.Util.Extension
{
public static class LinqExtensions
{
public static Expression Property(this Expression expression, string propertyName)
{
return Expression.Property(expression, propertyName);
}
public static Expression AndAlso(this Expression left, Expression right)
{
return Expression.AndAlso(left, right);
}
public static Expression Call(this Expression instance, string methodName, params Expression[] arguments)
{
return Expression.Call(instance, instance.Type.GetMethod(methodName), arguments);
}
public static Expression GreaterThan(this Expression left, Expression right)
{
return Expression.GreaterThan(left, right);
}
public static Expression<T> ToLambda<T>(this Expression body, params ParameterExpression[] parameters)
{
return Expression.Lambda<T>(body, parameters);
}
public static Expression<Func<T, bool>> True<T>() { return param => true; }
public static Expression<Func<T, bool>> False<T>() { return param => false; }
/// <summary>
/// 组合And
/// </summary>
/// <returns></returns>
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.Compose(second, Expression.AndAlso);
}
/// <summary>
/// 组合Or
/// </summary>
/// <returns></returns>
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)
{
return first.Compose(second, Expression.OrElse);
}
/// <summary>
/// Combines the first expression with the second using the specified merge function.
/// </summary>
static Expression<T> Compose<T>(this Expression<T> first, Expression<T> second, Func<Expression, Expression, Expression> merge)
{
var map = first.Parameters
.Select((f, i) => new { f, s = second.Parameters[i] })
.ToDictionary(p => p.s, p => p.f);
var secondBody = ParameterRebinder.ReplaceParameters(map, second.Body);
return Expression.Lambda<T>(merge(first.Body, secondBody), first.Parameters);
}
/// <summary>
/// ParameterRebinder
/// </summary>
private class ParameterRebinder : ExpressionVisitor
{
/// <summary>
/// The ParameterExpression map
/// </summary>
readonly Dictionary<ParameterExpression, ParameterExpression> map;
/// <summary>
/// Initializes a new instance of the <see cref="ParameterRebinder"/> class.
/// </summary>
/// <param name="map">The map.</param>
ParameterRebinder(Dictionary<ParameterExpression, ParameterExpression> map)
{
this.map = map ?? new Dictionary<ParameterExpression, ParameterExpression>();
}
/// <summary>
/// Replaces the parameters.
/// </summary>
/// <param name="map">The map.</param>
/// <param name="exp">The exp.</param>
/// <returns>Expression</returns>
public static Expression ReplaceParameters(Dictionary<ParameterExpression, ParameterExpression> map, Expression exp)
{
return new ParameterRebinder(map).Visit(exp);
}
/// <summary>
/// Visits the parameter.
/// </summary>
/// <param name="p">The p.</param>
/// <returns>Expression</returns>
protected override Expression VisitParameter(ParameterExpression p)
{
ParameterExpression replacement;
if (map.TryGetValue(p, out replacement))
{
p = replacement;
}
return base.VisitParameter(p);
}
}
}
}
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using NaiBa.Util.Helper;
using Newtonsoft.Json.Linq;
namespace NaiBa.Util.Extension
{
public static partial class Extensions
{
public static bool IsNullOrEmpty(this object value)
{
if (value != null && !string.IsNullOrEmpty(value.ParseToString()))
{
return false;
}
else
{
return true;
}
}
public static bool IsNullOrZero(this object value)
{
if (value == null || string.IsNullOrEmpty(value.ParseToString()) || value.ParseToString().Trim() == "0")
{
return true;
}
else
{
return false;
}
}
public static bool IsNumericType(this object value)
{
if (value == null)
{
return false;
}
switch (Type.GetTypeCode(value.GetType()))
{
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Decimal:
case TypeCode.Double:
case TypeCode.Single:
return true;
default:
return false;
}
}
public static bool IsStringType(this object value)
{
if (value == null)
{
return false;
}
switch (Type.GetTypeCode(value.GetType()))
{
case TypeCode.String:
return true;
default:
return false;
}
}
public static bool IsNumber(this string value)
{
return RegexHelper.IsNumber(value);
}
public static bool IsAlphabet(this string value)
{
return RegexHelper.IsAlphabet(value);
}
public static bool IsAlphabetOrNumber(this string value)
{
return RegexHelper.IsAlphabetOrNumber(value);
}
public static bool IsJson(this string value)
{
return JsonHelper.IsJson(value);
}
public static bool IsJTokenNullOrEmpty(this JToken token)
{
return (token == null) ||
(token.Type == JTokenType.Array && !token.HasValues) ||
(token.Type == JTokenType.Object && !token.HasValues) ||
(token.Type == JTokenType.String && token.ToString() == string.Empty) ||
(token.Type == JTokenType.Null);
}
public static bool IsAjaxRequest(this Microsoft.AspNetCore.Http.HttpRequest request)
{
if (request == null)
throw new ArgumentNullException("request");
if (request.Headers != null)
return request.Headers["X-Requested-With"] == "XMLHttpRequest";
return false;
}
}
}
@@ -0,0 +1,215 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class HtmlHelper
{
public static string HtmlEncode(string html)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
else
{
return WebUtility.HtmlEncode(html);
}
}
public static string HtmlDecode(string url)
{
if (string.IsNullOrEmpty(url))
{
return string.Empty;
}
else
{
return WebUtility.HtmlDecode(url);
}
}
/// <summary>
/// Unicode解码
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static string UnicodeDecode(string html)
{
html = WebUtility.HtmlDecode(html);
Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled);
return reUnicode.Replace(html, m =>
{
short c;
if (short.TryParse(m.Groups[1].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c))
{
return "" + (char)c;
}
return m.Value;
});
}
#region Resove
public static string Resove(string html, string prefix, string subfix = "")
{
int inl = html.IndexOf(prefix);
if (inl == -1)
{
prefix = prefix.Replace("\"", "'");
subfix = subfix.Replace("\"", "'");
inl = html.IndexOf(prefix);
}
if (inl == -1)
{
return null;
}
inl += prefix.Length;
if (!string.IsNullOrEmpty(subfix))
{
int inl2 = html.IndexOf(subfix, inl);
if (inl2 == -1)
{
return null;
}
string result = html.Substring(inl, inl2 - inl);
return result;
}
else
{
string result = html.Substring(inl);
return result;
}
}
#endregion
#region ResoveReverse
public static string ResoveReverse(string html, string subfix, string prefix)
{
int inl = html.IndexOf(subfix);
if (inl == -1)
{
return null;
}
string subString = html.Substring(0, inl);
int inl2 = subString.LastIndexOf(prefix);
if (inl2 == -1)
{
return null;
}
string s = subString.Substring(inl2 + prefix.Length, subString.Length - inl2 - prefix.Length);
return s;
}
#endregion
#region ResoveList
public static List<string> ResoveList(string html, string prefix, string subfix)
{
List<string> list = new List<string>();
int index = 0;
do
{
index = html.IndexOf(prefix, index);
if (index == -1)
{
break;
}
index += prefix.Length;
int indexEnd = html.IndexOf(subfix, index);
if (indexEnd > 0)
{
string content = html.Substring(index, indexEnd - index);
list.Add(content);
}
index = indexEnd;
}
while (index > -1);
return list;
}
#endregion
#region ResoveListByAT
public static List<string> ResoveListByAT(string html)
{
List<string> list = new List<string>();
int index = html.IndexOf('@');
while (index > 0)
{
int indexx = html.LastIndexOf("'", index); //向前一个单引号
int indexy = html.IndexOf("'", index + 1); //向后一个单引号
string s78 = html.Substring(indexx, indexy - indexx);
s78 = s78.Replace("'", "");
list.Add(s78);
index = html.IndexOf('@', indexy);
}
return list;
}
#endregion
/// <summary>
/// 清除HTML代码
/// </summary>
/// <param name="html"></param>
public static string ClearHtml(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, @"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", string.Empty);
html = Regex.Replace(html, @"(<span[\w\W]*?</span>)", string.Empty);
html = Regex.Replace(html, "(<[^>]*?>)", string.Empty);
return html;
}
public static string GetHtmlText(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, "<.*?>", string.Empty);
return html;
}
/// <summary>
/// 清除HTML代码A标签
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static string ClearHtmlA(string html)
{
html = html.ParseToString();
html = Regex.Replace(html, "(</?a[^>]*>)", "", RegexOptions.IgnoreCase);
return html.Trim();
}
public static string AddEscapeCharacter(string html)
{
html = html.ParseToString();
html = html.Replace("\"", "\\\"");
html = html.Replace("'", "\\'");
return html;
}
public static string TrimBOM(string html)
{
html = html.Trim(new char[] { '\uFEFF' });
return html;
}
public static string TrimJsonp(string json)
{
int start = json.IndexOf("{");
int end = json.LastIndexOf("}");
if (start > 0 && end > 0)
{
return json.Substring(start, end - start + 1);
}
return json;
}
}
}
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class JsonHelper
{
public static bool IsJson(string html)
{
if (string.IsNullOrEmpty(html))
{
return false;
}
html = html.Trim();
if ((html.StartsWith("{") && html.EndsWith("}")) || // For object
(html.StartsWith("[") && html.EndsWith("]"))) // For array
{
try
{
var obj = JToken.Parse(html);
return true;
}
catch
{
return false;
}
}
return false;
}
public static string JsonAlphabeticaly(string json)
{
json = json.ParseToString().Trim();
if (json.StartsWith("{"))
{
var jObj = JObject.Parse(json);
JObject result = new JObject();
OrderJson(result, jObj);
return result.ToString();
}
else
{
var jArr = JArray.Parse(json);
JArray result = new JArray();
foreach (var arr in jArr)
{
result.Add(new JObject());
OrderJson((JObject)result[result.Count - 1], (JObject)arr);
}
return result.ToString();
}
}
public static string SerializeAlphabeticaly(object obj)
{
return JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new OrderedContractResolver() });
}
public static string TrimJsonp(string json)
{
return HtmlHelper.TrimJsonp(json);
}
#region 私有方法
private static void OrderJson(JObject jObj, JObject item)
{
foreach (var property in item.Children<JProperty>().OrderBy(p => p.Name))
{
switch (property.Value.Type.ToString())
{
case "Array":
var jArr = new JArray();
jObj.Add(property.Name, jArr);
for (int i = 0; i < property.Value.Count(); i++)
{
switch (property.Value[i].Type.ToString())
{
case "Object":
var obj = new JObject();
jArr.Add(obj);
OrderJson(obj, (JObject)property.Value[i]);
break;
default:
jArr.Add(property.Value[i]);
break;
}
}
break;
case "Object":
jObj.Add(property.Name, new JObject());
OrderJson((JObject)jObj[property.Name], (JObject)property.Value);
break;
default:
jObj.Add(property.Name, property.Value);
break;
}
}
}
#endregion
}
public class OrderedContractResolver : DefaultContractResolver
{
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
{
return base.CreateProperties(type, memberSerialization)
.OrderBy(p => p.Order ?? int.MaxValue) // Honour any explit ordering first
.ThenBy(p => p.PropertyName)
.ToList();
}
}
}
@@ -0,0 +1,220 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Reflection;
using System.Linq.Expressions;
using NaiBa.Util.Extension;
namespace NaiBa.Util.Helper
{
public class ReflectionHelper
{
private static ConcurrentDictionary<string, object> dictCache = new ConcurrentDictionary<string, object>();
#region 得到类里面的属性集合
public static PropertyInfo[] GetProperties(Type type, string[] columns = null)
{
PropertyInfo[] properties = null;
if (dictCache.ContainsKey(type.FullName))
{
properties = dictCache[type.FullName] as PropertyInfo[];
}
else
{
properties = type.GetProperties();
dictCache.TryAdd(type.FullName, properties);
}
if (columns != null && columns.Length > 0)
{
// 按columns顺序返回属性
var columnPropertyList = new List<PropertyInfo>();
foreach (var column in columns)
{
var columnProperty = properties.Where(p => p.Name == column).FirstOrDefault();
if (columnProperty != null)
{
columnPropertyList.Add(columnProperty);
}
}
return columnPropertyList.ToArray();
}
else
{
return properties;
}
}
#endregion
public static List<MemberInfo> GetMembers(Type type)
{
var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
var members = new List<MemberInfo>();
members.AddRange(type.GetProperties(flags));
members.AddRange(type.GetFields(flags));
return members;
}
public static void SetObjectPropertyValue<T>(string propertyName, object value)
{
var type = typeof(T);
var field = type.GetProperty(propertyName);
if (field != null)
{
field.SetValue(null, value);
}
}
public static void SetObjectPropertyValue(object obj, string propertyName, object value)
{
if (obj != null)
{
PropertyInfo propertyInfo = GetProperties(obj.GetType()).Where(p => p.Name == propertyName).FirstOrDefault();
// make sure object has the property we are after
if (propertyInfo != null)
{
switch (propertyInfo.PropertyType.FullName)
{
case "System.Int32": propertyInfo.SetValue(obj, value.ParseToInt(), null); break;
case "System.Int64": propertyInfo.SetValue(obj, value.ParseToLong(), null); break;
case "System.Decimal": propertyInfo.SetValue(obj, value.ParseToDecimal(), null); break;
case "System.Double": propertyInfo.SetValue(obj, value.ParseToDouble(), null); break;
default:
if (propertyInfo.PropertyType.GenericTypeArguments.Length > 0)
{
switch (propertyInfo.PropertyType.GenericTypeArguments[0].FullName)
{
case "System.DateTime":
if (!string.IsNullOrEmpty(value.ParseToString()))
{
propertyInfo.SetValue(obj, value.ParseToString().ParseToDateTime(), null);
}
break;
case "System.Decimal":
propertyInfo.SetValue(obj, value.ParseToDecimal(), null);
break;
}
}
else
{
propertyInfo.SetValue(obj, value, null);
}
break;
}
}
}
}
public static object GetObjectPropertyValue(object obj, string propertyName)
{
if (obj != null)
{
PropertyInfo propertyInfo = GetProperties(obj.GetType()).Where(p => p.Name == propertyName).FirstOrDefault();
// make sure object has the property we are after
if (propertyInfo != null)
{
return propertyInfo.GetValue(obj);
}
}
return null;
}
public static string GetGenericName(Type type)
{
if (type.GetGenericArguments().Length > 0)
{
return GetGenericName(type.GetGenericArguments().FirstOrDefault());
}
else
{
if (type.GetGenericArguments().FirstOrDefault() != null)
{
return type.GetGenericArguments().FirstOrDefault().Name;
}
else
{
return type.Name;
}
}
}
public static string GetMemberName<T>(Expression<Func<T>> memberExpression)
{
MemberExpression expressionBody = (MemberExpression)memberExpression.Body;
return expressionBody.Member.Name;
}
public static void SetObjectValue<T>(ref T obj, MemberInfo member, object value)
{
// Boxing method used for modifying structures
var boxed = obj.GetType().IsValueType ? (object)obj : obj;
SetMemberValue(ref boxed, member, value);
obj = (T)boxed;
}
public static void SetMemberValue<T>(ref T obj, MemberInfo member, object value)
{
if (IsProperty(member))
{
var prop = (PropertyInfo)member;
if (prop.SetMethod != null)
{
prop.SetValue(obj, value);
}
}
else if (IsField(member))
{
var field = (FieldInfo)member;
field.SetValue(obj, value);
}
}
public static object GetMemberValue(object obj, MemberInfo member)
{
object result = null;
if (IsProperty(member))
{
var prop = (PropertyInfo)member;
result = prop.GetValue(obj, prop.GetIndexParameters().Count() == 1 ? new object[] { null } : null);
}
else if (IsField(member))
{
var field = (FieldInfo)member;
result = field.GetValue(obj);
}
return result;
}
public static bool CanWrite(MemberInfo member)
{
return IsProperty(member) ? ((PropertyInfo)member).CanWrite : IsField(member);
}
public static bool CanRead(MemberInfo member)
{
return IsProperty(member) ? ((PropertyInfo)member).CanRead : IsField(member);
}
#region 私有方法
private static bool IsProperty(MemberInfo member)
{
return IsType(member.GetType(), typeof(PropertyInfo));
}
private static bool IsField(MemberInfo member)
{
return IsType(member.GetType(), typeof(FieldInfo));
}
private static bool IsType(System.Type type, System.Type targetType)
{
return type.Equals(targetType) || type.IsSubclassOf(targetType);
}
#endregion
}
}
@@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace NaiBa.Util.Helper
{
public class RegexHelper
{
// <span\\sclass=\"rantings-num\".*?>(.+?)</span>
/// <summary>
/// 返回正则对象所有结果
/// </summary>
/// <param name="html"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static MatchCollection GetMatchCollection(string html, string regex)
{
if (string.IsNullOrEmpty(html))
{
return null;
}
return Regex.Matches(html, regex, RegexOptions.IgnoreCase);
}
/// <summary>
/// 返回单个正则分析结果
/// </summary>
/// <param name="html"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static string GetMatch(string html, string regex, int index = 0)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
MatchCollection mc = Regex.Matches(html, regex, RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
return mc[index].Groups[1].Value.ToString();
}
return string.Empty;
}
public static string GetMatchWithSingleLine(string html, string regex)
{
if (string.IsNullOrEmpty(html))
{
return string.Empty;
}
MatchCollection mc = Regex.Matches(html, regex, RegexOptions.IgnoreCase | RegexOptions.Singleline);
if (mc.Count > 0)
{
return mc[0].Groups[1].ToString();
}
return string.Empty;
}
public static bool IsNumber(string str)
{
Regex regex = new Regex(@"^[0-9\.]+$");
return regex.IsMatch(str);
}
public static bool IsAlphabet(string str)
{
Regex regex = new Regex(@"^[A-Za-z]+$");
return regex.IsMatch(str);
}
public static bool IsAlphabetOrNumber(string str)
{
Regex regex = new Regex(@"^[A-Za-z0-9]+$");
return regex.IsMatch(str);
}
}
}
+417
View File
@@ -0,0 +1,417 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Cache;
using System.Net.Security;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
namespace StoreHub.KJDWebService.Commons
{
public class HtmlUtils
{
static public string UrlDecodeUtf8(string value)
{
if (value == null)
{
return null;
}
Encoding encoding = Encoding.UTF8;//你的编码 也可能是GBK
int length = value.Length;
UrlDecoder decoder = new UrlDecoder(length, encoding);
for (int i = 0; i < length; i++)
{
char ch = value[i];
if (ch == '+')
{
ch = ' ';
}
else if ((ch == '%') && (i < (length - 2)))
{
if ((value[i + 1] == 'u') && (i < (length - 5)))
{
int num3 = HexToInt(value[i + 2]);
int num4 = HexToInt(value[i + 3]);
int num5 = HexToInt(value[i + 4]);
int num6 = HexToInt(value[i + 5]);
if (((num3 < 0) || (num4 < 0)) || ((num5 < 0) || (num6 < 0)))
{
goto Label_010B;
}
ch = (char)((((num3 << 12) | (num4 << 8)) | (num5 << 4)) | num6);
i += 5;
decoder.AddChar(ch);
continue;
}
int num7 = HexToInt(value[i + 1]);
int num8 = HexToInt(value[i + 2]);
if ((num7 >= 0) && (num8 >= 0))
{
byte b = (byte)((num7 << 4) | num8);
i += 2;
decoder.AddByte(b);
continue;
}
}
Label_010B:
if ((ch & 0xff80) == 0)
{
decoder.AddByte((byte)ch);
}
else
{
decoder.AddChar(ch);
}
}
return decoder.GetString();
}
/// <summary>
/// URL UTF-8转码
/// </summary>
/// <param name="IndexKey"></param>
/// <returns></returns>
public static string UrlEncodeUtf8(string IndexKey)
{
if (String.IsNullOrEmpty(IndexKey))
return "";
return WebUtility.UrlEncode(IndexKey);
}
/// <summary>
/// post 数据
/// </summary>
/// <param name="url"></param>
/// <param name="postData"></param>
/// <returns></returns>
public static string PostUtf8(string url, StringBuilder postData)
{
try
{
WebClientx wc = new WebClientx();
byte[] sendData = Encoding.GetEncoding("utf-8").GetBytes(postData.ToString());
wc.Headers.Add("ContentLength", sendData.Length.ToString());
wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
wc.Proxy = null;
return Encoding.UTF8.GetString(wc.UploadData(url, "POST", sendData));
}
catch
{
return "";
}
}
/// <summary>
/// 浏览器标识
/// </summary>
public static string UserAgent = @"Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36
Mozilla/5.0+(Windows+NT+6.1)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36
Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/54.0.2840.99+Safari/537.36
Mozilla/5.0+(Windows+NT+5.1)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/31.0.1650.63+Safari/537.36
Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+Win64;+x64;+Trident/5.0)
Mozilla/5.0+(Windows+NT+5.1)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
Mozilla/5.0+(Windows+NT+6.3;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko
Mozilla/5.0+(Windows+NT+10.0;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36
Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+WOW64;+Trident/5.0)
Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/57.0.2987.133+Safari/537.36
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
/// <summary>
/// post 数据
/// </summary>
/// <param name="url"></param>
/// <param name="postData"></param>
/// <returns></returns>
public static string PostUtf8(string url, string postData, string contentType = "")
{
//return PostUtf8(url, Encoding.UTF8.GetBytes(postData));
bool isError = false;
string[] l = UserAgent.Split('\n');
reTry:
try
{
string codeType = "utf-8";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = l[new Random(Guid.NewGuid().GetHashCode()).Next(l.Length)].Trim();
byte[] byteData = Encoding.GetEncoding(codeType).GetBytes(postData);
request.Method = "POST";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.Timeout = 30 * 1000;
request.ReadWriteTimeout = 30 * 1000;
request.Proxy = null;
request.ContentType = "application/x-www-form-urlencoded; charset=" + codeType;
//if (BaseClass.SaLevel > 0)
{
//260306 采用GZip/deflate压缩
//request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
//request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
}
if (url.StartsWith("https://openapi.jinritemai.com/"))
{
request.Headers.Add("X-USE-BOE", "1");
request.Headers.Add("Origin-From", "djt_prod");
request.Headers.Add("djt_prod", "boe_time_sku");
}
if (!string.IsNullOrEmpty(contentType))
{
request.ContentType = contentType;
}
request.ContentLength = byteData.Length;
request.Referer = url;
request.CookieContainer = new CookieContainer();
request.AllowAutoRedirect = false;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(byteData, 0, byteData.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType));
return readStream.ReadToEnd().Trim();
}
catch (Exception e)
{
//{
// isError = true;
// goto reTry;
//}
Thread.Sleep(50);
return "";
}
}
public static int HexToInt(char h)
{
if ((h >= '0') && (h <= '9'))
{
return (h - '0');
}
if ((h >= 'a') && (h <= 'f'))
{
return ((h - 'a') + 10);
}
if ((h >= 'A') && (h <= 'F'))
{
return ((h - 'A') + 10);
}
return -1;
}
}
/// <summary>
/// class UrlDecoder
/// </summary>
class UrlDecoder
{
// Fields
private int _bufferSize;
private byte[] _byteBuffer;
private char[] _charBuffer;
private Encoding _encoding;
private int _numBytes;
private int _numChars;
// Methods
internal UrlDecoder(int bufferSize, Encoding encoding)
{
this._bufferSize = bufferSize;
this._encoding = encoding;
this._charBuffer = new char[bufferSize];
}
internal void AddByte(byte b)
{
if (this._byteBuffer == null)
{
this._byteBuffer = new byte[this._bufferSize];
}
this._byteBuffer[this._numBytes++] = b;
}
internal void AddChar(char ch)
{
if (this._numBytes > 0)
{
this.FlushBytes();
}
this._charBuffer[this._numChars++] = ch;
}
private void FlushBytes()
{
if (this._numBytes > 0)
{
this._numChars += this._encoding.GetChars(this._byteBuffer, 0, this._numBytes, this._charBuffer, this._numChars);
this._numBytes = 0;
}
}
internal string GetString()
{
if (this._numBytes > 0)
{
this.FlushBytes();
}
if (this._numChars > 0)
{
return new string(this._charBuffer, 0, this._numChars);
}
return string.Empty;
}
}
/// <summary>
/// 下载器
/// </summary>
public class WebClientx : WebClient
{
/// <summary>
/// 默认超时多少秒
/// </summary>
public int Timeout = 100;
/// <summary>
/// 允许自动重定向
/// </summary>
public bool AllowAutoRedirect = true;
public bool IsDelete = false;
private string OutIP = "";
/// <summary>
/// 证书列表
/// </summary>
public static List<Certificate> X509List = new List<Certificate>();
/// <summary>
/// 绑定IP
/// </summary>
/// <param name="outIp"></param>
public WebClientx(string outIp)
{
OutIP = outIp;
CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
}
public WebClientx()
{
}
/// <summary>
/// 重写
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
protected override WebRequest GetWebRequest(Uri address)
{
string s = address.ToString();
if (string.IsNullOrEmpty(s) || s.Length < 7 || !(s.Substring(0, 7).ToLower() == "http://" || s.Substring(0, 8).ToLower() == "https://"))
return null;
var request = (HttpWebRequest)base.GetWebRequest(address);
request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
request.Timeout = 1000 * Timeout;
request.ReadWriteTimeout = 500 * Timeout;
request.AllowAutoRedirect = AllowAutoRedirect;
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
if (IsDelete)
request.Method = "DELETE";
if (!string.IsNullOrEmpty(OutIP))
{
request.ServicePoint.BindIPEndPointDelegate = (servicePoint, remoteEndPoint, retryCount) =>
{
servicePoint.MaxIdleTime = 20;
return new IPEndPoint(IPAddress.Parse(OutIP), 0);
};
}
if (request.RequestUri.Scheme == "https") //挂接验证服务端证书的回调
{
X509Certificate2 x509c = null;
for (int i = 0; i < X509List.Count; i++)
{
if (X509List[i].Domain.ToLower() == address.Host.ToLower())
{
x509c = X509List[i].X509;
break;
}
}
if (x509c == null)
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(RemoteCertificateValidationCallback);
try
{
X509Store _store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
_store.Open(OpenFlags.ReadWrite);
string findValue = Dns.GetHostName(); //获取本地主机名称作为证书查找的参数
X509Certificate2Collection _certsCollection =
_store.Certificates.Find(X509FindType.FindByIssuerName, findValue, false);
if (_certsCollection.Count > 0)
{
x509c = _certsCollection[0];
request.ClientCertificates.Add(x509c);
}
}
catch { }
}
}
return request;
}
/// <summary>
/// 获取证书
/// </summary>
/// <param name="sender"></param>
/// <param name="certificate"></param>
/// <param name="chain"></param>
/// <param name="sslPolicyErrors"></param>
/// <returns></returns>
public bool RemoteCertificateValidationCallback(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
//if (sslPolicyErrors == SslPolicyErrors.None) {
// return true;
//}
//Console.WriteLine("Certificate error: {0}", sslPolicyErrors);
//// Do not allow this client to communicate with unauthenticated servers.
//return false;
return true;
}
}
/// <summary>
/// 网站证书
/// </summary>
public class Certificate
{
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
/// <summary>
/// 证书
/// </summary>
public X509Certificate2 X509 { get; set; }
}
}
+380
View File
@@ -0,0 +1,380 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Commons
{
public class HttpUtils
{
public static string WxApiPostResponse(string _url, string _data, string referer)
{
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.ContentType = "application/json";
request.Accept = "*/*";
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = _data;
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = ReadResponse(response);
return result;
}
public static string WxApiGetResponse(string _url, string referer)
{
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.ContentType = "application/json";
request.Accept = "*/*";
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = ReadResponse(response);
return result;
}
public static string e57PostResponse(string _url, string _data, string referer)
{
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request;
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
{
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol =
ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
request = WebRequest.Create(url) as HttpWebRequest;
request.ProtocolVersion = HttpVersion.Version10;
}
else
request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.ContentType = "application/json";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; //request.Accept = "*/*";
request.Referer = referer;
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = _data;
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body);
request.ContentLength = postBytes.Length;
Stream stream = request.GetRequestStream();
stream.Write(postBytes, 0, postBytes.Length);
stream.Close();
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = ReadResponse(response);
return result;
}
public static string e57GetResponse(string _url, string referer)
{
HttpWebResponse response = null;
string result;
try
{
string url = _url;
HttpWebRequest request;
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
{
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol =
ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
request = WebRequest.Create(url) as HttpWebRequest;
request.ProtocolVersion = HttpVersion.Version10;
}
else
request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Add("sec-ch-ua", @"""Not(A:Brand"";v=""8"", ""Chromium"";v=""144"", ""Google Chrome"";v=""144""");
request.Headers.Add("sec-ch-ua-mobile", @"?0");
request.Headers.Add("sec-ch-ua-platform", @"""Windows""");
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
request.Headers.Add("Sec-Fetch-Site", @"none");
request.Headers.Add("Sec-Fetch-Mode", @"navigate");
request.Headers.Add("Sec-Fetch-User", @"?1");
request.Headers.Add("Sec-Fetch-Dest", @"document");
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = ReadResponse(response);
return result;
}
public static string ReadResponse(HttpWebResponse response)
{
using (Stream responseStream = response.GetResponseStream())
{
Stream streamToRead = responseStream;
if (response.ContentEncoding.ToLower().Contains("gzip"))
{
streamToRead = new GZipStream(streamToRead, CompressionMode.Decompress);
}
else if (response.ContentEncoding.ToLower().Contains("deflate"))
{
streamToRead = new DeflateStream(streamToRead, CompressionMode.Decompress);
}
using (StreamReader streamReader = new StreamReader(streamToRead, Encoding.UTF8))
{
return streamReader.ReadToEnd();
}
}
}
public static void WriteMultipartBodyToRequest(HttpWebRequest request, string body)
{
string[] multiparts = Regex.Split(body, @"<!>");
byte[] bytes;
using (MemoryStream ms = new MemoryStream())
{
foreach (string part in multiparts)
{
if (File.Exists(part))
{
bytes = File.ReadAllBytes(part);
}
else
{
bytes = System.Text.Encoding.UTF8.GetBytes(part.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n"));
}
ms.Write(bytes, 0, bytes.Length);
}
request.ContentLength = ms.Length;
using (Stream stream = request.GetRequestStream())
{
ms.WriteTo(stream);
}
}
}
/// <summary>
/// 读取网络图片转为Img以在DataGridView中显示,用于HttpWebRequest直接读取可能403的情况
/// </summary>
/// <param name="imgUrl"></param>
/// <param name="rst"></param>
/// <returns></returns>
public static Image GetUrlImg(string imgUrl, out string rst)
{
rst = "";
//return LoadImage(imgUrl);
Image image = null;
HttpWebResponse response = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
//request.IfModifiedSince = DateTime.Parse("Fri, 18 Jul 2025 06:00:49 GMT"); // 没改动不更新,CS程序无缓存不使用
response = (HttpWebResponse)request.GetResponse();
using (Stream stream = response.GetResponseStream())
{
image = Image.FromStream(stream);
}
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
rst = ReadResponse(response);
}
if (string.IsNullOrEmpty(rst))
rst = ex.Message;
}
catch (Exception e)
{
rst = e.Message;
}
if (response != null)
{
response.Close();
response.Dispose();
}
return image;
}
public static string WxApiUploadImgFile(string filePath, int width, int height, string accessToken)
{
string boundary = "----WebKitFormBoundaryeZuqpVO6jYOF5Y6S";
HttpWebResponse response = null;
string result;
try
{
string url = "https://api.weixin.qq.com/shop/ec/basics/img/upload?access_token=" + accessToken +
"&upload_type=0&resp_type=1&height=" + height + "&width=" + width;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = true;
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
request.ContentType = "multipart/form-data; boundary=" + boundary;
request.Accept = "*/*";
request.Referer = "";
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
string body = @"--" + boundary + @"
Content-Disposition: form-data; name=""media""; filename=""" + Path.GetFileName(filePath) + @"""
Content-Type: image/jpg
<!>" + filePath + @"<!>
--" + boundary + @"--
";
WriteMultipartBodyToRequest(request, body);
response = (HttpWebResponse)request.GetResponse();
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
response = (HttpWebResponse)ex.Response;
result = ReadResponse(response);
return result;
}
else return ex.Message;
}
catch (Exception e)
{
if (response != null) response.Close();
return e.Message;
}
result = ReadResponse(response);
return result;
}
}
}
+138
View File
@@ -0,0 +1,138 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace StoreHub.KJDWebService.Commons
{
public class JsonUtils
{
/// <summary>
/// 反序列化Json字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="jsonStr">json字符串</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string jsonStr) where T : class
{
try
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(jsonStr);
object obj = serializer.Deserialize(new JsonTextReader(sr), typeof(T));
T t = obj as T;
return t;
}
catch
{
return null;
}
}
public static string SerializeObject(object obj)
{
return SerializeObjectToString(obj);
}
public static string SerializeObjectToString(object obj, JsonSerializerSettings jsonsetting = null)
{
try
{
string str = "";
if (jsonsetting != null)
str = JsonConvert.SerializeObject(obj, Formatting.None, jsonsetting);
else
str = JsonConvert.SerializeObject(obj, Formatting.None);
return str;
}
catch
{
return null;
}
}
public static T DeserializeJsonToObjectNullable<T>(string json) where T : class
{
try
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(T));
T t = o as T;
return t;
}
catch
{
return null;
}
}
public static JObject JObjectParse(string json, JsonLoadSettings settings = null)
{
try
{
if (settings == null)
{
JObject obj = JObject.Parse(json);
return obj;
}
else
{
JObject obj = JObject.Parse(json, settings);
return obj;
}
}
catch
{
return null;
}
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
public static List<T> DeserializeJsonToListNullable<T>(string json) where T : class
{
try
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
catch
{
return null;
}
}
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
}
}
+41
View File
@@ -0,0 +1,41 @@
using Microsoft.Extensions.Configuration;
namespace StoreHub.KJDWebService.Commons
{
/// <summary>
/// 业务配置读取(旧 System.Configuration.ConfigurationManager 迁移)。
/// 连接串读 ConnectionStrings 节;业务开关读 KJDConfig 节。
/// 由宿主 Program.cs 在启动时初始化。
/// </summary>
public static class KJDConfig
{
private static IConfiguration _configuration;
public static void SetConfiguration(IConfiguration configuration)
{
_configuration = configuration;
}
public static string GetConnection(string key)
{
if (_configuration == null)
return null;
var v = _configuration[$"ConnectionStrings:{key}"];
if (!string.IsNullOrEmpty(v))
return v;
v = _configuration.GetConnectionString(key);
return v;
}
/// <summary>读取配置值(对应旧 connectionStrings["key"].ConnectionString)</summary>
public static string Get(string key)
{
if (_configuration == null)
return null;
// 优先业务配置节,其次连接串
var v = _configuration[$"KJDConfig:{key}"];
if (!string.IsNullOrEmpty(v))
return v;
v = _configuration.GetConnectionString(key);
return v;
}
}
}
+835
View File
@@ -0,0 +1,835 @@
using FreeSql;
using Microsoft.Extensions.DependencyInjection;
using MySql.Data.MySqlClient;
using System.Data;
using System.Security.Cryptography;
namespace StoreHub.KJDWebService.Commons
{
public class MysqlUtils
{
public string Message = "";
/// <summary>
/// 数据库连接字符串
/// </summary>
private string ConnString = "";
/// <summary>
/// 数据库连接
/// </summary>
private MySqlConnection Conn;
/// <summary>
/// 数据库读取对象
/// </summary>
private MySqlDataReader reader;
/// <summary>
/// 数据库执行对象
/// </summary>
private MySqlCommand cmd = new MySqlCommand();
/// <summary>
/// 错误信息
/// </summary>
//public static string ErrorString = "";
/// <summary>
/// 超时(秒)
/// </summary>
public int TimeOut = 120;
/// <summary>
/// 链接状态
/// </summary>
public bool Connected
{
get { return Conn != null && Conn.State == ConnectionState.Open; }
}
/// <summary>
/// 是否正在执行
/// </summary>
public bool IsRunning = false;
public bool IsUseTrans { get; set; } = false;
public MySqlTransaction Transaction { get; set; } = null;
/// <summary>
/// 初始化数据库链接
/// </summary>
/// <param name="connString">数据库链接</param>
public MysqlUtils(string connString, bool isUseTrans = false)
{
this.IsUseTrans = isUseTrans;
ConnString = KJDConfig.GetConnection(connString);
ConnTo();
}
/// <summary>
/// 去掉SQL中的特殊字符
/// </summary>
/// <param name="value">字符串</param>
/// <returns></returns>
public string ReplaceSql(string value)
{
return ReplaceSqlSpecial(value);
}
/// <summary>
/// 反转字符串,用于mysql反向索引
/// </summary>
/// <param name="temp"></param>
/// <returns></returns>
public static string ReverseString(string temp)
{
if (string.IsNullOrEmpty(temp))
return null;
char[] l = temp.ToCharArray();
Array.Reverse(l);
return new string(l);
}
/// <summary>
/// 去掉SQL中的特殊字符
/// </summary>
/// <param name="value">字符串</param>
/// <returns></returns>
public static string ReplaceSqlSpecial(string value)
{
if (string.IsNullOrEmpty(value))
return null;
value = value.Replace("\\", "\\\\");
value = value.Replace("'", "''");
//value = value.Replace("\"", "\\\"");
return value;
}
///// <summary>
///// 开放一个Conn获取路径,以便外部使用事务提交
///// </summary>
//public MySqlConnection GetConn()
//{
// //Transaction = Conn.BeginTransaction();
// return Conn;
//}
/// <summary>
/// 插入数据
/// </summary>
/// <param name="table"></param>
/// <param name="keys"></param>
/// <returns></returns>
public int Insert(string table, List<MysqlKeyValue> keys)
{
string temp = "", tempx = "";
for (int i = 0; i < keys.Count; i++)
{
temp += ",`" + keys[i].Key + "`";
tempx += ",'" + keys[i].Value + "'";
}
temp = temp.Substring(1);
tempx = tempx.Substring(1);
string sql = "insert into " + table + " (" + temp + ") values (" + tempx + ") ";
return (int)ExecuteInsertId(sql);
}
/// <summary>
/// 返回执行表
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public DataTable ExecuteDataTable(string SqlString)
{
return ExecuteDataTable(SqlString, null);
}
/// <summary>
/// 执行sql返回DataTable
/// </summary>
/// <param name="SqlString">SQL语句</param>
/// <param name="parms">Sql参数</param>
/// <returns>DataTable</returns>
public DataTable ExecuteDataTable(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
DataSet ds = new DataSet();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(ds);
return ds.Tables[0];
//DataTable dt = new DataTable();
//try
//{
// reader = cmd.ExecuteReader();
// dt.Load(reader);
//}
//catch
//{
// reader = cmd.ExecuteReader();
// dt = Read(ref reader);
//}
//return dt;
}
catch (Exception e)
{
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
return null;
}
finally
{
CloseReader();
IsRunning = false;
}
}
/// <summary>
/// 针对不同错误,执行不同的修正
/// </summary>
/// <param name="message"></param>
private void ErrorDoing(string message)
{
Message = message;
if (string.IsNullOrEmpty(message))
return;
if (message.Contains("Incorrect string value"))
return;
if (message.Contains("Connection must be valid and open"))
ConnTo();
if (message.Contains("There is already an open DataReader"))
{
Thread.Sleep(500);
ConnTo();
}
if (message.Contains("Fatal error encountered during command execution."))
ConnTo();
if (message.Contains(" StreamWriter ") || message.Contains("未将对象引用设置到对象的实例") || message.Contains("未将对象"))
ConnTo();
CloseReader();
Random ra = new Random(Guid.NewGuid().GetHashCode());
Thread.Sleep(ra.Next(200, 2000));
}
/// <summary>
/// 关闭读取线程
/// </summary>
private void CloseReader()
{
try
{
if (reader != null && !reader.IsClosed)
reader.Close();
cmd.Dispose();
//reader = null;
}
catch
{
}
}
/// <summary>
/// 返回执行行
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public DataRow ExecuteDataTableRow(string SqlString)
{
return ExecuteDataTableRow(SqlString, null);
}
/// <summary>
/// 返回第一行
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public DataRow ExecuteDataTableRow(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
DataSet ds = new DataSet();
MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(ds);
DataTable dt = ds.Tables[0];
if (dt.Rows.Count > 0)
return dt.Rows[0];
}
catch (Exception e)
{
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
}
finally
{
CloseReader();
IsRunning = false;
}
return null;
}
/// <summary>
/// 返回第一个执行结果
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public int ExecuteRowCount(string SqlString)
{
string f = ExecuteFirst(SqlString, null);
int c;
int.TryParse(f, out c);
return c;
}
public int ExecuteRowCount(string SqlString, MySqlParameter[] parms)
{
string f = ExecuteFirst(SqlString, parms);
int c;
int.TryParse(f, out c);
return c;
}
/// <summary>
/// 返回第一个执行结果
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public string ExecuteFirst(string SqlString)
{
return ExecuteFirst(SqlString, null);
}
/// <summary>
/// 返回第一个执行结果
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public int ExecuteFirstInt(string SqlString, MySqlParameter[] parms = null)
{
string id = ExecuteFirst(SqlString, parms);
int i;
int.TryParse(id, out i);
return i;
}
/// <summary>
/// 返回第一个执行结果
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public decimal ExecuteFirstDecimal(string SqlString, MySqlParameter[] parms = null)
{
string id = ExecuteFirst(SqlString, parms);
decimal i;
decimal.TryParse(id, out i);
return i;
}
/// <summary>
/// 返回第一个值
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public string ExecuteFirst(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
reader = cmd.ExecuteReader();
if (reader.Read())
return reader[0].ToString();
return "";
}
catch (Exception e)
{
if (e.Message.Contains("Illegal mix of collations"))
return null;
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
}
finally
{
CloseReader();
IsRunning = false;
}
return null;
}
/// <summary>
/// 返回更改、插入或删除的行数
/// </summary>
/// <param name="SqlString"></param>
/// <param name="parms"></param>
/// <returns></returns>
public int ExecuteAffectedRows(string SqlString)
{
return ExecuteAffectedRows(SqlString, null);
}
/// <summary>
/// 返回更改、插入或删除的行数
/// </summary>
/// <param name="SqlString"></param>
/// <param name="parms"></param>
/// <returns></returns>
public int ExecuteAffectedRows(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
reader = cmd.ExecuteReader();
if (reader.Read())
return reader.RecordsAffected;
return reader.RecordsAffected;
}
catch (Exception e)
{
if (e.Message.Contains("Illegal mix of collations"))
return 0;
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
}
finally
{
CloseReader();
IsRunning = false;
}
return 0;
}
/// <summary>
/// 返回插入ID
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public long ExecuteInsertId(string SqlString)
{
return ExecuteInsertId(SqlString, null);
}
/// <summary>
/// 返回第一个值
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public long ExecuteInsertId(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
cmd.ExecuteNonQuery();
long id = cmd.LastInsertedId;
return id;
}
catch (Exception e)
{
if (e.Message.Contains(" for key 'PRIMARY'") && e.Message.Contains("Duplicate entry"))
return 0;
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
}
finally
{
CloseReader();
IsRunning = false;
}
return 0;
}
/// <summary>
/// 无返回
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public bool ExecuteNonQuery(string SqlString)
{
return ExecuteNonQuery(SqlString, null);
}
/// <summary>
/// 只保留mysql可识别的字符串
/// </summary>
/// <param name="text"></param>
public string JustUtf8Words(string text)
{
JustUtf8Words(ref text);
return text;
}
/// <summary>
/// 只保留mysql可识别的字符串
/// </summary>
/// <param name="text"></param>
public void JustUtf8Words(ref string text)
{
if (string.IsNullOrEmpty(text))
return;
var cs = text.ToCharArray();
List<char> cc = new List<char>();
foreach (char c in cs)
{
if (c > 7814 && c < 8416 || c > 57096 && c < 59501 || c > 63707 && c < 64309 || c > 65505 || c < 0)
{
if (cc.Contains(c))
continue;
text = text.Replace(c.ToString(), "");
cc.Add(c);
}
}
}
/// <summary>
/// 执行无返回SQL语句
/// </summary>
/// <param name="SqlString">SQL语句</param>
/// <param name="parms">Sql参数</param>
///<returns>是否执行成功</returns>
public bool ExecuteNonQuery(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
cmd.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
if (e.Message.Contains("Illegal mix of collations") || e.Message.Contains("Incorrect string value")
|| e.Message.Contains(" for key 'PRIMARY'") && e.Message.Contains("Duplicate entry"))
return false;
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
return false;
}
finally
{
CloseReader();
IsRunning = false;
}
}
/// <summary>
/// 判断是否存在
/// </summary>
/// <param name="SqlString"></param>
/// <returns></returns>
public bool ExecuteExists(string SqlString)
{
return ExecuteExists(SqlString, null);
}
/// <summary>
/// 查询是否存在
/// </summary>
/// <param name="SqlString">SQL语句</param>
/// <param name="parms">SQL参数</param>
/// <returns>是否存在</returns>
public bool ExecuteExists(string SqlString, MySqlParameter[] parms)
{
SleepOrGo();
bool frist = true;
Retry:
if (Conn == null || Conn.State != ConnectionState.Open)
ConnTo();
try
{
CmdIni();
cmd.CommandText = SqlString;
if (parms != null)
foreach (MySqlParameter pram in parms)
cmd.Parameters.Add(pram);
reader = cmd.ExecuteReader();
if (reader.Read())
return true;
return false;
}
catch (Exception e)
{
if (frist)
{
frist = false;
ErrorDoing(e.Message);
goto Retry;
}
AddError(e.Message, SqlString);
return false;
}
finally
{
CloseReader();
IsRunning = false;
}
}
/// <summary>
/// 停止还是前进
/// </summary>
private void SleepOrGo()
{
int i = 0;
while (IsRunning && i < 300)
{
Thread.Sleep(100);
i++;
}
IsRunning = true;
}
/// <summary>
/// 初始化CMD
/// </summary>
private void CmdIni()
{
if (reader != null && !reader.IsClosed)
reader.Close();
if (cmd != null)
cmd.Dispose();
cmd = new MySqlCommand();
cmd.Connection = Conn;
cmd.CommandType = CommandType.Text;
cmd.CommandTimeout = TimeOut;
if (Transaction != null)
cmd.Transaction = Transaction;
}
/// <summary>
/// 连接数据库
/// </summary>
private void ConnTo()
{
Close();
try
{
Conn = new MySqlConnection(ConnString);
Conn.Open();
if (IsUseTrans)
this.Transaction = Conn.BeginTransaction();
}
catch (Exception e)
{
AddError(e.Message, ConnString);
}
}
/// <summary>
/// 错误信息
/// </summary>
/// <param name="message"></param>
/// <param name="sql"></param>
private void AddError(string message, string sql)
{
if (string.IsNullOrEmpty(message) || message.Contains("Illegal mix of collations"))
return;
ErrorDoing(message);
string errStr = "数据库连接错误:" + message + "\r\nSQL语句:" + sql;
try
{
if (!Directory.Exists("Log"))
{
Directory.CreateDirectory("Log");
}
File.AppendAllText("Log\\log-" + DateTime.Now.ToString("yyyyMMdd") + ".txt", errStr);
}
catch (Exception ex)
{
}
}
public void Commit()
{
if (Transaction != null)
Transaction.Commit();
}
public void RollBack()
{
if (Transaction != null)
Transaction.Rollback();
}
/// <summary>
/// 关闭数据库链接
/// </summary>
public void Close()
{
IsRunning = false;
try
{
if (Conn != null && Conn.State == ConnectionState.Open)
{
Conn.Close();
}
Conn = null;
try
{
if (reader != null && !reader.IsClosed)
reader.Close();
}
catch
{
}
reader = null;
try
{
if (Transaction != null)
Transaction.Dispose();
}
catch
{
}
Transaction = null;
}
catch
{
}
}
}
public class MysqlKeyValues
{
public List<MysqlKeyValue> List = new List<MysqlKeyValue>();
}
public class MysqlKeyValue
{
public MysqlKeyValue(string key, object value)
{
Key = key;
Value = value == null ? "" : MysqlUtils.ReplaceSqlSpecial(value.ToString());
}
public string Key = "";
public string Value;
}
/// <summary>
/// 根据连接串 key 提供 FreeSql IAdo(由框架 DI 注册的 keyed IFreeSql 提供)
/// </summary>
public static class AdoProvider
{
private static IServiceProvider _serviceProvider;
public static void SetServiceProvider(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public static IAdo Get(string connKey)
{
if (string.IsNullOrEmpty(connKey))
connKey = "ConnKJD";
string key = connKey switch
{
"ConnKJD" => "KJDDB",
"ConnKJDBAK" => "KJDBAKDB",
_ => "KJDDB",
};
var fsql = _serviceProvider?.GetKeyedService<IFreeSql>(key);
if (fsql == null)
{
var fsql2 = _serviceProvider?.GetService<IFreeSql>();
if (fsql2 != null)
return fsql2.Ado;
throw new InvalidOperationException("IFreeSql not registered for key " + key);
}
return fsql.Ado;
}
}
}
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StoreHub.KJDWebService.Commons
{
public class RandomUtils
{
public static string WordBase = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz";
public static string NumberBase = "0123456789";
public static string WordNumberBase = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz01234567890123456789";
public static string SignWordBase = ".`~^*_| -#$%&?+";//".`~^*_| -#$%&?";
public static int GetId(int max)
{
return new Random(Guid.NewGuid().GetHashCode()).Next(0, max);
}
public static int GetId(int min, int max)
{
return new Random(Guid.NewGuid().GetHashCode()).Next(min, max);
}
public static string GetWord(int len)
{
StringBuilder s = new StringBuilder();
for (int i = 0; i < len; i++)
{
s.Append(WordBase[new Random(Guid.NewGuid().GetHashCode()).Next(WordBase.Length)]);
}
return s.ToString();
}
public static string GetNumber(int len)
{
StringBuilder s = new StringBuilder();
for (int i = 0; i < len; i++)
{
s.Append(NumberBase[new Random(Guid.NewGuid().GetHashCode()).Next(NumberBase.Length)]);
}
return s.ToString();
}
public static string GetWordNumber(int len)
{
StringBuilder s = new StringBuilder();
for (int i = 0; i < len; i++)
{
s.Append(WordNumberBase[new Random(Guid.NewGuid().GetHashCode()).Next(WordNumberBase.Length)]);
}
return s.ToString();
}
/// <summary>
/// 获取新的属性名称
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static string GetNewProp(bool begin, string name)
{
char w = SignWordBase[new Random(Guid.NewGuid().GetHashCode()).Next(SignWordBase.Length)];
char add = SignWordBase[new Random(Guid.NewGuid().GetHashCode()).Next(SignWordBase.Length)];
if (begin)
name += "" + w + add;
else
name = "" + add + w + "" + name;
return name;
}
}
}
+762
View File
@@ -0,0 +1,762 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace StoreHub.KJDWebService.Commons
{
public static class RegexUtils
{
/// <summary>
/// 返回正则对象所有结果
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static MatchCollection GetMatchRegex(string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
return Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase);
}
/// <summary>
/// 返回正则对象所有结果
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static MatchCollection GetMatchRegex(ref string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
return Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase);
}
/// <summary>
/// 返回单个正则分析结果
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static string GetMatchRegexString(ref string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
MatchCollection mc = Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
return mc[0].Groups[1].Value.ToString();
}
return null;
}
/// <summary>
/// 返回单个正则分析结果
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static string GetMatchMaxRegexString(ref string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
MatchCollection mc = Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
return mc[mc.Count - 1].Groups[1].Value.ToString();
}
return null;
}
/// <summary>
/// 返回匹配的数值
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static int GetMatchInt(ref string HtmlString, string RegexString)
{
string id = GetMatchRegexString(ref HtmlString, RegexString);
int i;
int.TryParse(id, out i);
return i;
}
/// <summary>
/// 返回单个正则分析结果
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static string GetMatchRegexString(string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
MatchCollection mc = Regex.Matches(HtmlString, RegexString, RegexOptions.IgnoreCase);
if (mc.Count > 0)
{
return mc[0].Groups[1].ToString();
}
return null;
}
/// <summary>
/// 是否存在匹配
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static bool MatchRegex(string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return false;
}
return Regex.IsMatch(HtmlString, RegexString, RegexOptions.IgnoreCase);
}
/// <summary>
/// 根据正则删除表达式所匹配的内容
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static string Clear(string HtmlString, string RegexString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + RegexString);
return null;
}
return Regex.Replace(HtmlString, RegexString, "", RegexOptions.IgnoreCase);
}
/// <summary>
/// 清除HTML代码
/// </summary>
/// <param name="HtmlString"></param>
/// <returns>返回文字内容</returns>
public static string ClearHtml(string HtmlString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空");
return null;
}
return Regex.Replace(Regex.Replace(HtmlString,
@"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", ""), "(<[^>]*?>)", "").Trim();
}
/// <summary>
/// 清除HTML代码
/// </summary>
/// <param name="HtmlString"></param>
/// <returns>返回文字内容</returns>
public static string ClearHtml(ref string HtmlString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空");
return null;
}
return Regex.Replace(Regex.Replace(HtmlString,
@"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", ""), "(<[^>]*?>)", "").Trim();
}
/// <summary>
/// 清除HTML代码
/// </summary>
/// <param name="HtmlString"></param>
/// <returns>返回文字内容</returns>
public static void ClearHtmlX(ref string HtmlString)
{
if (string.IsNullOrEmpty(HtmlString))
{
//LogSave.Add("匹配正则发生错误:原始字符串为空");
return;
}
HtmlString = Regex.Replace(Regex.Replace(HtmlString,
@"(<head[\w\W]*?</head>|<script[\w\W]*?</script>|<style[\w\W]*?</style>|<!--[\w\W]*?-->)", ""), "(<[^>]*?>)", "");
}
/// <summary>
/// 清除HTML代码A标签
/// </summary>
/// <param name="HtmlString"></param>
/// <returns>返回文字内容</returns>
public static string ClearA(string HtmlString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空");
return null;
}
HtmlString = Regex.Replace(HtmlString, "(</?a[^>]*>)", "", RegexOptions.IgnoreCase);
return HtmlString.Trim();
}
/// <summary>
/// 去除空格和特殊空白
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public static string Trim(string text)
{
if (string.IsNullOrEmpty(text))
return "";
return text.Replace("\t", " ").Replace("\r\n", " ").Replace("\r", " ").Replace("\n", " ").Trim();
}
/// <summary>
/// 清除HTML代码A标签
/// </summary>
/// <param name="HtmlString"></param>
/// <returns>返回文字内容</returns>
public static string ClearTitle(string HtmlString)
{
if (HtmlString == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空");
return null;
}
HtmlString = Regex.Replace(HtmlString, "(title=\"[^\"]*\")", "");
return HtmlString.Trim();
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static string GetValue(string html, string reg)
{
return GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
}
/// <summary>
/// 清理多余的HTML元素
/// </summary>
/// <param name="html"></param>
/// <returns></returns>
public static string ClearNone(string html)
{
if (string.IsNullOrEmpty(html))
return null;
if (html.Contains("\0") && html.IndexOf("\0") > 0)
html = html.Substring(0, html.IndexOf("\0"));
string h = Clear(html, @"(<\!doctype[^>]*?>)");
h = Clear(h, @"(<html[^>]*?>)");
h = Clear(h, @"(<head[\w\W]*?</head>)");
h = Clear(h, @"(<script[\w\W]*?</script>)");
h = Clear(h, @"(<style[\w\W]*?</style>)");
h = Clear(h, @"(<input[^>]*?>)");
h = Clear(h, @"(<!--[\w\W]*?-->)");
h = Clear(h, @"(<link[^>]*?>)");
h = Clear(h, @"(\s*alt\s*=[""'\s]*[^>]*?['""]+)");
h = Clear(h, @"(\s*style\s*=[""'\s]*[^>]*?['""]+)");
h = Clear(h, @"(\s*title\s*=[""'\s]*[^>]*?['""]+)");
h = Clear(h, @"(\s*id\s*=[""'\s]*[^>]*?['""]+)");
h = Clear(h, @"(\s*class\s*=[""'\s]*[^>]*?['""]+)");
h = Clear(h, @"(\s*align\s*=[""'\s]*[^>]*?['""]+)");
h = h.Replace("\r\n", " ");
h = h.Replace("\n", " ").Replace("\r", " ").Replace("\t", " ");
h = h.Replace(" ", " ");
h = h.Replace(" ", " ");
h = h.Replace(" ", " ");
h = h.Replace(" ", " ");
return h.Replace(" ", " ").Replace(" ", " ");
}
/// <summary>
/// 返回执行结果数
/// </summary>
/// <param name="html"></param>
/// <param name="regex"></param>
/// <returns></returns>
public static int GetRegexCount(string html, string regex)
{
if (html == null)
{
//LogSave.Add("匹配正则发生错误:原始字符串为空,正则:" + regex);
return 0;
}
return Regex.Matches(html, regex, RegexOptions.IgnoreCase).Count;
}
/// <summary>
/// 根据正则删除表达式所匹配的内容
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static string Relpace(string HtmlString, string RegexString, string NewString)
{
if (HtmlString == null)
return null;
return Regex.Replace(HtmlString, RegexString, NewString, RegexOptions.IgnoreCase);
}
/// <summary>
/// 根据正则删除表达式所匹配的内容
/// </summary>
/// <param name="HtmlString"></param>
/// <param name="RegexString"></param>
/// <returns></returns>
public static void Relpace(ref string HtmlString, string RegexString, string NewString)
{
if (HtmlString == null)
return;
HtmlString = Regex.Replace(HtmlString, RegexString, NewString, RegexOptions.IgnoreCase);
}
/// <summary>
/// 关键词在文本中出现的次数
/// </summary>
/// <param name="b"></param>
/// <param name="keyword"></param>
/// <returns></returns>
public static int GetStringCount(ref byte[] b, string keyword)
{
if (string.IsNullOrEmpty(keyword))
return 0;
int c = 0;
bool had;
byte[] b1 = Encoding.UTF8.GetBytes(keyword);
for (int i = 0; i < b.Length - b1.Length; i++)
{
had = false;
for (int j = 0; j < b1.Length; j++)
{
if (b[i + j] != b1[j])
{
had = true;
break;
}
}
if (had)
{
c++;
i += b1.Length - 1;
}
}
return c;
}
/// <summary>
/// 是否存在
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static bool Exists(string html, string reg)
{
if (string.IsNullOrEmpty(html) || string.IsNullOrEmpty(reg))
return false;
return new Regex(reg).IsMatch(html);
}
/// <summary>
/// 是否是数字
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool IsNumber(string str)
{
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9\.]+$");
return reg1.IsMatch(str);
}
/// <summary>
/// 是否是字母
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool IsChar(string str)
{
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[A-Za-z]+$");
return reg1.IsMatch(str);
}
/// <summary>
/// 是否是字母
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static bool IsCharOrNumber(string str)
{
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[A-Za-z0-9]+$");
return reg1.IsMatch(str);
}
/// <summary>
/// 是否是中文字符串列
/// </summary>
/// <param name="word"></param>
/// <returns></returns>
public static bool IsWordList(string word)
{
char[] xj = word.ToCharArray();
for (int j = 0; j < xj.Length; j++)
if (!IsWord(xj[j]))
return false;
return true;
}
/// <summary>
/// 是否是字符
/// </summary>
/// <param name="ascii"></param>
/// <returns></returns>
private static bool IsWord(int ascii)
{
if (ascii == 32 || ascii == 35) //空格
return true;
if (ascii < 58 && ascii > 47) //数字
return true;
if (ascii < 48 && ascii > 31) //符号
return true;
if (ascii < 91 && ascii > 64) //小写字母
return true;
if (ascii < 123 && ascii > 96) //大写字母
return true;
if (ascii < 40892 && ascii > 13311) //中文字符串
return true;
return false;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static bool GetBoolValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
if (!string.IsNullOrEmpty(temp) && (temp.ToLower() == "true" || temp == "1"))
return true;
return false;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static int GetIntValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
int i;
if (int.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static long GetLongValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
long i;
if (long.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static double GetDoubleValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
double i;
if (double.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static DateTime GetDateValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
DateTime i;
if (DateTime.TryParse(temp, out i))
return i;
return DateTime.MinValue;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static decimal GetDecimalValue(string html, string reg)
{
string temp = GetMatchRegexString(html, "<" + reg + ">([^<]+)</" + reg + ">");
decimal i = 0;
if (decimal.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static decimal GetDecimalJson(ref string html, string reg)
{
string temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*['""]([^']+?)['""]");
if (string.IsNullOrEmpty(temp))
temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*([\d-\.]+)");
decimal i = 0;
if (decimal.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static int GetIntJson(ref string html, string reg)
{
string temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*['""]([^']+?)['""]");
if (string.IsNullOrEmpty(temp))
temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*([\d-]+)");
int i;
if (int.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 时间戳转字符串时间
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static string GetIntTimeToString(ref string html, string reg)
{
return GetIntTimeToString(ref html, reg, 0);
}
/// <summary>
/// 时间戳转字符串时间
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <param name="addTime">添加时间</param>
/// <returns></returns>
public static string GetIntTimeToString(ref string html, string reg, int addTime)
{
int time = GetIntJson(ref html, reg) + addTime;
DateTime dt = TimeUtils.StampToDateTime(time);
return dt.ToString("yyyy-MM-dd HH:mm:ss");
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static long GetLongJson(ref string html, string reg)
{
string temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*['""]([^']+?)['""]");
if (string.IsNullOrEmpty(temp))
temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*([\d]+)");
long i;
if (long.TryParse(temp, out i))
return i;
return 0;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static string GetStringJson(ref string html, string reg)
{
string temp = GetMatchRegexString(html, @"[""]" + reg + @"[""][\s]*:[\s]*[""]([^""]+?)[""]");
if (temp == null)
temp = GetMatchRegexString(html, @"[""]" + reg + @"[""][\s]*:[\s]*[""]([^""]*?)[""]");
if (temp == null)
temp = GetMatchRegexString(html, @"[']" + reg + @"['][\s]*:[\s]*[']([^']*?)[']");
if (temp == null)
temp = GetMatchRegexString(html, @"['""]" + reg + @"['""][\s]*:[\s]*([\d]+)");
return temp;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="reg"></param>
/// <returns></returns>
public static string GetStringInput(ref string html, string reg)
{
string temp = GetMatchRegexString(html, @"<input [^>]*?name=['""]" + reg + @"[""'][^>]+?value=[""']([^>]+)[""'][^>]*>");
if (string.IsNullOrEmpty(temp))
temp = GetMatchRegexString(html, @"<input [^>]*?value=[""']([^>]+)[""'][^>]+?name=['""]" + reg + @"[""'][^>]*>");
return temp;
}
/// <summary>
/// 获取值
/// </summary>
/// <param name="html"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetStringQuery(ref string queryString, string key, bool isGetJson = false)
{
List<string> strLst = queryString.Split('&').ToList();
var temp = strLst.FirstOrDefault(s => s.StartsWith(key + "="));
if (temp != null)
temp = ("&" + temp).Replace("&" + key + "=", "");
if (temp == null && isGetJson)
temp = GetStringJson(ref queryString, key);
//queryString = "&" + queryString;
//int nIndex = queryString.IndexOf("&" + key + "=");
//if (nIndex == -1)
// return null;
//string temp = queryString.Substring(nIndex).Replace("&" + key + "=", "");
//nIndex = temp.IndexOf('&');
//if (nIndex > -1)
// temp = temp.Substring(0, nIndex);
return temp;
}
public static string FliterHtmlTag(string htmlStr)
{
if (String.IsNullOrEmpty(htmlStr))
{
return "";
}
string regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; //定义style的正则表达式
string regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式
string regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式
htmlStr = Regex.Replace(htmlStr, regEx_style, "");//删除css
htmlStr = Regex.Replace(htmlStr, regEx_script, "");//删除js
htmlStr = Regex.Replace(htmlStr, regEx_html, "");//删除html标记
htmlStr = Regex.Replace(htmlStr, "\\s*|\t|\r|\n", "");//去除tab、空格、空行
htmlStr = htmlStr.Replace("\"", "");//去除异常的引号
return htmlStr.Trim();
}
public static string GetOneJsonObjStrJson(ref string html, string reg)
{
return GetJsonObjStrJson(ref html, reg).FirstOrDefault();
}
public static List<string> GetJsonObjStrJson(ref string html, string reg, int level = 0)
{
List<string> rstLst = new List<string>();
if (html == null)
return rstLst;
string htmlTmp = html.Replace("\\{", "\\这里是正花括号占位符").Replace("\\}", "\\这里是反花括号占位符").Replace("\"" + reg + "\": {", "\"" + reg + "\":{");
retry:
string lvStr = "";
if (level == 1)
{
lvStr += "\"";
}
var index1 = htmlTmp.IndexOf("\"" + reg + "\":" + lvStr + "{");
if (index1 < 0)
return rstLst;
htmlTmp = htmlTmp.Substring(index1 + ("\"" + reg + "\":" + lvStr + "{").Length - 1);
// 括号计数
int braceNum = 0;
//string rst = "{";
//while (htmlTmp.Length > 0)
for (int i = 0; i < htmlTmp.Length; i++)
{
//rst += htmlTmp.Substring(0, 1);
//if (htmlTmp.StartsWith("{"))
// braceNum++;
//else if (htmlTmp.StartsWith("}"))
// braceNum--;
if (htmlTmp[i] == '{')
braceNum++;
else if (htmlTmp[i] == '}')
braceNum--;
//htmlTmp = htmlTmp.Substring(1);
if (braceNum == 0)
{
rstLst.Add(htmlTmp.Substring(0, i + 1).Replace("\\这里是正花括号占位符", "\\{").Replace("\\这里是反花括号占位符", "\\}"));
htmlTmp = htmlTmp.Substring(i + 1);
//rstLst.Add(rst.Replace("\\这里是正花括号占位符", "\\{").Replace("\\这里是反花括号占位符", "\\}"));
break;
}
// 循环完了还没结果返回空列表
if (i == htmlTmp.Length - 1)
return rstLst;
}
if (htmlTmp.Length > 0)
goto retry;
return rstLst;
}
public static List<string> GetJsonArrStrJson(ref string html, string reg)
{
List<string> rstLst = new List<string>();
if (html == null)
return rstLst;
string htmlTmp = html.Replace("\\[", "\\这里是正方括号占位符").Replace("\\]", "\\这里是反方括号占位符").Replace("\"" + reg + "\": [", "\"" + reg + "\":[");
retry:
var index1 = htmlTmp.IndexOf("\"" + reg + "\":[");
if (index1 < 0)
return rstLst;
htmlTmp = htmlTmp.Substring(index1 + ("\"" + reg + "\":[").Length);
// 括号计数
int braceNum = 1;
string rst = "[";
while (htmlTmp.Length > 0)
{
rst += htmlTmp.Substring(0, 1);
if (htmlTmp.StartsWith("["))
braceNum++;
else if (htmlTmp.StartsWith("]"))
braceNum--;
htmlTmp = htmlTmp.Substring(1);
if (braceNum == 0)
{
rstLst.Add(rst.Replace("\\这里是正方括号占位符", "\\[").Replace("\\这里是反方括号占位符", "\\]"));
break;
}
}
if (htmlTmp.Length > 0)
goto retry;
return rstLst;
}
}
}
+58
View File
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Commons
{
public class TimeUtils
{
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name="timeStamp"></param>
/// <returns></returns>
public static DateTime StampToDateTime(int timeStamp)
{
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000000");
TimeSpan toNow = new TimeSpan(lTime);
return dateTimeStart.Add(toNow);
}
/// <summary>
/// 时间戳转为C#格式时间
/// </summary>
/// <param name="timeStamp"></param>
/// <returns></returns>
public static DateTime StampMillisecondsToDateTime(long timeStamp)
{
DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000");
TimeSpan toNow = new TimeSpan(lTime);
return dateTimeStart.Add(toNow);
}
/// <summary>
/// C#格式时间转换为Unix时间戳(秒)
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static int DateTimeToTimestampSeconds(DateTime time)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
return (int)(time - startTime).TotalSeconds;
}
/// <summary>
/// C#格式时间转换为Unix时间戳(毫秒)
/// </summary>
/// <param name="time"></param>
/// <returns></returns>
public static long DateTimeToTimestampMilliseconds(DateTime time)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
return (long)(time - startTime).TotalMilliseconds;
}
}
}
@@ -0,0 +1,179 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("bxx_price/[action]")]
public class BXXPriceController : BaseApiController
{
private readonly BXXPriceService _bXXPriceService;
public BXXPriceController(BXXPriceService bXXPriceService)
{
_bXXPriceService = bXXPriceService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_price_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.GetPriceList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.AddPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.DelDbPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.MdyDBPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.MdyPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.AddPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.DelPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_purchase_price_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.GetPurchasePriceList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_ext_code_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.AddExtCodePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_ext_code_price_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.GetExtCodePriceList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_ext_code_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.DelDbExtCodePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_ext_code_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXPriceService.MdyDBExtCodePrice(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,571 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("bxx_product/[action]")]
public class BXXProductController : BaseApiController
{
private readonly BXXProductService _bXXProductService;
private readonly WXShopService _wXShopService;
public BXXProductController(BXXProductService bXXProductService, WXShopService wXShopService)
{
_bXXProductService = bXXProductService;
_wXShopService = wXShopService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_spu_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductSpuIdLst(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_prod_down_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddProdDownSku(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_prod_down_sku_lst_by_sku_codes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProdDownSkuLstBySkuCodes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_list_random()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductListRandom(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_prod_wx_complate()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddProdWXComplate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_prod_wx_complate_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProdWXComplateList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sku_replace_img_list_random()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetSkuReplaceImgListRandom(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdyProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_violation_prod()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdyViolationProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_best_sale_prod()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdyBestSaleProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.DelDbProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdyDBProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_groups()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductGroups(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product_groups()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddProductGroup(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_product_groups()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.DelProductGroup(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddProductNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_product_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.DelProductNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_cates()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductMainCates(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_cates()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProductCates(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sku_img_replace()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddSkuImgReplace(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_sku_img_replace()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdySkuImgReplace(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sku_img_replace_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetSkuImgReplaceList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sku_img_replace_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetSkuImgReplaceList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sku_img()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddSkuImg(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_wx_tokens()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.E57GetWxTokens(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_get_all_cate()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiGetWxAllCate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_category_classify()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiCategoryClassify(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_upload_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiUploadImage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddJSTSku(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.MdyJSTSku(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_jst_sku_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetJSTSkuList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_random_company_product_config()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.SetRandomCompanyProductConfig(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_random_company_product_config()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetRandomCompanyProductConfig(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_relation()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddRelation(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_relation()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetRelation(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_mdy_jst_product_ban()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.AddMdyJstProductBan(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_jst_product_coid_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetJstProductCoidList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_jst_product_ban_platform_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetJstProductBanPlatformList(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,179 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("bxx_product_third/[action]")]
public class BXXProductThirdController : BaseApiController
{
private readonly BXXProductThirdService _bXXProductThirdService;
public BXXProductThirdController(BXXProductThirdService bXXProductThirdService)
{
_bXXProductThirdService = bXXProductThirdService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.GetProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.GetProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.AddProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.DelDbProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product_category()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.MdyProductCategory(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.AddUserSelectProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_user_select_product_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.MdyUserSelectProductStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.GetUserSelectProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.GetUserSelectProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.DelSelectProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_select_product_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.SetSelectProductSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product_select_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductThirdService.MdyProductSelectNotes(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,337 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("bxx_shop/[action]")]
public class BXXShopController : BaseApiController
{
private readonly BXXShopService _bXXShopService;
private readonly WXShopService _wXShopService;
public BXXShopController(BXXShopService bXXShopService, WXShopService wXShopService)
{
_bXXShopService = bXXShopService;
_wXShopService = wXShopService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_client_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetPddClientInfo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_client_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetShopClientInfo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_mdy_shop_client_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.AddMdyShopClientInfo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_one_login_name_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetOneLoginNameShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.AddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.DelShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_anti_content()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyAntiContent(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult sub_sa_get_select_prod_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.SubSaGetSelectProdShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_add_prod_remaining()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.UpdateAddProdRemaining(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.AddShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.DelShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.SetShopSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_get_wx_tokens()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.E57GetWxTokens(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_get_pdd_shop_token()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.E57GetPddShopToken(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_weidian_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.AddWeiDianShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_weidian_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyWeiDianShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_weidian_shop_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.MdyWeiDianShopCookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_weidian_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.GetWeiDianShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_weidian_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXShopService.DelWeiDianShop(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,252 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("bxx_user/[action]")]
public class BXXUserController : BaseApiController
{
private readonly BXXUserService _bXXUserService;
public BXXUserController(BXXUserService bXXUserService)
{
_bXXUserService = bXXUserService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult user_login()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.CheckUserLogin(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_package_sign()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.GetPackageSign(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult change_password()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.ChangePassword(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.GetSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.UpdateSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.AddSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult delete_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.DelUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_all_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.GetAllUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.UpdateUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.AddUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_scm121_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.UpdateScm121Cookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_scm121_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.GetScm121Cookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.AddBuyer(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.MdyBuyer(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_buyer_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.MdyBuyerCookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.GetBuyer(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_buyer()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXUserService.DelBuyer(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,84 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace StoreHub.KJDWebService.Controllers
{
/// <summary>
/// API 控制器基类:提供与旧 asmx 一致的请求读取(body JSON,为空回退 QueryString)
/// 与响应输出(text/html;charset=utf-8 原始 JSON 字符串)。
/// </summary>
[ApiController]
[ApiVersionNeutral]
public abstract class BaseApiController : ControllerBase
{
/// <summary>
/// 读取请求参数:先读 body,body 为空时回退 QueryString,统一转换为 key=value&amp;key=value 格式
/// (与旧 asmx 输入兼容,Manage 依赖 RegexUtils.GetStringQuery 解析 & 分隔的键值对)。
/// </summary>
protected string GetRequestJsonString()
{
Request.EnableBuffering();
string body = "";
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8, true, 1024, true))
{
body = reader.ReadToEnd();
}
Request.Body.Position = 0;
if (string.IsNullOrEmpty(body))
{
var qs = Request.Query;
if (qs != null && qs.Count > 0)
{
var parts = new List<string>();
foreach (var key in qs.Keys)
{
parts.Add(key + "=" + qs[key].ToString());
}
return string.Join("&", parts);
}
return "";
}
// body 是 JSON 时转换为 key=value&key=value
string trimmed = body.Trim();
if (trimmed.StartsWith("{"))
{
try
{
var jObj = Newtonsoft.Json.Linq.JObject.Parse(trimmed);
var parts2 = new List<string>();
foreach (var prop in jObj.Properties())
{
parts2.Add(prop.Name + "=" + (prop.Value?.ToString() ?? ""));
}
return string.Join("&", parts2);
}
catch
{
// 不是合法 JSON,按原样返回
return body;
}
}
// 已是 key=value 或 form 格式
return body;
}
/// <summary>输出原始 JSON 字符串(与旧 Context.Response.Write 等价)</summary>
protected ContentResult WriteJson(string result)
{
return Content(result ?? "", "text/html;charset=utf-8", Encoding.UTF8);
}
}
}
@@ -0,0 +1,192 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("dyxd_shop/[action]")]
public class DYShopController : BaseApiController
{
private readonly DYShopService _dYShopService;
public DYShopController(DYShopService dYShopService)
{
_dYShopService = dYShopService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.GetShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_one_login_name_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.GetOneLoginNameShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.AddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.DelShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.MdyShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.MdyCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.GetShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult sub_sa_get_select_prod_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.SubSaGetSelectProdShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_add_prod_remaining()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.UpdateAddProdRemaining(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.MdyShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.AddShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.DelShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYShopService.SetShopSubSa(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,161 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("dyxd_user/[action]")]
public class DYUserController : BaseApiController
{
private readonly DYUserService _dYUserService;
public DYUserController(DYUserService dYUserService)
{
_dYUserService = dYUserService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult user_login()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.CheckUserLogin(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_package_sign()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.GetPackageSign(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult change_password()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.ChangePassword(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.GetSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.UpdateSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.AddSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult delete_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.DelUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_all_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.GetAllUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.UpdateUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _dYUserService.AddUser(jsontext);
return WriteJson(result);
}
}
}
+27
View File
@@ -0,0 +1,27 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using Store.Framework.Commons;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[Route("api/v{version:apiVersion}/[controller]/[action]")]
public class Login : ControllerBase
{
private readonly DemoService _userService;
public Login(DemoService userService)
{
_userService = userService;
}
[HttpGet]
public ApiResult<bool> Loinout()
{
_userService.Test();
return ApiResult.Success(true);
}
}
}
@@ -0,0 +1,127 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("order/[action]")]
public class OrderController : BaseApiController
{
private readonly OrderService _orderService;
public OrderController(OrderService orderService)
{
_orderService = orderService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.AddOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_order_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.GetOrderList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_order_status1()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.UpdateOrderStatus1(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_order_code_file()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.AddOrderCodeFile(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult save_order_code_file_link()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.SaveOrderCodeFileLink(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_order_code_file()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.getOrderCodeFile(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult upload_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.UploadOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_order_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _orderService.UpdateOrderStatus(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,127 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("price/[action]")]
public class PriceController : BaseApiController
{
private readonly PriceService _priceService;
public PriceController(PriceService priceService)
{
_priceService = priceService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_price_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.GetPriceList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.AddPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.DelDbPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.MdyDBPrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.MdyPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.AddPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_purchase_price()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.DelPurchasePrice(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_purchase_price_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _priceService.GetPurchasePriceList(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,300 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("product/[action]")]
public class ProductController : BaseApiController
{
private readonly ProductService _productService;
public ProductController(ProductService productService)
{
_productService = productService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_group_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetProductGroupList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.AddProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.DelDbProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.MdyDBProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.AddUserSelectProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_user_select_product_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.MdyUserSelectProductStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetUserSelectProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetUserSelectProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.DelSelectProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_select_product_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.SetSelectProductSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product_select_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.MdyProductSelectNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_select_prod_db_id_map_draft_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetSelectProdDbIdMapDraftIdList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_select_prod_map_up_spu_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetSelectProdMapUpSpuIdList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sku_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.AddSkuImg(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_sku_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.DelSkuImg(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sku_image_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetSkuImgList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_base64_img_url()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.MdyBase64ImgUrl(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_base64_img_use_count()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.MdyBase64ImgUseCount(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_cate_size_weight_config_v2()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.AddCateSizeWeightConfig(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_cate_size_weight_config_v2()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productService.GetCateSizeWeightConfig(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,230 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("product_third/[action]")]
public class ProductThirdController : BaseApiController
{
private readonly ProductThirdService _productThirdService;
public ProductThirdController(ProductThirdService productThirdService)
{
_productThirdService = productThirdService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_empty_product_json_for_bak()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetProductListEmptyProductJsonForBak(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_product_detail_list_bak()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetProductListBak(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.AddProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.DelDbProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product_category()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.MdyProductCategory(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_db_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.MdyDBProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.AddUserSelectProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_user_select_product_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.MdyUserSelectProductStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetUserSelectProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_user_select_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetUserSelectProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_select_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.DelSelectProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_select_product_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.SetSelectProductSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_product_select_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.MdyProductSelectNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_select_prod_db_id_map_draft_id_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _productThirdService.GetSelectProdDbIdMapDraftIdList(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,257 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("shop/[action]")]
public class ShopController : BaseApiController
{
private readonly ShopService _shopService;
public ShopController(ShopService shopService)
{
_shopService = shopService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.GetShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_one_login_name_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.GetOneLoginNameShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.AddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.DelShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.MdyShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.MdyCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop_ads_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.MdyAdsCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.GetShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult sub_sa_get_select_prod_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.SubSaGetSelectProdShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_add_prod_remaining()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.UpdateAddProdRemaining(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.MdyShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.AddShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.DelShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.SetShopSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_card_code_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.GetShopCardCodeList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult create_shop_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.CreateShopCardCode(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_shop_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.DelShopCardCode(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult active_jit_card_code()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _shopService.ActiveJitCardCode(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,41 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("ToolService/[action]")]
public class ToolController : BaseApiController
{
private readonly ToolService _toolService;
public ToolController(ToolService toolService)
{
_toolService = toolService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult create_table()
{
//return;
_toolService.CreateTable();
return Content("");
}
}
}
@@ -0,0 +1,70 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("update/[action]")]
public class UpdateController : BaseApiController
{
private readonly UpdateService _updateService;
public UpdateController(UpdateService updateService)
{
_updateService = updateService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_update()
{
var jsontext = GetRequestJsonString();
var result = jsontext;
result = _updateService.GetUpdate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_update_new()
{
var jsontext = GetRequestJsonString();
var result = jsontext;
result = _updateService.GetUpdateNew(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_wx_finder_order_update()
{
var jsontext = GetRequestJsonString();
var result = jsontext;
result = _updateService.GetWxFindOrderUpdate(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,376 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("user/[action]")]
public class UserController : BaseApiController
{
private readonly UserService _userService;
private readonly UpdateService _updateService;
public UserController(UserService userService, UpdateService updateService)
{
_userService = userService;
_updateService = updateService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult user_login()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.CheckUserLogin(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_package_sign()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.GetPackageSign(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult is_get_return_package()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.IsGetReturnPackage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult change_password()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.ChangePassword(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.GetSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.UpdateSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.AddSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult delete_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.DelUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_all_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.GetAllUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.UpdateUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.AddUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_amount()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _userService.GetUserAmount(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult GetServer()
{
var softName = GetRequestJsonString();
var result = "";
//result = System.Configuration.ConfigurationManager.ConnectionStrings[softName + "ServerUrl"].ConnectionString;
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult GetUpdateInfo()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _updateService.GetUpdate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult DownloadFile()
{
string file = System.IO.Path.Combine(AppContext.BaseDirectory, "bin", "test.txt");
System.IO.FileStream fs = null;
if (System.IO.File.Exists(file))
{
try
{
fs = System.IO.File.OpenRead(file);
int b1;
System.IO.MemoryStream tempStream = new System.IO.MemoryStream();
while ((b1 = fs.ReadByte()) != -1)
{
tempStream.WriteByte(((byte)b1));
}
return File(tempStream.ToArray(), "application/octet-stream");
}
catch (Exception ex)
{
return Content("");
}
finally
{
fs.Close();
}
}
else
{
return Content("");
}
return Content("");
}
[AcceptVerbs("GET", "POST")]
public IActionResult AddComment()
{
string result="";
//// 输入为querystring
//var jsonText = GetRequestJsonString();
//try
//{
// var user_id = RegexUtils.GetStringJson(ref jsonText, "user_id");
// var comment = RegexUtils.GetStringJson(ref jsonText, "comment");
// if (string.IsNullOrEmpty(user_id))
// result = "{\"code\":1,\"msg\":\"未指定用户Id\"}";
// else if (string.IsNullOrEmpty(comment))
// result = "{\"code\":2,\"msg\":\"未指定留言内容\"}";
// else
// {
// string sql = "insert into pepdtp.comment ";
// string sql1 = "(";
// string sql2 = "(";
// if (user_id != null) { sql1 += "user_id,"; sql2 += "'" + user_id + "',"; }
// if (comment != null) { sql1 += "comment,"; sql2 += "'" + comment + "',"; }
// var tTime = "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
// sql1 += "add_time,";
// sql2 += tTime;
// sql1 = sql1.TrimEnd(',') + ")";
// sql2 = sql2.TrimEnd(',') + ")";
// sql = sql + sql1 + " values " + sql2;
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// bool isSuccess = mySql.ExecuteNonQuery(sql);
// if (!isSuccess)
// {
// result = "{\"code\":10001,\"msg\":\"添加留言入库出错,请稍后重试!\"}";
// }
// else
// {
// result = "{\"code\":0,\"msg\":\"添加留言成功!\"}";
// }
// mySql.Close();
// }
//}
//catch (Exception ex)
//{
// result = "{\"code\":10001,\"msg\":\"添加留言出错,请稍后重试!\"}";
//};
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult EditUser()
{
string result="";
// 输入为querystring
//var jsonText = GetRequestJsonString();
//try
//{
// //var role = RegexUtils.GetStringJson(ref jsonText, "role");
// var name = RegexUtils.GetStringJson(ref jsonText, "name");
// //var school = RegexUtils.GetStringJson(ref jsonText, "school");
// var rkxd = RegexUtils.GetStringJson(ref jsonText, "rkxd");
// var zxxkc = RegexUtils.GetStringJson(ref jsonText, "zxxkc");
// //var is_import = RegexUtils.GetStringJson(ref jsonText, "is_import");
// //var password = RegexUtils.GetStringJson(ref jsonText, "password");
// //var order_id = RegexUtils.GetStringJson(ref jsonText, "order_id");
// var user_id = RegexUtils.GetStringJson(ref jsonText, "user_id");
// if (string.IsNullOrEmpty(user_id))
// result = "{\"code\":1,\"msg\":\"未指定用户Id\"}";
// else
// {
// string sql = "update pepdtp.user set ";
// //if (role != null) sql += "role=" + role + ",";
// if (name != null) sql += "name='" + name + "',";
// //if (school != null) sql += "school='" + school + "',";
// if (rkxd != null) sql += "rkxd='" + rkxd + "',";
// if (zxxkc != null) sql += "zxxkc='" + zxxkc + "',";
// //if (is_import != null) sql += "is_import='" + is_import + "',";
// //if (password != null) sql += "password='" + password + "',";
// //if (order_id != null) sql += "order_id='" + order_id + "',";
// sql += "mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
// sql = sql.TrimEnd(' ').TrimEnd(',');
// if (user_id.Contains(","))
// sql += " where user_id in ('" + user_id.Replace(",", "','") + "')";
// else
// sql += " where user_id='" + user_id + "'";
// string conn = System.Configuration.ConfigurationManager.ConnectionStrings["Conn"].ConnectionString;
// MysqlUtils mySql = new MysqlUtils(conn);
// bool isSuccess = mySql.ExecuteNonQuery(sql);
// if (!isSuccess)
// {
// result = "{\"code\":10001,\"msg\":\"修改用户入库出错,请稍后重试!\"}";
// }
// else
// {
// result = "{\"code\":0,\"msg\":\"修改用户成功!\"}";
// }
// mySql.Close();
// }
//}
//catch (Exception ex)
//{
// result = "{\"code\":19999,\"msg\":\"修改用户出错,请稍后重试!\"}";
//};
return WriteJson(result);
}
}
}
@@ -0,0 +1,337 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_order/[action]")]
public class WXOrderController : BaseApiController
{
private readonly WXOrderService _wXOrderService;
public WXOrderController(WXOrderService wXOrderService)
{
_wXOrderService = wXOrderService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_erp_order_list()
{
get_order_list();
return Content("");
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_order_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetErpOrderList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_erp_order_item_list()
{
get_order_item_list();
return Content("");
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_order_item_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetErpOrderItemList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_erp_refund_list()
{
get_refund_list();
return Content("");
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_refund_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetErpRefundList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_buy_prod_map()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXAddMdyBuyProdMap(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_buy_prod_map()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetBuyPordMap(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_transit_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetTransitOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_erp_order_express()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateErpOrderExpress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_erp_allocated_order_no()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateErpAllocatedOrderNo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_del_erp_transit_warehouse_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXDelErpTransitWarehouseOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_erp_soft_remark()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateErpSoftRemark(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_erp_color_flag()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateErpColorFlag(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_erp_out_after_sale_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateErpOutAfterSaleStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_buyer_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXAddMdyBuyerOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_buyer_order_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetBuyerOrderList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_buyer_after_sale()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXAddMdyBuyerAfterSale(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_buyer_after_sale_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetBuyerAfterSaleList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_transit_warehouse_aftersale_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetTransitWarehouseAfterSaleList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_abnormal_transit_order()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateAbnormalTransitOrder(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_update_transit_order_reject_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXUpdateTransitOrderRejectStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_order_item_ext_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXAddOrderItemExtInfo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_mdy_order_item_ext_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXMdyOrderItemExtInfo(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_order_item_ext_info()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOrderService.WXGetOrderItemExtInfoList(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,461 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_product/[action]")]
public class WXProductController : BaseApiController
{
private readonly WXProductService _wXProductService;
private readonly BXXProductService _bXXProductService;
public WXProductController(WXProductService wXProductService, BXXProductService bXXProductService)
{
_wXProductService = wXProductService;
_bXXProductService = bXXProductService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetPDDProductList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_detail_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetPDDProductList(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_list_random()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetPDDProductListRandom(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_prod_wx_complate_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.GetProdWXComplateList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_groups()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetPDDProductGroups(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_pdd_product_cates()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetPDDProductCates(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_pdd_product()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXMdyPDDProduct(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_best_sale_prod()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.MdyBestSaleProd(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_random_company_product_config()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.SetRandomCompanyProductConfig(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_random_company_product_config()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.GetRandomCompanyProductConfig(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_secret_spu_id_shop_id_map()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddSecretSpuIdShopIdMap(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_secret_id_up_map()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddSecretIdUpMap(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_secret_spu_id_shop_id_map_List()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetSecretSpuIdShopIdMapList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_after_sale()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddMdyAfterSale(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_after_sale()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetAfterSale(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_random_after_sale_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetRandomAfterSaleList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_after_sale_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetAfterSaleList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_del_address()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXDelAddress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_shipping_template()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddMdyShippingTemplate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_shipping_template()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetShippingTemplate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_commission_rate()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddMdyCommissionRate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_commission_rate()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetCommissionRate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_qualification_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXAddMdyQualificationImage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_qualification_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXGetQualificationImage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_del_qualification_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.WXDelQualificationImage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_get_freight_template()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.E57GetFreightTemplate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_after_sale()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXProductService.E57AfterSale(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_get_all_cate()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiGetWxAllCate(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_dropship_search()
{
string jsontext = GetRequestJsonString();
var result = _bXXProductService.WxApiDropshipSearch(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_dropship_assign()
{
string jsontext = GetRequestJsonString();
var result = _bXXProductService.WxApiDropshipAssign(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_dropship_cancel()
{
string jsontext = GetRequestJsonString();
var result = _bXXProductService.WxApiDropshipCancel(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_category_classify()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiCategoryClassify(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_api_upload_image()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.WxApiUploadImage(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult is_get_wx_recommend_hot_prod()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _bXXProductService.IsGetWXRecommendHotProd(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,519 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_shop/[action]")]
public class WXShopController : BaseApiController
{
private readonly WXShopService _wXShopService;
private readonly WXExpressOptimizeService _wXExpressOptimizeService;
public WXShopController(WXShopService wXShopService, WXExpressOptimizeService wXExpressOptimizeService)
{
_wXShopService = wXShopService;
_wXExpressOptimizeService = wXExpressOptimizeService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.GetShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_erp_merchant()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.GetShopErpMerchant(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_one_login_name_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.GetOneLoginNameShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.AddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.DelShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.MdyShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult mdy_shop_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.MdyCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_get_shop_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.GetShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult sub_sa_get_select_prod_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.SubSaGetSelectProdShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_add_prod_remaining()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.UpdateAddProdRemaining(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_mdy_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.MdyShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_add_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.AddShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult admin_del_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.DelShop(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult set_shop_sub_sa()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.SetShopSubSa(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.AddWaybill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.DelWaybill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.GetWayBill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_waybill_no_user_name()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.GetWayBill(jsontext, true);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult select_and_set_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.SelectAndSetWaybill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult select_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.SelectWaybill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_used_waybill()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.UpdateUsedWaybill(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_mdy_express_optimize_rst()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.AddMdyExpressOptimizeRst(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_express_optimize_rst()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.GetExpressOptimizeRst(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_mdy_express_optimize_remark()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.AddMdyExpressOptimizeRemark(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_express_optimize_remark()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXExpressOptimizeService.GetExpressOptimizeRemark(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_shop_default_address()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXAddMdyShopDefaultAddress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_shop_default_address_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXGetShopDefaultAddressList(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_del_shop_default_address()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXDelShopDefaultAddress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_order_address()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXAddMdyOrderDecryptAddress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_order_address()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXGetOrderDecryptAddress(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_buy_url_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXAddMdyBuyUrlNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_buy_url_notes()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXGetBuyUrlNotes(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_add_mdy_29wx_pdd_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXAddMdy29WxPddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_mdy_29wx_pdd_cookie_and_login_status()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXMdy29WxPddCookieAndLoginStatus(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_del_29wx_pdd_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXDel29WxPddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult wx_get_29wx_pdd_shop()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.WXGet29WxPddShop(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_get_wx_tokens()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.E57GetWxTokens(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult e57_get_wx_shop_token()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopService.E57GetWxShopToken(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,36 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_shop_revenue_statistics/[action]")]
public class WXShopRevenueStatisticsController : BaseApiController
{
private readonly WXShopRevenueStatisticsService _wXShopRevenueStatisticsService;
public WXShopRevenueStatisticsController(WXShopRevenueStatisticsService wXShopRevenueStatisticsService)
{
_wXShopRevenueStatisticsService = wXShopRevenueStatisticsService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_shop_order_amount()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXShopRevenueStatisticsService.GetShopOrderAmountRange(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,306 @@
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using StoreHub.KJDWebService.Services;
namespace StoreHub.KJDWebService.Controllers
{
[ApiController]
[ApiVersionNeutral]
[Route("wxxd_user/[action]")]
public class WXUserController : BaseApiController
{
private readonly WXUserService _wXUserService;
private readonly WXOemService _wXOemService;
public WXUserController(WXUserService wXUserService, WXOemService wXOemService)
{
_wXUserService = wXUserService;
_wXOemService = wXOemService;
}
[AcceptVerbs("GET", "POST")]
public IActionResult hello_world()
{
return Content("Hello World");
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_e57_authorization()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetE57Authorization(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult user_login()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.CheckUserLogin(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult change_password()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.ChangePassword(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_sub_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.AddSubUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult delete_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.DelUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_all_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetAllUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_user()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.AddUser(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user_points()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateUserPoints(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_points()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetUserPoints(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_user_balance()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateUserBalance(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_user_balance()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetUserBalance(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_wx_sale_assistant_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetWxSaleAssistantCookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_wx_sale_assistant_cookie()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateWxSaleAssistantCookie(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult update_top_up_qrcode()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.UpdateTopUpQrcode(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_top_up_qrcode()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXUserService.GetTopUpQrcode(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult add_mdy_oem()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOemService.AddMdyOem(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult del_oem()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOemService.DelOem(jsontext);
return WriteJson(result);
}
[AcceptVerbs("GET", "POST")]
public IActionResult get_oem()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = _wXOemService.GetOem(jsontext);
return WriteJson(result);
}
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class CommentParam
{
public int id { get; set; }
public string user_id { get; set; }
public string comment { get; set; }
public DateTime add_time { get; set; }
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class DBPriceResultParam
{
public int id { get; set; }
public string ext_code { get; set; }
public int original_price { get; set; }
public int markup_times { get; set; }
public int extra_price { get; set; }
public string notes { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
public class DBExtCodePriceResult
{
public int id { get; set; }
public string ext_code { get; set; }
public int ext_code_price { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class DBProdDbIdMapProductIdResultParam
{
public long id { get; set; }
public long product_select_db_id { get; set; }
public long product_id { get; set; }
public long shop_id { get; set; }
public DateTime add_time { get; set; }
}
public class DBProdDraftIdMapUpSpuIdResultParam
{
public long id { get; set; }
public long draft_id { get; set; }
public long from_spu_id { get; set; }
public long shop_id { get; set; }
public DateTime add_time { get; set; }
public decimal? cost_price { get; set; }
public decimal? delivery_fee { get; set; }
public decimal? mark_fee { get; set; }
}
}
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class DBProductResultParamLite
{
public int id { get; set; }
public string spu_id { get; set; }
public string secret_spu_id { get; set; }
}
/// <summary>
/// 选品数据库商品
/// </summary>
public class DBProductResultParam
{
public int id { get; set; }
public string from_shop_id { get; set; } = "";
public string from_shop_name { get; set; } = "";
public string offline_supplier_id { get; set; }
public string offline_supplier_name { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
public string main_cat_id { get; set; }
public string cat_id { get; set; }
public string main_cat_name { get; set; }
public string cat_name { get; set; }
public string wx_cat_1 { get; set; }
public string wx_cat_2 { get; set; }
public string wx_cat_3 { get; set; }
public string wx_cat_leaf { get; set; }
/// <summary>
/// 母店价格
/// </summary>
public string price_text { get; set; }
/// <summary>
/// jit成本价格
/// </summary>
public string cost_price { get; set; }
/// <summary>
/// jit快递费
/// </summary>
public string delivery_fee { get; set; }
/// <summary>
/// jit贴单费
/// </summary>
public string mark_fee { get; set; }
/// <summary>
/// 变更类目ID(针对旧类目可能不可再提交商品)
/// </summary>
public string change_cat_id { get; set; }
/// <summary>
/// 变更类目名称(针对旧类目可能不可再提交商品)
/// </summary>
public string change_cat_name { get; set; }
public string ext_code { get; set; }
public string secret_spu_id { get; set; }
/// <summary>
/// 拼多多 设置类目价格
/// </summary>
public int? ext_code_price { get; set; }
public string product_name { get; set; }
public string product_json { get; set; }
public string size_json { get; set; }
public string sku_edit_json { get; set; }
/// <summary>
/// 微信推单商品和sku加密code信息
/// </summary>
public string sku_secret_json { get; set; }
public string wx_img_map_json { get; set; }
//public int sku_img_replace_id { get; set; }
//public string sku_img_replace_base64 { get; set; }
//public string sku_img_replace_url { get; set; }
public string main_img { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string group { get; set; }
public string notes { get; set; }
/// <summary>
/// 店铺选品次数
/// </summary>
public int select_count { get; set; } = 0;
/// <summary>
/// 被选中的总次数
/// </summary>
public int select_total_count { get; set; }
public string fission_imgs { get; set; }
public string fission_words { get; set; }
public string head_words { get; set; }
public string end_words { get; set; }
public int product_get_type { get; set; }
public string product_get_type_text { get; set; }
public int? view_uv { get; set; }
public int sale_count { get; set; }
public string sale_count_text { get; set; }
public string wx_safe_status { get; set; }
public string special_prod_type { get; set; }
public int send_to_out_server { get; set; }
public string real_coid { get; set; }
public string real_spu_id { get; set; }
public string has_wx_format { get; set; }
public string problem_prod_data { get; set; }
public int is_relation { get; set; }
public string add_user_name { get; set; }
}
public class KJDDBProduct : DBProductResultParam
{
}
}
@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.ErpModel
{
public class ErpMerchantInfo
{
public long id { get; set; }
/// <summary>
/// 唯一用户标识
/// </summary>
public long user_id { get; set; }
/// <summary>
/// 账户类型,1:分销商账户,2:供应商账户
/// </summary>
public int? account_type { get; set; }
/// <summary>
/// 账户名称
/// </summary>
public string account_name { get; set; }
/// <summary>
/// 账户状态(1-正常 2-冻结 3-注销)
/// </summary>
public int account_status { get; set; }
/// <summary>
/// 账户累计充值金额
/// </summary>
public decimal recharge_amount_total { get; set; }
/// <summary>
/// 可用余额
/// </summary>
public decimal balance { get; set; }
/// <summary>
/// 冻结金额
/// </summary>
public decimal frozen_amount { get; set; }
/// <summary>
/// 提现账户收款图片
/// </summary>
public string withdraw_account_image_url { get; set; }
/// <summary>
/// 已提现金额
/// </summary>
public decimal? withdrawn_amount { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime create_time { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime update_time { get; set; }
/// <summary>
/// 创建人
/// </summary>
public long? create_by { get; set; }
/// <summary>
/// 修改人
/// </summary>
public long? update_by { get; set; }
}
}
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class JSTDownProdSkuInfo
{
public int id { get; set; }
public List<string> itemMainImage { get; set; } // Array[5],
public string itemName { get; set; } // "光流沙咕卡麻将砖块转砖带灯创意礼物男孩女孩网红",
public string styleCode { get; set; } // "725068475481",
public string itemCode { get; set; } // "ysk00407C_3R",
public string colourSpec { get; set; } // "方形带灯翠绿色;无规格",
public decimal? supplyPrice { get; set; } // 2.93,
public object oldSupplyPrice { get; set; } // null,
public object priceDate { get; set; } // null,
public List<object> perfectPlatformList { get; set; } // Array[19],
public string shelvesType { get; set; } // "DISTRIBUTION",
public string supplierName { get; set; } // "努正供应链",
public List<object> itemShelvesInfos { get; set; } // [],
public string shelvesTime { get; set; } // "2026-01-30 18:50:50",
public string itemSource { get; set; } // "GYL",
public string itemSourceText { get; set; } // "供应链",
public string supplierCoId { get; set; } // "14204696",
public string spuId { get; set; } // "BEC902FFA8B542A6A9F16BF5964DEA4F",
public string coId { get; set; } // "14791477",
public string partnerSkuId { get; set; } // "21B50E4CA5264A078933C956F0250FD9",
public string partnerSpuId { get; set; } // "9573273974C1472E9CEC10D227218E89",
public bool? deleted { get; set; } // false,
public bool? isPartner { get; set; } // true,
public bool? partnerCanSee { get; set; } // false,
public bool? haveBaseData { get; set; } // false,
public object baseDataId { get; set; } // null,
public string itemStatus { get; set; } // "distribution",
public bool? privateStatus { get; set; } // false,
public string categoryId { get; set; } // "",
public string categoryName { get; set; } // "",
public object regulatePriceMin { get; set; } // null,
public object regulatePriceMax { get; set; } // null,
public object lastRegulatePriceMin { get; set; } // null,
public object lastRegulatePriceMax { get; set; } // null,
public object regulatePriceChangeTime { get; set; } // null,
public bool? showLastRegulatePrice { get; set; } // false,
public string supplierId { get; set; } // "8323D6C2837B42AF8CB37F2A262DCA98",
/// <summary>
/// sku状态 FOR_SHELVED:该商品已被供应商设置成不可分销
/// </summary>
public string drpItemStatus { get; set; } // "FOR_SHELVED",
public string lastOperator { get; set; } // "老马",
public string itemSpuIdMd5 { get; set; } // "BEC902FFA8B542A6A9F16BF5964DEA4F"
public string secret_spu_id { get; set; }
public string secret_sku_id { get; set; }
/// <summary>
/// 产品库中是否存在
/// </summary>
public int is_in_product_db { get; set; }
public DateTime? add_time { get; set; }
}
}
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class OrderParam
{
public int id { get; set; }
public string order_id { get; set; }
public string order_info { get; set; }
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.PddModel
{
public class BuyerLoginInfo
{
public int id { get; set; }
public string user_name { get; set; }
public string buyer_id { get; set; }
public string buyer_name { get; set; }
public string buyer_nick { get; set; }
public string cookie { get; set; }
public string status { get; set; }
public string notes { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
public class PDDMaterialInfo
{
public long? latest_material_id { get; set; }
public string latest_material { get; set; }
public int? check_status { get; set; }
public object check_comment { get; set; }
public string online_material { get; set; }
}
}
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
public class PDDProductDecorationInfo
{
public long? goods_id { get; set; }
public long? goods_commit_id { get; set; }
public long? mall_id { get; set; }
public List<PDDProdfloorItem> floor_list { get; set; } = new List<PDDProdfloorItem>();
public long? create_time { get; set; }
public long? update_time { get; set; }
}
public class PDDProdfloorItem
{
public long? floor_id { get; set; }
public string key { get; set; }
public string type { get; set; }
public int? priority { get; set; }
public List<PDDProdContentItem> content_list { get; set; }
public object check_status { get; set; }
public object check_id { get; set; }
public object check_name { get; set; }
public object comment { get; set; }
public object if_have_template { get; set; }
public object floor_status { get; set; }
public object template_id { get; set; }
public object template_type { get; set; }
public object template_json { get; set; }
}
public class PDDProdContentItem
{
public string img_url { get; set; }
public long? file_id { get; set; }
public int? height { get; set; }
public int? width { get; set; }
public int? file_status { get; set; }
public object goods_id { get; set; }
public object goods_name { get; set; }
public object show_price { get; set; }
public object status { get; set; }
public object min_on_sale_group_price { get; set; }
public string text { get; set; }
public object hot_zone_list { get; set; }
public text_module_detail_item text_module_details { get; set; }
public object activity_sn { get; set; }
public object combine_buy_element_dtolist { get; set; }
}
public class text_module_detail_item
{
public int? font_size { get; set; }
public string font_color { get; set; }
public int font_family { get; set; }
public string align { get; set; }
public string background_color { get; set; }
}
}
@@ -0,0 +1,332 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
public class PDDProductDetailInfo
{
public long? id { get; set; }
public long? goods_id { get; set; }
public int? check_status { get; set; }
public int? commit_deleted { get; set; }
public string owner { get; set; }
public int? is_shop { get; set; }
public string goods_sn { get; set; }
public string out_goods_sn { get; set; }
public int? is_folt { get; set; }
public string warm_tips { get; set; }
public object fabric { get; set; }
public object fabric_content { get; set; }
public long? cost_template_id { get; set; }
public int? cat_id { get; set; }
public long? mall_id { get; set; }
public string goods_name { get; set; }
public string tiny_name { get; set; }
public string goods_desc { get; set; }
public string share_desc { get; set; }
public List<object> list_desc { get; set; }
public int? market_price { get; set; }
public string thumb_url { get; set; }
public string image_url { get; set; }
public string hd_thumb_url { get; set; }
public List<object> allowed_region { get; set; }
public int? region_limit { get; set; }
public int? goods_type { get; set; }
public object country { get; set; }
public int? country_id { get; set; }
public string goods_name_prefix { get; set; }
public int? origin_country_id { get; set; }
public string origin_country_name { get; set; }
public object size_spec_id { get; set; }
public object size_parent_spec_id { get; set; }
public string warehouse { get; set; }
public int? event_type { get; set; }
public int? is_app { get; set; }
public int? is_pre_sale { get; set; }
public int? pre_sale_time { get; set; }
public int? is_sku_pre_sale { get; set; }
public int? is_refundable { get; set; }
public int? is_customs { get; set; }
public int? is_wms { get; set; }
public string customs { get; set; }
public int? is_bangdan { get; set; }
public long? shipment_limit_second { get; set; }
public int? quick_refund { get; set; }
public group_item groups { get; set; }
public commit_extension_item commit_extension { get; set; }
public List<gallery_item> galleries { get; set; }
public List<object> goods_commit_check { get; set; }
public mall_info_item mall_info { get; set; }
public List<sku_item> sku { get; set; }
public object reject_status { get; set; }
public object reject_reason { get; set; }
public object paper_net_weight { get; set; }
public object paper_length { get; set; }
public object paper_width { get; set; }
public object paper_plies_num { get; set; }
public int? second_hand { get; set; }
public int? source { get; set; }
public bool is_card_secret { get; set; }
public bool is_only_for_remote_area { get; set; }
public int? invoice_status { get; set; }
public object invoice_mode { get; set; }
public object client_id { get; set; }
public int? quan_guo_lian_bao { get; set; }
public int? zhi_huan_bu_xiu { get; set; }
public object song_huo_ru_hu { get; set; }
public object shang_men_an_zhuang { get; set; }
public object song_huo_an_zhuang { get; set; }
public object mai_jia_zi_ti { get; set; }
public object sf_markup_template_sn { get; set; }
public long? min_group_price { get; set; }
public long? max_group_price { get; set; }
public int? must_check_type { get; set; }
public object goods_property_list { get; set; }
public object is_small_group { get; set; }
public int? submit_time { get; set; }
public int? oversea_type { get; set; }
public object oversea_goods { get; set; }
public int? is_general_trade { get; set; }
public int? bad_fruit_claim { get; set; }
public string bad_claim_text { get; set; }
public int? allergy_refund { get; set; }
public int? lack_of_weight_claim { get; set; }
public int? delivery_one_day { get; set; }
public object delivery_type { get; set; }
public int? goods_pattern { get; set; }
public int? customizable { get; set; }
public int? is_group_pre_sale { get; set; }
public object elec_goods_attributes { get; set; }
public schedule_sale_item schedule_sale { get; set; }
public object goods_trade_attr { get; set; }
public object goods_travel_attr { get; set; }
public object sku_type { get; set; }
public int? is_goods_decoration { get; set; }
public List<object> goods_srv_templates { get; set; }
public object card_verification_list { get; set; }
public object transport_type_list { get; set; }
public object out_source_type { get; set; }
public object out_source_goods_id { get; set; }
public object is_all_weight_same { get; set; }
public bool? is_spring_festival_open_tag { get; set; }
public int? two_pieces_discount { get; set; }
public instruction_vo_item instruction_vo { get; set; }
public object local_service_id_list { get; set; }
public object shop_group_id { get; set; }
public object shop_group_name { get; set; }
public int? is_refundable_fifteen_day { get; set; }
public int? is_warranty_one_year { get; set; }
public long? created_at { get; set; }
public int? privacy_delivery { get; set; }
public object invoice_mode_sub_type { get; set; }
public bool? is_two_num_group { get; set; }
public extend_warranty_dto_item extend_warranty_dto { get; set; }
public int? is_sku_shipment { get; set; }
public List<object> qualification_id_list { get; set; }
public int? is_certificate_provide { get; set; }
public int? thawed_refund { get; set; }
public int? damage_claim { get; set; }
public int? is_wp_service { get; set; }
public int? is_size_change_casually { get; set; }
public string owner_name { get; set; }
public bool? show_activity_price { get; set; }
public object appeal_status { get; set; }
public object can_appeal { get; set; }
public List<int?> cat_ids { get; set; }
public List<string> cats { get; set; }
public bool? is_draft { get; set; }
public int? third_type { get; set; }
public int? estimate_quantity { get; set; }
public int? last_commit_check_status { get; set; }
public bool? is_deposit { get; set; }
public object gold_price_template_id { get; set; }
public object gold_price_type { get; set; }
public int? processing_charges { get; set; }
public object processing_charges_type { get; set; }
public object is_gold_price_matched { get; set; }
public object shoes_template_id { get; set; }
public object spu_id { get; set; }
public object spu_version { get; set; }
public object is_goods_copy { get; set; }
public int? promised_delivery_seconds { get; set; }
public int? community_group_buying { get; set; }
public int? purchase_info_supply { get; set; }
public int? same_city_template_id { get; set; }
public object goods_certificate { get; set; }
public int? is_customized { get; set; }
public string name_prefix { get; set; }
public object business_source_type { get; set; }
public object creator_name { get; set; }
public object reason { get; set; }
public object app_id { get; set; }
public object app_name { get; set; }
public int? user_source { get; set; }
public object check_type { get; set; }
}
public class group_item
{
public int? single_price { get; set; }
public int? group_price { get; set; }
public object carnival_price { get; set; }
public int? customer_num { get; set; }
public int? buy_limit { get; set; } //999999
public int? order_limit { get; set; } //999999
public string regular_limit { get; set; }
public object regular_limit_duration { get; set; }
public object min_num_of_order { get; set; }
public int? community_group_buying { get; set; } = 0;
}
public class commit_extension_item
{
public int? id { get; set; }
public int? goods_commit_id { get; set; }
public int? start_production_date { get; set; }
public int? end_production_date { get; set; }
public string production_license { get; set; }
public string production_standard_number { get; set; }
public int? shelf_life { get; set; }
public string out_goods_sn { get; set; }
public object created_at { get; set; }
public object updated_at { get; set; }
}
public class gallery_item
{
public string url { get; set; }
public int? width { get; set; }
public int? height { get; set; }
// 图片类型 1 主图 2 详情图 3视频
public int? type { get; set; }
public object source { get; set; }
public object status { get; set; }
public object video_url { get; set; }
public object file_id { get; set; }
public object is_deleted { get; set; }
public object check_comment { get; set; }
public object origin_url { get; set; }
}
public class mall_info_item {
public string mall_name { get; set; }
}
public class sku_edit_item : sku_item
{
public string thumb_md5 { get; set; }
}
public class sku_item
{
public long? id { get; set; }
public long? sku_id { get; set; }
public object sku_sn { get; set; }
public int? carnival_price { get; set; }
public int? init_quantity { get; set; }
public int? is_onsale { get; set; }
public int? limit_quantity { get; set; } = 999999; // 999999 max
public int? multi_price { get; set; }
public object multi_price_in_yuan { get; set; }
public int? price { get; set; }
public object price_in_yuan { get; set; }
public int? quantity { get; set; }
public int? reserve_quantity { get; set; }
public int? weight { get; set; }
public string thumb_url { get; set; }
public long? thumb_url_file_id { get; set; }
public object thumb_url_status { get; set; }
public object thumb_url_is_deleted { get; set; }
public int? quantity_delta { get; set; }
public List<spec_item> spec { get; set; }
// 货号
public string out_sku_sn { get; set; }
public object batch_id { get; set; }
public int? priority { get; set; }
public int? ware_id { get; set; }
public object ware_biz_type { get; set; } // null
public object advice_price { get; set; }
public object length { get; set; }
public oversea_sku_item oversea_sku { get; set; }
public object cspu_id { get; set; }
public object child_skus { get; set; }
public long? ref_sku_commit_id { get; set; }
public object start_time { get; set; }
public object end_time { get; set; }
public object sku_srv_templates { get; set; }
public object calendar_rule_id { get; set; }
public object hot_live_group { get; set; }
public int? pre_sale_time { get; set; }
public object out_source_sku_id { get; set; }
public object dd_grocery_sku_params { get; set; }
public object sku_extended_attribute_dtos { get; set; }
public object sku_basic_property_dtos { get; set; }
public object spec_note_map { get; set; }
public object delivery_schedule_dtos { get; set; }
public List<object> shipment_limit_second_list { get; set; }
public string sku69_code { get; set; }
}
public class spec_item
{
public long? parent_id { get; set; }
public string parent_name { get; set; }
public long? spec_id { get; set; }
public string spec_name { get; set; }
public object spec_note { get; set; }
public object bundle_spec_list { get; set; }
public object sku_combination { get; set; }
public object is_custom { get; set; }
}
public class oversea_sku_item
{
public object specifications { get; set; }
public object measurement_code { get; set; }
public object measurement_unit { get; set; }
public object taxation { get; set; }
public object record_id_list { get; set; }
}
public class schedule_sale_item
{
public int? sale_type { get; set; }
public object sale_time_fixed { get; set; }
public object sale_time { get; set; }
public object price_show { get; set; }
public object price_desc { get; set; }
}
public class instruction_vo_item
{
public object template_id { get; set; }
public int? template_status { get; set; }
public object template_name { get; set; }
public object rejected_reason { get; set; }
}
public class extend_warranty_dto_item
{
public int? extend_warranty { get; set; }
public object extend_warranty_year { get; set; }
public object extend_warranty_range { get; set; }
}
}
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
public class PDDProductInfo
{
public PDDProductDetailInfo detail { get; set; }
public PDDSizeSpecInfo size { get; set; }
public PDDProductDecorationInfo decoration { get; set; }
public PDDProductPropertyInfo property { get; set; }
/// <summary>
/// 白底图
/// </summary>
public PDDMaterialInfo material1 { get; set; }
/// <summary>
/// 长图
/// </summary>
public PDDMaterialInfo material3 { get; set; }
public object source_json { get; set; }
public string sale_count { get; set; }
public string sale_count_text { get; set; }
public string chance_id { get; set; }
public string chance_refere { get; set; } // 记录机会商品提交的refere
public string chance_tab { get; set; } // 记录机会商品提交的tab
}
}
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
public class PDDProductPropertyInfo
{
public List<goods_propertie_item> goods_properties { get; set; }
public object sku_properties { get; set; }
}
public class goods_propertie_item
{
public string name { get; set; }
public int? ref_pid { get; set; }
public List<value_item> values { get; set; }
/// <summary>
/// 对应微信输入类型
/// </summary>
//public int? wx_input_type { get; set; }
}
public class value_item
{
public long? vid { get; set; }
public string value { get; set; }
public string unit { get; set; }
public string raw_value { get; set; }
public table_info_vo_info table_info_vo { get; set; }
}
public class table_info_vo_info
{
public List<table_value_info> table_value_list { get; set; }
}
public class table_value_info
{
public string value { get; set; } // "100.0",
public string unit { get; set; } // "%",
public int? column_type { get; set; } // 1
}
}
@@ -0,0 +1,120 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models
{
//public class PDDSizeSpecInfo
//{
// public long? id { get; set; }
// public int? extendType { get; set; }
//}
//public class SizeContentItem
//{
// public string picUrl { get; set; }
//}
public class GroupsItem
{
/// <summary>
///
/// </summary>
public int? id { get; set; }
/// <summary>
/// 中国码
/// </summary>
public string name { get; set; }
/// <summary>
///
/// </summary>
public bool? required { get; set; }
}
public class ElementItem
{
/// <summary>
///
/// </summary>
public int? id { get; set; }
/// <summary>
/// 肩宽(cm)
/// </summary>
public string name { get; set; }
/// <summary>
///
/// </summary>
public bool? required { get; set; }
}
public class MetaItem
{
/// <summary>
///
/// </summary>
public List<GroupsItem> groups { get; set; }
/// <summary>
///
/// </summary>
public List<ElementItem> elements { get; set; }
/// <summary>
///
/// </summary>
public List<string> batchableElementIds { get; set; }
}
public class RecordItem
{
/// <summary>
///
/// </summary>
public Dictionary<string, string> values { get; set; }
}
public class ContentItem
{
/// <summary>
///
/// </summary>
public MetaItem meta { get; set; }
/// <summary>
///
/// </summary>
public List<RecordItem> records { get; set; }
/// <summary>
///
/// </summary>
public string picUrl { get; set; }
}
public class PDDSizeSpecInfo
{
/// <summary>
///
/// </summary>
public long? id { get; set; }
/// <summary>
///
/// </summary>
public int? extendType { get; set; }
/// <summary>
///
/// </summary>
public ContentItem content { get; set; }
/// <summary>
///
/// </summary>
public int? classId { get; set; }
/// <summary>
///
/// </summary>
public bool? reusable { get; set; }
/// <summary>
///
/// </summary>
public int? status { get; set; }
}
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class ProductPurchasePriceResultParam
{
public int id { get; set; }
public string shop_id { get; set; }
public string shop_name { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
public string cat_id { get; set; }
public string cat_name { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string main_img { get; set; }
public int discount { get; set; }
public string price_text { get; set; }
public string sku_purchase_price_json { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string notes { get; set; }
}
}
@@ -0,0 +1,49 @@
using StoreHub.KJDWebService.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
/// <summary>
/// 用户选品结果
/// </summary>
public class ProductSelectResultParam
{
public long id { get; set; }
public string out_product_Id { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string user_name { get; set; }
public string sub_user_name { get; set; }
public string notes { get; set; }
public string user_notes { get; set; }
public string status { get; set; }
public string draft_id { get; set; }
public int add_times { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string operate_sub_sa_name { get; set; }
public string operate_sub_sa_nick { get; set; }
public DateTime? add_sub_sa_time { get; set; }
public string fission_product_name { get; set; }
#region 外键连接属性
public string from_shop_id { get; set; } = "";
public string cat_id { get; set; }
public string cat_name { get; set; }
public string change_cat_id { get; set; }
public string change_cat_name { get; set; }
public string group { get; set; }
public string ext_code { get; set; }
public string product_name { get; set; }
public string main_img { get; set; }
public string spu_id { get; set; }
public string skc_id { get; set; }
public int product_get_type { get; set; }
#endregion
}
}
+48
View File
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class Result
{
public Result()
{
}
public Result(int code, string msg)
{
Code = code;
Msg = msg;
}
public int Code { get; set; }
public string Msg { get; set; }
public object Data { get; set; }
public static Result Success(string msg)
{
return new Result
{
Code = 200,
Msg = msg
};
}
public static Result Failure(string msg)
{
return new Result
{
Code = 500,
Msg = msg
};
}
//参数不合法
public static Result ArgumentNull()
{
return new Result { Code = 19999, Msg = "输入为空" };
}
}
}
@@ -0,0 +1,47 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.ShopModel
{
public class JSTListProductSkuInfo
{
public long id { get; set; }
public string skuId { get; set; } // "F51114C9251A4AC1A03D91256FB48EF5",
public string itemSpuId { get; set; } // "16306F9EA78643A6B8389036BFC6131B",
public string pic { get; set; } // "https://images.sursung.com/prod/item/11625838/20260213/7D4666188669485C95B31A53CE621EAB_s392918_h800_w800.jpg",
public string itemName { get; set; } // "汉服发带唐风发饰古风国风头饰女马面裙配饰",
/// <summary>
/// spu货号
/// </summary>
public string styleCode { get; set; } // "633881130581",
/// <summary>
/// sku货号
/// </summary>
public string itemCode { get; set; } // "sp01351C",
public string color { get; set; } // "葡萄花鸟复原蓝",
public string spec { get; set; } // "无规格",
public decimal? salePrice { get; set; } // 7,
//public object weight { get; set; } // null,
//public object stockLastTime { get; set; } // null,
//public object regulatePriceMin { get; set; } // null,
//public object regulatePriceMax { get; set; } // null
public decimal? supplyPrice { get; set; }
public int? stock { get; set; }
public decimal? weight { get; set; }
public DateTime stockTime { get; set; }
public string coid { get; set; }
public string supplierId { get; set; }
public string supplierName { get; set; }
public string status { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.ShopModel
{
public class JitCardCodeParam
{
public int id { get; set; }
public string card_code_id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime add_time { get; set; }
/// <summary>
/// 激活时间
/// </summary>
public DateTime? active_time { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime? expire_time { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string notes { get; set; }
}
}
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.ShopModel
{
public class ShopParam
{
public int id { get; set; }
public string login_name { get; set; }
public string login_pass { get; set; }
public string cookie { get; set; }
public string cookie2 { get; set; }
/// <summary>
/// 拼多多AntiContents
/// </summary>
public string anti_contents { get; set; }
/// <summary>
/// 拼多多Id
/// </summary>
public string pddid { get; set; }
/// <summary>
/// 拼多多mall_id
/// </summary>
public string mall_id { get; set; }
/// <summary>
/// 微店网页token
/// </summary>
public string wd_token { get; set; }
/// <summary>
/// 微信openId
/// </summary>
public string openid { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string sub_user_name { get; set; }
public string sub_nick_name { get; set; }
public string user_name { get; set; }
public string company_name { get; set; }
/// <summary>
/// 备注
/// </summary>
public string notes { get; set; }
public string group_name { get; set; }
public string login_status { get; set; }
public string login_status2 { get; set; }
public int add_product_remaining { get; set; }
public int add_product_month { get; set; }
public string operate_sub_sa_name { get; set; }
/// <summary>
/// temu推广直通车用户Id
/// </summary>
public string ad_seller_unique_id { get; set; }
/// <summary>
/// temu推广直通车链接地址(含信息)
/// </summary>
public string ad_url { get; set; }
/// <summary>
/// temu推广直通车cookie
/// </summary>
public string ad_cookie { get; set; }
/// <summary>
/// temu推广直通车登录状态
/// </summary>
public string ad_login_status { get; set; }
public DateTime? jit_expire_time { get; set; }
public int? expire_time { get; set; }
public DateTime add_time { get; set; }
//public DateTime mdy_time { get; set; }
public bool? is_point_shop_expire { get; set; } = false;
public long? erp_shop_id { get; internal set; }
public long? erp_corporate_account_user_id { get; internal set; }
public long? erp_manage_user_id { get; internal set; }
}
public class AuthInfo
{
public int id { get; set; }
public string ShopId { get; set; } = "";
public string AccessToken { get; set; } = "";
public string RefreshToken { get; set; } = "";
public string AppKey { get; set; } = "";
public string AppSecret { get; set; } = "";
public DateTime ExpiresTime { get; set; }
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
public string ApiAuthStatus { get; set; } = "未授权";
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.ShopModel
{
public class sku_img_replace
{
public int id { get; set; }
public string img_md5 { get; set; }
public string img_base64 { get; set; }
public string img_url { get; set; }
public string img_type { get; set; }
public string img_group { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class SkuImgResult
{
public int id { get; set; }
public int img_base64_db_id { get; set; }
public string img_md5 { get; set; }
public string img_url { get; set; }
public string product_id { get; set; }
public string spec_id { get; set; }
public string spec_name { get; set; }
public string original_img_url { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public DateTime base64_mdy_time { get; set; }
public string img_base64 { get; set; }
public int use_count { get; set; }
}
}
@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class TemuDBOrderInfo
{
public int? id { get; set; }
public string supplierId { get; set; } // '店铺Id',
public string supplierName { get; set; }
public string originalPurchaseOrderSn { get; set; } // '备货单号',
public string subPurchaseOrderSn { get; set; } // '备货母单号',
public string productName { get; set; }
public string category { get; set; }
public string productId { get; set; } // '商品编号',
public string upProductId { get; set; } // 上家商品编号
public string productSkcId { get; set; } //
public string productSkcPicture { get; set; } //'主图',
public string productSn { get; set; } // '货号',
public int status { get; set; } = 1; // '状态 1待发货 2已送货 7已入库 8已作废',
public string productSkuId { get; set; } // CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
/// <summary>
/// 订单sku货号
/// </summary>
public string extCode { get; set; } // 'sku货号',
public string className { get; set; } // 'sku规格',
public string currencyType { get; set; } // 价格单位
public int supplierPrice { get; set; } // '申报价格',
public int? costPrice { get; set; } // '成本价',
public int? deliveryFee { get; set; } // '车队费',
public int? markFee { get; set; } // '贴标费',
public int purchaseQuantity { get; set; } // '备货件数',
public int deliverQuantity { get; set; } // '送货件数',
public int realReceiveAuthenticQuantity { get; set; } // '入库件数',
public decimal? availableSaleDays { get; set; } // '可售天数',
public int? qcResult { get; set; } // '抽检结果 1合格 2不合格',
public string thumbUrlList { get; set; } // 'sku图片',
public long purchaseTime { get; set; } // '备货单创建时间',
public long? deliverTime { get; set; } // '发货时间',
public long? receiveTime { get; set; } // '收货时间',
public long expectLatestDeliverTimeOrDefault { get; set; } // '最迟发货时间',
public long expectLatestArrivalTimeOrDefault { get; set; } // '最迟到货时间',
public string deliveryOrderSn { get; set; } // '发货单号',
public string receiveWarehouseId { get; set; } // '实际收货仓库Id',
public string receiveWarehouseName { get; set; } // '实际收货仓库',
public string warehouseGroupId { get; set; } // '仓组Id',
public string jiaTongCode { get; set; } // '佳同码',
public string barCodeMd5 { get; set; } // '商品条码MD5',
public string shippingMark​Md5 { get; set; } // '箱唛文件MD5',
public string notes { get; set; } // '备注',
public int upLoadStatus { get; set; } = 0; // '是否上传订单(上传后扣除用户授权金额,产生扣费记录)',
public DateTime add_time { get; set; } //
public DateTime mdy_time { get; set; } //
}
}
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class UserLoginResultParam
{
public int id { get; set; }
/// <summary>
/// 用户名
/// </summary>
public string user_name { get; set; }
/// <summary>
/// 父用户名
/// </summary>
public string parent_user_name { get; set; }
/// <summary>
/// 贴牌编号
/// </summary>
public string oem_id { get; set; }
public string oem_name { get; set; }
public bool is_oem_owner { get; set; }
/// <summary>
/// 手机号(真实登录id,与用户名相同)
/// </summary>
public string mobile { get; set; }
public string password { get; set; }
public string nick_name { get; set; }
public string group_id { get; set; }
public bool is_import { get; set; }
public string company_name { get; set; }
public string card_id { get; set; }
private int _is_sa = 0;
public int is_sa
{
get { return Math.Max(_sa_level, _is_sa); }
set { _is_sa = value; }
}
private int _sa_level = 0;
public int sa_level
{
get { return Math.Max(_sa_level, _is_sa); }
set { _sa_level = value; }
}
public decimal authorized_amount { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
/// <summary>
/// 备注
/// </summary>
public string notes { get; set; }
/// <summary>
/// 用户的功能操作权限
/// </summary>
public string authority { get; set; }
/// <summary>
/// 父账户的功能操作权限
/// </summary>
public string parent_authority { get; set; }
/// <summary>
/// 子账号被禁止展示的功能页面
/// </summary>
public string forbidden_page { get; set; }
/// <summary>
/// 用户积分点数
/// </summary>
public int points { get; set; }
/// <summary>
/// 单店铺续费1个月消耗的点数
/// </summary>
public int shop_points_per_month { get; set; }
/// <summary>
/// 当前余额
/// </summary>
public decimal balance { get; set; }
/// <summary>
/// 历史充值总额
/// </summary>
public decimal recharge_amount_total { get; set; }
/// <summary>
/// 每单运费金额
/// </summary>
public decimal? postage_per_order { get; set; }
/// <summary>
/// 每单退货运费金额
/// </summary>
public decimal? refund_postage_per_order { get; set; }
/// <summary>
/// 每一单礼物额外收取费用
/// </summary>
public decimal? gift_oem_amount_per_order { get; set; }
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class WXAddressInfo
{
public int id { get; set; }
public string supplier_name { get; set; }
public string coid { get; set; }
public string after_sale_json { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
public string type { get; set; }
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class WXShopDefaultAddressInfo
{
public int? id { get; set; }
public string user_id { get; set; }
public string shop_id { get; set; }
public string province_name { get; set; }
public string city_name { get; set; }
public string county_name { get; set; }
public string detail_info { get; set; }
public string tel_number { get; set; }
public string user_name { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class WXBuyUrlNotesInfo
{
public int id { get; set; }
public string spu_code { get; set; }
public string user_name { get; set; }
public string buy_url_notes { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
public class WXBuyMapInfo
{
public long id { get; set; }
public string user_name { get; set; }
public string spu_code { get; set; }
public string sku_code { get; set; }
public string map_url { get; set; }
public string map_goods_name { get; set; }
/// <summary>
/// sku规格名称
/// </summary>
public string map_spec_name { get; set; }
public string map_goods_id { get; set; }
public string map_sku_id { get; set; }
/// <summary>
/// 发货地(省,市)
/// </summary>
public string map_send_address { get; set; }
public string transit_warehouse_id { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,170 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class WXClientProductInfoLite
{
public wx_client_prod_key product_key { get; set; }
public wx_client_prod_info info { get; set; }
public List<WXProductSkuInfoLite> productSkus { get; set; }
}
public class wx_client_prod_info
{
public string title { get; set; } // "2026新款情侣棒球帽立体C字母刺绣显脸小时尚百搭休闲韩版大头围鸭舌帽",
public string sub_title { get; set; } // "2025新款C字母立体刺绣棒球帽",
/// <summary>
/// 主图列表
/// </summary>
public List<string> head_img { get; set; } // ["https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/64f0a5760000484b151963b6bb81bc1e000000a000004f50", ...]
public List<wx_client_category> category { get; set; } // { "cat_id": "6093" }
/// <summary>
/// 商品详情(图)
/// </summary>
public wx_client_prod_detail detail { get; set; }
/// <summary>
/// 商品属性
/// </summary>
public List<wx_client_param> param { get; set; }
/// <summary>
/// 品牌id
/// </summary>
public string brand_id { get; set; } // "10250056"
public wx_client_sku_id_list sku_id_list { get; set; }
public wx_sku sku_list { get; set; }
public List<wx_client_product_sale_attr> product_sale_attrs { get; set; }
/// <summary>
/// 总销量
/// </summary>
public string total_sold_num { get; set; } // "46631"
public wx_client_service_desc service_desc { get; set; }
public wx_client_express_info express_info { get; set; }
public List<wx_client_head_video_info> headVideoInfo { get; set; }
public object afterSaleInfo { get; set; }
public List<object> deliveryExpressFee { get; set; }
public List<object> templateInfo { get; set; }
public string spuCode { get; set; }
}
public class wx_client_express_info
{
public string template_id { get; set; } // "243911370004",
public string product_id { get; set; } // "10000066623849",
public int? piece { get; set; } // 1,
public int? weight { get; set; } // 0,
public int? price { get; set; } // 5980
}
public class wx_client_service_desc
{
public string desc { get; set; } // "(麻烦阿姐阿哥们,带纸箱邮寄过去的一定记得用纸盒邮寄回,袋子邮寄的,带袋子寄回,拒收到付件,拒收自提件)"
}
public class wx_client_sku_id_list
{
public List<string> sku_ids { get; set; } //[ "1597139289", "1597121531", "1597127451", "1597113890", "1597119654" ]
}
public class wx_client_prod_key
{
public string product_id { get; set; } // "10000066623849",
public string appid { get; set; } // "wx62cca7dc2354b687"
}
public class wx_client_head_video_info
{
public string videoUrl { get; set; } // "https://wst.wxapp.tc.qq.com/162/20302/snssvpdownload/SH/reserved/0bc3yya5qaabfaaeaq6thjt2nrwd3ddadwaa.f100001.mp4?wdis_k=7cdc03c564ae62499c03d8034036e65c4405cd2d&wdis_t=1773699072&appid=none&scene=0&ext=eyJjaSI6MTAwMDY5LCJjczBjIjoxNywiY3MwbyI6NDA1MzAsImNzMWMiOjQsImNzMW8iOjExMDQ0OSwicnMiOiIyNDIwNDozIn0",
public string videoHeadImg { get; set; } // "https://wst.wxapp.tc.qq.com/162/20302/snssvpdownload/SH/reserved/0bc3yya5qaabfaaeaq6thjt2nrwd3ddadwaa.f1400_0.jpeg?wdis_k=7f202df2767ca6d4b8cec6f52d1706ea8e497708&wdis_t=1773699072&appid=none&scene=0&ext=eyJjaSI6MTAwMDY5LCJjczBjIjoxNywiY3MwbyI6NDA1MzAsImNzMWMiOjQsImNzMW8iOjExMDQ0OSwicnMiOiIyNDIwNDozIn0",
public int? videoLen { get; set; } // 24,
public string videoSize { get; set; } // "0",
public int? videoSource { get; set; } // 0,
public int? videoFormat { get; set; } // 0,
public string playableVideoUrl { get; set; } // "https://wst.wxapp.tc.qq.com/162/20302/snssvpdownload/SH/reserved/0bc3yya5qaabfaaeaq6thjt2nrwd3ddadwaa.f100001.mp4?wdis_k=7cdc03c564ae62499c03d8034036e65c4405cd2d&wdis_t=1773699072&appid=none&scene=0&ext=eyJjaSI6MTAwMDY5LCJjczBjIjoxNywiY3MwbyI6NDA1MzAsImNzMWMiOjQsImNzMW8iOjExMDQ0OSwicnMiOiIyNDIwNDozIn0",
public int? videoWidth { get; set; } // 1080,
public int? videoHeight { get; set; } // 1080,
public string videoH265Url { get; set; } // "https://wst.wxapp.tc.qq.com/162/20302/snssvpdownload/SH/reserved/0bc3yya5qaabfaaeaq6thjt2nrwd3ddadwaa.f100003.mp4?wdis_k=057570644d9b72ff0c62e85b1c54cf0f0a8b42f6&wdis_t=1773699072&appid=none&scene=0&ext=eyJjaSI6MTAwMDY5LCJjczBjIjoxNywiY3MwbyI6NDA1MzAsImNzMWMiOjQsImNzMW8iOjExMDQ0OSwicnMiOiIyNDIwNDozIn0",
public int? videoH265Width { get; set; } // 720,
public int? videoH265Height { get; set; } // 720
}
public class wx_client_product_sale_attr
{
public string key { get; set; } // "颜色"
public List<wx_client_product_sale_attr_item> items { get; set; }
public bool? has_img { get; set; }
}
public class wx_client_product_sale_attr_item
{
public string value { get; set; } // "卡其色"
public string img_url { get; set; } // "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/64eb0fd5000f2ca50a23b45f3567b01e000000a100004f50"
public List<string> sku_ids { get; set; } // [ "1597139289" ]
}
public class wx_sku
{
public List<wx_client_sku_info> sku_info { get; set; }
public string min_price_sku_id { get; set; } // "1597139289"
public string default_selected_sku_id { get; set; } // "1597139289"
}
public class wx_client_sku_info
{
public string sku_id { get; set; } // "1597139289",
public int? price { get; set; } // 5980,
public bool? is_discounted { get; set; } // true,
public int? discounted_price { get; set; } // 2990,
public int? origin_price { get; set; } // 5980,
}
public class wx_client_prod_detail
{
/// <summary>
/// 详情图
/// </summary>
public List<string> detail_img { get; set; } // ["https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/64f21d2b00009e7a156bc7cd6d63b01e000000a000004f50", ...]
public List<string> detailImg { get; set; } // ["https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/64f21d2b00009e7a156bc7cd6d63b01e000000a000004f50", ...]
public List<string> detail_img_real { get { return detail_img == null ? detailImg : detail_img; } }
public string desc { get; set; } // "纯萃美2025新款情侣棒球帽立体C字母刺绣显脸小时尚百搭休闲网红款韩版大头围硬顶鸭舌帽男女同款"
///// <summary>
/////
///// </summary>
//public List<string> detailImg { get; set; }
///// <summary>
///// 纯萃美2025新款情侣棒球帽立体C字母刺绣显脸小时尚百搭休闲网红款韩版大头围硬顶鸭舌帽男女同款
///// </summary>
//public string desc { get; set; }
}
public class wx_client_param
{
public List<wx_client_category> categorys { get; set; }
}
public class wx_client_category
{
public string catIdStr { get { return cat_id.IsNullOrEmpty() ? catId : cat_id; } } // "0",
public string cat_id { get; set; } // "0",
public string catId { get; set; } // "0",
public string name { get; set; } // "主要材质", "C字母刺绣"
public string f_cat_id { get; set; } // "0",
public string brand_cat { get; set; } // "0",
public wx_client_cat_info cat_info { get; set; }
}
public class wx_client_cat_info
{
public int? is_required { get; set; } // 1,
public int? is_customize { get; set; } // 0,
public int? input_type { get; set; } // 1
}
}
@@ -0,0 +1,192 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class WXGetEditProductInfoLite
{
public WXProductInfo product { get; set; }
public WXAfterSaleAddressInfo address { get; set; }
}
public class WXAfterSaleAddressInfo
{
public string addressId { get; set; } // "69496256002",
public string name { get; set; } // "",
public WXAddressInfo addressInfo { get; set; }
}
public class WXAddressInfo
{
public string userName { get; set; } // "王总",
public string postalCode { get; set; } // "",
public string provinceName { get; set; } // "安徽省",
public string cityName { get; set; } // "合肥市",
public string countyName { get; set; } // "肥西县",
public string detailInfo { get; set; } // "蜀山区长江西路某某号某某单元",
public string telNumber { get; set; } // "18388888888",
public int? lat { get; set; } // 0,
public int? lng { get; set; } // 0
}
public class WXProductInfo
{
public List<WXProductSkuInfoLite> productSkus { get; set; }
public WXProductKeyInfo productKey { get; set; }
public WXProductInfoInfo info { get; set; }
public int? status { get; set; } // 5
public string createTime { get; set; } // "1772529740",
public string updateTime { get; set; } // "1772533190",
public int? version { get; set; } // 8,
public int? editStatus { get; set; } // 4,
public string editTime { get; set; } // "1772533189",
public int source { get; set; } // 1
}
public class WXProductSkuInfoLite
{
public WXSkuKeyInfoLite skuKey { get; set; }
public WXProductSkuInfoInfoLite productSkuInfo { get; set; }
}
public class WXProductSkuInfoInfoLite
{
public List<WXSaleParamInfoLite> saleParam { get; set; }
public string thumbImg { get; set; } // "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69a6a1ae000e63741a5ddf35d5b71715000000a000004f50"
public string skuCode { get; set; } // ""
public int? salePrice { get; set; } // 5880
public WXStockInfoLite stockInfo { get; set; }
public WXRealStockInfoLite realStockInfo { get; set; }
}
public class WXRealStockInfoLite
{
public int? stockNum { get; set; } // 999
public int? totalNum { get; set; } // 999
}
public class WXStockInfoLite
{
public string stockNum { get; set; } // "9999999"
}
public class WXSaleParamInfoLite
{
public List<WXProductCategoryInfoLite> categorys { get; set; }
}
public class WXSkuKeyInfoLite
{
public string skuId { get; set; } // "8767785131",
}
public class WXProductKeyInfo
{
public string productId { get; set; } // "10000538778988"
}
public class WXProductInfoInfo
{
// 主图
public List<string> headImg { get; set; } = new List<string>();
public List<WXProductCategoryInfoLite> category { get; set; } = new List<WXProductCategoryInfoLite>();
public List<WXProductParamInfo> param { get; set; } = new List<WXProductParamInfo>();
public List<WXQualificationInfo> qualificationList { get; set; }
public List<WXProductHeadimgInfo> productHeadimgInfo { get; set; }
public List<WXHeadImgInfo> headImgInfos { get; set; }
public string title { get; set; } // "歪歪马震动棒 成人情趣用品"
public string subTitle { get; set; } // "",
public string brand { get; set; } // "",
public string model { get; set; } // "",
public WXProductDetailInfo detail { get; set; }
public string brandId { get; set; } // "10655917"
public string listingTime { get; set; } // "1772533190"
public string spuCode { get; set; } // "2028756820870602753"
public WXAfterSaleInfo afterSaleInfo { get; set; }
public string lastEditDraftTime { get; set; } // "1772532559"
public string shortTitle { get; set; } // "歪歪马脉冲震动成人情趣棒"
public string aiGenShortTitle { get; set; } // "歪歪马脉冲震动成人情趣棒"
public string uniqueId { get; set; } // "4411405439658180613"
}
public class WXAfterSaleInfo
{
public string afterSaleAddressId;
}
public class WXProductDetailInfo
{
public List<string> detailImg { get; set; } = new List<string>(); // [ "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69a6a8460000683300254e4c8c4fab15000000a100004f50", ... ],
public List<object> detailVideos { get; set; } = new List<object>();
public List<object> detailVideoInfo { get; set; } = new List<object>();
public List<object> carouselImg { get; set; } = new List<object>();
public string desc { get; set; } = "";
}
public class WXHeadImgInfo
{
public string imgUrl { get; set; } // "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69a6a8420006d56e0003583092a31715000000a100004f50",
public int? imgWidth { get; set; } // 800,
public int? imgHeight { get; set; } // 800
}
public class WXProductHeadimgInfo
{
public List<object> colors { get; set; } = new List<object>(); // []
public string imgUrl { get; set; } // "https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69a6a8420006d56e0003583092a31715000000a100004f50"
public WXMainColors mainColors { get; set; }
}
public class WXMainColors
{
public int? red { get; set; } // 255,
public int? green { get; set; } // 255,
public int? blue { get; set; } // 255
}
public class WXQualificationInfo
{
public List<string> qualificationUrl { get; set; } // ["https://wst.wxapp.tc.qq.com/161/20304/snscosdownload/SH/reserved/69a6a84a0008442e2a4a8f7179bc1715000000a000004f50"]
public string qualificationId { get; set; } // "50000115"
public int? showCertType { get; set; } // 0
}
public class WXProductParamInfo
{
public List<WXProductParamCategoryInfo> categorys { get; set; } = new List<WXProductParamCategoryInfo>();
}
public class WXProductParamCategoryInfo
{
public string name { get; set; } // [0] "name": "长度" [1] "name": "20 cm",
public int? catType { get; set; } = 0;
public WXProductParamCategoryCatInfo catInfo { get; set; }
}
public class WXProductParamCategoryCatInfo
{
public int? isRequired { get; set; } // 1,
public int? isCustomize { get; set; } // 0,
public int? inputType { get; set; } // 1-单选 2-文本
public long? catGroup { get; set; } // 4294967295,
}
public class WXProductCategoryInfoLite
{
public string catId { get; set; } // "10000577"
public string name { get; set; } // "情趣用品" // 可能为空或没有此字段
public string fCatId { get; set; } // "10000575"
public WXProductCategoryInfoInfoLite catInfo { get; set; }
public bool? leaf { get; set; } // false
}
public class WXProductCategoryInfoInfoLite
{
public int? catLevel { get; set; } // 2
public long? catGroup { get; set; } // 4294967295
}
}
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
/// <summary>
/// 微信订单金额详情
/// </summary>
public class WXOrderAmountInfo
{
/// <summary>
/// 店铺名称
/// </summary>
public string shop_name { get; set; }
/// <summary>
/// 下单时间(秒级时间戳)
/// </summary>
public int create_time { get; set; }
/// <summary>
/// 订单号
/// </summary>
public string order_id { get; set; }
/// <summary>
/// 订单状态
/// </summary>
public int status { get; set; }
/// <summary>
/// 商品总价(分)
/// </summary>
public int product_price { get; set; }
/// <summary>
/// 订单金额(分)
/// </summary>
public int order_price { get; set; }
/// <summary>
/// 采购价(分)
/// </summary>
public int purchase_price { get; set; }
/// <summary>
/// 运费(分)
/// </summary>
public int freight { get; set; }
/// <summary>
/// 平台服务费(预计技术服务费,分)
/// </summary>
public int predict_commission_fee { get; set; }
/// <summary>
/// 达人佣金(分)
/// </summary>
public int commission_amount { get; set; }
/// <summary>
/// 优惠金额(分)
/// </summary>
public int discounted_price { get; set; }
/// <summary>
/// 利润 = 订单金额 - 外采金额 - 平台服务费 - 达人佣金(分)
/// </summary>
public int profit { get; set; }
/// <summary>
/// 采购状态
/// </summary>
public int purchase_status { get; set; }
/// <summary>
/// 外采金额(分),out_amount 为空或0时从中转仓订单表补全
/// </summary>
public int out_amount { get; set; }
/// <summary>
/// 售后状态(订单明细 refund_status)
/// </summary>
public int refund_status { get; set; }
/// <summary>
/// 售后状态(退款单 status)
/// </summary>
public string refund_status_string { get; set; }
/// <summary>
/// 售后退款金额(分),无退款默认0
/// </summary>
public int refund_amount { get; set; }
/// <summary>
/// 是否外采:0=未从中转仓订单表查到,1=查到
/// </summary>
public int external_procurement { get; set; }
/// <summary>
/// 买手号退款金额(分):退款订单且非外采时,从买手售后表(order_pdd_buyer_after_sale)补全,无退款默认0
/// </summary>
public int buyer_refund_amount { get; set; }
/// <summary>
/// 买手号退款状态
/// </summary>
public string buyer_refund_status { get; set; }
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class WXOrderDecryptAddressInfo
{
public int id { get; set; }
public string shop_id { get; set; }
public string order_id { get; set; }
public string order_address { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class WxOptimizeExpressInfo
{
public int id { get; set; }
public string delivery_id { get; set; }
public string delivery_name { get; set; }
public string waybill_id { get; set; }
public int status { get; set; }
public string order_id { get; set; }
public string bind_order_id { get; set; }
public string shop_id { get; set; }
public DateTime add_time { get; set; }
public DateTime? use_time { get; set; }
public DateTime? waybill_pickup_time { get; set; }
}
public class WxOptimizeRstInfo
{
public int id { get; set; }
public string shop_id { get; set; }
public string order_id { get; set; }
public string optimize_rst { get; set; }
public string waybill_id { get; set; }
public string delivery_name { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
public class WxOptimizeRemarkInfo
{
public int id { get; set; }
public string shop_id { get; set; }
public string order_id { get; set; }
public string remark { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.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; }
}
}
@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class oms_wei_external_procurement_after_sale_info
{
public long id { get; set; }
public string order_no { get; set; }
/// <summary>
/// 订单唯一值:OrderCode (外采单号)
/// </summary>
public string order_code { get; set; }
/// <summary>
/// 中转仓售后订单号
/// </summary>
public string external_order_no { get; set; }
/// <summary>
/// 售后订单号
/// </summary>
public string after_sale_no { get; set; }
/// <summary>
/// 1=转寄,2=换货, 3=退货
/// </summary>
public int? return_or_exchange { get; set; }
/// <summary>
/// 退款地址-省
/// </summary>
public string refund_province { get; set; }
/// <summary>
/// 退款地址-市
/// </summary>
public string refund_city { get; set; }
/// <summary>
/// 退款地址-县/区
/// </summary>
public string refund_county { get; set; }
public string refund_detail_address { get; set; }
/// <summary>
/// 退款的快递单号
/// </summary>
public string refund_waybill { get; set; }
/// <summary>
/// 退货的快递公司
/// </summary>
public string return_express_company { get; set; }
/// <summary>
/// 收货人姓名
/// </summary>
public string recipient_name { get; set; }
/// <summary>
/// 收货人电话
/// </summary>
public string recipient_phone { get; set; }
/// <summary>
/// 原始消息/扩展信息(JSON)
/// </summary>
public string raw_message { get; set; }
/// <summary>
/// 售后处理状态,0未处理,1处理中,2已完成,9异常
/// </summary>
public int? status { get; set; }
public DateTime? created_time { get; set; }
public DateTime? updated_time { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string create_user { get; set; }
/// <summary>
/// 更新人
/// </summary>
public string update_user { get; set; }
/// <summary>
/// 账户名
/// </summary>
public string account_user { get; set; }
/// <summary>
/// 1=入库 2=出库
/// </summary>
public int? warehouse_status { get; set; }
/// <summary>
/// 入库时间
/// </summary>
public DateTime? inbound_time { get; set; }
/// <summary>
/// 出库时间
/// </summary>
public DateTime? outbound_time { get; set; }
/// <summary>
/// 下游快递单号
/// </summary>
public string downstream_waybill { get; set; }
/// <summary>
/// 下游快递公司编码
/// </summary>
public string downstream_express_code { get; set; }
}
}
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class oms_wei_external_procurement_log
{
public long id { get; set; }
public string out_order_no { get; set; }
public string order_no { get; set; }
public string order_sku_id { get; set; }
public string buyer_account { get; set; }
public int? out_amount { get; set; }
public string purchaser_note { get; set; }
public string express_1_company { get; set; }
public string express_1_waybill { get; set; }
public string express_2_company { get; set; }
public string express_2_waybill { get; set; }
public string refund_status { get; set; }
public DateTime pickup_time { get; set; }
/// <summary>
/// 中转仓状态:0 未使用,1 已创建,2 创建失败
/// </summary>
public int? transfer_warehouse_status { get; set; }
public string raw_message { get; set; }
public DateTime created_time { get; set; }
public DateTime updated_time { get; set; }
public string platform { get; set; }
public string order_platform_code { get; set; }
public string order_code { get; set; }
/// <summary>
/// 1正常取号 2提前取号
/// </summary>
public int? pre_allocated_order_no { get; set; }
public int? is_transfer_ship { get; set; }
/// <summary>
/// 溯源码
/// </summary>
public string random_code { get; set; }
/// <summary>
/// 1, "拒收" 2, "拦截" 3, "取消" 4, "订单作废"
/// </summary>
public int? transfer_refund_status { get; set; }
/// <summary>
/// 订单作废状态:0=正常,1=已作废,2=作废失败
/// </summary>
public int? order_void_status { get; set; }
/// <summary>
/// 0: 未使用, 1: 已入库, 2: 出库
/// </summary>
public int? warehouse_status { get; set; }
/// <summary>
/// 中转入库时间
/// </summary>
public DateTime? inbound_time { get; set; }
/// <summary>
/// 中转出库时间
/// </summary>
public DateTime? outbound_time { get; set; }
/// <summary>
/// 申请拒收状态 0未申请 1申请成功 2申请失败
/// </summary>
public int has_reject { get; set; }
}
}
@@ -0,0 +1,245 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class oms_wei_order
{
public long id { get; set; }
public long shop_id { get; set; }
public string shop_name { get; set; }
/// <summary>
/// 商户ID
/// </summary>
public long merchant_id { get; set; }
public string order_id { get; set; }
/// <summary>
/// 买家身份标识
/// </summary>
public string openid { get; set; }
public int create_time { get; set; }
public int update_time { get; set; }
public string unionid { get; set; }
/// <summary>
/// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
/// </summary>
public int? status { get; set; }
/// <summary>
/// 售后信息json
/// </summary>
public string aftersale_detail { get; set; }
/// <summary>
/// 支付信息
/// </summary>
public string pay_info { get; set; }
/// <summary>
/// 额外信息
/// </summary>
public string ext_info { get; set; }
/// <summary>
/// 商品总价
/// </summary>
public int? product_price { get; set; }
/// <summary>
/// 订单金额,单位为分,order_price=original_order_price-discounted_price-deduction_price-change_down_price
/// </summary>
public int? order_price { get; set; }
/// <summary>
/// 采购价,单位为分
/// </summary>
public int? purchase_price { get; set; }
/// <summary>
/// 采购时间
/// </summary>
public int? purchase_time { get; set; }
/// <summary>
/// 运费,单位为分
/// </summary>
public int? freight { get; set; }
/// <summary>
/// 平台服务费(微信小店:预计技术服务费),单位为分
/// </summary>
public int? predict_commission_fee { get; set; }
/// <summary>
/// 达人佣金(微信小店:分账金额),单位为分
/// </summary>
public int? commission_amount { get; set; }
/// <summary>
/// 优惠券优惠金额,单位为分
/// </summary>
public int? discounted_price { get; set; }
/// <summary>
/// 利润(实付金额-采购价-平台服务费-达人佣金,达人佣金、采购价为空值则为0)
/// </summary>
public int? profit { get; set; }
/// <summary>
/// 采购状态,默认值为:0未采购,推送仓库时修改为1采购
/// </summary>
public int? purchase_status { get; set; }
/// <summary>
/// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时)
/// </summary>
public int? delivery_deadline { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public int? delivery_time { get; set; }
/// <summary>
/// 收货人姓名
/// </summary>
public string user_name { get; set; }
/// <summary>
/// 邮编
/// </summary>
public string postal_code { get; set; }
public string province_name { get; set; }
public string city_name { get; set; }
/// <summary>
/// 区
/// </summary>
public string county_name { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string detail_info { get; set; }
public string tel_number { get; set; }
/// <summary>
/// 门牌号码
/// </summary>
public string house_number { get; set; }
/// <summary>
/// 虚拟发货订单联系方式(deliver_method=1时返回)
/// </summary>
public string virtual_order_tel_number { get; set; }
/// <summary>
/// 额外的联系方式信息(虚拟号码相关)
/// </summary>
public string tel_number_ext_info { get; set; }
/// <summary>
/// 0:不使用虚拟号码,1:使用虚拟号码
/// </summary>
public int? use_tel_number { get; set; }
/// <summary>
/// 标识当前店铺下一个唯一的用户收货地址
/// </summary>
public string hash_code { get; set; }
/// <summary>
/// 发货物流信息JSON
/// </summary>
public string delivery_product_info { get; set; }
/// <summary>
/// 发货完成时间,秒级时间戳
/// </summary>
public int? ship_done_time { get; set; }
/// <summary>
/// 电子面单代发时的订单密文
/// </summary>
public string ewaybill_order_code { get; set; }
/// <summary>
/// 结算信息json
/// </summary>
public string settle_info { get; set; }
/// <summary>
/// 订单审核状态(0待审核1已审核)
/// </summary>
public int? audit_status { get; set; }
/// <summary>
/// 订单审核时间
/// </summary>
public DateTime audit_time { get; set; }
/// <summary>
/// erp发货快递公司
/// </summary>
public string erp_send_company { get; set; }
/// <summary>
/// erp发货快递单号
/// </summary>
public string erp_send_code { get; set; }
/// <summary>
/// erp发货状态
/// </summary>
public int? erp_send_status { get; set; }
/// <summary>
/// erp发货时间
/// </summary>
public DateTime erp_send_time { get; set; }
/// <summary>
/// 旗帜颜色备注,1:灰旗,2:红旗,3:橙旗,4:绿旗,5:天蓝旗,6:紫旗
/// </summary>
public int? colour_flag { get; set; }
/// <summary>
/// 旗帜备注时间
/// </summary>
public DateTime colour_flag_update_time { get; set; }
/// <summary>
/// 供应商备注异常单
/// </summary>
public string supplier_remark_exception { get; set; }
/// <summary>
/// 礼物单状态,默认值0:不存在礼物单,1:礼物单已发货,2:礼物单信息已更正
/// </summary>
public int? gift_order_status { get; set; }
/// <summary>
/// 店铺备注:取微信ext_info.merchant_notes
/// </summary>
public string shop_remark { get; set; }
/// <summary>
/// 软件备注
/// </summary>
public string soft_remark { get; set; }
/// <summary>
/// 外采金额(单位:分,整数存储)
/// </summary>
public int? out_amount { get; set; }
/// <summary>
/// 外采账户
/// </summary>
public string out_account { get; set; }
/// <summary>
/// 外采订单号
/// </summary>
public string out_order_no { get; set; }
/// <summary>
/// 外采快递公司
/// </summary>
public string out_express_company { get; set; }
/// <summary>
/// 外采快递单号
/// </summary>
public string out_express_no { get; set; }
/// <summary>
/// 外采是否发货(0 未发货,1 已发货)
/// </summary>
public int? out_shipped { get; set; }
/// <summary>
/// 判断是否优化过发货0 未优化, 1已优化
/// </summary>
public int? is_shipment_optimized { get; set; }
/// <summary>
/// 判断是否优随机使用快递单号0 未使用, 1已使用
/// </summary>
public int? is_express_no_used { get; set; }
/// <summary>
/// 外采订单售后状态
/// </summary>
public string out_after_sale_status { get; set; }
/// <summary>
/// 是否支持运费险:0-不支持,1-支持
/// </summary>
public int? has_freight_insurance { get; set; }
/// <summary>
/// 运费险金额(单位:元)
/// </summary>
public decimal? freight_insurance_amount { get; set; }
/// <summary>
/// 是否外采礼物单:0-否,1-是(外采订单)
/// </summary>
public int? external_gift { get; set; }
/// <summary>
/// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号
/// </summary>
public decimal? transfer_warehouse_status { get; set; }
}
}
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class oms_wei_order_item
{
/// <summary>
/// 订单商品表数据库id
/// </summary>
public long id { get; set; }
public long shop_id { get; set; }
/// <summary>
/// 商户ID
/// </summary>
public long merchant_id { get; set; }
/// <summary>
/// 订单id(平台订单id)
/// </summary>
public string order_id { get; set; }
/// <summary>
/// 商品spuid
/// </summary>
public string product_id { get; set; }
public string sku_id { get; set; }
/// <summary>
/// sku小图
/// </summary>
public string thumb_img { get; set; }
/// <summary>
/// sku数量
/// </summary>
public int? sku_cnt { get; set; }
/// <summary>
/// 售卖单价(单位:分)
/// </summary>
public int? sale_price { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string title { get; set; }
/// <summary>
/// 正在售后/退款流程中的 sku 数量
/// </summary>
public int? on_aftersale_sku_cnt { get; set; }
/// <summary>
/// 完成售后/退款的 sku 数量
/// </summary>
public int? finish_aftersale_sku_cnt { get; set; }
/// <summary>
/// 商品编码
/// </summary>
public string sku_code { get; set; }
/// <summary>
/// 市场单价(单位:分)
/// </summary>
public int? market_price { get; set; }
/// <summary>
/// sku属性JSON
/// </summary>
public string sku_attrs { get; set; }
/// <summary>
/// sku实付总价,取estimate_price和change_price中较小值
/// </summary>
public int? real_price { get; set; }
/// <summary>
/// 商品外部spuid
/// </summary>
public string out_product_id { get; set; }
/// <summary>
/// 采购价
/// </summary>
public int? purchase_price { get; set; }
/// <summary>
/// 运费
/// </summary>
public int? freight { get; set; }
/// <summary>
/// 商品外部skuid
/// </summary>
public string out_sku_id { get; set; }
/// <summary>
/// 是否有优惠金额,非必填,默认为false
/// </summary>
public string is_discounted { get; set; }
/// <summary>
/// 优惠后sku总价,非必填,is_discounted为true时有值
/// </summary>
public int? estimate_price { get; set; }
/// <summary>
/// 是否修改过价格,非必填,默认为false
/// </summary>
public string is_change_price { get; set; }
/// <summary>
/// 改价后sku总价,非必填,is_change_price为true时有值
/// </summary>
public int? change_price { get; set; }
/// <summary>
/// 订单内商品维度平台券优惠金额(利润需要计算这个金额在内)
/// </summary>
public int? cash_coupon_discounted_price { get; set; }
/// <summary>
/// 区域库存id
/// </summary>
public string out_warehouse_id { get; set; }
/// <summary>
/// 退货地址
/// </summary>
public string return_address { get; set; }
/// <summary>
/// 商品发货信息JSON
/// </summary>
public string sku_deliver_info { get; set; }
/// <summary>
/// 商品额外服务信息JSON
/// </summary>
public string extra_service { get; set; }
/// <summary>
/// 是否使用了会员积分抵扣
/// </summary>
public string use_deduction { get; set; }
/// <summary>
/// 会员积分抵扣金额,单位为分
/// </summary>
public int? deduction_price { get; set; }
/// <summary>
/// 达人佣金(微信小店:分账金额),单位为分
/// </summary>
public int? predict_commission_fee { get; set; }
/// <summary>
/// 达人佣金(微信小店:分账金额),单位为分
/// </summary>
public int? commission_amount { get; set; }
/// <summary>
/// 商品优惠券信息,逐步替换 order.order_detail.coupon_info
/// </summary>
public string order_product_coupon_info_list { get; set; }
/// <summary>
/// 商品id(o_goods外键)
/// </summary>
public long? erp_goods_id { get; set; }
/// <summary>
/// 商品skuid(o_goods_sku外键)
/// </summary>
public long? erp_goods_sku_id { get; set; }
/// <summary>
/// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4: 退款成功 11 已取消
/// </summary>
public int? refund_status { get; set; }
}
}
@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class oms_wei_refund
{
public long id { get; set; }
public long? shop_id { get; set; }
public string after_sale_order_id { get; set; }
/// <summary>
/// 售后单当前状态,参考:
/// USER_CANCELD 用户取消申请
/// MERCHANT_PROCESSING 商家受理中
/// MERCHANT_REJECT_REFUND 商家拒绝退款
/// MERCHANT_REJECT_RETURN 商家拒绝退货退款
/// USER_WAIT_RETURN 待买家退货
/// RETURN_CLOSED 退货退款关闭
/// MERCHANT_WAIT_RECEIPT 待商家收货
/// MERCHANT_OVERDUE_REFUND 商家逾期未退款
/// MERCHANT_REFUND_SUCCESS 退款完成
/// MERCHANT_RETURN_SUCCESS 退货退款完成
/// PLATFORM_REFUNDING 平台退款中
/// PLATFORM_REFUND_FAIL 平台退款失败
/// USER_WAIT_CONFIRM 待用户确认
/// MERCHANT_REFUND_RETRY_FAIL 商家打款失败,客服关闭售后
/// MERCHANT_FAIL 售后关闭
/// USER_WAIT_CONFIRM_UPDATE 待用户处理商家协商
/// USER_WAIT_HANDLE_MERCHANT_AFTER_SALE 待用户处理商家代发起的售后申请
/// </summary>
public string status { get; set; }
/// <summary>
/// 买家身份标识
/// </summary>
public string openid { get; set; }
/// <summary>
/// 买家在开放平台的唯一标识符,若当前视频号小店已绑定到微信开放平台账号下会返回
/// </summary>
public string unionid { get; set; }
/// <summary>
/// 商品spuid
/// </summary>
public string product_id { get; set; }
/// <summary>
/// 商品skuid
/// </summary>
public string sku_id { get; set; }
/// <summary>
/// 售后数量
/// </summary>
public int? count { get; set; }
/// <summary>
/// 是否极速退款RefundInfo
/// </summary>
public string fast_refund { get; set; }
/// <summary>
/// 标明售后单退款直接原因, 枚举值参考 RefundReason
/// </summary>
public int? refund_reason { get; set; }
/// <summary>
/// 退款金额(分)
/// </summary>
public int? refund_amount { get; set; }
/// <summary>
/// 退款快递单号
/// </summary>
public string return_waybill_id { get; set; }
/// <summary>
/// 物流公司id
/// </summary>
public string return_delivery_id { get; set; }
/// <summary>
/// 物流公司名称
/// </summary>
public string return_delivery_name { get; set; }
/// <summary>
/// 售后相关商品信息JSON
/// </summary>
public string merchant_upload_info { get; set; }
/// <summary>
/// 售后单创建时间戳
/// </summary>
public int? create_time { get; set; }
/// <summary>
/// 售后单更新时间戳
/// </summary>
public int? update_time { get; set; }
/// <summary>
/// 退款原因
/// </summary>
public string reason { get; set; }
/// <summary>
/// 退款原因解释
/// </summary>
public string reason_text { get; set; }
/// <summary>
/// 售后类型。REFUND:退款;RETURN:退货退款。
/// </summary>
public string type { get; set; }
/// <summary>
/// 订单号,该字段可用于获取订单
/// </summary>
public string order_id { get; set; }
/// <summary>
/// detail json
/// </summary>
public string details { get; set; }
/// <summary>
/// 纠纷id,该字段可用于获取纠纷信息
/// </summary>
public string complaint_id { get; set; }
/// <summary>
/// 微信支付退款的响应
/// </summary>
public string refund_resp { get; set; }
/// <summary>
/// 推送状态(0未推送;1推送成功;2推送失败)
/// </summary>
public int? pull_status { get; set; }
/// <summary>
/// 订单审核时间
/// </summary>
public DateTime pull_time { get; set; }
/// <summary>
/// 商品id(o_goods外键)
/// </summary>
public long? erp_goods_id { get; set; }
/// <summary>
/// 商品skuid(o_goods_sku外键)
/// </summary>
public long? erp_goods_sku_id { get; set; }
/// <summary>
/// 商户id
/// </summary>
public long merchant_id { get; set; }
/// <summary>
/// 仓库受理状态
/// </summary>
public int? warehouse_status { get; set; }
public string return_user_name { get; set; }
public string return_province { get; set; }
public string return_city { get; set; }
public string return_county { get; set; }
public string return_detail { get; set; }
public string return_tel { get; set; }
}
}
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class order_item_ext
{
public long? id { get; set; }
public string order_id { get; set; }
public string out_order_id { get; set; }
public string sku_id { get; set; }
public string shop_app_id { get; set; }
public string shop_name { get; set; }
/// <summary>
/// 直发/云仓(一般只有直发才会写值,直发会覆盖中转)
/// </summary>
public string buy_type { get; set; }
/// <summary>
/// 订单异常文本
/// </summary>
public string abnormal_text { get; set; }
public int? flag { get; set; }
public string label { get; set; }
public string remark { get; set; }
public string after_sale_user_delivery_address { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class order_pdd_buyer_after_sale
{
public long? id { get; set; }
public string wx_order_id { get; set; }
public string wx_sku_id { get; set; }
/// <summary>
/// 买手订单在微信店铺的发货类型 0中转仓发货 1直发
/// </summary>
public int wx_send_type { get; set; }
public DateTime TransitCreateTime { get; set; }
//public DateTime TransitPickupTime { get; set; }
public int? pre_allocated_order_no { get; set; }
public string buyerId { get; set; }
public string buyerName { get; set; }
public string afterSalesId { get; set; }
public string orderSn { get; set; }
public int? orderAmount { get; set; }
public long? refundAmount { get; set; }
public long? orderDate { get; set; }
public string statusText { get; set; }
public string afterSaleAddress { get; set; }
public string order_detail { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class order_pdd_buyer_order
{
public long? id { get; set; }
public string wx_order_id { get; set; }
public string wx_sku_id { get; set; }
/// <summary>
/// 买手订单在微信店铺的发货类型 0中转仓发货 1直发
/// </summary>
public int wx_send_type { get; set; }
public DateTime TransitCreateTime { get; set; }
public int? pre_allocated_order_no { get; set; }
public string buyerId { get; set; }
public string buyerName { get; set; }
public string order_sn { get; set; }
public int? order_amount { get; set; }
public long? order_time { get; set; }
public string outExpressCompanyCode { get; set; }
public string tracking_number { get; set; }
/// <summary>
/// 订单状态
/// </summary>
public string order_status_prompt { get; set; }
public int? after_sales_status { get; set; }
public string order_detail { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class user_payment_record_info
{
public long id { get; set; }
/// <summary>
/// 变动类型,1:充值,2:采购花费,3:产品退款到账,4:运费退款到账,5:采购收款,6:产品退款扣除,7:运费退款扣除,16:礼物单话费,20:中转运费,23:作废运费返还
/// </summary>
public int? type { get; set; }
/// <summary>
/// 充值或花费的金额(元)
/// </summary>
public decimal amount { get; set; }
/// <summary>
/// 充值或花费后的当前账户余额(元)
/// </summary>
public decimal balance { get; set; }
/// <summary>
/// 账户名
/// </summary>
public string user_name { get; set; }
/// <summary>
/// 平台编码
/// </summary>
public string platform_code { get; set; }
/// <summary>
/// 订单id
/// </summary>
public string order_id { get; set; }
/// <summary>
/// 售后单id
/// </summary>
public long? after_sale_id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public string create_by { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime create_time { get; set; }
/// <summary>
/// 修改人
/// </summary>
public string update_by { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime update_time { get; set; }
/// <summary>
/// 是否已删除
/// </summary>
public int? is_deleted { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 扣款的对方账户名称
/// </summary>
public string counterparty_account_name { get; set; }
}
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class user_points_record_info
{
public int id { get; set; }
public string user_name { get; set; }
public string user_nick { get; set; }
public int delta_points { get; set; }
public int? new_points { get; set; }
public string option_type { get; set; }
public string operator_type { get; set; }
public string operator_name { get; set; }
public string shop_id { get; set; }
public string shop_account { get; set; }
public string remark { get; set; }
public DateTime add_time { get; set; }
/// <summary>
/// 对方账户名称
/// </summary>
public string counterparty_account_name { get; set; }
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models.WxModel
{
public class wx_qualification_image_info
{
public int id { get; set; }
public string cat_name { get; set; }
public string img_md5 { get; set; }
public string img_base64 { get; set; }
public string img_thumb_base64 { get; set; }
public string txt_margin { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace StoreHub.KJDWebService.Models
{
public class WxProdSecretSpuIdShopIdMapParam
{
public int id { get; set; }
public string up_secret_spu_id { get; set; }
public string up_spu_id { get; set; }
public string shop_id { get; set; }
public DateTime add_time { get; set; }
}
}
@@ -0,0 +1,12 @@
{
"profiles": {
"KJD_WebService": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:57509;http://localhost:57510"
}
}
}
@@ -0,0 +1,21 @@
using FreeSql;
using MAX.Core.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using StoreHub.Framework.Models;
using System;
using System.Collections.Generic;
using System.Text;
namespace StoreHub.Framework.Repositorys
{
public class SqlRepository : IScopedDependency
{
public IAdo Ado { get; }
public SqlRepository([FromKeyedServices("KJDDB")] IFreeSql fsql)
{
Ado = fsql.Ado;
}
}
}
@@ -0,0 +1,858 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Commons;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace StoreHub.KJDWebService.Services
{
public class BXXPriceService : ServiceBase
{
public BXXPriceService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string AddPrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
int original_price = RegexUtils.GetStringQuery(ref inputData, "original_price").ParseToInt();
int markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times").ParseToInt();
int extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price").ParseToInt();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from bxx.price_markup where ext_code=@ext_code";
string sql = "insert into bxx.price_markup " +
"(ext_code,original_price,markup_times,extra_price,notes) " +
"values (@ext_code,@original_price,@markup_times,@extra_price,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPriceList(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
string start_original_price = RegexUtils.GetStringQuery(ref inputData, "start_original_price");
string end_original_price = RegexUtils.GetStringQuery(ref inputData, "end_original_price");
string start_markup_times = RegexUtils.GetStringQuery(ref inputData, "start_markup_times");
string end_markup_times = RegexUtils.GetStringQuery(ref inputData, "end_markup_times");
string start_extra_price = RegexUtils.GetStringQuery(ref inputData, "start_extra_price");
string end_extra_price = RegexUtils.GetStringQuery(ref inputData, "end_extra_price");
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_ext_code"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_original_price", Value = start_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_original_price", Value = end_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_markup_times", Value = start_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_markup_times", Value = end_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_extra_price", Value = start_extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_extra_price", Value = end_extra_price.ParseToInt(), });
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = "'" + in_ext_code?.Replace(",", "','") + "'", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = in_ext_code.ParseToString() });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.price_markup p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrWhiteSpace(start_original_price))
where += " and p.original_price >= @start_original_price";
if (!string.IsNullOrWhiteSpace(end_original_price))
where += " and p.original_price <= @end_original_price";
if (!string.IsNullOrWhiteSpace(start_markup_times))
where += " and p.markup_times >= @start_markup_times";
if (!string.IsNullOrWhiteSpace(end_markup_times))
where += " and p.markup_times <= @end_markup_times";
if (!string.IsNullOrWhiteSpace(start_extra_price))
where += " and p.extra_price >= @start_extra_price";
if (!string.IsNullOrWhiteSpace(end_extra_price))
where += " and p.extra_price <= @end_extra_price";
if (!string.IsNullOrEmpty(in_ext_code))
where += " and p.ext_code in ('" + in_ext_code?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from bxx.price_markup p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<DBPriceResultParam> priceList = new List<DBPriceResultParam>();
foreach (DataRow row in dt.Rows)
{
DBPriceResultParam price = new DBPriceResultParam
{
id = row["id"].ParseToInt(),
extra_price = row["extra_price"].ParseToInt(),
markup_times = row["markup_times"].ParseToInt(),
original_price = row["original_price"].ParseToInt(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
priceList.Add(price);
}
var data = JsonUtils.SerializeObjectToString(priceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbPrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.price_markup where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyDBPrice(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string original_price = RegexUtils.GetStringQuery(ref inputData, "original_price");
string markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times");
string extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@db_id", Value = db_id, });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from bxx.price_markup where ext_code=@ext_code and id!=@db_id";
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
string sql = "update bxx.price_markup set";
if (notes != null)
sql += " notes=@notes,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (original_price != null)
sql += " original_price=@original_price,";
if (markup_times != null)
sql += " markup_times=@markup_times,";
if (extra_price != null)
sql += " extra_price=@extra_price,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddPurchasePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id")).ParseToString();
string skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skc_id")).ParseToString();
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(spu_id) from bxx.product_purchase_price where spu_id=@spu_id";
string sql = "insert into bxx.product_purchase_price " +
"(shop_id,shop_name,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,discount,price_text,sku_purchase_price_json,notes) " +
"values (@shop_id,@shop_name,@spu_id,@skc_id,@cat_id,@cat_name,@ext_code,@product_name,@main_img,@discount,@price_text,@sku_purchase_price_json,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyPurchasePrice(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@db_id", Value = db_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.product_purchase_price set";
if (shop_id != null)
sql += " shop_id=@shop_id,";
if (shop_name != null)
sql += " shop_name=@shop_name,";
if (cat_id != null)
sql += " cat_id=@cat_id,";
if (cat_name != null)
sql += " cat_name=@cat_name,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (product_name != null)
sql += " product_name=@product_name,";
if (main_img != null)
sql += " main_img=@main_img,";
if (discount != null)
sql += " discount=@discount,";
if (price_text != null)
sql += " price_text=@price_text,";
if (sku_purchase_price_json != null)
sql += " sku_purchase_price_json=@sku_purchase_price_json,";
if (notes != null)
sql += " notes=@notes,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPurchasePriceList(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_spu_id"));
var search_skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_skc_id"));
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_spu_id"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_spu_id", Value = "%" + search_spu_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_skc_id", Value = "%" + search_skc_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_spu_id", Value = in_spu_id.ParseToString() });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.product_purchase_price p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu_id))
where += " and p.spu_id like @search_spu_id";
if (!string.IsNullOrWhiteSpace(search_skc_id))
where += " and p.skc_id like @search_skc_id";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrEmpty(in_spu_id))
where += " and p.spu_id in ('" + in_spu_id?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from bxx.product_purchase_price p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductPurchasePriceResultParam> purchasePriceList = new List<ProductPurchasePriceResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductPurchasePriceResultParam price = new ProductPurchasePriceResultParam
{
id = row["id"].ParseToInt(),
shop_id = row["shop_id"].ParseToString(),
shop_name = row["shop_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
discount = row["discount"].ParseToInt(),
price_text = row["price_text"].ParseToString(),
product_name = row["product_name"].ParseToString(),
skc_id = row["skc_id"].ParseToString(),
sku_purchase_price_json = row["sku_purchase_price_json"].ParseToString(),
spu_id = row["spu_id"].ParseToString(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
purchasePriceList.Add(price);
}
var data = JsonUtils.SerializeObjectToString(purchasePriceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelPurchasePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.product_purchase_price where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddExtCodePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
var ext_code_price = RegexUtils.GetStringQuery(ref inputData, "ext_code_price")?.ParseToInt();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(ext_code))
{
return "{\"code\":500,\"msg\":\"没有货号\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@ext_code_price", Value = ext_code_price, });
string sql= "select count(ext_code) from bxx.ext_code_price where ext_code=@ext_code";
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
if (count.ParseToInt() > 0)
{
sql = "update bxx.ext_code_price set ext_code_price=@ext_code_price where ext_code=@ext_code";
}
else
{
sql = "insert into bxx.ext_code_price (ext_code,ext_code_price) values (@ext_code,@ext_code_price);";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetExtCodePriceList(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
string start_ext_price = RegexUtils.GetStringQuery(ref inputData, "start_ext_price");
string end_ext_price = RegexUtils.GetStringQuery(ref inputData, "end_ext_price");
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var in_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_ext_code"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_ext_price", Value = start_ext_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_ext_price", Value = end_ext_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = in_ext_code.ParseToString() });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.ext_code_price p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(start_ext_price))
where += " and p.ext_code_price >= @start_ext_price";
if (!string.IsNullOrWhiteSpace(end_ext_price))
where += " and p.ext_code_price <= @end_ext_price";
if (!string.IsNullOrEmpty(in_ext_code))
where += " and p.ext_code in ('" + in_ext_code?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from bxx.ext_code_price p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<DBExtCodePriceResult> priceList = new List<DBExtCodePriceResult>();
foreach (DataRow row in dt.Rows)
{
DBExtCodePriceResult price = new DBExtCodePriceResult
{
id = row["id"].ParseToInt(),
ext_code_price = row["ext_code_price"].ParseToInt(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
priceList.Add(price);
}
var data = JsonUtils.SerializeObjectToString(priceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbExtCodePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.ext_code_price where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyDBExtCodePrice(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string ext_code_price = RegexUtils.GetStringQuery(ref inputData, "original_price");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@ext_code_price", Value = ext_code_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@db_id", Value = db_id, });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
//string sqlExist = "select count(ext_code) from bxx.ext_code_price where ext_code=@ext_code and id!=@db_id";
//var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
//if (has != "0")
//{
// mySql.Close();
// return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
//}
string sql = "update bxx.ext_code_price set";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (ext_code_price != null)
sql += " ext_code_price=@ext_code_price,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,751 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Commons;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
namespace StoreHub.KJDWebService.Services
{
public class BXXProductThirdService : ServiceBase
{
public BXXProductThirdService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string AddProduct(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id");
string spu_id = RegexUtils.GetStringQuery(ref inputData, "spu_id");
string skc_id = RegexUtils.GetStringQuery(ref inputData, "skc_id");
string cat_id = RegexUtils.GetStringQuery(ref inputData, "cat_id");
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name"));
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name"));
string product_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_json"));
string size_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "size_json"));
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img"));
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
var json_ids = RegexUtils.GetMatchRegex(ref product_json, "(\"id\":\\d{8,14})"); // 取商品json数据里不同签名的部分
var product_json_replace = product_json;
foreach (Match json_id in json_ids)
{
product_json_replace = product_json_replace.Replace(json_id.Value, "\"id\":0");
}
var product_md5 = EncrypUtil.GetMd5(product_json_replace + size_json);
sql = "select id from bxx.third_product where product_md5='" + product_md5 + "';";
var rst = mySql.ExecuteFirstInt(sql).ParseToLong();
if (rst <= 0)
{
//sql = "insert into bxx.third_product (from_shop_id,spu_id,skc_id,cat_id,cat_name,product_name,ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " +
// "values ('" + from_shop_id + "','" + spu_id + "','" + skc_id + "','" + cat_id + "','" + cat_name + "','" + product_name + "','" +
// ext_code + "','" + main_img + "','" + product_json + "','" + size_json + "','" + notes + "','" + product_md5 + "','" +
// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
//rst = mySql.ExecuteInsertId(sql);
sql = "insert into bxx.third_product (from_shop_id,spu_id,skc_id,cat_id,cat_name,product_name," +
"ext_code,main_img,product_json,size_json,notes,product_md5,add_time,mdy_time) " +
"values (@from_shop_id,@spu_id,@skc_id,@cat_id,@cat_name,@product_name," +
"@ext_code,@main_img,@product_json,@size_json,@notes,@product_md5," +
"@add_time,@mdy_time);";
string add_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string mdy_time = add_time;
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@from_shop_id", Value = from_shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_json", Value = product_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@size_json", Value = size_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes.ParseToString(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_md5", Value = product_md5, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@add_time", Value = add_time, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@mdy_time", Value = mdy_time, });
rst = mySql.ExecuteInsertId(sql, paramLst.ToArray());
mySql.Close();
}
if (rst > 0)
{
return "{\"code\":200,\"msg\":\"success\",\"id\":" + rst + "}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetProductList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'","\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var from_shop_id = RegexUtils.GetStringQuery(ref inputData, "from_shop_id")?.Replace("'", "\\'");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from bxx.third_product where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
where += " and skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and product_name like '%" + search_prod_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and notes like '%" + search_notes + "%'";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and id in (" + search_db_ids + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
if (isDetail)
sql = "select * from bxx.third_product where 1=1";
else
sql = "select id,from_shop_id,spu_id,skc_id,cat_id,cat_name,change_cat_id,change_cat_name,ext_code,product_name,main_img,notes," +
"add_time,mdy_time from bxx.third_product where 1=1";
sql += where;
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<DBProductResultParam> productLst = new List<DBProductResultParam>();
foreach (DataRow row in dt.Rows)
{
DBProductResultParam prod = new DBProductResultParam
{
id = Convert.ToInt32(row["id"]),
from_shop_id = row["from_shop_id"].ToString(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
cat_id = row["cat_id"].ToString(),
cat_name = row["cat_name"].ToString(),
change_cat_id = row["change_cat_id"].ToString(),
change_cat_name = row["change_cat_name"].ToString(),
product_name = row["product_name"].ToString(),
main_img = row["main_img"].ToString(),
ext_code = row["ext_code"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ToString(),
};
if (isDetail)
{
prod.product_json = row["product_json"].ToString();
prod.size_json = row["size_json"].ToString();
}
productLst.Add(prod);
}
var data = JsonUtils.SerializeObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.third_product where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProductCategory(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
string change_cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_id"))?.Replace("'", "\\'");
string change_cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "change_cat_name"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.third_product set";
if (change_cat_id != null)
sql += " change_cat_id='" + change_cat_id + "',";
if (change_cat_name != null)
sql += " change_cat_name='" + change_cat_name + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddUserSelectProduct(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var out_product_Id = RegexUtils.GetStringQuery(ref inputData, "out_product_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account")?.Replace("'", "\\'");
var user_name = RegexUtils.GetStringQuery(ref inputData, "main_user_name")?.Replace("'", "\\'");
var sub_user_name = RegexUtils.GetStringQuery(ref inputData, "sub_user_name")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_product_remaining = RegexUtils.GetStringQuery(ref inputData, "add_product_remaining").ParseToInt();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(shop_id))
{
return "{\"code\":500,\"msg\":\"没有店铺信息\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "insert into bxx.third_product_select (out_product_Id,shop_id,shop_account,user_name,sub_user_name,notes,status,add_time,mdy_time) " +
"values ('" + out_product_Id + "','" + shop_id + "','" + shop_account + "','" + user_name + "','" + sub_user_name + "','" +
notes + "','" + status + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
if (add_product_remaining > 0)
{
add_product_remaining = add_product_remaining - 1;
sql += "\r\n";
sql += "update bxx.shop set add_product_remaining=" + add_product_remaining + " where shop_id='" + shop_id + "';";
//sql += "update bxx.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";";
sql += "INSERT INTO bxx.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" +
"ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)";
}
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyUserSelectProductStatus(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var draft_id = RegexUtils.GetStringQuery(ref inputData, "draft_id")?.Replace("'", "\\'");
var up_spu_id = RegexUtils.GetStringQuery(ref inputData, "up_spu_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var add_times = RegexUtils.GetStringQuery(ref inputData, "add_times")?.Replace("'", "\\'");
long l_draft_id = draft_id.ParseToLong();
long l_spu_map_table_id = l_draft_id % 128;
long l_select_map_table_id = id.ParseToLong() % 64;
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
// 使用事务一次提交多个sql操作
//sql += "set @@autocommit=0;\r\n";
sql += "START TRANSACTION;\r\n";
if (!string.IsNullOrEmpty(up_spu_id) && !string.IsNullOrEmpty(draft_id))
{
sql += "insert into kjd_map.spu_map_" + l_spu_map_table_id +
" (draft_id,from_spu_id,shop_id) values(" + draft_id + "," + up_spu_id + ",'" + shop_id + "');\r\n";
sql += "insert into kjd_map.product_third_select_map_" + l_select_map_table_id +
" (product_id,product_select_db_id,shop_id) values(" + draft_id + "," + id + ",'" + shop_id + "');\r\n";
}
sql += "update bxx.third_product_select set";
if (draft_id != null)
sql += " draft_id='" + draft_id + "',";
if (status != null)
sql += " status='" + status + "',";
if (status == "已上传")
sql += " add_times=add_times+1,";
sql += " mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + ";\r\n";
var rst = mySql.ExecuteNonQuery(sql);
string errMsg = mySql.Message;
if (string.IsNullOrEmpty(errMsg))
sql = "COMMIT;";
else
sql = "ROLLBACK;";
mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + errMsg + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetUserSelectProductList(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "\\'");
var search_shop_id = RegexUtils.GetStringQuery(ref inputData, "search_shop_id")?.Replace("'", "\\'");
var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account");
var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'");
var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'");
var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'");
var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'");
var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes")?.Replace("'", "\\'");
var search_user_notes = RegexUtils.GetStringQuery(ref inputData, "search_user_notes")?.Replace("'", "\\'");
var search_db_ids = RegexUtils.GetStringQuery(ref inputData, "search_db_ids")?.Replace("'", "\\'");
var search_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "search_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var no_sub_sa = RegexUtils.GetStringQuery(ref inputData, "no_sub_sa")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(s.id) from bxx.third_product_select s " +
"left join bxx.third_product p on s.out_product_id=p.id " +
"left join bxx.user u on s.operate_sub_sa_name=u.user_name " +
"where 1=1";
string where = "";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like'%" + user_name + "%')";
if (!string.IsNullOrEmpty(operate_sub_sa_name))
{
where += " and s.operate_sub_sa_name = '" + operate_sub_sa_name + "'";
}
if (no_sub_sa == "true")
where += " and s.operate_sub_sa_name is null";
if (!string.IsNullOrEmpty(search_db_ids))
where += " and s.id in (" + search_db_ids + ")";
if (!string.IsNullOrEmpty(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(status))
where += " and s.status = '" + status + "'";
if (!string.IsNullOrWhiteSpace(search_shop_id))
where += " and s.shop_id like '%" + search_shop_id + "%'";
if (!string.IsNullOrWhiteSpace(search_shop_account))
where += " and s.shop_account like @search_shop_account";
if (!string.IsNullOrWhiteSpace(search_notes))
{
//核价成功 重复 核价成功(重复)
if (search_notes == "无备注")
where += " and s.notes = ''";
else if (search_notes == "重复")
where += " and s.notes like '%重复%' and s.notes not like '%核价成功%' and s.notes not like '%核价通过%'";
else if (search_notes == "核价成功")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes not like '%重复%'";
else if (search_notes == "核价成功(重复)")
where += " and (s.notes like '%核价成功%' or s.notes like '%核价通过%') and s.notes like '%重复%'";
else
where += " and s.notes like '%" + search_notes + "%'";
}
if (!string.IsNullOrWhiteSpace(search_user_notes))
where += " and s.user_notes like '%" + search_user_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_spu))
where += " and p.spu_id like '%" + search_spu + "%'";
if (!string.IsNullOrWhiteSpace(search_skc))
where += " and p.skc_id like '%" + search_skc + "%'";
if (!string.IsNullOrWhiteSpace(search_cat))
where += " and p.cat_name like '%" + search_cat + "%'";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like '%" + search_ext_code + "%'";
if (!string.IsNullOrWhiteSpace(search_prod_name))
where += " and p.product_name like @search_prod_name";
if (!string.IsNullOrEmpty(search_sub_sa_name))
{
where += " and (s.operate_sub_sa_name like '%" + search_sub_sa_name + "%'";
where += " or u.nick_name like '%" + operate_sub_sa_name + "%')";
}
sql += where;
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_shop_account", Value = "%" + search_shop_account + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_prod_name", Value = "%" + search_prod_name + "%", });
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//if (isDetail)
//sql = "select * from bxx.third_product_select where 1=1";
//else
sql = "select s.id,s.out_product_id,s.shop_id,s.shop_account,s.user_name," +
"s.sub_user_name,s.notes,s.user_notes,s.status,s.draft_id,s.add_times,s.add_time,s.mdy_time," +
"s.fission_product_name,s.operate_sub_sa_name,s.add_sub_sa_time," +
"p.from_shop_id,p.spu_id,p.skc_id,p.cat_id,p.cat_name,p.change_cat_id,p.change_cat_name,p.ext_code,p.product_name,p.main_img," +
"u.nick_name as operate_sub_sa_nick " +
"from bxx.third_product_select s left join bxx.third_product p on s.out_product_id=p.id " +
"left join bxx.user u on u.user_name=s.operate_sub_sa_name " +
"where 1=1";
sql += where; // where子句
sql += " order by id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductSelectResultParam> productLst = new List<ProductSelectResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductSelectResultParam prodSelect = new ProductSelectResultParam()
{
id = row["id"].ParseToInt(),
out_product_Id = row["out_product_Id"].ParseToString(),
shop_account = row["shop_account"].ParseToString(),
shop_id = row["shop_id"].ParseToString(),
status = row["status"].ParseToString(),
sub_user_name = row["sub_user_name"].ParseToString(),
user_name = row["user_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
change_cat_id = row["change_cat_id"].ParseToString(),
change_cat_name = row["change_cat_name"].ParseToString(),
product_name = row["product_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
draft_id = row["draft_id"].ParseToString(),
add_times = row["add_times"].ParseToInt(),
skc_id = row["skc_id"].ToString(),
spu_id = row["spu_id"].ToString(),
operate_sub_sa_name = row["operate_sub_sa_name"].ToString(),
operate_sub_sa_nick = row["operate_sub_sa_nick"].ToString(),
fission_product_name = row["fission_product_name"].ToString(),
user_notes = row["user_notes"].ToString(),
from_shop_id = row["from_shop_id"].ToString(),
//product_json = row["product_json"].ToString(),
//size_json = row["size_json"].ToString(),
};
prodSelect.add_sub_sa_time = row["add_sub_sa_time"] as DateTime?;
productLst.Add(prodSelect);
}
var data = JsonUtils.SerializeObjectToString(productLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelSelectProd(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.third_product_select where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 设置上传商品的二级超管
/// </summary>
/// <returns></returns>
public string SetSelectProductSubSa(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var status = RegexUtils.GetStringQuery(ref inputData, "status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(shop_id))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.third_product_select set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(shop_id))
sql += " where shop_id in ('" + shop_id.Replace(",","','") + "')";
else
sql += " where 1=2";
if(!string.IsNullOrEmpty(status))
sql += " and status='" + status + "';";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyProductSelectNotes(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string user_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_notes"));
string fission_product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "fission_product_name"));
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.third_product_select set";
if (notes != null)
sql += " notes=@notes,";
if (user_notes != null)
sql += " user_notes=@user_notes,";
if (fission_product_name != null)
sql += " fission_product_name=@fission_product_name,";
sql = sql.TrimEnd(',');
sql += " where id=@id;";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@id", Value = id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@fission_product_name", Value = fission_product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@user_notes", Value = user_notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,894 @@
using StoreHub.KJDWebService.Services;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Models;
using StoreHub.KJDWebService.Models.PddModel;
using StoreHub.KJDWebService.Models.ShopModel;
using StoreHub.KJDWebService.Commons;
using NaiBa.Util.Extension;
using NaiBa.Util.Helper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Reflection;
namespace StoreHub.KJDWebService.Services
{
public class BXXUserService : ServiceBase
{
public BXXUserService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string CheckUserLogin(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData, true))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from bxx.user where user_name='"
+ mobile + "' and password='" + password + "'";
var dt = mySql.ExecuteDataTable(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if (dt == null)
dt = new DataTable();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["user_name"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
company_name = row["company_name"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
authority = row["authority"].ToString(),
forbidden_page = row["forbidden_page"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
};
if (string.IsNullOrEmpty(user.company_name))
{
user.company_name = "-";
}
if (user.group_id != "3" && !string.IsNullOrEmpty(user.parent_user_name))
{
sql = "select authority from bxx.user where user_name='" + user.parent_user_name + "'";
var rst = mySql.ExecuteFirst(sql);
if (mySql.Message.IsNullOrEmpty())
{
user.parent_authority = rst;
}
}
var data = JsonUtils.SerializeObjectToString(user);
mySql.Close();
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
mySql.Close();
return "{\"code\":1,\"msg\":\"用户名或密码错误\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "company"))?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var authority = RegexUtils.GetStringQuery(ref inputData, "authority")?.Replace("'", "\\'");
var forbidden_page = RegexUtils.GetStringQuery(ref inputData, "forbidden_page")?.Replace("'", "\\'");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from bxx.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into bxx.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,parent_user_name,authority,forbidden_page,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "','" + parent_user_name + "','" + authority + "','" + forbidden_page + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\""+ mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"子账户创建成功!\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var group = RegexUtils.GetStringQuery(ref inputData, "group");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from bxx.user where parent_user_name='"
+ user_name + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
authority = row.Table.Columns.Contains("authority") ? row["authority"].ParseToString() : "",
forbidden_page = row.Table.Columns.Contains("forbidden_page") ? row["forbidden_page"].ParseToString() : "",
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializeObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var authority = RegexUtils.GetStringQuery(ref inputData, "authority")?.Replace("'", "\\'");
var forbidden_page = RegexUtils.GetStringQuery(ref inputData, "forbidden_page")?.Replace("'", "\\'");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from bxx.user where parent_user_name='"
// + user_name + "'";
sql = "update bxx.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
if (authority != null)
sql += " authority='" + authority + "',";
if (forbidden_page != null)
sql += " forbidden_page='" + forbidden_page + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "id");
if (string.IsNullOrWhiteSpace(id))
return "{\"code\":500,\"msg\":\"id不能为空\"}";
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from bxx.user where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败,请稍后重试\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetAllUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var search = RegexUtils.GetStringQuery(ref inputData, "search")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
var r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
//string sql = "select * from bxx.user where group_id=3";
string sql = "select * from bxx.user where 1=1";
if (!string.IsNullOrEmpty(group_id))
sql += " and group_id=" + group_id;
if (!string.IsNullOrEmpty(sa_level))
sql += " and sa_level=" + sa_level;
if (!string.IsNullOrEmpty(search))
sql += " and (user_name like '%" + search +
"%' or nick_name like '%" + search +
"%' or company_name like '%" + search + "%')";
sql += " order by id desc";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
authority = row.Table.Columns.Contains("authority") ? row["authority"].ParseToString() : "",
forbidden_page = row.Table.Columns.Contains("forbidden_page") ? row["forbidden_page"].ParseToString() : "",
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializeObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'"); ;
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
var authority = RegexUtils.GetStringQuery(ref inputData, "authority")?.Replace("'", "\\'");
var forbidden_page = RegexUtils.GetStringQuery(ref inputData, "forbidden_page")?.Replace("'", "\\'");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from bxx.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into bxx.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,sa_level,authority,add_time,mdy_time,forbidden_page) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "'," + sa_level + ",'" + authority + "','" + forbidden_page + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserService.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
var authority = RegexUtils.GetStringQuery(ref inputData, "authority")?.Replace("'", "\\'");
var forbidden_page = RegexUtils.GetStringQuery(ref inputData, "forbidden_page")?.Replace("'", "\\'");
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from bxx.user where parent_user_name='"
// + user_name + "'";
sql = "update bxx.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(company_name))
sql += " company_name='" + company_name + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
if (!string.IsNullOrEmpty(sa_level))
sql += " sa_level=" + sa_level + ",";
if (authority != null)
sql += " authority='" + authority + "',";
if (forbidden_page != null)
sql += " forbidden_page='" + forbidden_page + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string ChangePassword(string inputData)
{
var userName = RegexUtils.GetStringJson(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringJson(ref inputData, "password")?.Replace("'", "\\'");
var newPassword = RegexUtils.GetStringJson(ref inputData, "new_password")?.Replace("'", "\\'");
string conn = "Conn";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select user_id,password from pepdtp.user where user_id='"
+ userName + "' and password='" + password + "'";
var dw = mySql.ExecuteDataTableRow(sql);
if (dw != null)
{
UserLoginResultParam user = new UserLoginResultParam
{
user_name = dw["user_id"].ToString(),
password = dw["password"].ToString(),
};
sql = "update pepdtp.user set password = '" + newPassword + "' where user_id='" + userName + "'";
var result = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (result)
{
return "{\"code\":0,\"msg\":\"密码修改成功!\"}";
}
else
return "{\"code\":19999,\"msg\":\"密码修改失败!请稍后再试。\"}";
}
else
{
mySql.Close();
return "{\"code\":1,\"msg\":\"原密码错误。\"}";
}
}
public string return_package_secret_key { get; set; } = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU=";
public string GetPackageSign(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var timestamp = RegexUtils.GetStringQuery(ref inputData, "timestamp")?.Replace("'", "\\'");
var mallId = RegexUtils.GetStringQuery(ref inputData, "mallId")?.Replace("'", "\\'");
var returnPackageNo = RegexUtils.GetStringQuery(ref inputData, "returnPackageNo")?.Replace("'", "\\'");
int r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
string c2 = RegexUtils.GetStringQuery(ref inputData, "c2");
if (EncrypUtil.Encryption(r2) != c2)
return "{\"code\":2,\"msg\":\"不合法的输入内容\"}";
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from bxx.user where user_name='"
+ mobile + "' and password='" + password + "'";
sql = "select * from bxx.user where user_name='" + mobile + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt == null || dt.Rows.Count <=0)
{
return "{\"code\":1,\"msg\":\"用户不存在\"}";
}
string sign = EncrypUtil.GetMd5(timestamp + return_package_secret_key + mallId + returnPackageNo).ToLower();
return "{\"code\":200, \"sign\":\"" + sign + "\", \"msg\":\"\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateScm121Cookie(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt();
if (id == 0)
id = 1;
var cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'");
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.scm121_user set cookie='" + cookie + "' WHERE id=" + id + ";";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst && string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":200,\"msg\":\"success\"}";
}
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetScm121Cookie(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = (RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'")).ParseToInt();
if (id == 0)
id = 1;
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select cookie from bxx.scm121_user WHERE id=" + id + ";";
var rst = mySql.ExecuteDataTableRow(sql);
mySql.Close();
if (string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":200,\"cookie\":" + rst["cookie"] + "}";
}
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string buyer_name = RegexUtils.GetStringQuery(ref inputData, "buyer_name")?.Replace("'", "\\'");
string buyer_nick = RegexUtils.GetStringQuery(ref inputData, "buyer_nick")?.Replace("'", "\\'");
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(buyer_name))
{
return "{\"code\":501,\"msg\":\"没有买手登录名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select exists (select 1 from bxx.shop where buyer_id='" + buyer_id + "' and user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"买手" + buyer_name + " " + buyer_nick + "已存在\"}";
}
sql = "insert into bxx.buyer (user_name,buyer_id,buyer_name,buyer_nick,cookie,notes) " +
"values ('" + user_name + "','" + buyer_id + "','" + buyer_name + "','" + buyer_nick + "','" + cookie + "','" + notes + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string buyer_name = RegexUtils.GetStringQuery(ref inputData, "buyer_name")?.Replace("'", "\\'"); ;
string buyer_nick = RegexUtils.GetStringQuery(ref inputData, "buyer_nick")?.Replace("'", "\\'"); ;
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'"); ;
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":501,\"msg\":\"没有买手号\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.buyer set";
if (buyer_name != null)
sql += " buyer_name='" + buyer_name + "',";
if (buyer_nick != null)
sql += " buyer_nick='" + buyer_nick + "',";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (notes != null)
sql += " notes='" + notes + "',";
if (status != null)
sql += " status='" + status + "',";
sql = sql.TrimEnd(',');
sql += " where buyer_id='" + buyer_id + "' and user_name='" + user_name + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyBuyerCookie(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "buyer_user_name")?.Replace("'", "\\'");
string buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id")?.Replace("'", "\\'");
string cookie = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cookie"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":501,\"msg\":\"没有买手号\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update bxx.buyer set";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (status != null)
sql += " status='" + status + "',";
sql = sql.TrimEnd(',');
sql += " where buyer_id='" + buyer_id + "';";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string GetBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_buyer_id = RegexUtils.GetStringQuery(ref inputData, "search_buyer_id");
var search_buyer_name = RegexUtils.GetStringQuery(ref inputData, "search_buyer_name");
var search_buyer_nick = RegexUtils.GetStringQuery(ref inputData, "search_buyer_nick");
var buyer_ids = RegexUtils.GetStringQuery(ref inputData, "buyer_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(buyer_ids))
{
List<string> shopIdLst = buyer_ids.Split(',').ToList();
buyer_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var buyer_names = RegexUtils.GetStringQuery(ref inputData, "buyer_names");
if (!string.IsNullOrWhiteSpace(buyer_names))
{
List<string> shopNameLst = buyer_names.Split(',').ToList();
buyer_names = "'" + string.Join("','", shopNameLst) + "'";
}
var buyer_nicks = RegexUtils.GetStringQuery(ref inputData, "buyer_nicks");
if (!string.IsNullOrWhiteSpace(buyer_nicks))
{
List<string> shopNotesLst = buyer_nicks.Split(',').ToList();
buyer_nicks = "'" + string.Join("','", shopNotesLst) + "'";
}
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(s.id) FROM bxx.buyer s WHERE 1=1";
//where子句
string where = "";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_id))
where += " and s.buyer_id like '%" + search_buyer_id + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_name))
where += " and s.buyer_name like '%" + search_buyer_name + "%'";
if (!string.IsNullOrWhiteSpace(search_buyer_nick))
where += " and s.buyer_nick like '%" + search_buyer_nick + "%'";
if (!string.IsNullOrWhiteSpace(buyer_ids))
where += " and s.buyer_id in (" + buyer_ids + ")";
if (!string.IsNullOrWhiteSpace(buyer_names))
where += " and s.buyer_name in (" + buyer_names + ")";
if (!string.IsNullOrWhiteSpace(buyer_nicks))
where += " and s.buyer_nick in (" + buyer_nicks + ")";
if (!string.IsNullOrWhiteSpace(user_name))
where += " and s.user_name='" + user_name + "'";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.*";
sql += " FROM bxx.buyer s WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
List<BuyerLoginInfo> buyerList = new List<BuyerLoginInfo>();
foreach (DataRow row in dt.Rows)
{
BuyerLoginInfo shop = new BuyerLoginInfo
{
id = Convert.ToInt32(row["id"]),
cookie = row["cookie"].ToString(),
user_name = row["user_name"].ToString(),
notes = row["notes"].ToString(),
add_time = row["add_time"].ParseToString().ParseToDateTime(),
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
buyer_id = row["buyer_id"].ToString(),
buyer_name = row["buyer_name"].ToString(),
buyer_nick = row["buyer_nick"].ToString(),
status = row["status"].ToString(),
};
buyerList.Add(shop);
}
var data = JsonUtils.SerializeObjectToString(buyerList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string DelBuyer(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var buyer_id = RegexUtils.GetStringQuery(ref inputData, "buyer_id");
if (string.IsNullOrEmpty(buyer_id))
{
return "{\"code\":500,\"msg\":\"没有买手号\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "DELETE FROM bxx.buyer WHERE user_name='" + user_name + "' and buyer_id='" + buyer_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":501,\"msg\":" + mySql.Message + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
}
}
@@ -0,0 +1,788 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Models.ShopModel;
using StoreHub.KJDWebService.Commons;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
namespace StoreHub.KJDWebService.Services
{
public class DYShopService : ServiceBase
{
public DYShopService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string GetShop(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_id = RegexUtils.GetStringQuery(ref inputData, "search_id");
var search_user_name = RegexUtils.GetStringQuery(ref inputData, "search_user_name");
var search_login_name = RegexUtils.GetStringQuery(ref inputData, "search_login_name");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var shop_names = RegexUtils.GetStringQuery(ref inputData, "shop_names");
if (!string.IsNullOrWhiteSpace(shop_names))
{
List<string> shopNameLst = shop_names.Split(',').ToList();
shop_names = "'" + string.Join("','", shopNameLst) + "'";
}
var shop_notes = RegexUtils.GetStringQuery(ref inputData, "shop_notes");
if (!string.IsNullOrWhiteSpace(shop_notes))
{
List<string> shopNotesLst = shop_notes.Split(',').ToList();
shop_notes = "'" + string.Join("','", shopNotesLst) + "'";
}
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(s.id) FROM dyxd.shop s WHERE 1=1";
//where子句
string where = "";
if (isAdmin)
where += " and (s.cookie='' or s.shop_id!='')";
if (!isAdmin)
where += " and (s.user_name='" + user_name + "' or s.sub_user_name like '%" + user_name + "%')";
if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
where += " and s.operate_sub_sa_name='" + operate_sub_sa_name + "'";
if (!string.IsNullOrWhiteSpace(search_user_name))
where += " and s.user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
where += " and s.login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
where += " and s.shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
where += " and s.shop_account like '%" + search_name + "%'";
if (!string.IsNullOrWhiteSpace(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(shop_names))
where += " and s.shop_account in (" + shop_names + ")";
if (!string.IsNullOrWhiteSpace(shop_notes))
where += " and s.notes in (" + shop_notes + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.anti_contents,s.pddid,s.shop_id,s.shop_account,s.sub_user_name," +
"s.user_name,s.company_name,s.notes,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month," +
"s.add_time,s.mdy_time,s.add_sub_sa_time,s.operate_sub_sa_name";
//sql += " FROM dyxd.shop s WHERE 1=1";
sql += " FROM dyxd.shop s LEFT JOIN dyxd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList=new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
anti_contents = row["anti_contents"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_product_remaining"].ParseToInt(),
add_product_month = row["add_product_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"].ParseToString(),
pddid = row["pddid"].ParseToString(),
};
shopList.Add(shop);
}
//sql = "\r\nINSERT INTO dyxd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
//foreach (var shop in shopList)
//{
// sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + shop.add_product_remaining + "," + shop.add_product_month + "),";
//}
//sql = sql.TrimEnd(',') + " \r\n";
//sql += "ON DUPLICATE KEY UPDATE " +
// "shop_account=VALUES(shop_account)," +
// "add_product_remaining=VALUES(add_product_remaining)," +
// "add_product_month=VALUES(add_product_month);";
//var result = mySql.ExecuteNonQuery(sql);
//mySql.Close();
int month = DateTime.Now.Month;
var shopMonthList = shopList.Where(s => s.add_product_month != month);
if (shopMonthList.Count() > 0)
{
int remainCount = 300;
var shopMonthIdList = shopMonthList.Select(s => s.id);
mySql = new MysqlUtils(conn);
string ids = string.Join(",", shopMonthIdList);
sql = "";
sql += "update dyxd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month +
" where 1=1 and id in (" + ids + ");";
sql += "\r\nINSERT INTO dyxd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
foreach (var shop in shopMonthList)
{
sql+= "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),";
}
sql = sql.TrimEnd(',') + " \r\n";
sql += "ON DUPLICATE KEY UPDATE " +
"shop_account=VALUES(shop_account)," +
"add_product_remaining=VALUES(add_product_remaining)," +
"add_product_month=VALUES(add_product_month);";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
foreach (var shop in shopMonthList)
{
shop.add_product_month = month;
shop.add_product_remaining = remainCount;
}
}
}
var data = JsonUtils.SerializeObjectToString(shopList);
//return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string SubSaGetSelectProdShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_id = RegexUtils.GetStringQuery(ref inputData, "search_id");
var search_user_name = RegexUtils.GetStringQuery(ref inputData, "search_user_name");
var search_login_name = RegexUtils.GetStringQuery(ref inputData, "search_login_name");
var search_notes = RegexUtils.GetStringQuery(ref inputData, "search_notes");
var search_name = RegexUtils.GetStringQuery(ref inputData, "search_name");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
var shop_names = RegexUtils.GetStringQuery(ref inputData, "shop_names");
if (!string.IsNullOrWhiteSpace(shop_names))
{
List<string> shopNameLst = shop_names.Split(',').ToList();
shop_names = "'" + string.Join("','", shopNameLst) + "'";
}
var shop_notes = RegexUtils.GetStringQuery(ref inputData, "shop_notes");
if (!string.IsNullOrWhiteSpace(shop_notes))
{
List<string> shopNotesLst = shop_notes.Split(',').ToList();
shop_notes = "'" + string.Join("','", shopNotesLst) + "'";
}
var page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
var page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt();
if (page_size == 0)
page_size = 50;
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(s.id) FROM dyxd.shop s WHERE 1=1";
//where子句
string where = "";
if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
where += " and (s.shop_id in (SELECT DISTINCT shop_id From dyxd.product_select WHERE operate_sub_sa_name='" + operate_sub_sa_name + "') or " +
"s.shop_id in (SELECT DISTINCT shop_id From dyxd.third_product_select WHERE operate_sub_sa_name='" + operate_sub_sa_name + "'))";
where += " and (s.cookie='' or s.shop_id!='')";
//if (!string.IsNullOrWhiteSpace(operate_sub_sa_name))
// where += " and s.operate_sub_sa_name='" + operate_sub_sa_name + "'";
if (!string.IsNullOrWhiteSpace(search_user_name))
where += " and s.user_name like '%" + search_user_name + "%'";
if (!string.IsNullOrWhiteSpace(search_login_name))
where += " and s.login_name like '%" + search_login_name + "%'";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and s.notes like '%" + search_notes + "%'";
if (!string.IsNullOrWhiteSpace(search_id))
where += " and s.shop_id like '%" + search_id + "%'";
if (!string.IsNullOrWhiteSpace(search_name))
where += " and s.shop_account like '%" + search_name + "%'";
if (!string.IsNullOrWhiteSpace(shop_ids))
where += " and s.shop_id in (" + shop_ids + ")";
if (!string.IsNullOrWhiteSpace(shop_names))
where += " and s.shop_account in (" + shop_names + ")";
if (!string.IsNullOrWhiteSpace(shop_notes))
where += " and s.notes in (" + shop_notes + ")";
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.anti_contents,s.shop_id,s.shop_account,s.sub_user_name,s.user_name," +
"s.company_name,s.notes,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month,s.add_time,s.mdy_time," +
"s.add_sub_sa_time,s.operate_sub_sa_name";
sql += " FROM dyxd.shop s LEFT JOIN dyxd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1";
sql += where; // where 子句
sql += " ORDER BY s.id DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
anti_contents = row["anti_contents"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
login_status2 = row["login_status2"].ToString(),
add_product_remaining = row["add_product_remaining"].ParseToInt(),
add_product_month = row["add_product_month"].ParseToInt(),
operate_sub_sa_name = row["operate_sub_sa_name"].ParseToString(),
};
shopList.Add(shop);
}
//sql = "\r\nINSERT INTO dyxd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
//foreach (var shop in shopList)
//{
// sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + shop.add_product_remaining + "," + shop.add_product_month + "),";
//}
//sql = sql.TrimEnd(',') + " \r\n";
//sql += "ON DUPLICATE KEY UPDATE " +
// "shop_account=VALUES(shop_account)," +
// "add_product_remaining=VALUES(add_product_remaining)," +
// "add_product_month=VALUES(add_product_month);";
//var result = mySql.ExecuteNonQuery(sql);
//mySql.Close();
int month = DateTime.Now.Month;
var shopMonthList = shopList.Where(s => s.add_product_month != month);
if (shopMonthList.Count() > 0)
{
int remainCount = 300;
var shopMonthIdList = shopMonthList.Select(s => s.id);
mySql = new MysqlUtils(conn);
string ids = string.Join(",", shopMonthIdList);
sql = "";
sql += "update dyxd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month +
" where 1=1 and id in (" + ids + ");";
sql += "\r\nINSERT INTO dyxd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES ";
foreach (var shop in shopMonthList)
{
sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),";
}
sql = sql.TrimEnd(',') + " \r\n";
sql += "ON DUPLICATE KEY UPDATE " +
"shop_account=VALUES(shop_account)," +
"add_product_remaining=VALUES(add_product_remaining)," +
"add_product_month=VALUES(add_product_month);";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
foreach (var shop in shopMonthList)
{
shop.add_product_month = month;
shop.add_product_remaining = remainCount;
}
}
}
var data = JsonUtils.SerializeObjectToString(shopList);
//return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string UpdateAddProdRemaining(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var remainCount = RegexUtils.GetStringQuery(ref inputData, "remain_count");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
if (!string.IsNullOrWhiteSpace(shop_ids))
{
List<string> shopIdLst = shop_ids.Split(',').ToList();
shop_ids = "'" + string.Join("','", shopIdLst) + "'";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql += "update dyxd.shop_add_prod_count set add_product_remaining=" + remainCount +
" where 1=1 and shop_id in (" + shop_ids + ");";
var rst = mySql.ExecuteNonQuery(sql);
var msg = mySql.Message;
mySql.Close();
if (rst)
return "{\"code\":200,\"msg\":\"success\"}";
else
return "{\"code\":50000,\"msg\":\"" + msg + "\"}";
}
else
{
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
//获取一个手机登录号码下的所有店铺(以便有则更新,无则新增)
public string GetOneLoginNameShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id,login_name,login_pass,cookie,cookie2,anti_contents,shop_id,shop_account,sub_user_name,user_name from dyxd.shop where user_name='"
+ user_name + "' and login_name='" + login_name + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
anti_contents = row["anti_contents"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
};
shopList.Add(shop);
}
var data = JsonUtils.SerializeObjectToString(shopList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
//获取一个手机登录号码下特定ID的店铺
public string GetOneIdShop(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select id,login_name,login_pass,cookie,cookie2,anti_contents,shop_id,shop_account,sub_user_name,user_name from dyxd.shop where user_name='"
+ user_name + "' and login_name='" + login_name + "' and shop_id='" + shop_id + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
{
id = Convert.ToInt32(row["id"]),
login_name = row["login_name"].ToString(),
login_pass = row["login_pass"].ToString(),
cookie = row["cookie"].ToString(),
cookie2 = row["cookie2"].ToString(),
anti_contents = row["anti_contents"].ToString(),
shop_id = row["shop_id"].ToString(),
shop_account = row["shop_account"].ToString(),
sub_user_name = row["sub_user_name"].ToString(),
user_name = row["user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
login_status = row["login_status"].ToString(),
};
shopList.Add(shop);
}
var data = JsonUtils.SerializeObjectToString(shopList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string AddShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string login_pass = RegexUtils.GetStringQuery(ref inputData, "login_pass");
string sub_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_user_name"));
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
if (string.IsNullOrEmpty(shop_id))
sql = "select exists (select 1 from dyxd.shop where login_name='" + login_name + "' and user_name='" + user_name + "')";
else
sql = "select exists (select 1 from dyxd.shop where login_name='" + login_name + "' and user_name='" + user_name +
"' and shop_id='" + shop_id + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist>0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"店铺" + login_name +" " + shop_account + "已存在\"}";
}
sql = "insert into dyxd.shop (login_name,login_pass,cookie,cookie2,anti_contents,shop_account,shop_id,sub_user_name,user_name,group_name,notes,add_time,mdy_time) " +
"values ('" + login_name + "','" + login_pass + "','" + cookie + "','" + cookie2 + "','" + anti_contents + "','" + shop_account + "','" + shop_id + "','" +
sub_user_name + "','" + user_name + "','" + group_name + "','" + notes + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string login_pass = RegexUtils.GetStringQuery(ref inputData, "login_pass");
string sub_user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_user_name"));
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string anti_contents = RegexUtils.GetStringQuery(ref inputData, "anti_contents");
string new_shop_id = RegexUtils.GetStringQuery(ref inputData, "new_shop_id");
string old_shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_account = RegexUtils.GetStringQuery(ref inputData, "shop_account");
string group_name = RegexUtils.GetStringQuery(ref inputData, "group_name");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update dyxd.shop set";
if (login_pass != null)
sql += " login_pass='" + login_pass + "',";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (cookie2 != null)
sql += " cookie2='" + cookie2 + "',";
if (anti_contents != null)
sql += " anti_contents='" + anti_contents + "',";
if (new_shop_id != null)
sql += " shop_id='" + new_shop_id + "',";
if (shop_account != null)
sql += " shop_account='" + shop_account + "',";
if (sub_user_name != null)
sql += " sub_user_name='" + sub_user_name + "',";
if (group_name != null)
sql += " group_name='" + group_name + "',";
if (notes != null)
sql += " notes='" + notes + "',";
if (login_status != null)
sql += " login_status='" + login_status + "',";
sql = sql.TrimEnd(',');
sql += " where login_name='" + login_name + "' and (user_name='" + user_name + "' or sub_user_name like '%" + user_name + "%')";
if (!string.IsNullOrEmpty(old_shop_id))
sql += " and shop_id='" + old_shop_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string MdyCookieAndLoginStatus(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
string login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
string cookie = RegexUtils.GetStringQuery(ref inputData, "cookie");
string cookie2 = RegexUtils.GetStringQuery(ref inputData, "cookie2");
string login_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status"));
string login_status2 = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "login_status2"));
string pddid = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pddid"));
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":500,\"msg\":\"店铺没有登录名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update dyxd.shop set";
if (cookie != null)
sql += " cookie='" + cookie + "',";
if (cookie2 != null)
sql += " cookie2='" + cookie2 + "',";
if (login_status != null)
sql += " login_status='" + login_status + "',";
if (login_status2 != null)
sql += " login_status2='" + login_status2 + "',";
if (pddid != null)
sql += " pddid='" + pddid + "',";
sql = sql.TrimEnd(',');
sql += " where login_name='" + login_name + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
public string DelShop(string inputData, bool isAdmin=false)
{
if (!string.IsNullOrEmpty(inputData))
{
var login_name = RegexUtils.GetStringQuery(ref inputData, "login_name");
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (isAdmin)
user_name = RegexUtils.GetStringQuery(ref inputData, "shop_user_name");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
if (string.IsNullOrEmpty(login_name))
{
return "{\"code\":501,\"msg\":\"没有店铺登录名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from dyxd.shop where user_name='" + user_name + "' and login_name='" + login_name + "'";
if (!string.IsNullOrEmpty(shop_id))
sql += " and shop_id='" + shop_id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
}
/// <summary>
/// 设置店铺的二级超管
/// </summary>
/// <returns></returns>
public string SetShopSubSa(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":50001,\"msg\":\"没有用户名\"}";
}
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
var login_name = RegexUtils.GetStringQuery(ref inputData, "shop_login_name")?.Replace("'", "\\'");
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(login_name))
{
return "{\"code\":50002,\"msg\":\"未选择任何待上传\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update dyxd.shop set";
if (operate_sub_sa_name != null)
sql += " operate_sub_sa_name='" + operate_sub_sa_name + "',";
sql += " add_sub_sa_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',";
sql = sql.TrimEnd(',');
if (!string.IsNullOrEmpty(id))
sql += " where id in (" + id + ")";
else if (!string.IsNullOrEmpty(login_name))
sql += " where login_name in ('" + login_name.Replace(",", "','") + "')";
else
sql += " where 1=2";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -0,0 +1,481 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Commons;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Reflection;
namespace StoreHub.KJDWebService.Services
{
public class DYUserService : ServiceBase
{
public DYUserService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string CheckUserLogin(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from dyxd.user where user_name='"
+ mobile + "' and password='" + password + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["user_name"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
company_name = row["company_name"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.company_name))
{
user.company_name = "-";
}
var data = JsonUtils.SerializeObjectToString(user);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
return "{\"code\":1,\"msg\":\"用户名或密码错误\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "company"))?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from dyxd.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into dyxd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,parent_user_name,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "','" + parent_user_name + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\""+ mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"子账户创建成功!\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var group = RegexUtils.GetStringQuery(ref inputData, "group");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from dyxd.user where parent_user_name='"
+ user_name + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializeObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateSubUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var parent_user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sub_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "sub_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from dyxd.user where parent_user_name='"
// + user_name + "'";
sql = "update dyxd.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var id = RegexUtils.GetStringQuery(ref inputData, "id");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from dyxd.user where id='"
+ id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败,请稍后重试\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetAllUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var search = RegexUtils.GetStringQuery(ref inputData, "search")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
//string sql = "select * from dyxd.user where group_id=3";
string sql = "select * from dyxd.user where 1=1";
if (!string.IsNullOrEmpty(group_id))
sql += " and group_id=" + group_id;
if (!string.IsNullOrEmpty(sa_level))
sql += " and sa_level=" + sa_level;
if (!string.IsNullOrEmpty(search))
sql += " and (user_name like '%" + search +
"%' or nick_name like '%" + search +
"%' or company_name like '%" + search + "%')";
sql += " order by id desc";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt != null)
{
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
foreach (DataRow row in dt.Rows)
{
UserLoginResultParam user = new UserLoginResultParam
{
id = Convert.ToInt32(row["id"]),
user_name = row["user_name"].ToString(),
nick_name = row["nick_name"].ToString(),
mobile = row["mobile"].ToString(),
password = row["password"].ToString(),
group_id = row["group_id"].ToString(),
card_id = row["card_id"].ToString(),
parent_user_name = row["parent_user_name"].ToString(),
company_name = row["company_name"].ToString(),
notes = row["notes"].ToString(),
is_sa = row.Table.Columns.Contains("is_sa") ? row["is_sa"].ParseToInt() : 0,
sa_level = row.Table.Columns.Contains("sa_level") ? row["sa_level"].ParseToInt() : 0,
};
if (string.IsNullOrEmpty(user.mobile))
{
user.mobile = row["user_name"].ToString();
}
userList.Add(user);
}
var data = JsonUtils.SerializeObjectToString(userList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"c\":\"" + EncrypUtil.Encryption(r2) + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'"); ;
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select exists (select 1 from dyxd.user where user_name='" + user_name + "')";
var exist = mySql.ExecuteFirstInt(sql);
if (exist > 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户名已存在\"}";
}
sql = "insert into dyxd.user (nick_name,user_name,mobile,password,card_id,group_id,company_name,notes,sa_level,add_time,mdy_time) " +
"values ('" + nick_name + "','" + user_name + "','" + mobile + "','" + password + "','" + card_id + "','" +
group_id + "','" + company_name + "','" + notes + "'," + sa_level + ",'" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" +
DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "');";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}";
else
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateUser(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'");
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'");
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'");
int r2 = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "r2"), out r2);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
//sql = "select * from dyxd.user where parent_user_name='"
// + user_name + "'";
sql = "update dyxd.user set";
if (!string.IsNullOrEmpty(nick_name))
sql += " nick_name='" + nick_name + "',";
if (!string.IsNullOrEmpty(user_name))
sql += " user_name='" + user_name + "',";
if (!string.IsNullOrEmpty(mobile))
sql += " mobile='" + mobile + "',";
if (!string.IsNullOrEmpty(company_name))
sql += " company_name='" + company_name + "',";
if (!string.IsNullOrEmpty(password))
sql += " password='" + password + "',";
if (!string.IsNullOrEmpty(group_id))
sql += " group_id=" + group_id + ",";
if (!string.IsNullOrEmpty(card_id))
sql += " card_id='" + card_id + "',";
if (!string.IsNullOrEmpty(notes))
sql += " notes='" + notes + "',";
if (!string.IsNullOrEmpty(sa_level))
sql += " sa_level=" + sa_level + ",";
sql = sql.TrimEnd(',');
sql += " where id=" + id + "";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string ChangePassword(string inputData)
{
var userName = RegexUtils.GetStringJson(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringJson(ref inputData, "password")?.Replace("'", "\\'");
var newPassword = RegexUtils.GetStringJson(ref inputData, "new_password")?.Replace("'", "\\'");
string conn = "Conn";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select user_id,password from pepdtp.user where user_id='"
+ userName + "' and password='" + password + "'";
var dw = mySql.ExecuteDataTableRow(sql);
if (dw != null)
{
UserLoginResultParam user = new UserLoginResultParam
{
user_name = dw["user_id"].ToString(),
password = dw["password"].ToString(),
};
sql = "update pepdtp.user set password = '" + newPassword + "' where user_id='" + userName + "'";
var result = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (result)
{
return "{\"code\":0,\"msg\":\"密码修改成功!\"}";
}
else
return "{\"code\":19999,\"msg\":\"密码修改失败!请稍后再试。\"}";
}
else
{
mySql.Close();
return "{\"code\":1,\"msg\":\"原密码错误。\"}";
}
}
public string return_package_secret_key { get; set; } = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU=";
public string GetPackageSign(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var timestamp = RegexUtils.GetStringQuery(ref inputData, "timestamp")?.Replace("'", "\\'");
var mallId = RegexUtils.GetStringQuery(ref inputData, "mallId")?.Replace("'", "\\'");
var returnPackageNo = RegexUtils.GetStringQuery(ref inputData, "returnPackageNo")?.Replace("'", "\\'");
int r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt();
string c2 = RegexUtils.GetStringQuery(ref inputData, "c2");
if (EncrypUtil.Encryption(r2) != c2)
return "{\"code\":2,\"msg\":\"不合法的输入内容\"}";
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select * from dyxd.user where user_name='"
+ mobile + "' and password='" + password + "'";
sql = "select * from dyxd.user where user_name='" + mobile + "'";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (dt == null || dt.Rows.Count <=0)
{
return "{\"code\":1,\"msg\":\"用户不存在\"}";
}
string sign = EncrypUtil.GetMd5(timestamp + return_package_secret_key + mallId + returnPackageNo).ToLower();
return "{\"code\":200, \"sign\":\"" + sign + "\", \"msg\":\"\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -0,0 +1,27 @@
using MAX.Core.DependencyInjection;
using StoreHub.Framework.Repositorys;
using System;
using System.Collections.Generic;
using System.Text;
namespace StoreHub.KJDWebService.Services
{
public class DemoService : ITransientDependency
{
private readonly SqlRepository _sqlRepository;
public DemoService(SqlRepository sqlRepository)
{
_sqlRepository = sqlRepository;
}
public bool Test()
{
_sqlRepository.Ado.ExecuteDataTable("select * from user");
return true;
}
public bool Test2()
{
return true;
}
}
}
@@ -0,0 +1,675 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Commons;
using NaiBa.Util.Extension;
using NaiBa.Util.Helper;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
namespace StoreHub.KJDWebService.Services
{
public class OrderService : ServiceBase
{
public OrderService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public List<string> year_mounth_lst = new List<string>() { "202510", "202511", "202512",
"202601", "202602", "202603", "202604", "202605", "202606", "202607", "202608", "202609", "202610", "202611", "202612",
"202701", "202702", "202703", "202704", "202705", "202706", "202707", "202708", "202709", "202710", "202711", "202712",
"202801", "202802", "202803", "202804", "202805", "202806", "202807", "202808", "202809", "202810", "202811", "202812",
"202901", "202902", "202903", "202904", "202905", "202906", "202907", "202908", "202909", "202910", "202911", "202912",
"203001", "203002", "203003", "203004", "203005", "203006", "203007", "203008", "203009", "203010", "203011", "203012",
"203101", "203102", "203103", "203104", "203105", "203106", "203107", "203108", "203109", "203110", "203111", "203112",
"203201", "203202", "203203", "203204", "203205", "203206", "203207", "203208", "203209", "203210", "203211", "203212",
"203301", "203302", "203303", "203304", "203305", "203306", "203307", "203308", "203309", "203310", "203311", "203312" };
public string AddOrder(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
string order_data = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_data"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(order_data))
return "{\"code\":500,\"msg\":\"请输入订单参数\"}";
//string orderPurchaseTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_data"))?.Replace("'", "\\'");
//if (string.IsNullOrEmpty(order_data))
// return "{\"code\":500,\"msg\":\"请输入订单创建时间\"}";
JObject jObj = null;
try
{
jObj = JObject.Parse(order_data);
}
catch
{
return "{\"code\":500,\"msg\":\"数据格式错误\"}";
}
//long table_id = shop_id.ParseToLong() % 128;
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(jObj["purchaseTime"].ToString())).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "insert into kjd_order.order_" + table_id + " (";
foreach (var item in jObj)
{
if (item.Key.ParseToString() != "id" && JsonConvert.SerializeObject(item.Value) != "null" &&
item.Key.ParseToString() != "add_time" && item.Key.ParseToString() != "mdy_time")
sql += item.Key + ",";
}
sql = sql.Trim(',');
sql += ")";
sql += "values (";
foreach (var item in jObj)
{
if (item.Key.ParseToString() != "id" && JsonConvert.SerializeObject(item.Value) != "null" &&
item.Key.ParseToString() != "add_time" && item.Key.ParseToString() != "mdy_time")
sql += "'" + item.Value.ParseToString().Replace("\\'", "'").Replace("'", "\\'") + "',";
}
sql = sql.Trim(',');
sql += ");";
var rst = mySql.ExecuteInsertId(sql);
mySql.Close();
if (rst > 0)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetOrderList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
//if (string.IsNullOrEmpty(shop_id))
// return "{\"code\":500,\"msg\":\"请输入查询店铺\",\"data\":[],\"count\":" + 0 + "}";
var upload_order_status = RegexUtils.GetStringQuery(ref inputData, "upload_order_status")?.Replace("'", "\\'");
//var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
var start_time = TimeUtils.DateTimeToTimestampMilliseconds(DateTime.Now.Date.AddDays(-30));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string startTimeStr = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "startTime"))?.Replace("'", "\\'");
string endTimeStr = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "endTime"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(endTimeStr))
{
var datetime = DateTime.Now;
startTimeStr = datetime.AddMonths(-1).ToString("yyyyMM");
endTimeStr = datetime.ToString("yyyyMM");
}
var startIndex = year_mounth_lst.IndexOf(startTimeStr);
var endIndex = year_mounth_lst.IndexOf(endTimeStr);
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
//long table_id = shop_id.ParseToLong() % 128;
//sql = "select count(id) from kjd_order.order_" + table_id + " o where 1=1";
string sql = "";
sql += " SELECT count(*) FROM ( ";
for (int i = startIndex; i<=endIndex; i++)
{
if (i > startIndex)
sql += " UNION ALL ";
sql += " SELECT id,purchaseTime,supplierId,upLoadStatus FROM kjd_order.order_" + year_mounth_lst[i];
}
sql += " ) AS o WHERE 1=1";
string where = "";
if (start_time > 0)
where += " and o.purchaseTime > " + start_time;
if (!string.IsNullOrWhiteSpace(shop_id))
where += " and o.supplierId = '" + shop_id + "'";
if (!string.IsNullOrEmpty(upload_order_status))
where += " and upLoadStatus >= " + upload_order_status;
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
//sql = "SELECT * FROM kjd_order.order_" + table_id + " o where 1=1"; // p.is_del=0
sql = " SELECT * FROM ( ";
for (int i = startIndex; i <= endIndex; i++)
{
if (i > startIndex)
sql += " UNION ALL ";
sql += " SELECT * FROM kjd_order.order_" + year_mounth_lst[i];
}
sql += " ) AS o WHERE 1=1";
//where子句
sql += where;
sql += " ORDER BY o.purchaseTime desc";
//sql += " ORDER BY o.select_total_count desc, p.id desc";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<TemuDBOrderInfo> orderLst = new List<TemuDBOrderInfo>();
foreach (DataRow row in dt.Rows)
{
TemuDBOrderInfo prod = new TemuDBOrderInfo
{
id = Convert.ToInt32(row["id"]),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
notes = row["notes"].ParseToString(),
availableSaleDays = row["availableSaleDays"].ParseToNullableDecimal(),
barCodeMd5 = row["barCodeMd5"].ParseToString(),
category = row["category"].ParseToString(),
className = row["className"].ParseToString(),
costPrice = row["costPrice"].ParseToNullableInt(),
currencyType = row["currencyType"].ParseToString(),
deliverQuantity = row["deliverQuantity"].ParseToInt(),
deliverTime = row["deliverTime"].ParseToNullableLong(),
deliveryFee = row["deliveryFee"].ParseToNullableInt(),
deliveryOrderSn = row["deliveryOrderSn"].ParseToString(),
expectLatestArrivalTimeOrDefault = row["expectLatestArrivalTimeOrDefault"].ParseToLong(),
expectLatestDeliverTimeOrDefault = row["expectLatestDeliverTimeOrDefault"].ParseToLong(),
extCode = row["extCode"].ParseToString(),
jiaTongCode = row["jiaTongCode"].ParseToString(),
markFee = row["markFee"].ParseToNullableInt(),
originalPurchaseOrderSn = row["originalPurchaseOrderSn"].ParseToString(),
productId = row["productId"].ParseToString(),
productName = row["productName"].ParseToString(),
productSkcPicture = row["productSkcPicture"].ParseToString(),
productSkcId = row["productSkcId"].ParseToString(),
productSkuId = row["productSkuId"].ParseToString(),
productSn = row["productSn"].ParseToString(),
purchaseQuantity = row["purchaseQuantity"].ParseToInt(),
purchaseTime = row["purchaseTime"].ParseToLong(),
qcResult = row["qcResult"].ParseToNullableInt(),
realReceiveAuthenticQuantity = row["realReceiveAuthenticQuantity"].ParseToInt(),
receiveTime = row["receiveTime"].ParseToNullableLong(),
receiveWarehouseId = row["receiveWarehouseId"].ParseToString(),
receiveWarehouseName = row["receiveWarehouseName"].ParseToString(),
shippingMarkMd5 = row["shippingMarkMd5"].ParseToString(),
status = row["status"].ParseToInt(),
subPurchaseOrderSn = row["subPurchaseOrderSn"].ParseToString(),
supplierId = row["supplierId"].ParseToString(),
supplierName = row["supplierName"].ParseToString(),
supplierPrice = row["supplierPrice"].ParseToInt(),
thumbUrlList = row["thumbUrlList"].ParseToString(),
upLoadStatus = row["upLoadStatus"].ParseToInt(),
upProductId = row["upProductId"].ParseToString(),
warehouseGroupId = row["warehouseGroupId"].ParseToString(),
};
orderLst.Add(prod);
}
var data = JsonUtils.SerializeObjectToString(orderLst);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateOrderStatus1(string inputData, bool isDetail = false)
{
//作废
//if (!string.IsNullOrEmpty(inputData))
//{
// var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
// string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
// if (time1 != EncrypUtil.Encryption(time))
// return "{\"code\":50000,\"msg\":\"校验失败\"}";
// var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
// var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'");
// var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
// if (string.IsNullOrEmpty(shop_id))
// return "{\"code\":500,\"msg\":\"请输入查询店铺\"}";
// var product_id = RegexUtils.GetStringQuery(ref inputData, "product_id")?.Replace("'", "\\'");
// if (string.IsNullOrEmpty(product_id))
// return "{\"code\":500,\"msg\":\"请输入商品编号\"}";
// int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
// int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
// string conn = "ConnKJD";
// MysqlUtils mySql = new MysqlUtils(conn);
// long table_id = shop_id.ParseToLong() % 128;
// string sql = "update kjd_order.order_" + table_id + " o set o.upLoadStatus=1";
// string where = "";
// where += " and o.supplierId = '" + shop_id + "'";
// where += " and o.productId = '" + product_id + "'";
// where += " and o.upLoadStatus < 1";
// sql += where;
// var rst = mySql.ExecuteNonQuery(sql);
// mySql.Close();
// if (rst)
// {
// return "{\"code\":200,\"msg\":\"success\"}";
// }
// else
// {
// return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
// }
//}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddOrderCodeFile(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
string file_md5 = RegexUtils.GetStringQuery(ref inputData, "file_md5")?.Replace("'", "\\'");
string file_base64 = RegexUtils.GetStringQuery(ref inputData, "file_base64")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(file_md5) || string.IsNullOrEmpty(file_base64))
return "{\"code\":500,\"msg\":\"请输入文件信息\"}";
//long table_id = shop_id.ParseToLong() % 128;
string purchaseTime = RegexUtils.GetStringQuery(ref inputData, "purchaseTime")?.Replace("'", "\\'");
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(purchaseTime)).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"请输入正确的时间:" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select count(fileCodeMd5) from kjd_order.order_code_" + table_id + " where fileCodeMd5='" + file_md5 + "';";
var rowCount = mySql.ExecuteRowCount(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
else if (rowCount > 0)
{
mySql.Close();
return "{\"code\":200,\"msg\":\"success\"}";
}
sql = "insert into kjd_order.order_code_" + table_id + " (supplierId,fileCodeMd5,fileCodeBase64)";
sql += " values ('" + shop_id + "','" + file_md5 + "','" + file_base64 + "')";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (!rst)
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string SaveOrderCodeFileLink(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
var sub_order_sn = RegexUtils.GetStringQuery(ref inputData, "sub_order_sn")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(sub_order_sn))
return "{\"code\":500,\"msg\":\"请输入子单号\"}";
string jia_tong_code = RegexUtils.GetStringQuery(ref inputData, "jia_tong_code")?.Replace("'", "\\'"); // 佳同码
string bar_code_md5 = RegexUtils.GetStringQuery(ref inputData, "bar_code_md5")?.Replace("'", "\\'"); // 商品条码md5
string shipping_mark_md5 = RegexUtils.GetStringQuery(ref inputData, "shipping_mark_md5")?.Replace("'", "\\'"); // 箱唛md5
if (string.IsNullOrEmpty(jia_tong_code) && string.IsNullOrEmpty(bar_code_md5) && string.IsNullOrEmpty(shipping_mark_md5))
return "{\"code\":500,\"msg\":\"请输入文件信息\"}";
//long table_id = shop_id.ParseToLong() % 128;
string purchaseTime = RegexUtils.GetStringQuery(ref inputData, "purchaseTime")?.Replace("'", "\\'"); // 佳同码
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(purchaseTime)).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"请输入正确的时间:" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update kjd_order.order_" + table_id;
sql += " set";
if (jia_tong_code != null)
sql += " jiaTongCode='" + jia_tong_code + "',";
if (bar_code_md5 != null)
sql += " barCodeMd5='" + bar_code_md5 + "',";
if (shipping_mark_md5 != null)
sql += " shippingMarkMd5='" + shipping_mark_md5 + "',";
sql = sql.TrimEnd(',');
sql += " where subPurchaseOrderSn='" + sub_order_sn + "';";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string getOrderCodeFile(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
string file_md5 = RegexUtils.GetStringQuery(ref inputData, "file_md5")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(file_md5))
return "{\"code\":500,\"msg\":\"请输入文件信息\"}";
//long table_id = shop_id.ParseToLong() % 128;
string purchaseTime = RegexUtils.GetStringQuery(ref inputData, "purchaseTime")?.Replace("'", "\\'");
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(purchaseTime)).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"请输入正确的时间:" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select fileCodeMd5,fileCodeBase64 from kjd_order.order_code_" + table_id + " where fileCodeMd5='" + file_md5 + "';";
var dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
else
{
string file_md5_rst = "";
string file_base64_rst = "";
if (dt.Rows.Count > 0)
{
file_md5_rst = dt.Rows[0]["fileCodeMd5"].ParseToString();
file_base64_rst = dt.Rows[0]["fileCodeBase64"].ParseToString();
}
return "{\"code\":200,\"msg\":\"success\",\"data\":\"{\"file_md5\":\"" + file_md5_rst + "\",\"file_base64\":\"" + file_base64_rst + "\"}\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UploadOrder(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
string subPurchaseOrderSn = RegexUtils.GetStringQuery(ref inputData, "subPurchaseOrderSn")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(subPurchaseOrderSn))
return "{\"code\":500,\"msg\":\"请输入订单编号\"}";
string feeStr = RegexUtils.GetStringQuery(ref inputData, "fee")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(feeStr))
return "{\"code\":500,\"msg\":\"请输入费用\"}";
decimal fee = feeStr.ParseToDecimal();
//long table_id = shop_id.ParseToLong() % 128;
string purchaseTime = RegexUtils.GetStringQuery(ref inputData, "purchaseTime")?.Replace("'", "\\'");
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(purchaseTime)).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"请输入正确的时间:" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "select authorized_amount from kjd.user where user_name='" + user_name + "'";
var value = mySql.ExecuteFirst(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if (value.IsNullOrEmpty())
{
mySql.Close();
return "{\"code\":500,\"msg\":\"用户不存\"}";
}
if (value.ParseToDecimal() < fee)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"授权金不足\"}";
}
sql = "update kjd_order.order_" + table_id + " set upLoadStatus=2 where upLoadStatus < 2 and subPurchaseOrderSn in('" + subPurchaseOrderSn + "');";
var rst = mySql.ExecuteAffectedRows(sql);
if (!string.IsNullOrEmpty(mySql.Message))
{
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if (rst == 0)
{
mySql.Close();
return "{\"code\":500,\"msg\":\"订单不存在或已上传\"}";
}
sql = "update kjd.user set authorized_amount=authorized_amount-" + fee + " where user_name='" + user_name + "';";
rst = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
if(rst == 0)
{
return "{\"code\":500,\"msg\":\"订单已提交但扣费失败\"}";
}
return "{\"code\":200,\"msg\":\"success\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string UpdateOrderStatus(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(shop_id))
return "{\"code\":500,\"msg\":\"请输入店铺\"}";
string subPurchaseOrderSn = RegexUtils.GetStringQuery(ref inputData, "subPurchaseOrderSn")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(subPurchaseOrderSn))
return "{\"code\":500,\"msg\":\"请输入订单编号\"}";
string new_status = RegexUtils.GetStringQuery(ref inputData, "new_status")?.Replace("'", "\\'");
string old_status = RegexUtils.GetStringQuery(ref inputData, "old_status")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(new_status))
return "{\"code\":500,\"msg\":\"请输入订单状态\"}";
//long table_id = shop_id.ParseToLong() % 128;
string purchaseTime = RegexUtils.GetStringQuery(ref inputData, "purchaseTime")?.Replace("'", "\\'");
string table_id = "999999";
try
{
table_id = TimeUtils.StampMillisecondsToDateTime(long.Parse(purchaseTime)).ToString("yyyyMM");
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"请输入正确的时间:" + ex.Message + "\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update kjd_order.order_" + table_id + " set upLoadStatus=" + new_status + " where 1=1";
if (!string.IsNullOrEmpty(old_status))
sql += " and upLoadStatus=" + old_status;
sql += " and subPurchaseOrderSn in('" + subPurchaseOrderSn + "');";
var rst = mySql.ExecuteAffectedRows(sql);
mySql.Close();
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
else
{
return "{\"code\":200,\"msg\":\"success\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -0,0 +1,607 @@
using StoreHub.KJDWebService.Models;
using StoreHub.Framework.Repositorys;
using Microsoft.Extensions.Configuration;
using StoreHub.KJDWebService.Commons;
using MySql.Data.MySqlClient;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace StoreHub.KJDWebService.Services
{
public class PriceService : ServiceBase
{
public PriceService(SqlRepository sqlRepository, IConfiguration configuration) : base(sqlRepository, configuration)
{
}
public string AddPrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
int original_price = RegexUtils.GetStringQuery(ref inputData, "original_price").ParseToInt();
int markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times").ParseToInt();
int extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price").ParseToInt();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from kjd.price_markup where ext_code=@ext_code";
string sql = "insert into kjd.price_markup " +
"(ext_code,original_price,markup_times,extra_price,notes) " +
"values (@ext_code,@original_price,@markup_times,@extra_price,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPriceList(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
string start_original_price = RegexUtils.GetStringQuery(ref inputData, "start_original_price");
string end_original_price = RegexUtils.GetStringQuery(ref inputData, "end_original_price");
string start_markup_times = RegexUtils.GetStringQuery(ref inputData, "start_markup_times");
string end_markup_times = RegexUtils.GetStringQuery(ref inputData, "end_markup_times");
string start_extra_price = RegexUtils.GetStringQuery(ref inputData, "start_extra_price");
string end_extra_price = RegexUtils.GetStringQuery(ref inputData, "end_extra_price");
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_ext_code"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_original_price", Value = start_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_original_price", Value = end_original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_markup_times", Value = start_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_markup_times", Value = end_markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_extra_price", Value = start_extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_extra_price", Value = end_extra_price.ParseToInt(), });
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = "'" + in_ext_code?.Replace(",", "','") + "'", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = in_ext_code.ParseToString() });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.price_markup p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrWhiteSpace(start_original_price))
where += " and p.original_price >= @start_original_price";
if (!string.IsNullOrWhiteSpace(end_original_price))
where += " and p.original_price <= @end_original_price";
if (!string.IsNullOrWhiteSpace(start_markup_times))
where += " and p.markup_times >= @start_markup_times";
if (!string.IsNullOrWhiteSpace(end_markup_times))
where += " and p.markup_times <= @end_markup_times";
if (!string.IsNullOrWhiteSpace(start_extra_price))
where += " and p.extra_price >= @start_extra_price";
if (!string.IsNullOrWhiteSpace(end_extra_price))
where += " and p.extra_price <= @end_extra_price";
if (!string.IsNullOrEmpty(in_ext_code))
where += " and p.ext_code in ('" + in_ext_code?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd.price_markup p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<DBPriceResultParam> priceList = new List<DBPriceResultParam>();
foreach (DataRow row in dt.Rows)
{
DBPriceResultParam price = new DBPriceResultParam
{
id = row["id"].ParseToInt(),
extra_price = row["extra_price"].ParseToInt(),
markup_times = row["markup_times"].ParseToInt(),
original_price = row["original_price"].ParseToInt(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
priceList.Add(price);
}
var data = JsonUtils.SerializeObjectToString(priceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelDbPrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.price_markup where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyDBPrice(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes"));
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code"));
string original_price = RegexUtils.GetStringQuery(ref inputData, "original_price");
string markup_times = RegexUtils.GetStringQuery(ref inputData, "markup_times");
string extra_price = RegexUtils.GetStringQuery(ref inputData, "extra_price");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@original_price", Value = original_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@markup_times", Value = markup_times.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@extra_price", Value = extra_price.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@db_id", Value = db_id, });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(ext_code) from kjd.price_markup where ext_code=@ext_code and id!=@db_id";
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
string sql = "update kjd.price_markup set";
if (notes != null)
sql += " notes=@notes,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (original_price != null)
sql += " original_price=@original_price,";
if (markup_times != null)
sql += " markup_times=@markup_times,";
if (extra_price != null)
sql += " extra_price=@extra_price,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddPurchasePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spu_id")).ParseToString();
string skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skc_id")).ParseToString();
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sqlExist = "select count(spu_id) from kjd.product_purchase_price where spu_id=@spu_id";
string sql = "insert into kjd.product_purchase_price " +
"(shop_id,shop_name,spu_id,skc_id,cat_id,cat_name,ext_code,product_name,main_img,discount,price_text,sku_purchase_price_json,notes) " +
"values (@shop_id,@shop_name,@spu_id,@skc_id,@cat_id,@cat_name,@ext_code,@product_name,@main_img,@discount,@price_text,@sku_purchase_price_json,@notes);";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@spu_id", Value = spu_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@skc_id", Value = skc_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
var has = mySql.ExecuteFirst(sqlExist, paramLst.ToArray());
if (has != "0")
{
mySql.Close();
return "{\"code\":501,\"msg\":\"货号 " + ext_code + " 价格数据已存在\"}";
}
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":502,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyPurchasePrice(string inputData, bool isAdmin = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
var db_id = RegexUtils.GetStringQuery(ref inputData, "db_id");
string shop_id = RegexUtils.GetStringQuery(ref inputData, "shop_id");
string shop_name = RegexUtils.GetStringQuery(ref inputData, "shop_name");
string cat_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_id")).ParseToString();
string cat_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "cat_name")).ParseToString();
string ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "ext_code")).ParseToString();
string product_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "product_name")).ParseToString();
string main_img = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "main_img")).ParseToString();
string discount = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "discount")).ParseToString();
string price_text = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "price_text")).ParseToString();
string sku_purchase_price_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_purchase_price_json")).ParseToString();
string notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "notes")).ParseToString();
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@db_id", Value = db_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_id", Value = shop_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@shop_name", Value = shop_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_id", Value = cat_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@cat_name", Value = cat_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@ext_code", Value = ext_code, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@product_name", Value = product_name, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@main_img", Value = main_img, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@discount", Value = discount.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@price_text", Value = price_text, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@sku_purchase_price_json", Value = sku_purchase_price_json, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@notes", Value = notes, });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "update kjd.product_purchase_price set";
if (shop_id != null)
sql += " shop_id=@shop_id,";
if (shop_name != null)
sql += " shop_name=@shop_name,";
if (cat_id != null)
sql += " cat_id=@cat_id,";
if (cat_name != null)
sql += " cat_name=@cat_name,";
if (ext_code != null)
sql += " ext_code=@ext_code,";
if (product_name != null)
sql += " product_name=@product_name,";
if (main_img != null)
sql += " main_img=@main_img,";
if (discount != null)
sql += " discount=@discount,";
if (price_text != null)
sql += " price_text=@price_text,";
if (sku_purchase_price_json != null)
sql += " sku_purchase_price_json=@sku_purchase_price_json,";
if (notes != null)
sql += " notes=@notes,";
sql = sql.TrimEnd(',');
sql += " where id=@db_id;";
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"更新失败:" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetPurchasePriceList(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var password = RegexUtils.GetStringQuery(ref inputData, "password");
var search_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_spu_id"));
var search_skc_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_skc_id"));
var search_ext_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_ext_code"));
var search_notes = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "search_notes"));
var in_spu_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "in_spu_id"));
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_spu_id", Value = "%" + search_spu_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_skc_id", Value = "%" + search_skc_id + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_ext_code", Value = "%" + search_ext_code + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@search_notes", Value = "%" + search_notes + "%", });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_spu_id", Value = in_spu_id.ParseToString() });
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(id) from kjd.product_purchase_price p where 1=1";
string where = "";
if (!string.IsNullOrWhiteSpace(search_spu_id))
where += " and p.spu_id like @search_spu_id";
if (!string.IsNullOrWhiteSpace(search_skc_id))
where += " and p.skc_id like @search_skc_id";
if (!string.IsNullOrWhiteSpace(search_ext_code))
where += " and p.ext_code like @search_ext_code";
if (!string.IsNullOrWhiteSpace(search_notes))
where += " and p.notes like @search_notes";
if (!string.IsNullOrEmpty(in_spu_id))
where += " and p.spu_id in ('" + in_spu_id?.Replace(",", "','") + "')";
sql += where;
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select * from kjd.product_purchase_price p where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql, paramLst.ToArray());
}
mySql.Close();
if (dt != null)
{
try
{
List<ProductPurchasePriceResultParam> purchasePriceList = new List<ProductPurchasePriceResultParam>();
foreach (DataRow row in dt.Rows)
{
ProductPurchasePriceResultParam price = new ProductPurchasePriceResultParam
{
id = row["id"].ParseToInt(),
shop_id = row["shop_id"].ParseToString(),
shop_name = row["shop_name"].ParseToString(),
cat_id = row["cat_id"].ParseToString(),
cat_name = row["cat_name"].ParseToString(),
main_img = row["main_img"].ParseToString(),
discount = row["discount"].ParseToInt(),
price_text = row["price_text"].ParseToString(),
product_name = row["product_name"].ParseToString(),
skc_id = row["skc_id"].ParseToString(),
sku_purchase_price_json = row["sku_purchase_price_json"].ParseToString(),
spu_id = row["spu_id"].ParseToString(),
notes = row["notes"].ParseToString(),
ext_code = row["ext_code"].ParseToString(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
};
purchasePriceList.Add(price);
}
var data = JsonUtils.SerializeObjectToString(purchasePriceList);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string DelPurchasePrice(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
var id = RegexUtils.GetStringQuery(ref inputData, "db_id")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = "ConnKJD";
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "delete from kjd.product_purchase_price where id='" + id + "'";
var rst = mySql.ExecuteNonQuery(sql);
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
return "{\"code\":500,\"msg\":\"删除失败:" + mySql.Message + "\"}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff. Show more