Money.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <?php
  2. /**
  3. *------Create thems Controller------
  4. *------SCWPHP Version 1.0.0------
  5. *------Dev Model Jions------
  6. *------Create Time 2017-06-13 15:41:29------
  7. */
  8. namespace App\Api\Controller;
  9. use Biz\Account\AccountManager;
  10. class Money extends BaseController {
  11. public $money;
  12. public function init() {
  13. $this->money = new \Biz\Money\MoneyHandle;
  14. }
  15. /**
  16. * 绑银行卡接口
  17. */
  18. public function Bind_bank() {
  19. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  20. $bank_address = $this->verifyPar('bank_address', 'post'); //开户银行所在地
  21. $bank_name = $this->verifyPar('bank_name', 'post'); //银行名称
  22. $bank_no = $this->verifyPar('bank_no', 'post'); //银行卡号
  23. $bank_user = $this->verifyPar('bank_user', 'post'); //开户人姓名
  24. $pay_pwd = $this->verifyPar('pay_pwd', 'post'); //支付密码
  25. $sure_pwd = $this->verifyPar('sure_pwd', 'post'); //确认密码
  26. //$money = new \Biz\Money\MoneyHandle();
  27. $res = $this->money->bind_bank($account_identity, $bank_address, $bank_name, $bank_no, $bank_user, $pay_pwd, $sure_pwd);
  28. Render($res, '1', lang()->get('success'));
  29. }
  30. /**
  31. * 设置交易密码接口
  32. */
  33. public function Set_payPwd() {
  34. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  35. $pay_pwd = $this->verifyPar('pay_pwd', 'post'); //支付密码
  36. $sure_pwd = $this->verifyPar('sure_pwd', 'post'); //确认密码
  37. //$money = new \Biz\Money\MoneyHandle();
  38. $res = $this->money->setPayPwd($account_identity, $pay_pwd, $sure_pwd);
  39. Render($res, '1', lang()->get('success'));
  40. }
  41. /**
  42. * 设置交易密码接口 ,新增
  43. */
  44. public function SetPayPwd() {
  45. //$account_identity = isset($_SESSION['uinfo']['account_identity']) ? $_SESSION['uinfo']['account_identity'] : '';
  46. $am=new AccountManager();
  47. $uinfo=$am->getCurrentUser ();
  48. $account_identity=$uinfo?$uinfo->account_identity:'';
  49. $pay_pwd = $this->verifyPar('pay_pwd', 'post'); //支付密码
  50. $sure_pwd = $this->verifyPar('sure_pwd', 'post'); //确认密码
  51. //$money = new \Biz\Money\MoneyHandle();
  52. $res = $this->money->setPayPwd($account_identity, $pay_pwd, $sure_pwd);
  53. Render('', $res, '');
  54. }
  55. /**
  56. * 检测用户是否设置交易密码
  57. */
  58. public function CheckSetPayPwd() {
  59. $am=new AccountManager();
  60. $uinfo=$am->getCurrentUser ();
  61. $account_identity=$uinfo?$uinfo->account_identity:'';
  62. $res = $this->money->checkPayPwd($account_identity);
  63. Render('', $res, '');
  64. }
  65. /**
  66. * 修改银行卡状态接口
  67. */
  68. public function ChangeStatus() {
  69. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  70. $pay_pwd = $this->verifyPar('pay_pwd', 'post'); //支付密码
  71. $bank_no = $this->verifyPar('bank_no', 'post'); //银行卡号
  72. $type = $this->verifyPar('type', 'post'); //修改状态
  73. //$money = new \Biz\Money\MoneyHandle();
  74. $res = $this->money->bankStatus($account_identity, $bank_no, $pay_pwd, $type);
  75. Render($res, '1', lang()->get('success'));
  76. }
  77. /**
  78. * 提现申请接口
  79. */
  80. public function TakeMoney() {
  81. $money = $this->verifyPar('money', 'post'); //提现金额
  82. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  83. $pwd = $this->verifyPar('pay_pwd', 'post'); //支付密码
  84. //$money123 = new \Biz\Money\MoneyHandle();
  85. $res = $this->money->takeMoney($account_identity, $money, $pwd);
  86. Render($res, '1', lang()->get('success'));
  87. }
  88. /**
  89. * 投注
  90. */
  91. public function Betting() {
  92. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  93. $money = $this->verifyPar('money', 'post'); //操作所需金额
  94. $money_type = $this->verifyPar('money_type', 'post'); //资金类型
  95. $identity = UUID();
  96. $orderId = OrderID();
  97. $game_type = $this->verifyPar('game_type', 'post'); //游戏id
  98. $data = [
  99. 'money_type' => $money_type,
  100. 'identity' => $identity,
  101. 'order_id' => $orderId,
  102. 'game_type' => $game_type,
  103. ];
  104. //$moneyclass = new \Biz\Money\MoneyHandle();
  105. $res = $this->money->betting($account_identity, $money, $data);
  106. Render($res, '1', lang()->get('success'));
  107. }
  108. /***
  109. * 中奖
  110. */
  111. public function Prize() {
  112. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  113. $money = $this->verifyPar('money', 'post'); //操作所需金额
  114. $game_type = 'testGame';
  115. //$moneyclass = new \Biz\Money\MoneyHandle();
  116. $res = $this->money->prize($account_identity, $money, $game_type);
  117. Render($res, '1', lang()->get('success'));}
  118. /**
  119. * 充值
  120. */
  121. public function AddMoney() {
  122. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  123. $money = $this->verifyPar('money', 'post'); //操作所需金额
  124. //$moneyclass = new \Biz\Money\MoneyHandle();
  125. $res = $this->money->addMoney($account_identity, $money);
  126. Render($res, '1', lang()->get('success'));
  127. }
  128. /**
  129. * 撤单
  130. */
  131. public function Cancel() {
  132. $account_identity = $this->verifyPar('account_identity', 'post'); //用户唯一id
  133. $order_id = $this->verifyPar('order_id', 'post'); //订单id
  134. //$money = new \Biz\Money\MoneyHandle();
  135. //$money->setPayPwd();
  136. $abc = $this->money->cancel($account_identity, $order_id);
  137. Render($abc, '1', lang()->get('success'));
  138. }
  139. /**
  140. * 验证参数是否传入
  141. * @param [type] $name 参数名
  142. * @param [type] $type 传入类型
  143. * @return [type] 返回参数
  144. */
  145. public function verifyPar($name, $type) {
  146. if ($type == 'get') {
  147. $value = isset($_GET[$name]) ? $_GET[$name] : '';
  148. } else if ($type == 'post') {
  149. $value = isset($_POST[$name]) ? $_POST[$name] : '';
  150. }
  151. return $value;
  152. }
  153. }