搞不懂啥问题

This commit is contained in:
朱小炯 2025-09-08 15:25:38 +08:00
parent ed402df472
commit 085deceb17
5 changed files with 293 additions and 131 deletions

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.IO; using System.IO;
using System.Linq;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Security.Cryptography; using System.Security.Cryptography;
@ -23,6 +24,45 @@ namespace Mini.Common
return ConfigHelper.GetSectionValue(key); return ConfigHelper.GetSectionValue(key);
} }
/// <summary>
/// 获取时间戳
/// </summary>
/// <returns></returns>
public static Int64 GetTimeStamp(bool isMinseconds = false)
{
var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
long times = Convert.ToInt64(isMinseconds ? ts.TotalMilliseconds : ts.TotalSeconds);
return times;
}
/// <summary>
/// 加密
/// </summary>
/// <param name="clientId"></param>
/// <param name="paramData"></param>
/// <returns></returns>
public static string encyptDataByConfig(string clientId, string paramData)
{
//if (!bWithEncypt)
// return paramData;
ClientKey client = ClientKey.GetClientKey(clientId);
if (client == null)
throw new Exception("非法客户端访问");
return encyptData(paramData, client.AccessKey);
}
public static string encyptData(string ciphertext, string accessKey)
{
SymmetricAlgorithm des = new DESCryptoServiceProvider();
Encoding utf = new UTF8Encoding();
byte[] key = utf.GetBytes(accessKey);
byte[] iv = { 0x75, 0x70, 0x63, 0x68, 0x69, 0x6e, 0x61, 0x31 };
ICryptoTransform encryptor = des.CreateEncryptor(key, iv);
byte[] data = utf.GetBytes(ciphertext);
byte[] encData = encryptor.TransformFinalBlock(data, 0, data.Length);
return Convert.ToBase64String(encData);
}
/// <summary> /// <summary>
/// DataTable 转list /// DataTable 转list
@ -302,7 +342,11 @@ namespace Mini.Common
} }
} }
} }
public static long ConvertDateTimeLong(System.DateTime time)
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
return (long)(time - startTime).TotalSeconds * 1000;
}
/// <summary> /// <summary>
/// 对DES加密后的字符串进行解密 /// 对DES加密后的字符串进行解密
/// </summary> /// </summary>
@ -971,4 +1015,52 @@ namespace Mini.Common
catch { return null; } catch { return null; }
} }
} }
public sealed class ClientKey
{
private ClientKey(string _Id, string _Name, string _AccessKey)
{
Id = _Id;
Name = _Name;
AccessKey = _AccessKey;
}
public string Id
{
get;
private set;
}
public string Name
{
get;
private set;
}
public string AccessKey
{
get;
private set;
}
private static List<ClientKey> clientList;
static ClientKey()
{
clientList = new List<ClientKey>();
clientList.Add(new ClientKey("UPWEBSITE", "UP网站", "1622a92d"));
clientList.Add(new ClientKey("TDORDERSITE", "订单接口", "622a92d1"));
clientList.Add(new ClientKey("UPPRODUCT", "UP产品端", "c268a2cd"));
clientList.Add(new ClientKey("gd_crm", "UPCRM", "upchina."));
clientList.Add(new ClientKey("nj_crm", "UPCRM", "pchina.1"));
clientList.Add(new ClientKey("AYCRM2_CTI", "CTI", "ac910f51"));
clientList.Add(new ClientKey("WX_EXT", "企微相关外部链接", "dwj5rc8x"));
clientList.Add(new ClientKey("saleclue", "线索专用", "dwddsj5d"));//线索专用,跨本系统
}
public static ClientKey GetClientKey(string clientId)
{
return clientList.FirstOrDefault(obj => obj.Id == clientId);
}
}
} }

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Mini.Model.DTO
{
public class saledsleadDesDto
{
public string appid { get; set; }
public string appuserid { get; set; }
public string deptid { get; set; }
public string eid { get; set; }
public string employee_id { get; set; }
public string employeeid { get; set; }
public string employee { get; set; }
public string ext_flag { get; set; }
}
}

View File

