50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using APT.BaseData.Domain.Entities.FM;
 | 
						|
using APT.BaseData.Domain.Enums;
 | 
						|
using APT.BaseData.Domain.IServices.OP;
 | 
						|
using APT.Infrastructure.Core;
 | 
						|
using APT.Utility;
 | 
						|
using Microsoft.AspNetCore.Http;
 | 
						|
using Microsoft.AspNetCore.Mvc;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
using System.Threading.Tasks;
 | 
						|
 | 
						|
namespace APT.OP.WebApi.Controllers.Api
 | 
						|
{
 | 
						|
    [Route("api/OP/OPNotic")]
 | 
						|
    public partial class NoticController : AuthorizeApiController<T_FM_NOTICE>
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 短信发送跑批
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="entity"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        [HttpPost, Route("SendNote")]
 | 
						|
        public JsonActionResult<bool> SendNote([FromBody] KeywordFilter entity)
 | 
						|
        {
 | 
						|
            return SafeExecute<bool>(() =>
 | 
						|
            {
 | 
						|
                //var serice = APT.Infrastructure.Api.ServiceLocator.Instance.GetService<IOPSmsService>();
 | 
						|
                //var list = this.GetEntities<T_FM_NOTICE>(x => x.NOTICE_STATUS != (int)FMNoticeStatus.发送成功 && x.NOTICE_TYPE == (int)FMNoticeType.短信 && x.TRYCOUNT > 0, entity);
 | 
						|
                //foreach (var item in list)
 | 
						|
                //{
 | 
						|
                //    if (serice.SendNote(item))
 | 
						|
                //    {
 | 
						|
                //        item.NOTICE_STATUS = (int)FMNoticeStatus.发送成功;
 | 
						|
                //    }
 | 
						|
                //    else
 | 
						|
                //    {
 | 
						|
                //        item.NOTICE_STATUS = (int)FMNoticeStatus.发送失败;
 | 
						|
                //        item.TRYCOUNT--;
 | 
						|
                //    }
 | 
						|
                //    System.Threading.Thread.Sleep(100);
 | 
						|
                //}
 | 
						|
                //if (list.Any())
 | 
						|
                //    this.BantchUpdateEntity(list);
 | 
						|
                return true;
 | 
						|
            });
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |