.
admin
2024-04-04 561ef76cf91503ef6ce478f4240240da5d8828e4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Mvc;
using CommonHelper;
using CommonHelper.Redis;
using Newtonsoft.Json.Linq;
using Flurl.Http;
 
namespace GasolineBlend.Controllers
{
    /// <summary>
    /// 问财
    /// </summary>
    public class WenCaiController : BaseController
    {
        private readonly CustomerRedis _customerRedis = new CustomerRedis();
 
 
        [HttpPost]
        public async Task<ActionResult> GetWenCaiAnswerList(string question, int pageSize, int pageNo)
        {
            var v = _customerRedis.Get("wencai_v"); //"A1KZZpxeY5TyBp9oALdJcIVAoxItY1b9iGdKIRyrfoXwL_CIBPOmDVj3mjDv";//
            var url = "https://www.iwencai.com/unifiedwap/unified-wap/v2/result/get-robot-data";
 
            var param = new
            {
                question=question,
                perpage=pageSize,
                page=pageNo,
                source= "Ths_iwencai_Xuangu",
                add_info="{\"urp\":{\"scene\":3,\"company\":1,\"business\":1,\"is_lowcode\":1},\"contentType\":\"json\"}"
            };
            var res = await url.WithHeader("hexin-v", v).PostUrlEncodedAsync(param).ReceiveString();
            string strCov = Regex.Unescape(res);
            //去除冗余字段
            string tmpInfoA ="", strCovA="";
            int i = strCov.IndexOf("\"meta\"");
            int j = strCov.IndexOf("\"puuid\"");
            if (i > 0 && j > 0)
            {
                tmpInfoA = strCov.Substring(i - 1, j - i - 1);
                strCovA = strCov.Replace(tmpInfoA, "");
            }
            i = strCovA.IndexOf("\"layout_data\"");
            j = strCovA.IndexOf("\"layout_mode\"");   
            if (i > 0 && j > 0)
            {
                tmpInfoA = strCovA.Substring(i, j - i);
                strCovA = strCovA.Replace(tmpInfoA, "");
            }
            i = strCovA.IndexOf("\"appModule\"");
            j = strCovA.IndexOf("\"appVersion\"");
            if (i > 0 && j > 0)
            {
                tmpInfoA = strCovA.Substring(i, j - i);
                strCovA = strCovA.Replace(tmpInfoA, "");
            }
 
 
            //object m=  JsonHelper.JSONToObject<object>(strCov);
            return SuccessNoShow(data: strCovA);
        }
    }
}