* @version : HUOSDK 8.0 */ namespace huo\controller\wallet; use huo\controller\common\CommonFunc; use huo\model\finance\GmBackModel; use huo\model\finance\PtbBackModel; use huolib\constant\WalletConst; class WalletRequest { private $order_id = ''; /* 订单号 */ private $type = 1; /* 1 充值 */ private $agent_id = 1; /* 渠道ID */ private $from_id = 0; /* 发放ID */ private $mem_id = 0; /* 玩家 */ private $amount = 0.00; /* 人民币数额 */ private $real_amount = 0.00; /* 实际支付金额 */ private $ptb_cnt = 0.00; /* 平台币数量 */ private $rebate_cnt = 0.00; /* 返利数量 默认为0 */ private $discount = 1.00; /* 折扣 */ private $payway = ''; /* 充值方式 */ private $ip = ''; /* 用户充值时使用的网络终端IP */ private $status = 1; /* 1 待支付 2 支付完成 3 支付失败 */ private $create_time = 0; /* 创建时间 */ private $update_time = 0; /* 更新时间 */ private $remark = '';/* 备注 */ private $cost_ptb_cnt = 0;/* 消耗的平台币 */ private $to_agent_id = 0;/* 发放给渠道ID */ private $app_id = 0;/* 游戏ID */ private $back_ptb_cnt = 0.00;/* 扣回订单平台币数量 */ private $gm_cnt = 0.00; /* 游戏币数量 */ private $cost_gm_cnt = 0.00; /* 花费游戏币数量 */ private $back_gm_cnt = 0.00;/* 扣回订单游戏币数量 */ public function __construct() { $this->ip = request()->ip(); } /** * 从SDK订单中转换平台币订单 * * @param $data */ public function setDataFromSdkOrder($data) { if (empty($data)) { return; } $_ptb_rmb_rate = CommonFunc::getPtbRmbRate(); $_gm_rmb_rate = CommonFunc::getGmRmbRate(); $this->setOrderId(get_val($data, 'order_id', $this->order_id)); $this->setType(WalletConst::WALLET_FROM_COST); $this->setAppId(get_val($data, 'app_id', $this->app_id)); $this->setMemId(get_val($data, 'mem_id', $this->mem_id)); $this->setAmount(get_val($data, 'amount', $this->amount)); $this->setRealAmount(get_val($data, 'real_amount', $this->real_amount)); $this->setRebateCnt(get_val($data, 'rebate_amount', $this->rebate_cnt)); $this->setDiscount(get_val($data, 'rate', $this->discount)); $this->setPayway(get_val($data, 'payway', '')); $this->setIp(get_val($data, 'ip', request()->ip())); $this->setStatus(get_val($data, 'status', $this->status)); $this->setPtbCnt($_ptb_rmb_rate * get_val($data, 'ptb_amount', $this->ptb_cnt)); $this->setCostPtbCnt($_ptb_rmb_rate * get_val($data, 'ptb_amount', $this->ptb_cnt)); $this->setGmCnt($_gm_rmb_rate * get_val($data, 'gm_amount', $this->ptb_cnt)); $this->setCostGmCnt($_gm_rmb_rate * get_val($data, 'gm_amount', $this->ptb_cnt)); } /** * 设置订单数据 * * @param array $data */ public function setPtbChargeData($data = []) { if (empty($data)) { return; } $this->setOrderId(get_val($data, 'order_id', $this->order_id)); $this->setType(get_val($data, 'type', $this->type)); $this->setFromId(get_val($data, 'from_id', $this->from_id)); $this->setMemId(get_val($data, 'mem_id', $this->mem_id)); $this->setAmount(get_val($data, 'amount', $this->amount)); $this->setRealAmount(get_val($data, 'real_amount', $this->real_amount)); $this->setPtbCnt(get_val($data, 'ptb_cnt', $this->ptb_cnt)); $this->setRebateCnt(get_val($data, 'rebate_cnt', $this->rebate_cnt)); $this->setDiscount(get_val($data, 'discount', $this->discount)); $this->setPayway(get_val($data, 'payway', '')); $this->setIp(get_val($data, 'ip', request()->ip())); $this->setStatus(get_val($data, 'status', $this->status)); } /** * 设置游戏币充值订单数据 * * @param array $data */ public function setGmChargeData($data = []) { if (empty($data)) { return; } $this->setOrderId(get_val($data, 'order_id', $this->order_id)); $this->setMemId(get_val($data, 'mem_id', $this->mem_id)); $this->setAppId(get_val($data, 'app_id', $this->app_id)); $this->setFromId(get_val($data, 'from_id', $this->from_id)); $this->setType(get_val($data, 'type', $this->type)); $this->setAmount(get_val($data, 'amount', $this->amount)); $this->setRealAmount(get_val($data, 'real_amount', $this->real_amount)); $this->setGmCnt(get_val($data, 'gm_cnt', $this->gm_cnt)); $this->setRebateCnt(get_val($data, 'rebate_cnt', $this->rebate_cnt)); $this->setDiscount(get_val($data, 'discount', $this->discount)); $this->setPayway(get_val($data, 'payway', '')); $this->setIp(get_val($data, 'ip', request()->ip())); $this->setStatus(get_val($data, 'status', $this->status)); } /** * 获取玩家平台币收入输入 * * @return array */ public function getPtbChargeData() { $_data['order_id'] = $this->order_id; $_data['mem_id'] = $this->mem_id; $_data['from_id'] = $this->agent_id; $_data['type'] = $this->type; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['ptb_cnt'] = $this->ptb_cnt; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * 获取玩家游戏币收入 * * @return array */ public function getGmChargeData() { $_data['order_id'] = $this->order_id; $_data['mem_id'] = $this->mem_id; $_data['app_id'] = $this->app_id; $_data['from_id'] = $this->agent_id; $_data['type'] = $this->type; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['gm_cnt'] = $this->gm_cnt; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * 设置渠道平台币订单数据 * * @param array $data */ public function setPtbAgentChargeData($data = []) { if (empty($data)) { return; } $this->setOrderId(get_val($data, 'order_id', $this->order_id)); $this->setType(get_val($data, 'type', $this->type)); $this->setFromId(get_val($data, 'from_id', $this->from_id)); $this->setAgentId(get_val($data, 'agent_id', $this->agent_id)); $this->setAmount(get_val($data, 'amount', $this->amount)); $this->setRealAmount(get_val($data, 'real_amount', $this->real_amount)); $this->setPtbCnt(get_val($data, 'ptb_cnt', $this->ptb_cnt)); $this->setRebateCnt(get_val($data, 'rebate_cnt', $this->rebate_cnt)); $this->setDiscount(get_val($data, 'discount', $this->discount)); $this->setPayway(get_val($data, 'payway', '')); $this->setIp(get_val($data, 'ip', request()->ip())); $this->setStatus(get_val($data, 'status', $this->status)); } /** * 获取渠道平台币充值数据 * * @return array */ public function getPtbAgentChargeData() { $_data['order_id'] = $this->order_id; $_data['agent_id'] = $this->to_agent_id; $_data['from_id'] = $this->agent_id; $_data['type'] = $this->type; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['ptb_cnt'] = $this->ptb_cnt; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * 获取渠道平台币扣除数据 */ public function getPtbAgentDeductData() { $_data['app_id'] = $this->app_id; $_data['back_order_id'] = $this->order_id; $_data['user_type'] = PtbBackModel::USER_TYPE_AGENT; $_data['agent_id'] = $this->to_agent_id; $_data['ptb_cnt'] = $this->ptb_cnt; $_data['back_ptb_cnt'] = $this->back_ptb_cnt; $_data['status'] = $this->status; $_data['remark'] = $this->remark; return $_data; } /** * 获取玩家平台币扣除数据 */ public function getPtbPlayerDeductData() { $_data['app_id'] = $this->app_id; $_data['back_order_id'] = $this->order_id; $_data['user_type'] = PtbBackModel::USER_TYPE_MEM; $_data['mem_id'] = $this->mem_id; $_data['ptb_cnt'] = $this->ptb_cnt; $_data['back_ptb_cnt'] = $this->back_ptb_cnt; $_data['status'] = $this->status; $_data['remark'] = $this->remark; return $_data; } /** * 获取玩家游戏币扣除数据 */ public function getGmPlayerDeductData() { $_data['app_id'] = $this->app_id; $_data['back_order_id'] = $this->order_id; $_data['user_type'] = GmBackModel::USER_TYPE_MEM; $_data['mem_id'] = $this->mem_id; $_data['gm_cnt'] = $this->gm_cnt; $_data['back_gm_cnt'] = $this->back_gm_cnt; $_data['status'] = $this->status; $_data['remark'] = $this->remark; return $_data; } /** * 获取渠道平台币充值数据 * * @return array */ public function getPtbAgentOrderData() { $_data['order_id'] = $this->order_id; $_data['agent_id'] = $this->agent_id; $_data['to_mem_id'] = $this->mem_id; $_data['to_agent_id'] = $this->to_agent_id; $_data['app_id'] = $this->app_id; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['ptb_cnt'] = $this->ptb_cnt; $_data['gm_cnt'] = $this->gm_cnt; $_data['cost_ptb_cnt'] = $this->cost_ptb_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * 获取玩家平台币充值数据 * * @return array */ public function getPtbOrderData() { $_data['order_id'] = $this->order_id; $_data['type'] = $this->type; $_data['app_id'] = $this->app_id; $_data['mem_id'] = $this->mem_id; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['ptb_cnt'] = $this->cost_ptb_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * 获取玩家游戏币消费数据 * * @return array */ public function getGmOrderData() { $_data['order_id'] = $this->order_id; $_data['type'] = $this->type; $_data['app_id'] = $this->app_id; $_data['mem_id'] = $this->mem_id; $_data['amount'] = $this->amount; $_data['real_amount'] = $this->real_amount; $_data['rebate_cnt'] = $this->rebate_cnt; $_data['gm_cnt'] = $this->cost_gm_cnt; $_data['discount'] = $this->discount; $_data['payway'] = $this->payway; $_data['ip'] = $this->ip; $_data['status'] = $this->status; return $_data; } /** * @return string */ public function getOrderId() { return $this->order_id; } /** * @param string $order_id */ public function setOrderId($order_id) { $this->order_id = $order_id; } /** * @return int */ public function getFromId() { return $this->from_id; } /** * @param int $from_id */ public function setFromId($from_id) { $this->from_id = $from_id; } /** * @return int */ public function getMemId() { return $this->mem_id; } /** * @param int $mem_id */ public function setMemId($mem_id) { $this->mem_id = $mem_id; } /** * @return float */ public function getAmount() { return $this->amount; } /** * @param float $amount */ public function setAmount($amount) { $this->amount = $amount; } /** * @return float */ public function getRealAmount() { return $this->real_amount; } /** * @param float $real_amount */ public function setRealAmount($real_amount) { $this->real_amount = $real_amount; } /** * @return float */ public function getPtbCnt() { return $this->ptb_cnt; } /** * @param float $ptb_cnt */ public function setPtbCnt($ptb_cnt) { $this->ptb_cnt = $ptb_cnt; } /** * @return float */ public function getRebateCnt() { return $this->rebate_cnt; } /** * @param float $rebate_cnt */ public function setRebateCnt($rebate_cnt) { $this->rebate_cnt = $rebate_cnt; } /** * @return float */ public function getDiscount() { return $this->discount; } /** * @param float $discount */ public function setDiscount($discount) { $this->discount = $discount; } /** * @return string */ public function getPayway() { return $this->payway; } /** * @param string $payway */ public function setPayway($payway) { $this->payway = $payway; } /** * @return string */ public function getIp() { return $this->ip; } /** * @param string $ip */ public function setIp($ip) { $this->ip = $ip; } /** * @return int */ public function getStatus() { return $this->status; } /** * @param int $status */ public function setStatus($status) { $this->status = $status; } /** * @return int */ public function getCreateTime() { return $this->create_time; } /** * @param int $create_time */ public function setCreateTime($create_time) { $this->create_time = $create_time; } /** * @return int */ public function getUpdateTime() { return $this->update_time; } /** * @param int $update_time */ public function setUpdateTime($update_time) { $this->update_time = $update_time; } /** * @return string */ public function getRemark() { return $this->remark; } /** * @param string $remark */ public function setRemark($remark) { $this->remark = $remark; } /** * @return int */ public function getType() { return $this->type; } /** * @param int $type */ public function setType($type) { $this->type = $type; } /** * @return int */ public function getAgentId() { return $this->agent_id; } /** * @param int $agent_id */ public function setAgentId($agent_id) { $this->agent_id = $agent_id; } /** * @return int */ public function getCostPtbCnt() { return $this->cost_ptb_cnt; } /** * @param int $cost_ptb_cnt */ public function setCostPtbCnt($cost_ptb_cnt) { $this->cost_ptb_cnt = $cost_ptb_cnt; } /** * @return int */ public function getToAgentId() { return $this->to_agent_id; } /** * @param int $to_agent_id */ public function setToAgentId($to_agent_id) { $this->to_agent_id = $to_agent_id; } /** * @return int */ public function getAppId() { return $this->app_id; } /** * @param int $app_id */ public function setAppId($app_id) { $this->app_id = $app_id; } /** * @return float */ public function getBackPtbCnt() { return $this->back_ptb_cnt; } /** * @param float $back_ptb_cnt */ public function setBackPtbCnt($back_ptb_cnt) { $this->back_ptb_cnt = $back_ptb_cnt; } /** * @return float */ public function getGmCnt() { return $this->gm_cnt; } /** * @param float $gm_cnt */ public function setGmCnt($gm_cnt) { $this->gm_cnt = $gm_cnt; } /** * @return float */ public function getCostGmCnt() { return $this->cost_gm_cnt; } /** * @param float $cost_gm_cnt */ public function setCostGmCnt($cost_gm_cnt) { $this->cost_gm_cnt = $cost_gm_cnt; } /** * @return float */ public function getBackGmCnt() { return $this->back_gm_cnt; } /** * @param float $back_gm_cnt */ public function setBackGmCnt($back_gm_cnt) { $this->back_gm_cnt = $back_gm_cnt; } }