• 极光推送



    /// <summary>
    /// 应用标识:极光推送的用户名(门禁)
    /// </summary>
    private readonly string AppKey = ConfigurationManager.AppSettings["AppKey"];
    /// <summary>
    /// 极光推送的密码(门禁)
    /// </summary>
    private readonly string MasterSecret = ConfigurationManager.AppSettings["MasterSecret"];


    //***有一条待审核订单
    /// <summary>
    /// 订单消息推送
    /// </summary>
    /// <param name="nextcode">下个审核节点(审核完后)</param>
    public AppOrderPushResult AppOrderPush(string nextcode)
    {
    //流程配置表找权限编号->用户表中找对应审核人
    var count = 0;
    string R_Id = context.AuditConfigure.SingleOrDefault(s => s.AC_Code == nextcode).R_Id;
    var list = context.Users.Where(s => s.R_Id == R_Id && s.U_Status == "0").ToList();
    if (list.Count() > 0)
    {
    foreach (var item in list)
    {
    if (SendAppContent(item.U_Name,item.jpushid))
    {
    count += 1;
    }
    }
    if (count > 0)
    {
    return new AppOrderPushResult { ResCode = ResCode.Ok, ResMsg = "消息推送成功" };
    }
    else
    {
    return new AppOrderPushResult { ResCode = ResCode.Fail, ResMsg = "消息推送失败" };
    }
    }
    else
    {
    return new AppOrderPushResult { ResCode = ResCode.Fail, ResMsg = "消息推送失败" };
    }
    }


    /// <summary>
    /// 极光推送
    /// </summary>
    /// <param name="name">name</param>
    /// <param name="jpushid">jpushid</param>
    /// <returns></returns>
    public bool SendAppContent(string name, string jpushid)
    {
    if (!string.IsNullOrEmpty(jpushid) && jpushid != "" && jpushid.Trim() != "")
    {
    JPushClient client = new JPushClient(AppKey, MasterSecret);
    string content = name + "有一条消息待审核。";

    PushPayload pushPayload = new PushPayload();
    pushPayload.platform = Platform.all();
    pushPayload.audience = Audience.s_registrationId(jpushid);
    pushPayload.message = Message.content(content)
    .AddExtras("type", "104");

    var jresult = client.SendPush(pushPayload);
    return jresult.isResultOK();
    }
    else
    {
    return false;
    }
    }

  • 相关阅读:
    HTTP Authorization
    php导出数组到csv格式demo
    nginx 配置ajax跨域访问php接口
    node.js和npm离线安装
    使用Docker快速搭建Nginx+PHP-FPM环境
    django中文件下载(HttpResponse)
    django 下载文件 无法正常打开
    C语言Review2_struct
    基础概念——回车换行
    C语言Review1_预处理器和宏
  • 原文地址:https://www.cnblogs.com/tfeblog/p/10556977.html
Copyright © 2020-2023  润新知