123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <?php
- namespace app\api\controller;
- use addons\epay\library\Service;
- use app\api\controller\Common;
- use app\common\model\GiftUserParty;
- use app\common\model\UserExchangeLog;
- use app\common\model\UserExchsoundLog;
- use applebuy\applebuy;
- use fast\Random;
- use app\common\model\RecharOrder;
- use kjpay\kjpay;
- use kjwithdraw\kjwithdraw;
- use think\Exception;
- use think\exception\PDOException;
- use think\exception\ValidateException;
- use think\Request;
- use think\Db;
- use app\common\library\Sms as Smslib;
- class Money extends Common
- {
- protected $noNeedLogin = ['getRecharConfig', 'getRateMoney', 'getExchangeConfig', 'getExchsoundConfig', 'rebateDuty',
- 'kjRecharge', 'changeWithDrawStatus','moneyConfig'];
- protected $noNeedRight = '*';
- public function _initialize()
- {
- parent::_initialize();
- }
-
- public function givejeweltouser(){
- $money = intval(input('money',0));
- $user_id = input('user_id',0);
- $pay_password = input('paypassword','');
-
- if($this->auth->power->transfer == 1){
- $this->error('您已经被限制消费-转账');
- }
-
- if ($user_id == $this->auth->id) {
- $this->error('不允许给自己转账');
- }
-
- $check = Db::name('user')->where('id',$user_id)->find();
- if(empty($check)){
- $this->error('不存在的用户');
- }
-
- if(!$this->auth->pay_password){
- $this->error('请先设置支付密码');
- }
- if ($this->auth->pay_password != $this->getEncryptPassword($pay_password, $this->auth->pay_salt)) {
- $this->error('支付密码有误');
- }
- Db::startTrans();
-
- $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,$money,'-',0,'私聊转账给:'.$check['nickname'],11,'jewel');
- if($rs_wallet['status'] === false){
- Db::rollback();
- $this->error($rs_wallet['msg']);
- }
- $rs_wallet = model('wallet')->lockChangeAccountRemain($user_id,$money,'+',0,$this->auth->nickname.':私聊到账',12,'jewel');
- if($rs_wallet['status'] === false){
- Db::rollback();
- $this->error($rs_wallet['msg']);
- }
- Db::commit();
- $this->success('转账成功');
- }
-
- private function getEncryptPassword($password, $salt = '')
- {
- return md5(md5($password) . $salt);
- }
-
- public function withdrawTransfer() {
- $info = [
- 'money' => 0.10,
- 'alipay_account' => '',
- 'name' => '',
- ];
- $data['out_biz_no'] = getMillisecond() . mt_rand(1, 1000);
- $data['trans_amount'] = $info['money'];
- $data['product_code'] = 'TRANS_ACCOUNT_NO_PWD';
- $data['biz_scene'] = 'DIRECT_TRANSFER';
- $data['order_title'] = 'GG语音提现';
- $data['payee_info']['identity'] = $info['alipay_account'];
-
-
- $data['payee_info']['identity_type'] = 'ALIPAY_LOGON_ID';
- $data['payee_info']['name'] = $info['name'];
-
- $data['remark'] = 'GG语音提现';
- require_once("../extend/AliPay/AliPay.php");
- $alipay =new \AliPay();
- $result =$alipay->AliPayWithdraw($data);
- return $result;
- }
- }
|