Commit a7ee0ce2 authored by 黄奎's avatar 黄奎

页面修改

parent 4764f52c
......@@ -83,14 +83,22 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult SetCategoryInfo()
{
var req = RequestParm;
RB_Assess_Category_Extend demodel = JsonHelper.DeserializeObject<RB_Assess_Category_Extend>(req.msg.ToString());
JObject parms = JObject.Parse(base.RequestParm.msg.ToString());
RB_Assess_Category_Extend demodel = new RB_Assess_Category_Extend()
{
Id=parms.GetInt("Id"),
Name=parms.GetStringValue("Name"),
Image=parms.GetStringValue("Image"),
Enable=parms.GetInt("Enable"),
Sort=parms.GetInt("Sort"),
};
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请传递分类名称");
}
if (string.IsNullOrEmpty(demodel.Image))
{
return ApiResult.ParamIsNull("请上传分类背景图片");
return ApiResult.ParamIsNull("请上传分类Logo图片");
}
demodel.Enable = demodel.Enable == 0 ? 1 : demodel.Enable;
......@@ -206,7 +214,30 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult SetBrandInfo()
{
var req = RequestParm;
RB_Assess_Brand_Extend demodel = JsonHelper.DeserializeObject<RB_Assess_Brand_Extend>(req.msg.ToString());
JObject parms = JObject.Parse(base.RequestParm.msg.ToString());
RB_Assess_Brand_Extend demodel = new RB_Assess_Brand_Extend()
{
Id=parms.GetInt("Id"),
Name = parms.GetStringValue("Name"),
CategoryId=parms.GetInt("CategoryId"),
IsHot=parms.GetInt("IsHot"),
Logo=parms.GetStringValue("Logo"),
MoreDesc=parms.GetStringValue("MoreDesc"),
RemarkDesc=parms.GetStringValue("RemarkDesc"),
BrandImgList=new List<AssessBrandImg> ()
};
string str = parms.GetStringValue("BrandImgList");
if (!string.IsNullOrEmpty(str))
{
try
{
demodel.BrandImgList = JsonHelper.DeserializeObject<List<AssessBrandImg>>(str);
}
catch
{
}
}
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请传递品牌名称");
......
......@@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Test.DBHelper;
......@@ -65,7 +66,7 @@ namespace Test.Helper
{
if (!string.IsNullOrEmpty(item.logo))
{
MallHelper.CreateImage(item.logo);
//MallHelper.CreateImage(item.logo);
}
}
list.AddRange(tempList);
......@@ -99,7 +100,7 @@ namespace Test.Helper
{
if (!string.IsNullOrEmpty(item.logo))
{
MallHelper.CreateImage(item.logo);
InsertImg(item.logo, item.category_id);
}
GetBrandInfo(item);
}
......@@ -110,6 +111,37 @@ namespace Test.Helper
}
}
private static void InsertImg(string url,int category_id)
{
Thread.Sleep(1000 * 1);
int parentId = 0;
if (category_id == 1)
{
parentId = 5142;
}
if (category_id == 2)
{
parentId = 5143;
}
if (category_id == 4)
{
parentId = 5144;
}
if (category_id == 31)
{
parentId = 5145;
}
MallHelper.CreateImage(url,out string filename);
string path = "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com" + MallHelper.GetFileUrl(url);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendFormat("INSERT INTO rb_material_info(Name,Type,GroupId,Path,Image,VideoTime,WithHeight,TenantId,MallBaseId,CreateDate,UpdateDate,Recycled,Status)");
stringBuilder.AppendFormat(" VALUES(@Name,{0},{1},'{2}','{3}',0,0,21,11,'{4}','{5}',1,0)", 1, parentId, path, "", DateTime.Now, DateTime.Now);
var parameters = new List<MySqlParameter>();
parameters.Add(new MySqlParameter() { ParameterName = "Name", Value = filename });
var newResult = DBHelper.MySqlHelper.ExecuteNonQuery(DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, stringBuilder.ToString(), parameters.ToArray());
}
/// <summary>
/// 获取分类详情
/// </summary>
......@@ -150,7 +182,7 @@ namespace Test.Helper
string fullImage = imgObj["full_image"].ToString();
if (!string.IsNullOrEmpty(fullImage))
{
MallHelper.CreateImage(fullImage);
InsertImg(fullImage,item.category_id);
}
imgList.Add(new
{
......@@ -164,35 +196,35 @@ namespace Test.Helper
string remark = dataObj["remark"].ToString();
string bottom_remark = dataObj["bottom_remark"].ToString();
string selectSql = "SELECT Id FROM rb_assess_brand WHERE Id=" + item.id;
var obj= Test.DBHelper.MySqlHelper.ExecuteScalar(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, selectSql,null);
int Id = 0;
if (obj != null && Convert.ToInt32(obj.ToString()) > 0)
{
Id = Convert.ToInt32(obj.ToString());
}
if (Id <= 0)
{
string sql = @" INSERT INTO rb_assess_brand(Id,CategoryId,Name,Logo,PinYin,IsHot,BrandImg,CreateDate,UpdateDate,MoreDesc,RemarkDesc) ";
sql += string.Format(@" VALUES(@Id,@CategoryId,@Name,@Logo,@PinYin,@IsHot,@BrandImg,@CreateDate,@UpdateDate,@MoreDesc,@RemarkDesc) ");
var parameters = new List<MySqlParameter>();
parameters.Add(new MySqlParameter() { ParameterName = "Id", Value = item.id });
parameters.Add(new MySqlParameter() { ParameterName = "CategoryId", Value = item.category_id });
parameters.Add(new MySqlParameter() { ParameterName = "Name", Value = item.brand_name });
parameters.Add(new MySqlParameter() { ParameterName = "Logo", Value = item.logo });
parameters.Add(new MySqlParameter() { ParameterName = "PinYin", Value = item.initial });
parameters.Add(new MySqlParameter() { ParameterName = "IsHot", Value = item.ishot });
parameters.Add(new MySqlParameter() { ParameterName = "BrandImg", Value = Newtonsoft.Json.JsonConvert.SerializeObject(imgList) });
parameters.Add(new MySqlParameter() { ParameterName = "CreateDate", Value = DateTime.Now });
parameters.Add(new MySqlParameter() { ParameterName = "UpdateDate", Value = DateTime.Now });
parameters.Add(new MySqlParameter() { ParameterName = "MoreDesc", Value = bottom_remark });
parameters.Add(new MySqlParameter() { ParameterName = "RemarkDesc", Value = remark });
var res = Test.DBHelper.MySqlHelper.ExecuteNonQuery(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, sql, parameters.ToArray());
}
else
{
string str = "";
}
//string selectSql = "SELECT Id FROM rb_assess_brand WHERE Id=" + item.id;
//var obj= Test.DBHelper.MySqlHelper.ExecuteScalar(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, selectSql,null);
//int Id = 0;
//if (obj != null && Convert.ToInt32(obj.ToString()) > 0)
//{
// Id = Convert.ToInt32(obj.ToString());
//}
//if (Id <= 0)
//{
// string sql = @" INSERT INTO rb_assess_brand(Id,CategoryId,Name,Logo,PinYin,IsHot,BrandImg,CreateDate,UpdateDate,MoreDesc,RemarkDesc) ";
// sql += string.Format(@" VALUES(@Id,@CategoryId,@Name,@Logo,@PinYin,@IsHot,@BrandImg,@CreateDate,@UpdateDate,@MoreDesc,@RemarkDesc) ");
// var parameters = new List<MySqlParameter>();
// parameters.Add(new MySqlParameter() { ParameterName = "Id", Value = item.id });
// parameters.Add(new MySqlParameter() { ParameterName = "CategoryId", Value = item.category_id });
// parameters.Add(new MySqlParameter() { ParameterName = "Name", Value = item.brand_name });
// parameters.Add(new MySqlParameter() { ParameterName = "Logo", Value = item.logo });
// parameters.Add(new MySqlParameter() { ParameterName = "PinYin", Value = item.initial });
// parameters.Add(new MySqlParameter() { ParameterName = "IsHot", Value = item.ishot });
// parameters.Add(new MySqlParameter() { ParameterName = "BrandImg", Value = Newtonsoft.Json.JsonConvert.SerializeObject(imgList) });
// parameters.Add(new MySqlParameter() { ParameterName = "CreateDate", Value = DateTime.Now });
// parameters.Add(new MySqlParameter() { ParameterName = "UpdateDate", Value = DateTime.Now });
// parameters.Add(new MySqlParameter() { ParameterName = "MoreDesc", Value = bottom_remark });
// parameters.Add(new MySqlParameter() { ParameterName = "RemarkDesc", Value = remark });
// // var res = Test.DBHelper.MySqlHelper.ExecuteNonQuery(Test.DBHelper.MySqlHelper.defaultConnection, System.Data.CommandType.Text, sql, parameters.ToArray());
//}
//else
//{
// string str = "";
//}
}
}
}
......
......@@ -47,14 +47,14 @@ namespace Test.Helper
foreach (var item in imgList)
{
string newStr = item.Replace("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com", "http://kydwx.oss-cn-hangzhou.aliyuncs.com/");
CreateImage(newStr);
//CreateImage(newStr);
}
}
string customShareImage = res.Tables[0].Rows[i]["CustomShareImage"].ToString();
if (!string.IsNullOrEmpty(customShareImage))
{
string newStr = customShareImage.Replace("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com", "http://kydwx.oss-cn-hangzhou.aliyuncs.com/");
CreateImage(newStr);
//CreateImage(newStr);
}
Console.WriteLine(string.Format("{0}/{1} 已完成", i + 1, res.Tables[0].Rows.Count));
}
......@@ -70,7 +70,7 @@ namespace Test.Helper
if (!string.IsNullOrEmpty(image))
{
string newStr = image.Replace("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com", "http://kydwx.oss-cn-hangzhou.aliyuncs.com/");
CreateImage(newStr);
//CreateImage(newStr);
Console.WriteLine(string.Format("{0}/{1} 已完成", i + 1, res2.Tables[0].Rows.Count));
}
}
......@@ -86,7 +86,7 @@ namespace Test.Helper
if (!string.IsNullOrEmpty(image))
{
string newStr = image.Replace("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com", "http://kydwx.oss-cn-hangzhou.aliyuncs.com/");
CreateImage(newStr);
//CreateImage(newStr);
Console.WriteLine(string.Format("{0}/{1} 已完成", i + 1, res3.Tables[0].Rows.Count));
}
}
......@@ -318,7 +318,7 @@ namespace Test.Helper
{
try
{
CreateImage(subItem.url);
// CreateImage(subItem.url);
string path = "https://viitto-1301420277.cos.ap-chengdu.myqcloud.com" + GetFileUrl(subItem.url);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendFormat("INSERT INTO rb_material_info(Name,Type,GroupId,Path,Image,VideoTime,WithHeight,TenantId,MallBaseId,CreateDate,UpdateDate,Recycled,Status)");
......@@ -396,7 +396,7 @@ namespace Test.Helper
/// 生成图片
/// </summary>
/// <param name="url"></param>
public static void CreateImage(string url)
public static void CreateImage(string url,out string fileName)
{
string tempPath = GetFileUrl(url);
string path = Environment.CurrentDirectory +"/NewImage/"+ tempPath;//下载到的地址+文件名 // 设置参数
......@@ -410,6 +410,7 @@ namespace Test.Helper
{
System.IO.Directory.CreateDirectory(newFilePath);
}
fileName = Path.GetFileName(url);
//创建本地文件写入流
Stream stream = new FileStream(path, FileMode.Create);
byte[] bArr = new byte[1024];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment