QiFeng.ZWY.MagWeb/Controllers/APIs/NotificationsController.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Configuration;
using System.Linq;
using System.Web.Http;
using log4net;
using QiFeng.LMSD.Utility;
using QiFeng.LMSD.Bll;

namespace QiFeng.LMSD.MagWeb.Controllers.APIs
{
    // Message Notification API
    public class NotificationsController : ApiController
    {
        private readonly ILog _fileLog = LogManager.GetLogger(typeof(NotificationsController));

        [HttpGet]
        public bool PushNotification(int shopId, int pushingMsgType, string orderNo, string wxUserOpenId, string mcAccountId)
        {
            var checkResult = CheckPermission("OrderApiController | PushNotification");
            if (!checkResult)
            {
                return false;
            }

            //McMessagesBll.Instance.PushingMsg(shopId, pushingMsgType, orderNo, wxUserOpenId, mcAccountId);

            return true;
        }

        /// <summary>
        /// 检查接口调用权限
        /// </summary>
        /// <returns></returns>
        protected bool CheckPermission(string interfaceEntryName)
        {
            var strClientIp = IpHelper.IPAddress;
            _fileLog.Info("NotificationsController | " + interfaceEntryName + " | Client Ip: " + strClientIp +
                          " | Called time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            var strLimitIpSwitch = ConfigurationManager.AppSettings["LimitIpSwitch"];
            if (strLimitIpSwitch == "0")
            {
                return true;
            }

            var strAccessIp = ConfigurationManager.AppSettings["AccessIp"];
            if (string.IsNullOrWhiteSpace(strAccessIp))
            {
                return false;
            }

            var arAccessIp = strAccessIp.Split(',');
            var bCheck = arAccessIp.Any(accessIp => strClientIp == accessIp);

            if (!bCheck)
            {
                _fileLog.Error("NotificationsController | " + interfaceEntryName + " | Error: Invalid Ip - " + strClientIp);
            }

            return bCheck;
后面还有 5 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。