HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/cs.wgegeghx.com/application/pay/controller/Payment.php
<?php

// | 支付模块管理

namespace app\pay\controller;

use app\common\controller\Adminbase;
use app\pay\model\Account as AccountModel;
use app\pay\model\Payment as PaymentModel;
use app\pay\model\Spend as SpendModel;
use think\Db;

class Payment extends Adminbase
{
    protected function initialize()
    {
        parent::initialize();
        $this->PaymentModel = new PaymentModel;
        $this->modelClass = new AccountModel;
        $this->SpendModel = new SpendModel;

    }

    public function modify_deposit()
    {
        if ($this->request->isAjax()) {
            $data = $this->request->post();
            $result = $this->validate($data, 'Account');
            if (true !== $result) {
                return $this->error($result);
            }
            $userinfo = Db::name('member')->where('username', trim($data['username']))->find();
            if ($userinfo) {
                if ($data['pay_unit']) {
                    //增加
                    $this->modelClass->_add($data['pay_type'], floatval($data['unit']), 'recharge', $userinfo['id'], $userinfo['username'], $data['usernote'], $this->_userinfo['username']);
                } else {
                    //减少
                    $this->SpendModel->_spend($data['pay_type'], floatval($data['unit']), $userinfo['id'], $userinfo['username'], '后台充值', $data['usernote']);
                }
                $this->success("充值成功!");
            } else {
                $this->error('用户不存在!');
            }

        } else {
            return $this->fetch();
        }
    }

    //支付模块列表
    public function pay_list()
    {
        if ($this->request->isAjax()) {
            $data = $this->PaymentModel->select();
            return json(["code" => 0, "data" => $data]);
        } else {
            return $this->fetch();
        }
    }

    //支付模块配置
    public function edit()
    {
        if ($this->request->isPost()) {
            $data = [];
            $id = $this->request->param('id/d', 0);
            $config = $this->request->param('config/a');
            $data['status'] = $this->request->param('status/d', 0);
            $data['config'] = serialize($config);
            if ($this->PaymentModel->allowField(true)->save($data, ['id' => $id])) {
                cache('Pay_Config', null);
                $this->success("更新成功!", url('index'));
            } else {
                $this->success("更新失败!");
            }
        } else {
            $id = $this->request->param('id/d', 0);
            $info = $this->PaymentModel->where('id', $id)->find();
            $this->assign('info', $info);
            return $this->fetch($info['name']);
        }
    }
}