代理+1 代理提现利润统计 二维码拿掉。 代理积分消耗情况统计
This commit is contained in:
1 parent
558c87897e
commit
bd3040efa3
69 files changed
+19415
-7071
No files matched your search
@@ -637,6 +637,8 @@ namespace KJD_Web.BLL.BXX
|
||||
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
|
||||
var problem_prod_data = RegexUtils.GetStringQuery(ref inputData, "problem_prod_data")?.Replace("'", "\\'");
|
||||
var is_relation = RegexUtils.GetStringQuery(ref inputData, "is_relation")?.Replace("'", "\\'");
|
||||
var add_time_begin = RegexUtils.GetStringQuery(ref inputData, "add_time_begin")?.Replace("'", "\\'");
|
||||
var add_time_end = RegexUtils.GetStringQuery(ref inputData, "add_time_end")?.Replace("'", "\\'");
|
||||
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
|
||||
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
|
||||
var ban_wx = RegexUtils.GetStringQuery(ref inputData, "ban_wx")?.Replace("'", "\\'");
|
||||
@@ -678,6 +680,10 @@ namespace KJD_Web.BLL.BXX
|
||||
forceIndex.Add("index_ext_code");
|
||||
//if (!add_user_name.IsNullOrEmpty())
|
||||
// forceIndex.Add("index_add_user_name");
|
||||
if (!search_notes.IsNullOrEmpty())
|
||||
forceIndex.Add("index_notes");
|
||||
if (!start_time.IsNullOrEmpty())
|
||||
forceIndex.Add("index_mdy_time");
|
||||
|
||||
if (!forceIndex.Contains("index_view_uv"))
|
||||
forceIndex.Add("index_sort_add_time");
|
||||
@@ -817,6 +823,10 @@ namespace KJD_Web.BLL.BXX
|
||||
{
|
||||
where += " and p.is_relation=" + is_relation;
|
||||
}
|
||||
if (add_time_begin != null && add_time_end != null)
|
||||
{
|
||||
where += " and p.add_time between '" + add_time_begin + "' and '" + add_time_end + "'";
|
||||
}
|
||||
if (start_time != null && end_time != null)
|
||||
{
|
||||
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using KJD_Web.Model;
|
||||
using KJD_Web.Model.WxModel;
|
||||
using KJD_Web.Utils;
|
||||
using MySql.Data.MySqlClient;
|
||||
using Mysqlx.Crud;
|
||||
@@ -9,6 +10,7 @@ using System.Data;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.ApplicationServices;
|
||||
using System.Web.Security;
|
||||
@@ -55,7 +57,8 @@ namespace KJD_Web.BLL.WXXD
|
||||
var version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
|
||||
if (sub_soft_type == "order")
|
||||
{
|
||||
|
||||
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["WxFindOrderLimitVersion"]?.ConnectionString).ParseToInt())
|
||||
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -375,22 +378,25 @@ namespace KJD_Web.BLL.WXXD
|
||||
var search_company_name = RegexUtils.GetStringQuery(ref inputData, "search_company_name")?.Replace("'", "\\'");
|
||||
var search_authoritys_and = RegexUtils.GetStringQuery(ref inputData, "search_authoritys_and")?.Replace("'", "\\'");
|
||||
var search_authoritys_or = RegexUtils.GetStringQuery(ref inputData, "search_authoritys_or")?.Replace("'", "\\'");
|
||||
var oem_id = RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'");
|
||||
var oem_id = RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'");
|
||||
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'");
|
||||
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(20000);
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(5000);
|
||||
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
//string sql = "select * from wxxd.user where group_id=3";
|
||||
string sql = "select u.*,uu.authority as main_authority,uu.oem_id as main_oem_id,uu.postage_per_order as main_postage_per_order,o.oem_name " +
|
||||
string sql = "select COUNT(*) " +
|
||||
" FROM wxxd.user u " +
|
||||
" LEFT JOIN wxxd.user uu ON uu.user_name=u.parent_user_name " +
|
||||
" LEFT JOIN wxxd.oem o ON uu.oem_id=o.oem_id or u.oem_id=o.oem_id " +
|
||||
" WHERE 1=1";
|
||||
|
||||
|
||||
string where = "";
|
||||
if (!string.IsNullOrEmpty(group_id))
|
||||
where += " AND u.group_id=" + group_id;
|
||||
@@ -437,10 +443,39 @@ namespace KJD_Web.BLL.WXXD
|
||||
where += " AND (u.oem_id='" + oem_id + "' or uu.oem_id='" + oem_id + "')";
|
||||
|
||||
sql += where;
|
||||
|
||||
int count = -1;
|
||||
if (is_not_count != "true")
|
||||
{
|
||||
count = mySql.ExecuteFirstInt(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":[]}";
|
||||
}
|
||||
}
|
||||
|
||||
sql = "select u.*,uu.authority as main_authority,uu.oem_id as main_oem_id,uu.postage_per_order as main_postage_per_order,o.oem_name " +
|
||||
" FROM wxxd.user u " +
|
||||
" LEFT JOIN wxxd.user uu ON uu.user_name=u.parent_user_name " +
|
||||
" LEFT JOIN wxxd.oem o ON uu.oem_id=o.oem_id or u.oem_id=o.oem_id " +
|
||||
" WHERE 1=1";
|
||||
sql += where;
|
||||
|
||||
sql += " ORDER BY u.id desc";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
if (dt != null)
|
||||
{
|
||||
List<UserLoginResultParam> userList = new List<UserLoginResultParam>();
|
||||
@@ -501,7 +536,7 @@ namespace KJD_Web.BLL.WXXD
|
||||
userList.Add(user);
|
||||
}
|
||||
var data = JsonUtils.SerializeObjectToString(userList);
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + "}";
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
@@ -741,18 +776,26 @@ namespace KJD_Web.BLL.WXXD
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn, true);
|
||||
string sql;
|
||||
int userPoints;
|
||||
int newUserPoints;
|
||||
int operatorPoints;
|
||||
int newOperatorPoints;
|
||||
int shopPointsPerMonth = 30;
|
||||
decimal userPoints;
|
||||
decimal userPointsNew;
|
||||
decimal userTotalPoints;
|
||||
decimal userTotalPointsNew;
|
||||
decimal operatorPoints;
|
||||
decimal operatorPointsNew;
|
||||
decimal shopPointsPerMonth = 30;
|
||||
|
||||
// 账户之间的转移单独写
|
||||
if (option_type == "转移")
|
||||
{
|
||||
// 转移查找自己账户及对方账户确定余额足够
|
||||
sql = "SELECT points FROM `wxxd`.`user` WHERE user_name='" + operator_name + "'";
|
||||
operatorPoints = mySql.ExecuteFirstInt(sql);
|
||||
operatorPoints = mySql.ExecuteFirstDecimal(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"查询错误:" + mySql.Message + "\"}";
|
||||
}
|
||||
if (operatorPoints < delta_points)
|
||||
{
|
||||
mySql.RollBack();
|
||||
@@ -760,16 +803,31 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":500,\"msg\":\"余额不足\"}";
|
||||
}
|
||||
sql = "SELECT points FROM `wxxd`.`user` WHERE user_name='" + user_name + "'";
|
||||
userPoints = mySql.ExecuteFirstInt(sql);
|
||||
userPoints = mySql.ExecuteFirstDecimal(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"查询错误:" + mySql.Message + "\"}";
|
||||
}
|
||||
if (userPoints < -delta_points)
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"对方账户余额不足\"}";
|
||||
}
|
||||
sql = "SELECT recharge_points_total FROM `wxxd`.`user` WHERE user_name='" + user_name + "'";
|
||||
userTotalPoints = mySql.ExecuteFirstDecimal(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"查询错误:" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
newUserPoints = userPoints + delta_points.ParseToInt();
|
||||
sql = " UPDATE `wxxd`.`user` SET points=" + newUserPoints.ParseToInt();
|
||||
userPointsNew = userPoints + delta_points;
|
||||
userTotalPointsNew = userTotalPoints + delta_points;
|
||||
sql = " UPDATE `wxxd`.`user` SET points=" + userPointsNew + ",recharge_points_total=" + userTotalPointsNew;
|
||||
sql += " WHERE user_name='" + user_name + "' AND points=" + userPoints + ";";
|
||||
var toPointsRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
@@ -785,8 +843,8 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":500,\"msg\":\"收款账户已发生改变,请刷新账户后重新操作\"}";
|
||||
}
|
||||
|
||||
newOperatorPoints = operatorPoints - delta_points.ParseToInt();
|
||||
sql = " UPDATE `wxxd`.`user` SET points=" + newOperatorPoints.ParseToInt();
|
||||
operatorPointsNew = operatorPoints - delta_points;
|
||||
sql = " UPDATE `wxxd`.`user` SET points=" + operatorPointsNew;
|
||||
sql += " WHERE user_name='" + operator_name + "' AND points=" + operatorPoints + ";";
|
||||
var fromPointsRst = mySql.ExecuteAffectedRows(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
@@ -803,17 +861,21 @@ namespace KJD_Web.BLL.WXXD
|
||||
}
|
||||
|
||||
// 转入
|
||||
sql = " INSERT INTO wxxd.user_points_record(user_name,user_nick,points,option_type,operator_type,operator_name,shop_id,shop_account)";
|
||||
sql += " VALUES(@user_name,@user_nick,@points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account);";
|
||||
sql = " INSERT INTO wxxd.user_points_record" +
|
||||
" (user_name,user_nick,delta_points,new_points,option_type,operator_type,operator_name,shop_id,shop_account,counterparty_account_name)";
|
||||
sql += " VALUES" +
|
||||
" (@user_name,@user_nick,@delta_points,@new_points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account,@counterparty_account_name);";
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_name", Value = user_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_nick", Value = user_nick, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "option_type", Value = delta_points > 0 ? "转入" : "转出", });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "delta_points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "new_points", Value = userPointsNew, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "option_type", Value = "转入" });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_type", Value = operator_type, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_name", Value = operator_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "shop_id", Value = shop_id, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "shop_account", Value = shop_account, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "counterparty_account_name", Value = operator_name, });
|
||||
var addOptionRst = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
@@ -828,17 +890,22 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":500,\"msg\":\"新增操作记录失败,请稍候重试\"}";
|
||||
}
|
||||
|
||||
sql = " INSERT INTO wxxd.user_points_record(user_name,user_nick,points,option_type,operator_type,operator_name,shop_id,shop_account)";
|
||||
sql += " VALUES(@user_name,@user_nick,@points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account);";
|
||||
// 转出
|
||||
sql = " INSERT INTO wxxd.user_points_record" +
|
||||
"(user_name,user_nick,delta_points,new_points,option_type,operator_type,operator_name,shop_id,shop_account,counterparty_account_name)";
|
||||
sql += " VALUES" +
|
||||
"(@user_name,@user_nick,@delta_points,@new_points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account,@counterparty_account_name);";
|
||||
paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_name", Value = operator_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_nick", Value = operator_nick, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "option_type", Value = delta_points > 0 ? "转出" : "转入", });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "delta_points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "new_points", Value = operatorPointsNew, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "option_type", Value = "转出" });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_type", Value = operator_type, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_name", Value = operator_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "shop_id", Value = shop_id, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "shop_account", Value = shop_account, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "counterparty_account_name", Value = user_name, });
|
||||
addOptionRst = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
@@ -855,24 +922,32 @@ namespace KJD_Web.BLL.WXXD
|
||||
|
||||
mySql.Commit();
|
||||
mySql.Close();
|
||||
return "{\"code\":200,\"msg\":\"success\",\"newOperatorPoints\":" + newOperatorPoints + ",\"newUserPoints\":" + newUserPoints + "}";
|
||||
return "{\"code\":200,\"msg\":\"success\",\"newOperatorPoints\":" + operatorPointsNew + ",\"newUserPoints\":" + userPointsNew + "}";
|
||||
}
|
||||
else
|
||||
{
|
||||
#region 计算是否余额不足
|
||||
sql = "SELECT points FROM `wxxd`.`user` WHERE user_name='" + user_name + "'";
|
||||
userPoints = mySql.ExecuteFirstInt(sql);
|
||||
|
||||
userPoints = mySql.ExecuteFirstDecimal(sql);
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
sql = "SELECT recharge_points_total FROM `wxxd`.`user` WHERE user_name='" + user_name + "'";
|
||||
userTotalPoints = mySql.ExecuteFirstDecimal(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"查询错误:" + mySql.Message + "\"}";
|
||||
}
|
||||
|
||||
if (option_type == "续费")
|
||||
{
|
||||
sql = "SELECT shop_points_per_month FROM `wxxd`.`user` WHERE user_name='" + user_name + "'";
|
||||
shopPointsPerMonth = mySql.ExecuteFirstInt(sql); // 店铺续费一个月的点数,默认30,可以设置为其他值
|
||||
shopPointsPerMonth = mySql.ExecuteFirstDecimal(sql); // 店铺续费一个月的点数,默认30,可以设置为其他值
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
mySql.RollBack();
|
||||
@@ -881,11 +956,11 @@ namespace KJD_Web.BLL.WXXD
|
||||
}
|
||||
shopPointsPerMonth = Math.Max(30, shopPointsPerMonth);
|
||||
|
||||
if (delta_points <= 0 || delta_points % shopPointsPerMonth > 0)
|
||||
if (delta_points <= 0 || delta_points.ParseToInt().ParseToDecimal() != delta_points || delta_points.ParseToInt() % shopPointsPerMonth.ParseToInt() > 0)
|
||||
{
|
||||
mySql.RollBack();
|
||||
mySql.Close();
|
||||
return "{\"code\":501,\"msg\":\"续费点数必须是" + shopPointsPerMonth + "的整倍数\"}";
|
||||
return "{\"code\":501,\"msg\":\"续费点数必须是" + shopPointsPerMonth.ParseToInt() + "的整倍数\"}";
|
||||
}
|
||||
else if (userPoints < delta_points)
|
||||
{
|
||||
@@ -899,13 +974,15 @@ namespace KJD_Web.BLL.WXXD
|
||||
sql = "UPDATE `wxxd`.`user` SET";
|
||||
if (option_type == "充值")
|
||||
{
|
||||
sql += " points=points+" + delta_points.ParseToInt() + ",";
|
||||
newUserPoints = userPoints + delta_points.ParseToInt();
|
||||
userPointsNew = userPoints + delta_points;
|
||||
sql += " points=" + userPointsNew + ",";
|
||||
userTotalPointsNew = userTotalPoints + delta_points;
|
||||
sql += " recharge_points_total=" + userTotalPointsNew + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql += " points=points-" + delta_points.ParseToInt() + ",";
|
||||
newUserPoints = userPoints - delta_points.ParseToInt();
|
||||
userPointsNew = userPoints - delta_points;
|
||||
sql += " points=" + userPointsNew + ",";
|
||||
}
|
||||
sql = sql.TrimEnd(',');
|
||||
sql += " WHERE user_name='" + user_name + "' AND points=" + userPoints + ";";
|
||||
@@ -923,12 +1000,13 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":500,\"msg\":\"账户已发生改变,请刷新账户后重新操作\"}";
|
||||
}
|
||||
|
||||
sql = " INSERT INTO wxxd.user_points_record(user_name,user_nick,points,option_type,operator_type,operator_name,shop_id,shop_account)";
|
||||
sql += " VALUES(@user_name,@user_nick,@points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account);";
|
||||
sql = " INSERT INTO wxxd.user_points_record(user_name,user_nick,delta_points,new_points,option_type,operator_type,operator_name,shop_id,shop_account)";
|
||||
sql += " VALUES(@user_name,@user_nick,@delta_points,@new_points,@option_type,@operator_type,@operator_name,@shop_id,@shop_account);";
|
||||
List<MySqlParameter> paramLst = new List<MySqlParameter>();
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_name", Value = user_name, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "user_nick", Value = user_nick, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "delta_points", Value = delta_points, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Decimal, ParameterName = "new_points", Value = userPointsNew, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "option_type", Value = option_type, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_type", Value = operator_type, });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "operator_name", Value = operator_name, });
|
||||
@@ -963,7 +1041,7 @@ namespace KJD_Web.BLL.WXXD
|
||||
|
||||
if (expireTime == 0)
|
||||
{
|
||||
newExpireTime = TimeUtils.DateTimeToTimestampSeconds(DateTime.Now.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth));
|
||||
newExpireTime = TimeUtils.DateTimeToTimestampSeconds(DateTime.Now.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth.ParseToInt()));
|
||||
sql = " INSERT INTO `wxxd`.`user_points_shop_expire` (shop_id,expire_time)" +
|
||||
" VALUES ('" + shop_id + "'," + newExpireTime + ");";
|
||||
}
|
||||
@@ -971,9 +1049,9 @@ namespace KJD_Web.BLL.WXXD
|
||||
{
|
||||
DateTime expireDateTime = TimeUtils.StampToDateTime(expireTime);
|
||||
if (expireDateTime < DateTime.Now)
|
||||
expireDateTime = DateTime.Now.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth);
|
||||
expireDateTime = DateTime.Now.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth.ParseToInt());
|
||||
else
|
||||
expireDateTime = expireDateTime.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth);
|
||||
expireDateTime = expireDateTime.AddMonths(delta_points.ParseToInt() / shopPointsPerMonth.ParseToInt());
|
||||
newExpireTime = TimeUtils.DateTimeToTimestampSeconds(expireDateTime);
|
||||
|
||||
sql = "UPDATE `wxxd`.`user_points_shop_expire` set expire_time=" + newExpireTime + " WHERE shop_id='" + shop_id + "' AND expire_time=" + expireTime;
|
||||
@@ -995,7 +1073,102 @@ namespace KJD_Web.BLL.WXXD
|
||||
|
||||
mySql.Commit();
|
||||
mySql.Close();
|
||||
return "{\"code\":200,\"msg\":\"success\",\"newExpireTime\":" + newExpireTime + ",\"newUserPoints\":" + newUserPoints + "}";
|
||||
return "{\"code\":200,\"msg\":\"success\",\"newExpireTime\":" + newExpireTime + ",\"newUserPoints\":" + userPointsNew + "}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
|
||||
public string GetUserPoints(string inputData)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
var option_type_in = RegexUtils.GetStringQuery(ref inputData, "option_type_in")?.Replace("'", "\\'");
|
||||
var user_name_in = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_name_in"))?.Replace("'", "\\'");
|
||||
var shop_id_in = RegexUtils.GetStringQuery(ref inputData, "shop_id_in")?.Replace("'", "\\'");
|
||||
var shop_account_in = RegexUtils.GetStringQuery(ref inputData, "shop_account_in")?.Replace("'", "\\'");
|
||||
var create_time_begin = RegexUtils.GetStringQuery(ref inputData, "create_time_begin")?.Replace("'", "\\'");
|
||||
var create_time_end = RegexUtils.GetStringQuery(ref inputData, "create_time_end")?.Replace("'", "\\'");
|
||||
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT count(*) " +
|
||||
" FROM wxxd.user_points_record up " +
|
||||
" WHERE 1=1";
|
||||
string where = "";
|
||||
if (!string.IsNullOrEmpty(option_type_in))
|
||||
where += " AND up.option_type in ('" + option_type_in + "')";
|
||||
if (!string.IsNullOrEmpty(user_name_in))
|
||||
where += " AND up.user_name in ('" + user_name_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(shop_id_in))
|
||||
where += " AND up.shop_id in ('" + shop_id_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(shop_account_in))
|
||||
where += " AND up.shop_account in ('" + shop_account_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(create_time_begin))
|
||||
where += " AND up.add_time >= '" + create_time_begin + "'";
|
||||
if (!string.IsNullOrEmpty(create_time_end))
|
||||
where += " AND up.add_time <= '" + create_time_end + "'";
|
||||
|
||||
sql += where;
|
||||
|
||||
int count = -1;
|
||||
if (is_not_count != "true")
|
||||
{
|
||||
count = mySql.ExecuteFirstInt(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
sql = "SELECT * " +
|
||||
" FROM wxxd.user_points_record up " +
|
||||
" WHERE 1=1";
|
||||
sql += where;
|
||||
sql += " ORDER BY up.add_time desc ";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (!string.IsNullOrEmpty(mySql.Message))
|
||||
{
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
if (dt != null)
|
||||
{
|
||||
List<user_points_record_info> userPaymentList = new List<user_points_record_info>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
user_points_record_info userPayment = new user_points_record_info
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
user_name = row["user_name"].ParseToString(),
|
||||
delta_points = row["delta_points"].ParseToInt(),
|
||||
new_points = row["new_points"].ParseToNullableInt(),
|
||||
operator_name = row["operator_name"].ParseToString(),
|
||||
operator_type = row["operator_type"].ParseToString(),
|
||||
option_type = row["option_type"].ParseToString(),
|
||||
shop_account = row["shop_account"].ParseToString(),
|
||||
shop_id = row["shop_id"].ParseToString(),
|
||||
user_nick = row["user_nick"].ParseToString(),
|
||||
remark = row["remark"].ParseToString(),
|
||||
add_time = row["add_time"].ParseToString().ParseToDateTime(),
|
||||
counterparty_account_name = row["counterparty_account_name"].ParseToString(),
|
||||
};
|
||||
userPaymentList.Add(userPayment);
|
||||
}
|
||||
var data = JsonUtils.SerializeObjectToString(userPaymentList);
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":\"" + count + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
@@ -1208,6 +1381,126 @@ namespace KJD_Web.BLL.WXXD
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string GetUserBalance(string inputData)
|
||||
{
|
||||
// ALTER TABLE books ALTER INDEX idx_name INVISIBLE; --隐藏
|
||||
// ALTER TABLE books ALTER INDEX idx_name VISIBLE; --恢复
|
||||
// 双字匹配的全文索引 ALTER TABLE `user_payment_record` ADD FULLTEXT INDEX `remark_fulltext` (`remark`) WITH parser ngram
|
||||
if (!string.IsNullOrEmpty(inputData))
|
||||
{
|
||||
if (!GetSign(inputData))
|
||||
return "{\"code\":999,\"msg\":\"校验失败\"}";
|
||||
|
||||
var timeCalc = DateTime.Now;
|
||||
|
||||
var type_in = RegexUtils.GetStringQuery(ref inputData, "type_in")?.Replace("'", "\\'");
|
||||
var user_name_in = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "user_name_in"))?.Replace("'", "\\'");
|
||||
var order_id_in = RegexUtils.GetStringQuery(ref inputData, "order_id_in")?.Replace("'", "\\'");
|
||||
var after_sale_id_in = RegexUtils.GetStringQuery(ref inputData, "after_sale_id_in")?.Replace("'", "\\'");
|
||||
var create_time_begin = RegexUtils.GetStringQuery(ref inputData, "create_time_begin")?.Replace("'", "\\'");
|
||||
var create_time_end = RegexUtils.GetStringQuery(ref inputData, "create_time_end")?.Replace("'", "\\'");
|
||||
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'");
|
||||
var remark_fulltext = RegexUtils.GetStringQuery(ref inputData, "remark_fulltext")?.Replace("'", "\\'");
|
||||
|
||||
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
|
||||
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(200);
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT count(*) " +
|
||||
" FROM wxxd.user_payment_record up " +
|
||||
" WHERE 1=1";
|
||||
string where = "";
|
||||
if (!string.IsNullOrEmpty(type_in))
|
||||
where += " AND up.type in (" + type_in + ")";
|
||||
if (!string.IsNullOrEmpty(user_name_in))
|
||||
where += " AND up.user_name in ('" + user_name_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(order_id_in))
|
||||
where += " AND up.order_id in ('" + order_id_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(after_sale_id_in))
|
||||
where += " AND up.after_sale_id in ('" + after_sale_id_in.Replace(",", "','") + "')";
|
||||
if (!string.IsNullOrEmpty(create_time_begin))
|
||||
where += " AND up.create_time >= '" + create_time_begin + "'";
|
||||
if (!string.IsNullOrEmpty(create_time_end))
|
||||
where += " AND up.create_time <= '" + create_time_end + "'";
|
||||
//if (!string.IsNullOrEmpty(remark_fulltext))
|
||||
//{
|
||||
// List<string> fullTextSearchStr = new List<string>();
|
||||
// var remark_fulltextLst = remark_fulltext.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
|
||||
// foreach (var t in remark_fulltextLst)
|
||||
// {
|
||||
// var t1 = t;
|
||||
// while (t1.Length >= 12)
|
||||
// {
|
||||
// fullTextSearchStr.Add(t1.Substring(0, 10));
|
||||
// t1 = t1.Substring(10);
|
||||
// }
|
||||
// fullTextSearchStr.Add(t1);
|
||||
// }
|
||||
// where += " AND MATCH(remark) AGAINST('" + string.Join(" +", fullTextSearchStr) + "' IN BOOLEAN MODE) ";
|
||||
// //where += " AND MATCH(remark) AGAINST('" + string.Join(" +", fullTextSearchStr) + "' IN NATURAL LANGUAGE MODE) ";
|
||||
// //where += " AND MATCH(remark) AGAINST('" + remark_fulltext.Replace(",", " ") + "' IN NATURAL LANGUAGE MODE) ";
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(remark_fulltext))
|
||||
{
|
||||
where += " AND MATCH(remark) AGAINST('" + remark_fulltext + "' IN BOOLEAN MODE)";
|
||||
}
|
||||
|
||||
sql += where;
|
||||
|
||||
int count = -1;
|
||||
if (is_not_count != "true")
|
||||
{
|
||||
count = mySql.ExecuteFirstInt(sql);
|
||||
if (!mySql.Message.IsNullOrEmpty())
|
||||
{
|
||||
mySql.Close();
|
||||
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
|
||||
}
|
||||
}
|
||||
|
||||
sql = "SELECT * " +
|
||||
" FROM wxxd.user_payment_record up " +
|
||||
" WHERE 1=1";
|
||||
sql += where;
|
||||
sql += " ORDER BY up.create_time desc ";
|
||||
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
|
||||
|
||||
var dt = mySql.ExecuteDataTable(sql);
|
||||
mySql.Close();
|
||||
if (dt != null)
|
||||
{
|
||||
List<user_payment_record_info> userPaymentList = new List<user_payment_record_info>();
|
||||
foreach (DataRow row in dt.Rows)
|
||||
{
|
||||
user_payment_record_info userPayment = new user_payment_record_info
|
||||
{
|
||||
id = Convert.ToInt32(row["id"]),
|
||||
user_name = row["user_name"].ParseToString(),
|
||||
after_sale_id = row["after_sale_id"].ParseToLong(),
|
||||
amount = row["amount"].ParseToDecimal(),
|
||||
counterparty_account_name = row["counterparty_account_name"].ParseToString(),
|
||||
create_by = row["create_by"].ParseToString(),
|
||||
balance = row["balance"].ParseToDecimal(),
|
||||
create_time = row["create_time"].ParseToString().ParseToDateTime(),
|
||||
is_deleted = row["is_deleted"].ParseToInt(),
|
||||
order_id = row["order_id"].ParseToString(),
|
||||
platform_code = row["platform_code"].ParseToString(),
|
||||
remark = row["remark"].ParseToString(),
|
||||
type = row["type"].ParseToInt(),
|
||||
update_by = row["update_by"].ParseToString(),
|
||||
update_time = row["update_time"].ParseToString().ParseToDateTime(),
|
||||
};
|
||||
userPaymentList.Add(userPayment);
|
||||
}
|
||||
var data = JsonUtils.SerializeObjectToString(userPaymentList);
|
||||
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
|
||||
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":\"" + count + "\",\"seconds\":\"" + seconds + "\"}";
|
||||
}
|
||||
}
|
||||
return "{\"code\":19999,\"msg\":\"输入为空\"}";
|
||||
}
|
||||
|
||||
public string ChangePassword(string inputData)
|
||||
{
|
||||
|
||||
@@ -139,7 +139,8 @@
|
||||
<Compile Include="Model\WxModel\oms_wei_order_item.cs" />
|
||||
<Compile Include="Model\WxModel\oms_wei_refund.cs" />
|
||||
<Compile Include="Model\WxModel\order_pdd_buyer_order.cs" />
|
||||
<Compile Include="Model\WxModel\user_payment_record.cs" />
|
||||
<Compile Include="Model\WxModel\user_payment_record_info.cs" />
|
||||
<Compile Include="Model\WxModel\user_points_record_info.cs" />
|
||||
<Compile Include="Model\WxModel\WXBuyUrlNotesInfo.cs" />
|
||||
<Compile Include="Model\WxModel\WXClientProductInfoLite.cs" />
|
||||
<Compile Include="Model\WxModel\WXGetEditProductInfoLite.cs" />
|
||||
|
||||
+4
-1
@@ -5,9 +5,12 @@ using System.Web;
|
||||
|
||||
namespace KJD_Web.Model.WxModel
|
||||
{
|
||||
public class user_payment_record
|
||||
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>
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace KJD_Web.Model.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; }
|
||||
}
|
||||
}
|
||||
@@ -351,6 +351,20 @@ namespace KJD_Web.Utils
|
||||
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>
|
||||
|
||||
@@ -174,7 +174,19 @@ namespace KJD_Web
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void get_user_points()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserPoints(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void update_user_balance()
|
||||
{
|
||||
@@ -187,6 +199,18 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_user_balance()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new WXUserManage().GetUserBalance(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void get_wx_sale_assistant_cookie()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<add name="UpdateWxFindOrderFileDir" connectionString="C:\inetpub\wwwroot\find_order_update"/>
|
||||
<add name="UpdateWxFindOrderUrl" connectionString="http://weidian.e57.cn/find_order_update/"/>
|
||||
<add name="WxFindOrderLimitVersion" connectionString="99"/>
|
||||
<add name="WxFindOrderLimitVersion" connectionString="172"/>
|
||||
<add name="WxFindOrderLowVersion" connectionString="99"/>
|
||||
</connectionStrings>
|
||||
<!--
|
||||
|
||||
Reference in new issue
Block a user