123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651 |
- <?php
- /**
- * WalletRequest.php UTF-8
- *
- *
- * @date : 2018/5/16 22:04
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @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;
- }
- }
|