89 lines
1.9 KiB
C#
89 lines
1.9 KiB
C#
using AllBase;
|
|
using AllBase.Helper;
|
|
using CefSharp.DevTools.FedCm;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
using Work._29Tools.BLL;
|
|
using Work.ERP.API.Orders;
|
|
using WxOrder.Framework;
|
|
|
|
namespace _29WxOrderWpf.Services;
|
|
|
|
/// <summary>
|
|
/// 礼物单服务
|
|
///
|
|
/// </summary>
|
|
public class ShipGiftService : SingleInstance<ShipGiftService>
|
|
{
|
|
public enum GiftType
|
|
{
|
|
_155 = 2,
|
|
_160 = 5
|
|
}
|
|
private ShipGiftServiceApi _api;
|
|
private ShipGiftService()
|
|
{
|
|
_api = new ShipGiftServiceApi();
|
|
}
|
|
public async Task<bool> Send(string orderId, GiftType giftType)
|
|
{
|
|
var item = GlobalConfig.lstFilterOrder.FirstOrDefault(a => a.order_id == orderId);
|
|
if (item == null) return false;
|
|
|
|
decimal giftAmount = 1.6m;
|
|
if (giftType == GiftType._155)
|
|
{
|
|
giftAmount = 1.55m;
|
|
}
|
|
|
|
if (BaseClass.Setting.AutoSwitchGiftType && (item.product_price ?? 0) > 6 * 1000)
|
|
{
|
|
giftAmount = 1.6m;
|
|
}
|
|
decimal amount = giftAmount + BaseClass.OemGiftAmount;
|
|
|
|
|
|
string province = item.province_name;
|
|
string city = item.city_name;
|
|
|
|
if (city == "深圳市")
|
|
{
|
|
amount += 0.60m;
|
|
}
|
|
else if (city == "北京市")
|
|
{
|
|
amount += 1.00m;
|
|
}
|
|
else if (city == "上海市")
|
|
{
|
|
amount += 0.60m;
|
|
}
|
|
else if (province.Contains("新疆") || province.Contains("西藏"))
|
|
{
|
|
amount += 12.15m;
|
|
}
|
|
|
|
//string data = JsonConvert.SerializeObject(new
|
|
//{
|
|
// platformCode = "WEISHOP",
|
|
// orderIds = new List<string> { orderId },
|
|
// userId = BaseClass.UserId,
|
|
// userName = BaseClass.UserName,
|
|
// giftOrderType = (int)giftType,
|
|
// amount = (int)(amount * 100),
|
|
// oemAmount = (int)(BaseClass.OemGiftAmount * 100)
|
|
//});
|
|
var ret = await _api.SendShipGift([orderId], (int)giftType, amount, BaseClass.OemGiftAmount);
|
|
return ret;
|
|
|
|
|
|
}
|
|
}
|