BuyLogic.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. -----------------------------------------
  2. -- 直购
  3. -----------------------------------------
  4. local BuyExcel = require("excel.buy").buy
  5. local TopupExcel = require("excel.buy").topup
  6. local presentExcel = require("excel.present")
  7. local Log = require("common.Log")
  8. local Lang = require("common.Lang")
  9. local Msg = require("core.Msg")
  10. local ObjHuman = require("core.ObjHuman")
  11. local BagLogic = require("bag.BagLogic")
  12. local FcmLogic = require("fcm.FcmLogic")
  13. local PfLogic = require("platform.PfLogic")
  14. local FundLogic = require("present.FundLogic")
  15. local DailyLibaoLogic = require("present.DailyLibaoLogic")
  16. local RichangLibaoLogic = require("present.RichangLibaoLogic")
  17. local TequanShopLogic = require("present.TequanShopLogic")
  18. local TopupLogic = require("topup.TopupLogic")
  19. local VipLogic = require("vip.VipLogic")
  20. local SceneHandler = require("scene.Handler")
  21. local UnionRedBagLogic = require("union.UnionRedBagLogic")
  22. local LimitBuy = require("present.LimitBuy")
  23. local ActCustomizeLogic = require("present.ActCustomizeLogic")
  24. local OpenServerGiftLogic = require("present.OpenServerGiftLogic")
  25. local MonthCard = require("present.MonthCard")
  26. local GiftPackLogic = require("present.GiftPackLogic")
  27. local PremiumGiftLogic = require("absAct.PremiumGiftLogic")
  28. local LimitMangHeLogic = require("present.LimitMangHeLogic")
  29. local Broadcast = require("broadcast.Broadcast")
  30. local MangHeLogic = require("absAct.MangHeLogic")
  31. local HeroGrowUp = require("absAct.HeroGrowUp")
  32. local ItemDefine = require("bag.ItemDefine")
  33. local OverflowFundLogic = require("present.OverflowFundLogic")
  34. local AbsWeeklyCardLogic = require("absAct.AbsWeeklyCardLogic")
  35. local YunYingLogic = require("yunying.YunYingLogic")
  36. local DoubleChargeLogic = require("absAct.DoubleChargeLogic")
  37. local MoshouLogic = require("moshou.MoshouLogic")
  38. local HeroSkinLogic = require("present.HeroSkinLogic")
  39. local SkinGiftLogic = require("skin.SkinGiftLogic")
  40. local OrderExcel = require("excel.warOrder")
  41. local WarOrderLogic = require("shop.WarOrder")
  42. local GiftExcel = require("excel.buy").gift
  43. local GiftLogic = require("topup.GiftLogic")
  44. local VoucherShopLogic = require("voucher.VoucherShopLogic")
  45. local MaiDianDefine = require("MaiDian.MaiDianDefine")
  46. local MainDianLogic = require("MaiDian.MaiDianLogic")
  47. local NewFirstCharge = require("present.NewFirstChargeLogic")
  48. local OneKillGiftLogic = require("present.OneKillGift")
  49. local OpenServerGiftPackage = require("present.OpenServerGiftPackage")
  50. local CommonDefine = require("common.CommonDefine")
  51. local ZhuanpanGift = require("zhuanpan.ZhuanpanGift")
  52. local VoucherInvest = require("voucher.VoucherInvest")
  53. local VoucherSpecialOffer = require("voucher.VoucherSpecialOffer")
  54. local VoucherSpecialOffer = require("voucher.VoucherSpecialOffer")
  55. local CommonActLoginGift = require("absAct.CommonActLoginGift")
  56. local ExcludedAccRechargeIdCfg = require("excel.buy").excludedAccRechargeIds
  57. BUY_CODE_NORMAL = 0 -- 正常调平台的充值接口
  58. BUY_CODE_WX_KEFU = 1 -- 微信小程序客服充值接口
  59. cmd = {}
  60. function initAfterHot()
  61. BuyExcel = require("excel.buy").buy
  62. TopupExcel = require("excel.buy").topup
  63. end
  64. local function GetFirstMark(human)
  65. if not human.db.nFirstBuy then
  66. human.db.nFirstBuy = 0
  67. return false
  68. end
  69. return human.db.nFirstBuy == 0 and false or true
  70. end
  71. local function SetFirstMark(human, nValue)
  72. human.db.nFirstBuy = nValue
  73. end
  74. -- 检查该购买项是否不计入累充,true-不计入, false-计入
  75. local function isExcludedAccRechargeId(buyId)
  76. if not ExcludedAccRechargeIdCfg or not ExcludedAccRechargeIdCfg[1] or not ExcludedAccRechargeIdCfg[1].excludedAccRechargeIds then
  77. return false
  78. end
  79. local excludedAccRechargeIds = ExcludedAccRechargeIdCfg[1].excludedAccRechargeIds
  80. if table.find(excludedAccRechargeIds, buyId) then
  81. return true
  82. end
  83. return false
  84. end
  85. -- 是否充值过
  86. function isChange(human)
  87. if not human.db.topupAcount or human.db.topupAcount <= 0 then
  88. return false
  89. end
  90. return true
  91. end
  92. -- 是否首次购买
  93. function getIsFirst(human,id)
  94. if not human.db.buy or
  95. not human.db.buy[id] then
  96. return true
  97. end
  98. end
  99. -- 购买次数
  100. function getBuyCnt(human,id)
  101. if not human.db.buy or
  102. not human.db.buy[id] then
  103. return 0
  104. end
  105. local cnt = human.db.buy[id].cnt or 0
  106. return cnt
  107. end
  108. -- 双倍购买次数
  109. function getDoubleBuyCnt(human,id)
  110. if not human.db.buy or
  111. not human.db.buy[id] then
  112. return 0
  113. end
  114. local cnt = human.db.buy[id].doubleCnt or 0
  115. return cnt
  116. end
  117. -- 真实价格 某些商品首次购买比较便宜
  118. function getRealPrice(human, buyID, region)
  119. region = human.region or "CN"
  120. local buyConf = BuyExcel[buyID]
  121. if not buyConf then return 0 end
  122. return buyConf[region]
  123. end
  124. local function getRealName(human, buyID, region)
  125. region = human.region or "CN"
  126. local buyConf = BuyExcel[buyID]
  127. if not buyConf then return "" end
  128. if region == "US" then
  129. return buyConf.nameEn
  130. elseif region == "VN" then
  131. return buyConf.nameEn
  132. else
  133. return buyConf.name
  134. end
  135. end
  136. local function getRealProductId(human, buyID, region)
  137. region = human.region or "CN"
  138. local buyConf = BuyExcel[buyID]
  139. if not buyConf then return "" end
  140. if region == "US" and human.phpChanelID == CommonDefine.CHANNEL_TAG_FT then
  141. if human.version == "ios" or human.version == "iostishen" then
  142. return buyConf.productidIos
  143. else
  144. return buyConf.productidEn
  145. end
  146. end
  147. if region == "US" then
  148. return buyConf.productidEn
  149. elseif region == "VN" then
  150. return buyConf.productidEn
  151. else
  152. return buyConf.productid
  153. end
  154. end
  155. -- 封装BuyItem结构体
  156. function fontBuyItem(human, net, buyID)
  157. net.nCanBuyNum = 0
  158. net.disableVoucher = 1
  159. if buyID == 0 then
  160. net.buyID = buyID
  161. net.region = "zuanshi"
  162. net.cost = 0
  163. net.icon = 0
  164. net.name = ""
  165. net.isFirst = 0
  166. net.desc = ""
  167. net.doubleCnt = 0
  168. net.actDoubleCnt = 0
  169. net.useDoubleCnt = 0
  170. net.buyCnt = 0
  171. net.vipExp = 0
  172. net.yuanjia = 0
  173. net.zhekou = 0
  174. net.voucher = 0
  175. net.productId = ""
  176. else
  177. local conf = BuyExcel[buyID]
  178. net.buyID = buyID
  179. local region = human.region or "CN"
  180. net.region = region
  181. net.cost = getRealPrice(human, buyID, region)
  182. net.icon = conf.icon
  183. -- net.name = conf.name
  184. net.name = getRealName(human, buyID, region)
  185. net.isFirst = getIsFirst(human, buyID) and 1 or 0
  186. local giveZuanshi = tonumber(conf.desc)
  187. if giveZuanshi then
  188. if net.isFirst == 1 then
  189. net.desc = tostring(giveZuanshi * 3)
  190. else
  191. net.desc = tostring(giveZuanshi)
  192. end
  193. else
  194. net.desc = conf.desc
  195. end
  196. net.doubleCnt = conf.doubleCnt
  197. local actDouble = YunYingLogic.onCallBack(human,"getDoubleCnt", buyID, true)
  198. net.actDoubleCnt = actDouble or 0
  199. net.useDoubleCnt = getDoubleBuyCnt(human, buyID)
  200. net.buyCnt = getBuyCnt(human, buyID)
  201. net.vipExp = conf.vipExp
  202. net.yuanjia = conf.oCN
  203. net.zhekou = conf.zhekou
  204. net.voucher = conf.Voucher
  205. -- net.productId = conf.productid
  206. net.productId = getRealProductId(human, buyID, region)
  207. -- net.disableVoucher = conf.disableVoucher or 1
  208. net.disableVoucher = isExcludedAccRechargeId(buyID) and 1 or 0
  209. if conf.module and conf.module ~= "" then
  210. local tModule = load("return require(\"" .. conf.module .. "\")")()
  211. if tModule and tModule.GetRemainNum then
  212. net.nCanBuyNum = tModule.GetRemainNum(human, buyID)
  213. end
  214. end
  215. end
  216. end
  217. -------------------------------- cmd开始 ----------------------------------
  218. -- 充值-元宝
  219. function cmd.topup(human, buyConf, isFirst, buyCnt, buyNum)
  220. local args = buyConf.args
  221. local id = args[1]
  222. local config = TopupExcel[id]
  223. local cnt = config.cnt * 2
  224. local doubleCnt = buyConf.doubleCnt
  225. local actDouble = YunYingLogic.onCallBack(human,"getDoubleCnt", config.buyID, true)
  226. if actDouble > 0 then
  227. YunYingLogic.onCallBack(human,"buyCall",config.buyID)
  228. cnt = cnt * 2
  229. else
  230. YunYingLogic.onCallBack(human,"touchSingleReach",config.buyID)
  231. --首冲双倍
  232. if buyCnt < doubleCnt then
  233. cnt = cnt * 2
  234. human.db.buy[config.buyID].doubleCnt = human.db.buy[config.buyID].doubleCnt + 1
  235. end
  236. end
  237. ObjHuman.addZuanshi(human, cnt, "buyTopup")
  238. BagLogic.sendItemGetList(human, {{ItemDefine.ITEM_ZUANSHI_ID, cnt}}, "buyTopup")
  239. TopupLogic.query(human)
  240. end
  241. -- 充值-每日礼包
  242. function cmd.dailyLibao(human, buyConf, isFirst, buyCnt, buyNum)
  243. local id = buyConf.args[1]
  244. DailyLibaoLogic.buyLibao(human, id, buyNum)
  245. end
  246. -- 充值-每周礼包
  247. function cmd.weekLibao(human, buyConf, isFirst, buyCnt, buyNum)
  248. local id = buyConf.args[1]
  249. RichangLibaoLogic.buyLibao(human, RichangLibaoLogic.LIBAOTYPE_WEEK, id, RichangLibaoLogic.RMB_BUY, buyNum)
  250. end
  251. -- 充值-每月礼包
  252. function cmd.monthLibao(human, buyConf, isFirst, buyCnt, buyNum)
  253. local id = buyConf.args[1]
  254. RichangLibaoLogic.buyLibao(human, RichangLibaoLogic.LIBAOTYPE_MONTH, id, RichangLibaoLogic.RMB_BUY, buyNum)
  255. end
  256. -- 成长礼包
  257. function cmd.giftPack(human, buyConf, isFirst, buyCnt, buyNum)
  258. local id = buyConf.args[1]
  259. GiftPackLogic.buyLibao(human, id, buyNum)
  260. end
  261. -- 充值-特权商店
  262. function cmd.tequanShop(human, buyConf, isFirst, buyCnt, buyNum)
  263. local id = buyConf.args[1]
  264. TequanShopLogic.buyLibao(human, id, TequanShopLogic.COST_RMB, buyNum)
  265. end
  266. -- 发公会红包
  267. function cmd.unionRedbag(human,buyConf, isFirst, buyCnt, buyNum)
  268. UnionRedBagLogic.sendRedBagCallBack(human,buyConf.args[1], buyNum)
  269. end
  270. -- 限时抢购
  271. function cmd.limitBuy(human, buyConf, isFirst, buyCnt, buyNum)
  272. LimitBuy.buy(human, buyConf.args[1], buyNum)
  273. end
  274. function cmd.customize(human,buyConf, isFirst, buyCnt, buyNum)
  275. ActCustomizeLogic.onBuyCustomize(human,buyConf.args[1], buyNum)
  276. end
  277. -- 开服好礼
  278. function cmd.openServer(human,buyConf, isFirst, buyCnt, buyNum)
  279. OpenServerGiftLogic.buyGift(human,buyConf.args[1], buyNum)
  280. end
  281. -- 月卡
  282. function cmd.monthCard(human,buyConf, isFirst, buyCnt, buyNum)
  283. MonthCard.buyMonthCard(human,buyConf.args[1], buyNum)
  284. end
  285. --
  286. function cmd.heroGrowUp(human, buyConf, isFirst, buyCnt, buyNum)
  287. HeroGrowUp.buyKing(human, buyNum)
  288. end
  289. function cmd.limitMangHe(human, buyConf, isFirst, buyCnt, buyNum)
  290. LimitMangHeLogic.buy(human, buyConf.id, buyNum)
  291. end
  292. function cmd.overflowFund(human,buyConf, isFirst, buyCnt, buyNum)
  293. OverflowFundLogic.onBuy(human,buyConf.args[1], buyNum)
  294. end
  295. function cmd.xiLianGift(human, buyConf, isFirst, buyCnt, buyNum)
  296. MoshouLogic.xlianGiftBuy(human, buyConf.id, buyNum)
  297. end
  298. function cmd.heroSkin(human,buyConf, isFirst, buyCnt, buyNum)
  299. local buyId = buyConf.id
  300. return HeroSkinLogic.buy(human,buyId, buyNum)
  301. end
  302. function cmd.gift(human,buyConf, isFirst, buyCnt, buyNum)
  303. local buyId = buyConf.id
  304. for id,cfg in pairs(GiftExcel) do
  305. if cfg.buyID == buyId then
  306. GiftLogic.buy(human,id, buyNum)
  307. break
  308. end
  309. end
  310. end
  311. function cmd.warOrder(human,buyConf, isFirst, buyCnt, buyNum)
  312. local buyId = buyConf.id
  313. for _,cfg in pairs(OrderExcel.desc) do
  314. if cfg.buyId == buyId then
  315. WarOrderLogic.warOrderUnlock(human,cfg.type, buyNum)
  316. break
  317. end
  318. end
  319. end
  320. function cmd.voucherbuy(human, buyConf, isFirst, buyCnt, buyNum)
  321. local nBuyID = buyConf.id
  322. VoucherShopLogic.VoucherShop_OnBuyVoucher(human, nBuyID, buyNum)
  323. end
  324. function cmd.newfirstcharge(human, buyConf, isFirst, buyCnt, buyNum)
  325. local nBuyID = buyConf.id
  326. -- print("[cmd.newfirstcharge] nBuyID = "..nBuyID)
  327. NewFirstCharge.onCharge(human, nBuyID, buyNum)
  328. end
  329. function cmd.onekillgift(human, buyConf, isFirst, buyCnt, buyNum)
  330. local nBuyID = buyConf.id
  331. -- print("[cmd.onekillgift] nBuyID = "..nBuyID)
  332. OneKillGiftLogic.onCharge(human, nBuyID, buyNum)
  333. end
  334. function cmd.openServergiftpackage(human, buyConf, isFirst, buyCnt, buyNum)
  335. local nBuyID = buyConf.id
  336. -- print("[cmd.openservergiftpackage] nBuyID = "..nBuyID)
  337. OpenServerGiftPackage.onCharge(human, nBuyID, buyNum)
  338. end
  339. function cmd.zhuanpanGift(human, buyConf, isFirst, buyCnt, buyNum)
  340. local nBuyID = buyConf.id
  341. ZhuanpanGift.onCharge(human, nBuyID, buyNum)
  342. end
  343. function cmd.VoucherInvest(human, buyConf, isFirst, buyCnt, buyNum)
  344. local nBuyID = buyConf.id
  345. VoucherInvest.onCharge(human, nBuyID, buyNum)
  346. end
  347. function cmd.voucherSpecialOffer(human, buyConf, isFirst, buyCnt, buyNum)
  348. local nBuyID = buyConf.id
  349. VoucherSpecialOffer.onCharge(human, nBuyID, buyNum)
  350. end
  351. function cmd.skinGift(human, buyConf, isFirst, buyCnt, buyNum)
  352. local nBuyID = buyConf.id
  353. SkinGiftLogic.onCharge(human, nBuyID, buyNum)
  354. end
  355. function cmd.CommonActLoginGift(human, buyConf, isFirst, buyCnt, buyNum)
  356. local nBuyID = buyConf.id
  357. CommonActLoginGift.onCharge(human, nBuyID, buyNum)
  358. end
  359. -------------------------------- cmd结束 ----------------------------------
  360. function checkBuy(human, ret)
  361. local buyID = ret.id
  362. local buyConf = BuyExcel[buyID]
  363. if buyConf then
  364. --临时处理,后续应该要根据web传的货币类型来判断
  365. -- if not buyConf.CN or buyConf.CN ~= ret.money then
  366. -- return false
  367. -- end
  368. local currencyType = "CN"
  369. if ret.channelID and table.find(CommonDefine.SEA_CHANNEL_ARR, ret.channelID) then
  370. currencyType = "US"
  371. end
  372. if not buyConf[currencyType] or buyConf[currencyType] ~= ret.money then
  373. return false
  374. end
  375. return true
  376. end
  377. ret.result = 8
  378. ret.err = buyID..":buy config not exist"
  379. end
  380. function isArgOK(human,buyID,region,money)
  381. local buyConf = BuyExcel[buyID]
  382. if not (buyConf and buyConf[region]) then
  383. return
  384. end
  385. --海外微端统计,会传转换后的美元值,增加多一层判断
  386. if PfLogic.isHaiwaiWeiduan(human) then
  387. if money == buyConf["US"] then
  388. return true
  389. end
  390. end
  391. local checkMoney = getRealPrice(human, buyID, region)
  392. if money ~= checkMoney then
  393. return
  394. end
  395. return true
  396. end
  397. --直购
  398. function buy(human, arg, nolog)
  399. local buyID, buyNum
  400. if type(arg) == "table" then
  401. buyID = arg.buyID
  402. buyNum = arg.buyNum or 1
  403. else
  404. buyID = arg
  405. buyNum = 1
  406. end
  407. local buyConf = BuyExcel[buyID]
  408. local isFirst = getIsFirst(human, buyID)
  409. local cnt = getBuyCnt(human, buyID)
  410. local buyDB = human.db.buy
  411. buyDB[buyID] = buyDB[buyID] or {upTime = {}, cnt=0}
  412. buyDB[buyID].upTime[#buyDB[buyID].upTime + 1] = os.time()
  413. buyDB[buyID].cnt = buyDB[buyID].cnt or 0
  414. buyDB[buyID].cnt = buyDB[buyID].cnt + 1
  415. buyDB[buyID].doubleCnt = buyDB[buyID].doubleCnt or 0
  416. if cmd[buyConf.cmd] then
  417. cmd[buyConf.cmd](human, buyConf, isFirst, buyDB[buyID].doubleCnt, buyNum)
  418. else
  419. YunYingLogic.onBuy(human, buyConf, isFirst, cnt, buyNum)
  420. end
  421. -- 增加VIP经验
  422. if buyConf.vipExp > 0 then
  423. VipLogic.addExp(human, buyConf.vipExp)
  424. end
  425. if not nolog and type(arg) == "table" and arg.order ~= "transaction_id1"then
  426. --Log.write(Log.LOGID_OSS_PAY, human.db._id, human.db.account, human.db.name, human.db.lv,arg.order or "" ,buyID or 0,arg.amt or arg.money or 0,arg.gold or 0,2,arg.region or "")
  427. Log.write(Log.LOGID_OSS_PAY, human.db._id, human.db.newUniqueTag, human.db.name, human.db.lv,arg.order or "" ,buyID or 0,arg.amt or arg.money or 0,arg.gold or 0,2,arg.region or "")
  428. end
  429. if type(arg) == "table" then
  430. afterCharge(human, arg, buyID, buyConf, buyNum)
  431. end
  432. if false == GetFirstMark(human) then
  433. MainDianLogic.MaiDian_Begin(human, MaiDianDefine.MAIDIAN_TYPE_BUY, {nValue = buyID})
  434. SetFirstMark(human, 1)
  435. local RoleLogic = require("role.RoleLogic")
  436. RoleLogic.RoleLogic_QueryHumanInfo(human)
  437. DailyLibaoLogic.ShowAct(human)
  438. RichangLibaoLogic.ShowAct(human)
  439. end
  440. end
  441. function afterCharge(human,oJsonInput, buyID, buyConf, buyNum)
  442. --local price = oJsonInput.topupMoney
  443. local buyConf = BuyExcel[buyID]
  444. local price = oJsonInput.price or buyConf.CN
  445. if price and price > 0 and buyConf.cmd ~= "voucherbuy" and not isExcludedAccRechargeId(buyID) then
  446. TopupLogic.clacTopupAcount(human, price, buyID, buyNum)
  447. local msgRet = Msg.gc.GC_NOTICE_DADIAN
  448. msgRet.type = 1
  449. msgRet.param = oJsonInput.price * 100
  450. msgRet.param2 = tonumber(oJsonInput.buyID)
  451. Msg.send(msgRet,human.fd)
  452. end
  453. end
  454. --直充
  455. function charge(human,oJsonInput)
  456. local gold = oJsonInput.gold
  457. local money = oJsonInput.money
  458. local region = oJsonInput.region
  459. local buyID = oJsonInput.buyID
  460. if buyID and BuyExcel[buyID] then
  461. oJsonInput.id = buyID
  462. buy(human,oJsonInput,true)
  463. else
  464. --直充档次表没有对应配置的话直接给请求中要求的元宝
  465. ObjHuman.addZuanshi(human, gold, "buyTopup")
  466. end
  467. if oJsonInput.order ~= 'transaction_id1' then
  468. --Log.write(Log.LOGID_OSS_PAY, human.db._id, human.db.account, human.db.name, human.db.lv,oJsonInput.order,buyID or 0,oJsonInput.amt or oJsonInput.money,oJsonInput.gold,2,oJsonInput.region)
  469. Log.write(Log.LOGID_OSS_PAY, human.db._id, human.db.newUniqueTag, human.db.name, human.db.lv,oJsonInput.order,buyID or 0,oJsonInput.amt or oJsonInput.money,oJsonInput.gold,2,oJsonInput.region)
  470. end
  471. end
  472. function onLogin(human)
  473. if not human.db.buyOrder then return end
  474. for k,v in ipairs(human.db.buyOrder) do
  475. if v.cmd == "charge" then
  476. buy(human,v)
  477. elseif v.cmd == "deliver" then
  478. charge(human,v)
  479. end
  480. end
  481. human.db.buyOrder = nil
  482. end
  483. -- 判断能不能直购
  484. function checkCanBuy(human, buyID)
  485. local buyConf = BuyExcel[buyID]
  486. if not buyConf then return end
  487. local price = getRealPrice(human, buyID, "CN")
  488. if price and not FcmLogic.checkCanBuy(human, price) then
  489. return
  490. end
  491. if SceneHandler.canCharge(human) ~= true then
  492. return Broadcast.sendErr(human, Lang.CHARGE_CLOSE_TIP)
  493. end
  494. local msgRet = Msg.gc.GC_BUY_CHECK
  495. msgRet.buyCode = BUY_CODE_NORMAL
  496. if PfLogic.isFKW(human) then
  497. -- 方块玩微信小程序的正式服 ios下走客服充值
  498. if human.isIOS == 1 then
  499. msgRet.buyCode = BUY_CODE_WX_KEFU
  500. end
  501. elseif PfLogic.isKunTang(human) then
  502. -- 坤堂微信小程序的正式服 ios和安卓都走客服充值
  503. msgRet.buyCode = BUY_CODE_WX_KEFU
  504. end
  505. fontBuyItem(human, msgRet.buyItem, buyID)
  506. Msg.send(msgRet, human.fd)
  507. end