* @version : HUOSDK 8.5 */ namespace huoIdentify\controller; use huo\controller\common\Base; use huo\model\game\GameModel; use huo\model\member\MemberModel; use huoIdentify\logic\IdentifyDayIdotLogic; use huoIdentify\logic\IdentifyIdotLogic; use huoIdentify\model\IdentifyMemModel; use huolib\constant\CommonConst; use huolib\constant\GameConst; use huolib\constant\IdentifyConst; use huolib\constant\MemConst; use huolib\status\IdentifyStatus; use huolib\utils\IdentifyUtils; class Pay extends Base { /** * 支付校验 * * @param int $mem_id 玩家id * @param int $app_id 游戏id * @param float $amount 订单金额 * @param string $token token * * @return string|array url 实名认证地址或提示信息地址 */ public function checkLimit($mem_id, $app_id, $amount, $token = '') { $_token = empty($token) ? session_id() : $token; $_game_auth = (new GameModel())->getIsAuthById($app_id); /* 不需要实名不做任何处理 */ if (GameConst::GAME_IDENTIFY_IS_NO == $_game_auth) { return ''; } $_identify_conf = (new IdentifyConf())->getConf(); $_id_card = (new IdentifyMemModel())->getIdCardByMemId($mem_id); if (empty($_id_card)) { $_is_allow_charge = $_identify_conf['unnamed']['is_allow_charge']; /* 如果未实名允许充值则不做任何处理 */ if (CommonConst::STATUS_YES == $_is_allow_charge) { return ''; } /* Modified by chenbingling BEGIN 2021/9/3 ISSUES:#15622 产品需求 已输入过实名的用户用没有说明认证不成功,点击充值的时候不用再输入姓名等信息*/ $_in_progress_data = (new Identify())->getInProgressDataByMemApp($mem_id, $app_id); if (!empty($_in_progress_data)) { $_code = IdentifyStatus::MEM_IDENTIFY_IN_PROGRESS; return $this->huoError($_code, IdentifyStatus::getMsg($_code)); } /* END 2021/9/3 ISSUES:#15622 */ $_param = [ 'app_id' => $app_id, 'token' => $_token ]; $_identify_url = IdentifyConst::getIdentifyUrl($_param); $_mem_model = new MemberModel(); $_status = $_mem_model->getStatus($mem_id); $_mobile = $_mem_model->getMobileById($mem_id); if (empty($_mobile) && MemConst::STATUS_TRY == $_status) { $_identify_url = IdentifyConst::getBindMobileUrl($_param); } return $_identify_url; } $_age = IdentifyUtils::getAgeById($_id_card); if ($_age >= 18) { return ''; } // 校验未成年玩家限制 $_online_class = new Online($app_id, $mem_id, ''); $_online_class->setToken($_token); $_url = $_online_class->checkUnderageLimitOnTheHour(); if (!empty($_url)) { return $_url; } $_type = CommonConst::CONST_ZERO; $_idot_data = (new IdentifyIdotLogic())->getInfoByIdCard($_id_card); $_week_money = get_val($_idot_data, 'week_money', 0.00) + $amount; $_month_money = get_val($_idot_data, 'month_money', 0.00) + $amount; $_charge_limit = $_identify_conf['underage']['charge_limit']; foreach ($_charge_limit as $_k => $_v) { if ($_v['min_age'] <= $_age && $_age <= $_v['max_age'] && ($_week_money > $_v['week_money'] || $_month_money > $_v['month_money'])) { switch ($_k) { case 0: $_type = IdentifyConst::UNDERAGE_AGE_8_CHARGE_LIMIT; break; case 1: $_type = IdentifyConst::UNDERAGE_AGE_8_16_CHARGE_LIMIT; break; case 2: $_type = IdentifyConst::UNDERAGE_AGE_16_18_CHARGE_LIMIT; break; default: } break; } } $_param = [ 'app_id' => $app_id, 'token' => $token ]; return IdentifyConst::getUnderageLimitMsgUrl($_type, $_param); } /** * 更新支付金额 * * @param int $mem_id 玩家id * @param float $money 支付金额 * * @return bool */ public function updateMoney($mem_id, $money) { $_id_card = (new IdentifyMemModel())->getIdCardByMemId($mem_id); if (!empty($_id_card)) { (new IdentifyDayIdotLogic())->updateSumMoneyByIdCard($money, $_id_card, $mem_id); (new IdentifyIdotLogic())->updateSumMoneyByIdCard($money, $_id_card); } return true; } }