BuyLogic.lua 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  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. if conf.module and conf.module ~= "" then
  209. local tModule = load("return require(\"" .. conf.module .. "\")")()
  210. if tModule and tModule.GetRemainNum then
  211. net.nCanBuyNum = tModule.GetRemainNum(human, buyID)
  212. end
  213. end
  214. end
  215. end
  216. -------------------------------- cmd开始 ----------------------------------
  217. -- 充值-元宝
  218. function cmd.topup(human, buyConf, isFirst, buyCnt, buyNum)
  219. local args = buyConf.args
  220. local id = args[1]
  221. local config = TopupExcel[id]
  222. local cnt = config.cnt * 2
  223. local doubleCnt = buyConf.doubleCnt
  224. local actDouble = YunYingLogic.onCallBack(human,"getDoubleCnt", config.buyID, true)
  225. if actDouble > 0 then
  226. YunYingLogic.onCallBack(human,"buyCall",config.buyID)
  227. cnt = cnt * 2
  228. else
  229. YunYingLogic.onCallBack(human,"touchSingleReach",config.buyID)
  230. --首冲双倍
  231. if buyCnt < doubleCnt then
  232. cnt = cnt * 2
  233. human.db.buy[config.buyID].doubleCnt = human.db.buy[config.buyID].doubleCnt + 1
  234. end
  235. end
  236. ObjHuman.addZuanshi(human, cnt, "buyTopup")
  237. BagLogic.sendItemGetList(human, {{ItemDefine.ITEM_ZUANSHI_ID, cnt}}, "buyTopup")
  238. TopupLogic.query(human)
  239. end
  240. -- 充值-每日礼包
  241. function cmd.dailyLibao(human, buyConf, isFirst, buyCnt, buyNum)
  242. local id = buyConf.args[1]
  243. DailyLibaoLogic.buyLibao(human, id, buyNum)
  244. end
  245. -- 充值-每周礼包
  246. function cmd.weekLibao(human, buyConf, isFirst, buyCnt, buyNum)
  247. local id = buyConf.args[1]
  248. RichangLibaoLogic.buyLibao(human, RichangLibaoLogic.LIBAOTYPE_WEEK, id, RichangLibaoLogic.RMB_BUY, buyNum)
  249. end
  250. -- 充值-每月礼包
  251. function cmd.monthLibao(human, buyConf, isFirst, buyCnt, buyNum)
  252. local id = buyConf.args[1]
  253. RichangLibaoLogic.buyLibao(human, RichangLibaoLogic.LIBAOTYPE_MONTH, id, RichangLibaoLogic.RMB_BUY, buyNum)
  254. end
  255. -- 成长礼包
  256. function cmd.giftPack(human, buyConf, isFirst, buyCnt, buyNum)
  257. local id = buyConf.args[1]
  258. GiftPackLogic.buyLibao(human, id, buyNum)
  259. end
  260. -- 充值-特权商店
  261. function cmd.tequanShop(human, buyConf, isFirst, buyCnt, buyNum)
  262. local id = buyConf.args[1]
  263. TequanShopLogic.buyLibao(human, id, TequanShopLogic.COST_RMB, buyNum)
  264. end
  265. -- 发公会红包
  266. function cmd.unionRedbag(human,buyConf, isFirst, buyCnt, buyNum)
  267. UnionRedBagLogic.sendRedBagCallBack(human,buyConf.args[1], buyNum)
  268. end
  269. -- 限时抢购
  270. function cmd.limitBuy(human, buyConf, isFirst, buyCnt, buyNum)
  271. LimitBuy.buy(human, buyConf.args[1], buyNum)
  272. end
  273. function cmd.customize(human,buyConf, isFirst, buyCnt, buyNum)
  274. ActCustomizeLogic.onBuyCustomize(human,buyConf.args[1], buyNum)
  275. end
  276. -- 开服好礼
  277. function cmd.openServer(human,buyConf, isFirst, buyCnt, buyNum)
  278. OpenServerGiftLogic.buyGift(human,buyConf.args[1], buyNum)
  279. end
  280. -- 月卡
  281. function cmd.monthCard(human,buyConf, isFirst, buyCnt, buyNum)
  282. MonthCard.buyMonthCard(human,buyConf.args[1], buyNum)
  283. end
  284. --
  285. function cmd.heroGrowUp(human, buyConf, isFirst, buyCnt, buyNum)
  286. HeroGrowUp.buyKing(human, buyNum)
  287. end
  288. function cmd.limitMangHe(human, buyConf, isFirst, buyCnt, buyNum)
  289. LimitMangHeLogic.buy(human, buyConf.id, buyNum)
  290. end
  291. function cmd.overflowFund(human,buyConf, isFirst, buyCnt, buyNum)
  292. OverflowFundLogic.onBuy(human,buyConf.args[1], buyNum)
  293. end
  294. function cmd.xiLianGift(human, buyConf, isFirst, buyCnt, buyNum)
  295. MoshouLogic.xlianGiftBuy(human, buyConf.id, buyNum)
  296. end
  297. function cmd.heroSkin(human,buyConf, isFirst, buyCnt, buyNum)
  298. local buyId = buyConf.id
  299. return HeroSkinLogic.buy(human,buyId, buyNum)
  300. end
  301. function cmd.gift(human,buyConf, isFirst, buyCnt, buyNum)
  302. local buyId = buyConf.id
  303. for id,cfg in pairs(GiftExcel) do
  304. if cfg.buyID == buyId then
  305. GiftLogic.buy(human,id, buyNum)
  306. break
  307. end
  308. end
  309. end
  310. function cmd.warOrder(human,buyConf, isFirst, buyCnt, buyNum)
  311. local buyId = buyConf.id
  312. for _,cfg in pairs(OrderExcel.desc) do
  313. if cfg.buyId == buyId then
  314. WarOrderLogic.warOrderUnlock(human,cfg.type, buyNum)
  315. break
  316. end
  317. end
  318. end
  319. function cmd.voucherbuy(human, buyConf, isFirst, buyCnt, buyNum)
  320. local nBuyID = buyConf.id
  321. VoucherShopLogic.VoucherShop_OnBuyVoucher(human, nBuyID, buyNum)
  322. end
  323. function cmd.newfirstcharge(human, buyConf, isFirst, buyCnt, buyNum)
  324. local nBuyID = buyConf.id
  325. -- print("[cmd.newfirstcharge] nBuyID = "..nBuyID)
  326. NewFirstCharge.onCharge(human, nBuyID, buyNum)
  327. end
  328. function cmd.onekillgift(human, buyConf, isFirst, buyCnt, buyNum)
  329. local nBuyID = buyConf.id
  330. -- print("[cmd.onekillgift] nBuyID = "..nBuyID)
  331. OneKillGiftLogic.onCharge(human, nBuyID, buyNum)
  332. end
  333. function cmd.openServergiftpackage(human, buyConf, isFirst, buyCnt, buyNum)
  334. local nBuyID = buyConf.id
  335. -- print("[cmd.openservergiftpackage] nBuyID = "..nBuyID)
  336. OpenServerGiftPackage.onCharge(human, nBuyID, buyNum)
  337. end
  338. function cmd.zhuanpanGift(human, buyConf, isFirst, buyCnt, buyNum)
  339. local nBuyID = buyConf.id
  340. ZhuanpanGift.onCharge(human, nBuyID, buyNum)
  341. end
  342. function cmd.VoucherInvest(human, buyConf, isFirst, buyCnt, buyNum)
  343. local nBuyID = buyConf.id
  344. VoucherInvest.onCharge(human, nBuyID, buyNum)
  345. end
  346. function cmd.voucherSpecialOffer(human, buyConf, isFirst, buyCnt, buyNum)
  347. local nBuyID = buyConf.id
  348. VoucherSpecialOffer.onCharge(human, nBuyID, buyNum)
  349. end
  350. function cmd.skinGift(human, buyConf, isFirst, buyCnt, buyNum)
  351. local nBuyID = buyConf.id
  352. SkinGiftLogic.onCharge(human, nBuyID, buyNum)
  353. end
  354. function cmd.CommonActLoginGift(human, buyConf, isFirst, buyCnt, buyNum)
  355. local nBuyID = buyConf.id
  356. CommonActLoginGift.onCharge(human, nBuyID, buyNum)
  357. end
  358. -------------------------------- cmd结束 ----------------------------------
  359. function checkBuy(human, ret)
  360. local buyID = ret.id
  361. local buyConf = BuyExcel[buyID]
  362. if buyConf then
  363. --临时处理,后续应该要根据web传的货币类型来判断
  364. -- if not buyConf.CN or buyConf.CN ~= ret.money then
  365. -- return false
  366. -- end
  367. local currencyType = "CN"
  368. if ret.channelID and table.find(CommonDefine.SEA_CHANNEL_ARR, ret.channelID) then
  369. currencyType = "US"
  370. end
  371. if not buyConf[currencyType] or buyConf[currencyType] ~= ret.money then
  372. return false
  373. end
  374. return true
  375. end
  376. ret.result = 8
  377. ret.err = buyID..":buy config not exist"
  378. end
  379. function isArgOK(human,buyID,region,money)
  380. local buyConf = BuyExcel[buyID]
  381. if not (buyConf and buyConf[region]) then
  382. return
  383. end
  384. --海外微端统计,会传转换后的美元值,增加多一层判断
  385. if PfLogic.isHaiwaiWeiduan(human) then
  386. if money == buyConf["US"] then
  387. return true
  388. end
  389. end
  390. local checkMoney = getRealPrice(human, buyID, region)
  391. if money ~= checkMoney then
  392. return
  393. end
  394. return true
  395. end
  396. --直购
  397. function buy(human, arg, nolog)
  398. local buyID, buyNum
  399. if type(arg) == "table" then
  400. buyID = arg.buyID
  401. buyNum = arg.buyNum or 1
  402. else
  403. buyID = arg
  404. buyNum = 1
  405. end
  406. local buyConf = BuyExcel[buyID]
  407. local isFirst = getIsFirst(human, buyID)
  408. local cnt = getBuyCnt(human, buyID)
  409. local buyDB = human.db.buy
  410. buyDB[buyID] = buyDB[buyID] or {upTime = {}, cnt=0}
  411. buyDB[buyID].upTime[#buyDB[buyID].upTime + 1] = os.time()
  412. buyDB[buyID].cnt = buyDB[buyID].cnt or 0
  413. buyDB[buyID].cnt = buyDB[buyID].cnt + 1
  414. buyDB[buyID].doubleCnt = buyDB[buyID].doubleCnt or 0
  415. if cmd[buyConf.cmd] then
  416. cmd[buyConf.cmd](human, buyConf, isFirst, buyDB[buyID].doubleCnt, buyNum)
  417. else
  418. YunYingLogic.onBuy(human, buyConf, isFirst, cnt, buyNum)
  419. end
  420. -- 增加VIP经验
  421. if buyConf.vipExp > 0 then
  422. VipLogic.addExp(human, buyConf.vipExp)
  423. end
  424. if not nolog and type(arg) == "table" and arg.order ~= "transaction_id1"then
  425. --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 "")
  426. 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 "")
  427. end
  428. if type(arg) == "table" then
  429. afterCharge(human, arg, buyID, buyConf, buyNum)
  430. end
  431. if false == GetFirstMark(human) then
  432. MainDianLogic.MaiDian_Begin(human, MaiDianDefine.MAIDIAN_TYPE_BUY, {nValue = buyID})
  433. SetFirstMark(human, 1)
  434. local RoleLogic = require("role.RoleLogic")
  435. RoleLogic.RoleLogic_QueryHumanInfo(human)
  436. DailyLibaoLogic.ShowAct(human)
  437. RichangLibaoLogic.ShowAct(human)
  438. end
  439. end
  440. function afterCharge(human,oJsonInput, buyID, buyConf, buyNum)
  441. --local price = oJsonInput.topupMoney
  442. local buyConf = BuyExcel[buyID]
  443. local price = oJsonInput.price or buyConf.CN
  444. if price and price > 0 and buyConf.cmd ~= "voucherbuy" and not isExcludedAccRechargeId(buyID) then
  445. TopupLogic.clacTopupAcount(human, price, buyID, buyNum)
  446. local msgRet = Msg.gc.GC_NOTICE_DADIAN
  447. msgRet.type = 1
  448. msgRet.param = oJsonInput.price * 100
  449. msgRet.param2 = tonumber(oJsonInput.buyID)
  450. Msg.send(msgRet,human.fd)
  451. end
  452. end
  453. --直充
  454. function charge(human,oJsonInput)
  455. local gold = oJsonInput.gold
  456. local money = oJsonInput.money
  457. local region = oJsonInput.region
  458. local buyID = oJsonInput.buyID
  459. if buyID and BuyExcel[buyID] then
  460. oJsonInput.id = buyID
  461. buy(human,oJsonInput,true)
  462. else
  463. --直充档次表没有对应配置的话直接给请求中要求的元宝
  464. ObjHuman.addZuanshi(human, gold, "buyTopup")
  465. end
  466. if oJsonInput.order ~= 'transaction_id1' then
  467. --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)
  468. 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)
  469. end
  470. end
  471. function onLogin(human)
  472. if not human.db.buyOrder then return end
  473. for k,v in ipairs(human.db.buyOrder) do
  474. if v.cmd == "charge" then
  475. buy(human,v)
  476. elseif v.cmd == "deliver" then
  477. charge(human,v)
  478. end
  479. end
  480. human.db.buyOrder = nil
  481. end
  482. -- 判断能不能直购
  483. function checkCanBuy(human, buyID)
  484. local buyConf = BuyExcel[buyID]
  485. if not buyConf then return end
  486. local price = getRealPrice(human, buyID, "CN")
  487. if price and not FcmLogic.checkCanBuy(human, price) then
  488. return
  489. end
  490. if SceneHandler.canCharge(human) ~= true then
  491. return Broadcast.sendErr(human, Lang.CHARGE_CLOSE_TIP)
  492. end
  493. local msgRet = Msg.gc.GC_BUY_CHECK
  494. msgRet.buyCode = BUY_CODE_NORMAL
  495. if PfLogic.isFKW(human) then
  496. -- 方块玩微信小程序的正式服 ios下走客服充值
  497. if human.isIOS == 1 then
  498. msgRet.buyCode = BUY_CODE_WX_KEFU
  499. end
  500. elseif PfLogic.isKunTang(human) then
  501. -- 坤堂微信小程序的正式服 ios和安卓都走客服充值
  502. msgRet.buyCode = BUY_CODE_WX_KEFU
  503. end
  504. fontBuyItem(human, msgRet.buyItem, buyID)
  505. Msg.send(msgRet, human.fd)
  506. end