@ -25,6 +25,7 @@ using Mini.Web.WebHelper;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Security.Cryptography;
namespace Mini.Web.Areas.Admin.Controllers namespace Mini.Web.Areas.Admin.Controllers
{ {
public class OutHHuserController : Controller public class OutHHuserController : Controller
@ -653,7 +654,7 @@ namespace Mini.Web.Areas.Admin.Controllers
} }
[Area("Admin")] [Area("Admin")]
public ActionResult User_extuserList(string exuserid, string isHg, string showstyle, string userIds, string companycode,string canLookComapyCode) public ActionResult User_extuserList(string exuserid, string isHg, string showstyle, string userIds, string companycode, string canLookComapyCode, int eid, bool isChoose = false)
{ {
List<Wx_ExuserModel> list = new List<Wx_ExuserModel>(); List<Wx_ExuserModel> list = new List<Wx_ExuserModel>();
try try
@ -670,7 +671,7 @@ namespace Mini.Web.Areas.Admin.Controllers
{ {
if (!ids.Contains(item.userid)) if (!ids.Contains(item.userid))
{ {
item.isOutDept=1; item.isOutDept = 1;
} }
} }
} }
@ -722,42 +723,43 @@ namespace Mini.Web.Areas.Admin.Controllers
{ {
LogHelper.Error("错误:" + e.ToString()); LogHelper.Error("错误:" + e.ToString());
} }
ViewBag.isChoose = isChoose;
ViewBag.data = Common.JsonHelper.ObjDivertToJson(list); ViewBag.data = Common.JsonHelper.ObjDivertToJson(list);
ViewBag.roomData = Common.JsonHelper.ObjDivertToJson(roomeCList);//群的列表 ViewBag.roomData = Common.JsonHelper.ObjDivertToJson(roomeCList);//群的列表
ViewBag.isHg = isHg; ViewBag.isHg = isHg;
ViewBag.eid = eid;
return View();
}
[Area("Admin")]
public ActionResult User_extuserList2(string exuserid, string isHg, string showstyle, string userIds, string companycode, string canLookComapyCode)
{
List<Wx_ExuserModel> list = new List<Wx_ExuserModel>();
try
{
if (!string.IsNullOrEmpty(exuserid))
{
list = _iww_hhuser_service.Extuser_GetAllUser_check(exuserid, companycode).Where(p => p.isOutDept != 1).ToList();
foreach (var item in list)
{
item.name = ManagerPhoneHelper.FormatPhoneUserName(string.Format("{0}", item.name));
}
}
}
catch (Exception e)
{
LogHelper.Error(e.ToString());
}
ViewBag.data = Common.JsonHelper.ObjDivertToJson(list);
//ViewBag.roomData = Common.JsonHelper.ObjDivertToJson(roomeCList);//群的列表
ViewBag.isHg = isHg;
return View(); return View();
} }
[Area("Admin")]
public ActionResult User_extuserList2(string exuserid, string isHg, string showstyle, string userIds, string companycode, string canLookComapyCode)
{
List<Wx_ExuserModel> list = new List<Wx_ExuserModel>();
try
{
if (!string.IsNullOrEmpty(exuserid))
{
list = _iww_hhuser_service.Extuser_GetAllUser_check(exuserid, companycode).Where(p => p.isOutDept != 1).ToList();
foreach (var item in list) [Area("Admin")]
{
item.name = ManagerPhoneHelper.FormatPhoneUserName(string.Format("{0}", item.name));
}
}
}
catch (Exception e)
{
LogHelper.Error(e.ToString());
}
ViewBag.data = Common.JsonHelper.ObjDivertToJson(list);
//ViewBag.roomData = Common.JsonHelper.ObjDivertToJson(roomeCList);//群的列表
ViewBag.isHg = isHg;
return View();
}
[Area("Admin")]
public ActionResult OneMessage(string corpid, string name, string extuserid, string uname, string userid) public ActionResult OneMessage(string corpid, string name, string extuserid, string uname, string userid)
{ {
@ -779,7 +781,116 @@ namespace Mini.Web.Areas.Admin.Controllers
/// <param name="locationJson">定位的json信息</param> /// <param name="locationJson">定位的json信息</param>
/// <returns></returns> /// <returns></returns>
[Area("Admin")] [Area("Admin")]
public ActionResult MessageDetial(string isgroup, string userid, string uname, string corp, string customer, string nickname, string isHg, string locationJson) public ActionResult MessageDetial(string isgroup, string userid, string uname, string corp, string customer, string nickname, string isHg, string locationJson, string eid, string deptid, string ext_flag)
{
string[] ROLES = { "NONW" };
ViewBag.IsHiddenEWM = MangerEWM.GetIsHiddenEWM(ROLES);
ViewBag.userid = userid;
ViewBag.uname = uname;
ViewBag.corp = corp;
ViewBag.customer = customer;
ViewBag.nickname = nickname;
ViewBag.isgroup = isgroup;
ViewBag.locationJson = string.IsNullOrEmpty(locationJson) ? "{\"NeedLocaltion\":0}" : locationJson;
bool IsCanLoadKeyWords = false;
if (isHg != null && isHg == "True")
{
IsCanLoadKeyWords = true;
}
ViewBag.IsCanLoadKeyWords = IsCanLoadKeyWords;
if (IsCanLoadKeyWords)
ViewBag.KeyWrods = _bas_parameter.GetParameterValue(ParameterEnums.WeiXin_IllegalKewords);
else
ViewBag.KeyWrods = "";
var content = "";
var j = "";
if (customer == null)
{
ViewBag.content = "";
}
else
{
ext_flag = Utility.Decrypt(ext_flag);
j = JsonConvert.SerializeObject(new saledsleadDesDto { appid = $"{corp}_1", appuserid = customer, deptid = deptid, eid = eid, employeeid = eid, employee_id = eid, employee = eid, ext_flag = ext_flag });
content = Utility.encyptDataByConfig("saleclue", Newtonsoft.Json.JsonConvert.SerializeObject
(
new { account = "account", password = "password", appid = $"{corp}_1", appuserid = customer, employee_id = eid, time = Utility.GetTimeStamp() }
)
);
ViewBag.content = System.Web.HttpUtility.UrlEncode(content);
}
ViewBag.ShowSaleLine = _bas_parameter.GetParameterValue(ParameterEnums.ShowSaleLine);
ViewBag.SaleLineHttp = _bas_parameter.GetParameterValue(ParameterEnums.SaleLineHttp);
List<Wx_ExuserModel> list = new List<Wx_ExuserModel>();
string zhi = _bas_parameter.GetParameterValue(ParameterEnums.ShowOtherSaleLT);
if (!string.IsNullOrEmpty(customer) && zhi == "true")
list = _iww_hhuser_service.Extuser_GetAllUser(customer);//外部联系人
ViewBag.OtherKeFu = list.Where(m => m.userid != userid).ToList();//其他客服,排除掉当前客服
string folderName = string.Format("temp_{0}_{1}_{2}", corp, userid, customer);
string groupname = "";
if (isgroup == "true")
{
Ww_MsgRoom model = _iww_hhuser_service.GetRoom(corp, customer);
ViewBag.roomInfo = model;
ViewBag.nickname = string.IsNullOrEmpty(model.roomname) ? "群:" + model.roomid : "群:" + model.roomname;
groupname = ViewBag.nickname;
List<GroupUser> info = _iww_hhuser_service.GetGroupUser(corp, model);
ViewBag.groupuser = Common.JsonHelper.ObjDivertToJson(info);
}
else
{
ViewBag.groupuser = "[]";
}
if (MessagePack.GenerateDownFile.ContainsKey(folderName))
{
ViewBag.IsPackNow = 1;//是不是正在下载
}
else
{
ViewBag.IsPackNow = 0;
var webPath = FileUnit.GetBaseDirectory();//站点目录
var tmpPath = Path.Combine(webPath, "temp");//临时文件目录
string zipPath = Path.Combine(tmpPath, folderName + ".zip");
ViewBag.folderName = folderName;
FileInfo info = new FileInfo(zipPath);
ViewBag.zipPathName = string.Format("{0} 与 {1} 的聊天记录", uname, nickname);
if (isgroup == "true")
{
ViewBag.zipPathName = string.Format("{0}的聊天记录", groupname);
}
if (info.Exists)
{
string name = info.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + ".zip";//获取最后修改时间
ViewBag.NowPathName = string.Format("{0} 与 {1} 的聊天记录{2}", uname, nickname, name);
if (isgroup == "true")
{
ViewBag.NowPathName = string.Format("{0}的聊天记录{1}", groupname, name);
}
}
else
{
ViewBag.NowPathName = "";
}
}
return View();
}
/// <summary>
///
/// </summary>
/// <param name="userid">客服ID</param>
/// <param name="uname">客服名称</param>
/// <param name="corp">公司ID</param>
/// <param name="customer">客户ID</param>
/// <param name="nickname">客户名称</param>
/// <param name="locationJson">定位的json信息</param>
/// <returns></returns>
[Area("Admin")]
public ActionResult MessageDetial10(string isgroup, string userid, string uname, string corp, string customer, string nickname, string isHg, string locationJson)
{ {
string[] ROLES = { "NONW" }; string[] ROLES = { "NONW" };
ViewBag.IsHiddenEWM = MangerEWM.GetIsHiddenEWM(ROLES); ViewBag.IsHiddenEWM = MangerEWM.GetIsHiddenEWM(ROLES);
@ -861,99 +972,6 @@ namespace Mini.Web.Areas.Admin.Controllers
} }
/// <summary>
///
/// </summary>
/// <param name="userid">客服ID</param>
/// <param name="uname">客服名称</param>
/// <param name="corp">公司ID</param>
/// <param name="customer">客户ID</param>
/// <param name="nickname">客户名称</param>
/// <param name="locationJson">定位的json信息</param>
/// <returns></returns>
[Area("Admin")]
public ActionResult MessageDetial10(string isgroup, string userid, string uname, string corp, string customer, string nickname, string isHg, string locationJson)
{
string[] ROLES = { "NONW" };
ViewBag.IsHiddenEWM = MangerEWM.GetIsHiddenEWM(ROLES);
ViewBag.userid = userid;
ViewBag.uname = uname;
ViewBag.corp = corp;
ViewBag.customer = customer;
ViewBag.nickname = nickname;
ViewBag.isgroup = isgroup;
ViewBag.locationJson = string.IsNullOrEmpty(locationJson) ? "{\"NeedLocaltion\":0}" : locationJson;
bool IsCanLoadKeyWords = false;
if (isHg != null && isHg == "True")
{
IsCanLoadKeyWords = true;
}
ViewBag.IsCanLoadKeyWords = IsCanLoadKeyWords;
if (IsCanLoadKeyWords)
ViewBag.KeyWrods = _bas_parameter.GetParameterValue(ParameterEnums.WeiXin_IllegalKewords);
else
ViewBag.KeyWrods = "";
ViewBag.ShowSaleLine = _bas_parameter.GetParameterValue(ParameterEnums.ShowSaleLine);
ViewBag.SaleLineHttp = _bas_parameter.GetParameterValue(ParameterEnums.SaleLineHttp);
List<Wx_ExuserModel> list = new List<Wx_ExuserModel>();
string zhi = _bas_parameter.GetParameterValue(ParameterEnums.ShowOtherSaleLT);
if (!string.IsNullOrEmpty(customer) && zhi == "true")
list = _iww_hhuser_service.Extuser_GetAllUser(customer);//外部联系人
ViewBag.OtherKeFu = list.Where(m => m.userid != userid).ToList();//其他客服,排除掉当前客服
string folderName = string.Format("temp_{0}_{1}_{2}", corp, userid, customer);
string groupname = "";
if (isgroup == "true")
{
Ww_MsgRoom model = _iww_hhuser_service.GetRoom(corp, customer);
ViewBag.roomInfo = model;
ViewBag.nickname = string.IsNullOrEmpty(model.roomname) ? "群:" + model.roomid : "群:" + model.roomname;
groupname = ViewBag.nickname;
List<GroupUser> info = _iww_hhuser_service.GetGroupUser(corp, model);
ViewBag.groupuser = Common.JsonHelper.ObjDivertToJson(info);
}
else
{
ViewBag.groupuser = "[]";
}
if (MessagePack.GenerateDownFile.ContainsKey(folderName))
{
ViewBag.IsPackNow = 1;//是不是正在下载
}
else
{
ViewBag.IsPackNow = 0;
var webPath = FileUnit.GetBaseDirectory();//站点目录
var tmpPath = Path.Combine(webPath, "temp");//临时文件目录
string zipPath = Path.Combine(tmpPath, folderName + ".zip");
ViewBag.folderName = folderName;
FileInfo info = new FileInfo(zipPath);
ViewBag.zipPathName = string.Format("{0} 与 {1} 的聊天记录", uname, nickname);
if (isgroup == "true")
{
ViewBag.zipPathName = string.Format("{0}的聊天记录", groupname);
}
if (info.Exists)
{
string name = info.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") + ".zip";//获取最后修改时间
ViewBag.NowPathName = string.Format("{0} 与 {1} 的聊天记录{2}", uname, nickname, name);
if (isgroup == "true")
{
ViewBag.NowPathName = string.Format("{0}的聊天记录{1}", groupname, name);
}
}
else
{
ViewBag.NowPathName = "";
}
}
return View();
}
[Area("Admin")] [Area("Admin")]
[HttpGet] [HttpGet]

View File

@ -604,9 +604,15 @@
}); });
} }
$(function () { $(function () {
var content = "@Html.Raw(ViewBag.content)" + "&clientid=WK_EXT";
$("#saleline").click(function () { $("#saleline").click(function () {
var url = "@Html.Raw(SaleLineHttp)"; var url = "@Html.Raw(SaleLineHttp)";
var saleurl = url.replace("{corp}", corp + "_1").replace("{appuserid}", cs_username);//http://sc.soft.dn8188.com/dev.html?appid={corp}&appuserid={appuserid} //var saleurl = url.replace("{corp}", corp + "_1").replace("{appuserid}", cs_username);//http://sc.soft.dn8188.com/dev.html?appid={corp}&appuserid={appuserid}
if ("@Html.Raw(ViewBag.content)"== "") {
layer.msg('请选择微信好友!');
return;
}
var saleurl = url.replace("{content}", content);
layer.open({ layer.open({
type: 2, type: 2,
content: saleurl, content: saleurl,

View File

@ -75,6 +75,10 @@
} }
</style> </style>
<div class="x-body"> <div class="x-body">
@if (ViewBag.isChoose)
{
<button class="layui-btn" id="userChoose">提交</button>
}
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table> <table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
<br /> <br />
<table class="layui-hide" id="tabl2" lay-filter="tabl2"></table> <table class="layui-hide" id="tabl2" lay-filter="tabl2"></table>
@ -96,7 +100,8 @@
}] }]
, ,
[ [
{ field: 'corpname', title: '企业号' } { field: 'checkobj', type: 'checkbox', fixed: 'left' }
,{ field: 'corpname', title: '企业号' }
, { field: 'name', title: '客户姓名' } , { field: 'name', title: '客户姓名' }
, { field: 'extuserid', title: '客户ID' } , { field: 'extuserid', title: '客户ID' }
, { field: 'uname', title: '客服姓名' } , { field: 'uname', title: '客服姓名' }
@ -154,14 +159,37 @@
]], ]],
}); });
$('#userChoose').on('click', function () {
var checkdata = table.checkStatus('wxmessagelist');
var uidata = checkdata.data;
if (uidata.length == 0) {
layer.msg("请至少选中一条记录!", { icon: 7 });
return;
}
var list = [];
for (var i = 0; i < uidata.length; i++)
{
var item= uidata[i];
var obj = {
corpid:item.corpid,
corpname:item.corpname,
extuserid:item.extuserid,
userid:item.userid,
ename:item.ename,
eid:item.eid
}
list.push(obj);
}
window.parent.postMessage({ type: "extuserInfo", list: list }, "*");
});
}); });
function showMessage(corpid, name, extuserid, uname, userid) { function showMessage(corpid, name, extuserid, uname, userid) {
//alert(username); //alert(username);
//alert(jobwxusername); //alert(jobwxusername);
//alert(companycode); //alert(companycode);
var url = "MessageDetial?isgroup=false&corp=" + corpid + "&nickname=" + name + "&customer=" + extuserid + "&uname=" + uname + "&userid=" + userid + "&IsHg=@Html.Raw(ViewBag.isHg)"; var ext_flag = "@Html.Raw($"&ext_flag={Mini.Common.Utility.EncryptUrlEncode(Mini.Common.Utility.ConvertDateTimeLong(DateTime.Now).ToString()).ToString()}")";
var url = "MessageDetial?isgroup=false&corp=" + corpid + "&nickname=" + name + "&customer=" + extuserid + "&uname=" + uname + "&userid=" + userid + "&eid=@Html.Raw(ViewBag.eid)" + "&IsHg=@Html.Raw(ViewBag.isHg)" + ext_flag;
layui.use('layer', function () { layui.use('layer', function () {
var layer = layui.layer; var layer = layui.layer;
layer.open({ layer.open({