Commit 04684870 authored by liudong1993's avatar liudong1993
parents aaafd0d6 ca37b02d
......@@ -83,5 +83,10 @@ namespace Mall.Model.Entity.User
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
}
}
......@@ -76,5 +76,15 @@ namespace Mall.Model.Entity.User
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
}
}
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic
{
/// <summary>
/// 专题Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 标题
/// </summary>
public string Title
{
get;
set;
}
/// <summary>
/// 专题列表布局方式
/// </summary>
public int? FlexType
{
get;
set;
}
/// <summary>
/// 封面图
/// </summary>
public string CoverImg
{
get;
set;
}
/// <summary>
/// 摘要
/// </summary>
public string Abstract
{
get;
set;
}
/// <summary>
/// 自定义分享标题
/// </summary>
public string CustomTitle
{
get;
set;
}
/// <summary>
/// 自定义分享图片
/// </summary>
public string CustomImg
{
get;
set;
}
/// <summary>
/// 是否精选(1-是)
/// </summary>
public int? IsChoice
{
get;
set;
}
/// <summary>
/// 分类编号
/// </summary>
public int? TopicTypeId
{
get;
set;
}
/// <summary>
/// 阅读数量
/// </summary>
public int? ReadNum
{
get;
set;
}
/// <summary>
/// 排序
/// </summary>
public int? SortNum
{
get;
set;
}
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 模板数据[JSON]格式
/// </summary>
public string TemplateData { get; set; }
}
}
......@@ -302,6 +302,98 @@ namespace Mall.Model.Extend.MarketingCenter
public string btnTextColor { get; set; }
}
/// <summary>
/// 专题插件
/// </summary>
public class topicItem
{
/// <summary>
/// 样式
/// </summary>
public string normal { get; set; }
public int count { get; set; }
public string logo_1 { get; set; }
public string logo_2 { get; set; }
public string icon { get; set; }
/// <summary>
/// 是否显示分类
/// </summary>
public bool cat_show { get; set; }
/// <summary>
/// 专题列表
/// </summary>
public List<topicDetailsItem> topic_list { get; set; }
/// <summary>
/// 专题分类列表
/// </summary>
public List<topicTypeItem> list { get; set; }
}
/// <summary>
/// 专题分类
/// </summary>
public class topicTypeItem
{
/// <summary>
/// 分类Id
/// </summary>
public int cat_id { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public int cat_name { get; set; }
/// <summary>
/// 分类名称
/// </summary>
public int name { get; set; }
public int custom { get; set; }
public int number { get; set; }
public List<object> children { get; set; }
}
/// <summary>
/// 专题列表详情
/// </summary>
public class topicDetailsItem
{
/// <summary>
/// 专题标题
/// </summary>
public string title { get; set; }
/// <summary>
/// 专题封面图
/// </summary>
public string cover_pic { get; set; }
/// <summary>
/// 专题阅读数量
/// </summary>
public int read_count { get; set; }
/// <summary>
///
/// </summary>
public int layout { get; set; }
/// <summary>
///
/// </summary>
public int id { get; set; }
}
/// <summary>
/// 标题组件
/// </summary>
......
......@@ -13,6 +13,16 @@ namespace Mall.Model.Entity.User
[DB(ConnectionName = "DefaultConnection")]
public class RB_Employee_Extend : Model.Entity.User.RB_Employee
{
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateDateStr
{
get {
string str = "";
str = Convert.ToDateTime(this.CreateDate).ToString("yyyy-MM-dd HH:mm:ss");
return str;
}
}
}
}
\ No newline at end of file
......@@ -13,5 +13,22 @@ namespace Mall.Model.Entity.User
[DB(ConnectionName = "DefaultConnection")]
public class RB_Role_Extend : Model.Entity.User.RB_Role
{
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateDateStr
{
get
{
string str = "";
str = Convert.ToDateTime(this.CreateDate).ToString("yyyy-MM-dd HH:mm:ss");
return str;
}
}
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
\ No newline at end of file
using Mall.Common.AOP;
using Mall.Common.Enum.User;
using Mall.Model.Extend.MarketingCenter;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 专题表扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Topic_Extend : Model.Entity.User.RB_Topic
{
/// <summary>
/// 专题名称
/// </summary>
public string TopicName { get; set; }
/// <summary>
/// 专题列表布局方式
/// </summary>
public string FlexTypeStr
{
get
{
string str = "";
if (this.FlexType > 0)
{
switch (Convert.ToInt32(this.FlexType))
{
case 1: str = "小图模式"; break;
case 2: str = "大图模式"; break;
case 3: str = "多图模式"; break;
}
}
return str;
}
}
/// <summary>
/// 是否精选字符串
/// </summary>
public string IsChoiceStr
{
get
{
string str = "";
if (this.IsChoice >= 0)
{
switch (Convert.ToInt32(this.IsChoice))
{
case 0: str = "否"; break;
case 1: str = "是"; break;
}
}
return str;
}
}
/// <summary>
/// 前端组件
/// </summary>
public List<ComponentItem> ComponentDataList { get; set; }
}
}
......@@ -101,6 +101,9 @@ namespace Mall.Module.MarketingCenter
case "nav": item.data = JsonHelper.DeserializeObject<navItem>(item.data.ToString()); break;
case "banner": item.data = JsonHelper.DeserializeObject<bannerItem>(item.data.ToString()); break;
case "notice": item.data = JsonHelper.DeserializeObject<noticeItem>(item.data.ToString()); break;
//专题
case "topic": item.data = JsonHelper.DeserializeObject<topicItem>(item.data.ToString()); break;
case "link": item.data = JsonHelper.DeserializeObject<linkItem>(item.data.ToString()); break;
case "rubik": item.data = JsonHelper.DeserializeObject<rubikItem>(item.data.ToString()); break;
case "video": item.data = JsonHelper.DeserializeObject<videoItem>(item.data.ToString()); break;
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Plugin;
using Mall.Model.Entity.User;
using Mall.Model.Extend.MarketingCenter;
using Mall.Model.Extend.User;
using Mall.Repository;
using Mall.Repository.User;
......@@ -33,6 +35,11 @@ namespace Mall.Module.User
/// </summary>
private RB_ArticleRepository articleRepository = new RB_ArticleRepository();
/// <summary>
/// 专题仓储层对象
/// </summary>
private RB_TopicRepository topicRepository = new RB_TopicRepository();
#region 专题分类
/// <summary>
......@@ -129,6 +136,109 @@ namespace Mall.Module.User
}
#endregion
#region 专题
/// <summary>
/// 专题分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicPageListModule(int pageIndex, int pageSize, out long rowCount, RB_Topic_Extend query)
{
return topicRepository.GetTopicPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicListModule(RB_Topic_Extend query)
{
return topicRepository.GetTopicListRepository(query);
}
/// <summary>
/// 新增修改专题
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTopicModule(RB_Topic_Extend extModel)
{
bool flag = false;
if (extModel.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Extend.Title),extModel.Title.Trim()},
{ nameof(RB_Topic_Extend.FlexType),extModel.FlexType},
{ nameof(RB_Topic_Extend.CoverImg),extModel.CoverImg},
{ nameof(RB_Topic_Extend.Abstract),extModel.Abstract},
{ nameof(RB_Topic_Extend.CustomTitle),extModel.CustomTitle},
{ nameof(RB_Topic_Extend.CustomImg),extModel.CustomImg},
{ nameof(RB_Topic_Extend.IsChoice),extModel.IsChoice},
{ nameof(RB_Topic_Extend.TopicTypeId),extModel.TopicTypeId},
{ nameof(RB_Topic_Extend.ReadNum),extModel.ReadNum},
{ nameof(RB_Topic_Extend.SortNum),extModel.SortNum},
};
flag = topicRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Extend.Id), extModel.Id));
}
else
{
var newId = topicRepository.Insert(extModel);
extModel.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 获取专题实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Topic_Extend GetTopicModule(object Id)
{
var extModel= topicRepository.GetEntity<RB_Topic_Extend>(Id);
if (extModel.TemplateData != null && !string.IsNullOrEmpty(extModel.TemplateData))
{
extModel.ComponentDataList = JsonHelper.DeserializeObject<List<ComponentItem>>(extModel.TemplateData);
if (extModel.ComponentDataList != null && extModel.ComponentDataList.Count > 0)
{
foreach (var item in extModel.ComponentDataList)
{
switch (item.Id)
{
case "rubik": item.data = JsonHelper.DeserializeObject<rubikItem>(item.data.ToString()); break;
case "video": item.data = JsonHelper.DeserializeObject<videoItem>(item.data.ToString()); break;
case "image-text": item.data = JsonHelper.DeserializeObject<imagetextItem>(item.data.ToString()); break;
}
}
}
}
return extModel;
}
/// <summary>
/// 删除专题
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool RemoveTopicModule(object Id)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Topic_Extend.Status),1},
};
flag = topicRepository.Update(fileds, new WhereHelper(nameof(RB_Topic_Extend.Id), Id));
return flag;
}
#endregion
#region 门店
/// <summary>
......
......@@ -146,7 +146,6 @@ namespace Mall.Module.User
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Employee_Extend.EmpAccount),extModel.EmpAccount.Trim()},
{ nameof(RB_Employee_Extend.EmpPwd),extModel.EmpPwd},
{ nameof(RB_Employee_Extend.EmpName),extModel.EmpName},
{ nameof(RB_Employee_Extend.RoleAuth),extModel.RoleAuth},
};
......@@ -161,6 +160,22 @@ namespace Mall.Module.User
return flag;
}
/// <summary>
/// 修改员工密码
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetEmployeePwdModule(RB_Employee_Extend extModel)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Employee_Extend.EmpPwd),extModel.EmpPwd},
};
flag = employeeRepository.Update(fileds, new WhereHelper(nameof(RB_Employee_Extend.EmpId), extModel.EmpId));
return flag;
}
/// <summary>
/// 获取员工实体
/// </summary>
......@@ -198,7 +213,13 @@ namespace Mall.Module.User
/// <returns></returns>
public RB_Emp_Config_Extend GetEmpConfigListModule(RB_Emp_Config_Extend query)
{
return emp_ConfigRepository.GetEmpConfigListRepository(query)?.FirstOrDefault();
RB_Emp_Config_Extend extModel = new RB_Emp_Config_Extend();
var list = emp_ConfigRepository.GetEmpConfigListRepository(query);
if (list != null)
{
extModel = list.FirstOrDefault();
}
return extModel;
}
/// <summary>
......@@ -209,6 +230,11 @@ namespace Mall.Module.User
public bool SetEmpConfigModule(RB_Emp_Config_Extend extModel)
{
bool flag = false;
var defaultModel = GetEmpConfigListModule(new RB_Emp_Config_Extend() { MallBaseId = extModel.MallBaseId, TenantId = extModel.TenantId });
if (defaultModel != null && defaultModel.ConfigId>0)
{
extModel.ConfigId = defaultModel.ConfigId;
}
if (extModel.ConfigId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
......
......@@ -20,7 +20,7 @@ namespace Mall.Repository.User
public List<RB_Emp_Config_Extend> GetEmpConfigListRepository(RB_Emp_Config_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Emp_Config WHERE 1=1 AND Status=0 ");
builder.AppendFormat(@" SELECT * FROM RB_Emp_Config WHERE 1=1 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Emp_Config_Extend.TenantId), query.TenantId);
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 专题表仓储层
/// </summary>
public class RB_TopicRepository : RepositoryBase<RB_Topic>
{
/// <summary>
/// 专题分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Topic_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,B.TopicName FROM RB_Topic AS A LEFT JOIN rb_topic_type AS B ON A.TopicTypeId=B.Id
WHERE 1=1 AND A.Status=0
");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.Id), query.Id);
}
if (query.Title != null && !string.IsNullOrEmpty(query.Title.Trim()))
{
builder.AppendFormat(" AND A.{0} LIKE '%{1}%' ", nameof(RB_Topic_Extend.Title), query.Title.Trim());
}
if (query.TopicTypeId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Topic_Extend.TopicTypeId), query.TopicTypeId);
}
builder.Append(" ORDER BY A.SortNum ");
return GetPage<RB_Topic_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Topic_Extend> GetTopicListRepository(RB_Topic_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Topic WHERE 1=1 AND Status=0 ");
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.MallBaseId), query.MallBaseId);
}
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Topic_Extend.Id), query.Id);
}
if (query.Title != null && !string.IsNullOrEmpty(query.Title.Trim()))
{
builder.AppendFormat(" AND {0} LIKE '%{1}%' ", nameof(RB_Topic_Extend.Title), query.Title.Trim());
}
builder.Append(" ORDER BY SortNum ");
return Get<RB_Topic_Extend>(builder.ToString()).ToList();
}
}
}
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Google.Protobuf.WellKnownTypes;
using Mall.Common.API;
......@@ -59,143 +60,147 @@ namespace Mall.WebApi.Controllers.ByteDance
}
/// <summary>
/// 向客户抖音小程序发送消息
/// </summary>
/// <param name="content"></param>
/// <param name="model"></param>
/// <param name="ID"></param>
/// <param name="guestModel"></param>
public void SendMsg(string content, ByteDanceCustomer model, int ID, RB_Member_User userModel)
{
///// <summary>
///// 向客户抖音小程序发送消息
///// </summary>
///// <param name="content"></param>
///// <param name="model"></param>
///// <param name="ID"></param>
///// <param name="guestModel"></param>
//public void SendMsg(string content, ByteDanceCustomer model, int ID, RB_Member_User userModel)
//{
//谁来接受微信消息通知
string tempOpenId = model.Openid;
//要使用的form_id
string formId = "";
// //谁来接受微信消息通知
// string tempOpenId = model.Openid;
// //要使用的form_id
// string formId = "";
var list = CacheManager.ByteDance.ByteDanceRedis.GetByteDanceList(model.UserID, formId);
if (list != null && list.Any())
{
formId = list.OrderBy(x => x.FormCreateDate).FirstOrDefault().FormId;
string WeChatSendTemplate = Common.Config.ByteDanceSendTemplate;
var tempData = new
{
// var list = CacheManager.ByteDance.ByteDanceRedis.GetByteDanceList(model.UserID, formId);
// if (list != null && list.Any())
// {
// formId = list.OrderBy(x => x.FormCreateDate).FirstOrDefault().FormId;
// string WeChatSendTemplate = Common.Config.ByteDanceSendTemplate;
// var tempData = new
// {
keyword1 = new
{
value = "旅客意见调查表",
},
keyword2 = new
{
value = userModel.AliasName,
},
keyword3 = new
{
value = content,
},
};
//拼接字符串
var msgData = new
{
access_token = "",
touser = tempOpenId,//openId,推送给谁,给那个用户
template_id = WeChatSendTemplate,//模板消息ID,在微信小程序后台的模板消息里有.。这个是*****成功通知。的id
// topcolor = "#173177",
page = "",//点击消息卡片之后打开的小程序页面地址,空则无跳转。       
form_id = formId,//要从服务器数据库里取最近7天时间最长的一条没有使用的来,用完了要设置这个formId被用过了。
data = tempData
};
// keyword1 = new
// {
// value = "旅客意见调查表",
// },
// keyword2 = new
// {
// value = userModel.AliasName,
// },
// keyword3 = new
// {
// value = content,
// },
// };
// //拼接字符串
// var msgData = new
// {
// access_token = "",
// touser = tempOpenId,//openId,推送给谁,给那个用户
// template_id = WeChatSendTemplate,//模板消息ID,在微信小程序后台的模板消息里有.。这个是*****成功通知。的id
// // topcolor = "#173177",
// page = "",//点击消息卡片之后打开的小程序页面地址,空则无跳转。       
// form_id = formId,//要从服务器数据库里取最近7天时间最长的一条没有使用的来,用完了要设置这个formId被用过了。
// data = tempData
// };
string postData = JsonHelper.Serialize(msgData);
string tempUrl = "https://developer.toutiao.com/api/apps/game/template/send";
string resulr = WebRequestPostOrGet(tempUrl, postData);
CacheManager.ByteDance.ByteDanceRedis.RemoveCacheKey(model.UserID.ToString(), formId, model);
}
}
// string postData = JsonHelper.Serialize(msgData);
// string tempUrl = "https://developer.toutiao.com/api/apps/game/template/send";
// string resulr = WebRequestPostOrGet(tempUrl, postData);
// CacheManager.ByteDance.ByteDanceRedis.RemoveCacheKey(model.UserID.ToString(), formId, model);
// }
//}
///// <summary>
///// 发送消息
///// </summary>
///// <param name="sUrl"></param>
///// <param name="sParam"></param>
///// <returns></returns>
//public static string WebRequestPostOrGet(string sUrl, string sParam)
//{
// byte[] bt = System.Text.Encoding.UTF8.GetBytes(sParam);
// Uri uriurl = new Uri(sUrl);
// HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uriurl);//HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url + (url.IndexOf("?") > -1 ? "" : "?") + param);
// req.Method = "Post";
// req.Timeout = 120 * 1000;
// req.ContentType = "application/x-www-form-urlencoded;";
// req.ContentLength = bt.Length;
// using (Stream reqStream = req.GetRequestStream())//using 使用可以释放using段内的内存
// {
// reqStream.Write(bt, 0, bt.Length);
// reqStream.Flush();
// }
// try
// {
// using (WebResponse res = req.GetResponse())
// {
// Stream resStream = res.GetResponseStream();
// StreamReader resStreamReader = new StreamReader(resStream, System.Text.Encoding.UTF8);
// string resLine;
// System.Text.StringBuilder resStringBuilder = new System.Text.StringBuilder();
// while ((resLine = resStreamReader.ReadLine()) != null)
// {
// resStringBuilder.Append(resLine + System.Environment.NewLine);
// }
// resStream.Close();
// resStreamReader.Close();
// return resStringBuilder.ToString();
// }
// }
// catch (Exception ex)
// {
// return ex.Message;//url错误时候回报错
// }
//}
/// <summary>
/// 发送消息
/// 输入手机号码获取抖音小程序短信验证码
/// </summary>
/// <param name="sUrl"></param>
/// <param name="sParam"></param>
/// <returns></returns>
public static string WebRequestPostOrGet(string sUrl, string sParam)
[HttpPost]
public ApiResult GetMobileCode()
{
byte[] bt = System.Text.Encoding.UTF8.GetBytes(sParam);
Uri uriurl = new Uri(sUrl);
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(uriurl);//HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url + (url.IndexOf("?") > -1 ? "" : "?") + param);
req.Method = "Post";
req.Timeout = 120 * 1000;
req.ContentType = "application/x-www-form-urlencoded;";
req.ContentLength = bt.Length;
using (Stream reqStream = req.GetRequestStream())//using 使用可以释放using段内的内存
{
reqStream.Write(bt, 0, bt.Length);
reqStream.Flush();
}
try
var parms = RequestParm;
JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
string mobile = parmsJob.GetStringValue("mobile");
string info = ExecuteInCmd($"bytecli -l {mobile}");
if (info.IndexOf("获取验证码成功") > -1)
{
using (WebResponse res = req.GetResponse())
{
Stream resStream = res.GetResponseStream();
StreamReader resStreamReader = new StreamReader(resStream, System.Text.Encoding.UTF8);
string resLine;
System.Text.StringBuilder resStringBuilder = new System.Text.StringBuilder();
while ((resLine = resStreamReader.ReadLine()) != null)
{
resStringBuilder.Append(resLine + System.Environment.NewLine);
}
resStream.Close();
resStreamReader.Close();
return resStringBuilder.ToString();
}
return ApiResult.Success("获取验证码成功,请查看手机,输入验证码", info);
}
catch (Exception ex)
else
{
return ex.Message;//url错误时候回报错
return ApiResult.Failed("获取验证失败");
}
}
public ApiResult GetTest()
{
string info = ExecuteInCmd("ipconfig");
// ProcessCore.ExecuteOutCmd("-I http://www.baidu.com", @"C:\curl.exe");
return ApiResult.Success("", info);
}
/// <summary>
/// 执行外部命令
/// 输入手机号码获取抖音小程序短信验证码
/// </summary>
/// <param name="argument">命令参数</param>
/// <param name="application">命令程序路径</param>
/// <returns>执行结果</returns>
public static string ExecuteOutCmd(string argument, string applocaltion)
/// <returns></returns>
[HttpPost]
public ApiResult GetLogin()
{
using (var process = new System.Diagnostics.Process())
var parms = RequestParm;
JObject parmsJob = JObject.Parse(RequestParm.msg.ToString());
string mobile = parmsJob.GetStringValue("mobile");
string code = parmsJob.GetStringValue("code");
string info = ExecuteInCmd($"bytecli -l {mobile}@{code}");
if (info.IndexOf("获取验证码成功") > -1)
{
process.StartInfo.Arguments = argument;
process.StartInfo.FileName = applocaltion;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.StandardInput.AutoFlush = true;
process.StandardInput.WriteLine("exit");
//获取cmd窗口的输出信息
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
process.Close();
return output;
return ApiResult.Success("获取验证码成功,请查看手机,输入验证码", info);
}
else
{
return ApiResult.Failed("获取验证失败");
}
}
......@@ -207,27 +212,51 @@ namespace Mall.WebApi.Controllers.ByteDance
/// <returns>执行结果</returns>
public static string ExecuteInCmd(string cmdline)
{
using (var process = new System.Diagnostics.Process())
{
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
//创建ProcessInfo对象
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
psi.WorkingDirectory = "D:\\Tool\\bytedance\\bytedanceide\\resources\\app.asar.unpacked";
psi.StandardOutputEncoding = Encoding.UTF8;
// psi.StandardInputEncoding = Encoding.UTF8;
// Start the process
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
process.Start();
process.StandardInput.AutoFlush = true;
process.StandardInput.WriteLine(cmdline + "&exit");
proc.StandardInput.AutoFlush = true;
proc.StandardInput.WriteLine(cmdline + "&exit");
//获取cmd窗口的输出信息
string output = process.StandardOutput.ReadToEnd();
//获取cmd窗口的输出信息
string output = proc.StandardOutput.ReadToEnd();
process.WaitForExit();
process.Close();
proc.WaitForExit();
proc.Close();
return output;
}
return output;
//////using (var process = new System.Diagnostics.Process())
//////{
////// process.StartInfo.FileName = "cmd.exe cd 'D:\\Tool\\bytedance\\bytedanceide\\resources\\app.asar.unpacked\\bytecli.bat'";//后面的 \"D:\\ServKit\"替换为你需要的路径即可。
////// // process.StartInfo.FileName = "cmd.exe";
////// process.StartInfo.UseShellExecute = false;
////// process.StartInfo.RedirectStandardInput = true;
////// process.StartInfo.RedirectStandardOutput = true;
////// process.StartInfo.RedirectStandardError = true;
////// process.StartInfo.CreateNoWindow = true;
////// process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
////// process.Start();
////// process.StandardInput.AutoFlush = true;
////// process.StandardInput.WriteLine(cmdline + "&exit");
////// //获取cmd窗口的输出信息
////// string output = process.StandardOutput.ReadToEnd();
////// process.WaitForExit();
////// process.Close();
////// return output;
//////}
}
}
......
......@@ -25,7 +25,7 @@ namespace Mall.WebApi.Controllers.MarketingCenter
/// <summary>
/// 设置购物车数量
/// 获取用户未使用的优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
......
......@@ -42,6 +42,16 @@ namespace Mall.WebApi.Controllers.User
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = module.GetRolePageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.Account ?? "";
}
}
}
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
......@@ -70,6 +80,9 @@ namespace Mall.WebApi.Controllers.User
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
Int32.TryParse(RequestParm.uid, out int Uid);
extModel.CreateBy = Uid;
extModel.CreateDate = DateTime.Now;
var flag = module.SetRoleModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......@@ -140,10 +153,24 @@ namespace Mall.WebApi.Controllers.User
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
extModel.EmpPwd = Common.DES.Encrypt(extModel.EmpPwd, Common.Config.WebApiKey, Common.Config.WebApiIV);
var flag = module.SetEmployeeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改密码
/// </summary>
/// <returns></returns>
public ApiResult SetEmployeePwd()
{
var extModel = JsonConvert.DeserializeObject<RB_Employee_Extend>(RequestParm.msg.ToString());
extModel.EmpPwd = Common.DES.Encrypt(extModel.EmpPwd, Common.Config.WebApiKey, Common.Config.WebApiIV);
var flag = module.SetEmployeePwdModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取员工实体
/// </summary>
......@@ -169,7 +196,7 @@ namespace Mall.WebApi.Controllers.User
}
#endregion
#region 员工管理
#region 员工配置管理
/// <summary>
......
......@@ -115,6 +115,81 @@ namespace Mall.WebApi.Controllers.User
#endregion
#region 专题
/// <summary>
/// 专题分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicPageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取专题列表
/// </summary>
/// <returns></returns>
public ApiResult GetTopicList()
{
var query = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = contentModule.GetTopicListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 新增修改专题
/// </summary>
/// <returns></returns>
public ApiResult SetTopic()
{
var extModel = JsonConvert.DeserializeObject<RB_Topic_Extend>(RequestParm.msg.ToString());
extModel.Status = 0;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
extModel.CreateDate = DateTime.Now;
if (extModel.ComponentDataList != null && extModel.ComponentDataList.Count > 0)
{
extModel.TemplateData = JsonConvert.SerializeObject(extModel.ComponentDataList);
}
var flag = contentModule.SetTopicModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取专题实体
/// </summary>
/// <returns></returns>
public ApiResult GetTopic()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = contentModule.GetTopicModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除专题
/// </summary>
/// <returns></returns>
public ApiResult RemoveTopic()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var flag = contentModule.RemoveTopicModule(Id);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion
#region 门店
/// <summary>
......
......@@ -10,5 +10,6 @@
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>mall.oytour.com</NameOfLastUsedPublishProfile>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
\ No newline at end of file
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