搞不懂啥问题

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.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Security.Cryptography;
@ -23,6 +24,45 @@ namespace Mini.Common
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>
/// 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>
/// 对DES加密后的字符串进行解密
/// </summary>
@ -971,4 +1015,52 @@ namespace Mini.Common
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.Linq;
using Microsoft.AspNetCore.Http;
using System.Security.Cryptography;
namespace Mini.Web.Areas.Admin.Controllers
{
public class OutHHuserController : Controller
@ -653,7 +654,7 @@ namespace Mini.Web.Areas.Admin.Controllers
}
[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>();
try
@ -722,10 +723,11 @@ namespace Mini.Web.Areas.Admin.Controllers
{
LogHelper.Error("错误:" + e.ToString());
}
ViewBag.isChoose = isChoose;
ViewBag.data = Common.JsonHelper.ObjDivertToJson(list);
ViewBag.roomData = Common.JsonHelper.ObjDivertToJson(roomeCList);//群的列表
ViewBag.isHg = isHg;
ViewBag.eid = eid;
return View();
}
@ -779,7 +781,7 @@ namespace Mini.Web.Areas.Admin.Controllers
/// <param name="locationJson">定位的json信息</param>
/// <returns></returns>
[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);
@ -801,7 +803,23 @@ namespace Mini.Web.Areas.Admin.Controllers
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>();

View File

@ -604,9 +604,15 @@
});
}
$(function () {
var content = "@Html.Raw(ViewBag.content)" + "&clientid=WK_EXT";
$("#saleline").click(function () {
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({
type: 2,
content: saleurl,

View File

@ -75,6 +75,10 @@
}
</style>
<div class="x-body">
@if (ViewBag.isChoose)
{
<button class="layui-btn" id="userChoose">提交</button>
}
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
<br />
<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: 'extuserid', title: '客户ID' }
, { 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) {
//alert(username);
//alert(jobwxusername);
//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 () {
var layer = layui.layer;
layer.open({