2025-03-28 09:49:56 +08:00

70 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web.Http;
using System.Web.Http.Description;
using Newtonsoft.Json;
using HZQR.Common;
using RedisHelp;
namespace OpenApi.Controllers
{
/// <summary>
/// 基础信息相关接口
/// </summary>
public class BaseInfoController : BaseController
{
#region
/// <summary>
/// 获取服务区门店列表
/// </summary>
/// <param name="code">授权码</param>
/// <returns></returns>
[Route("BaseInfo/GetGZServerpartList")]
[AcceptVerbs("GET")]
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<Models.ServerpartModel>>))]
public IHttpActionResult GetGZServerpartList(string code)
{
if (!Method.Common.VerifyCode(code))
{
return Ok(Method.Common.ReturnJson(201, "查询失败,请传入正确的授权码信息!"));
}
RedisHelper redisHelper = new RedisHelper(12);
if (redisHelper.KeyExists("GetGZServerpartList"))
{
return Ok(Method.Common.ReturnJson(200, "查询失败请于1分钟后再次查询数据"));
}
else
{
redisHelper.StringSet("GetGZServerpartList", DateTime.Now.ToString());
redisHelper.KeyExpire("GetGZServerpartList", new TimeSpan(0, 1, 0));
}
string Parameter = "入参信息:授权码【" + code + "】";
try
{
//获取交易流水订单表列表
List<Models.ServerpartModel> ServerpartList = Method.ServerpartHelper.GetServerpartList(transaction, code.ToDecrypt());
//转化json形式
Models.JsonList<Models.ServerpartModel> jsonList = Models.JsonList<Models.ServerpartModel>.Success(
ServerpartList, ServerpartList.Count, 1, ServerpartList.Count);
LogUtil.WriteLog(null, "查询成功!" + Parameter, DateTime.Now.ToString("yyyyMMdd") + "_GetGZServerpartList");
return Ok(Models.JsonMsg<Models.JsonList<Models.ServerpartModel>>.Success(jsonList, 100, "查询成功"));
}
catch (Exception ex)
{
//事务回滚
transaction.Rollback();
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
DateTime.Now.ToString("yyyyMMdd") + "_GetGZServerpartListError");
return Ok(Method.Common.ReturnJson(999, "查询失败!接口异常,请联系管理员"));
}
}
#endregion
}
}