动态随机换图,上传后还原图片和标题功能
This commit is contained in:
1 parent
2a4a3ef744
commit
8135f50686
17 files changed
+2034
-50
No files matched your search
@@ -26,11 +26,23 @@ namespace KJD_Web.BLL
|
||||
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 (shop_ids != null)
|
||||
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();
|
||||
@@ -65,6 +77,10 @@ namespace KJD_Web.BLL
|
||||
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);
|
||||
@@ -175,6 +191,183 @@ namespace KJD_Web.BLL
|
||||
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 = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
|
||||
string sql = "SELECT COUNT(s.id) FROM kjd.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 kjd.product_select WHERE operate_sub_sa_name='" + operate_sub_sa_name + "') or " +
|
||||
"s.shop_id in (SELECT DISTINCT shop_id From kjd.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.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 kjd.shop s LEFT JOIN kjd.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(),
|
||||
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"] as string,
|
||||
|
||||
};
|
||||
shopList.Add(shop);
|
||||
}
|
||||
|
||||
//sql = "\r\nINSERT INTO kjd.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 = 100;
|
||||
var shopMonthIdList = shopMonthList.Select(s => s.id);
|
||||
mySql = new MysqlUtils(conn);
|
||||
string ids = string.Join(",", shopMonthIdList);
|
||||
sql = "";
|
||||
sql += "update kjd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month +
|
||||
" where 1=1 and id in (" + ids + ");";
|
||||
|
||||
sql += "\r\nINSERT INTO kjd.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.SerializerObjectToString(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 GetOneLoginNameShop(string inputData)
|
||||
{
|
||||
|
||||
@@ -132,6 +132,18 @@ namespace KJD_Web
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void sub_sa_get_select_prod_shop()
|
||||
{
|
||||
string jsontext = GetRequestJsonString();
|
||||
|
||||
var result = jsontext;
|
||||
result = new ShopManage().SubSaGetSelectProdShop(jsontext);
|
||||
|
||||
Context.Response.Write(result);
|
||||
Context.Response.End();
|
||||
}
|
||||
|
||||
|
||||
[WebMethod]
|
||||
public void admin_mdy_shop()
|
||||
|
||||
Reference in new issue
Block a user