| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
- /**
- * 提现
- */
- namespace app\admin\controller\withdraw;
- use alipay\AopCertClient;
- use alipay\request\AlipayFundTransUniTransferRequest;
- use app\admin\logic\UserLogic;
- use app\admin\logic\WithdrawLogLogic;
- use app\admin\model\dao\WithdrawLog;
- use app\admin\traits\Curd;
- use app\api\services\AliPayServices;
- use app\api\services\ThirdPayServices;
- use app\validate\admin\withdraw\withdraw\ReturnServiceMoney;
- use EasyAdmin\annotation\ControllerAnnotation;
- use EasyAdmin\annotation\NodeAnotation;
- use app\common\controller\AdminController;
- use app\common\model\WithDrawLogModel;
- use jianyan\excel\Excel;
- use think\App;
- use think\Exception;
- use think\exception\ValidateException;
- use think\facade\Cache;
- use think\facade\Db;
- /**
- * Class Admin
- * @package app\admin\controller\withdraw
- * @ControllerAnnotation(title="提现管理处理")
- */
- class Withdraw extends AdminController
- {
- public function __construct(App $app, WithDrawLogModel $model)
- {
- parent::__construct($app);
- $this->model = $model;
- }
- use Curd;
- /**
- * @NodeAnotation(title="列表")
- */
- public function index()
- {
- if ($this->request->isAjax()) {
- if (input('selectFields')) {
- return $this->selectList();
- }
- list($page, $limit, $where) = $this->buildTableParames();
- Cache::set("WITHDRAW_EXPORT", ['page' => $page, 'limit' => $limit, 'where' => $where]);
- list($count, $list) = WithdrawLogLogic::getList($page, $limit, $where, $this->user_map, $this->sort);
- $data = [
- 'code' => 0,
- 'msg' => '',
- 'count' => $count,
- 'data' => $list,
- ];
- return json($data);
- }
- $this->assign('limits',[10, 15, 20, 25, 50, 100]);
- return $this->fetch();
- }
- /**
- * @NodeAnotation(title="提现失败")
- */
- public function withdrawerror($id)
- {
- if ($this->request->isPost()) {
- $post = $this->request->post();
- list($return, $msg) = WithdrawLogLogic::withdrawError($id, $post);
- $return === true ? $this->success($msg) : $this->error($msg);
- }
- return $this->fetch();
- }
- /**
- * @NodeAnotation(title="执行提现")
- */
- public function tx($id)
- {
- list($return, $msg) = WithdrawLogLogic::tx($id);
- $return === true ? $this->success($msg) : $this->error($msg);
- }
- /**
- * @NodeAnotation(title="导出")
- */
- public function export()
- {
- list($page, $limit, $where) = $this->buildTableParames();
- if (empty($where)) {
- $search = Cache::get("WITHDRAW_EXPORT");
- $page = $search['page'];
- $limit = $search['limit'];
- $where = $search['where'];
- }
- $header = getExportHeader($this->model->getName(), $this->noExportFields);
- $list = WithdrawLogLogic::getExportList($where, $page, $limit);
- $fileName = time();
- return Excel::exportData($list, $header, $fileName, 'xlsx');
- }
- /**
- * @NodeAnotation(title="提现数据")
- */
- public function withdrawdata()
- {
- $tx_success = WithdrawLog::SumPracticalMoneyByStatus(1);
- $this->assign('tx_success', $tx_success);
- $tx = WithdrawLog::SumPracticalMoneyByStatus(0);
- $this->assign('tx', $tx);
- return $this->fetch();
- }
- /**
- * 退还手续费
- * @return mixed
- */
- public function returnservicemoney()
- {
- $id = $this->request['id'];
- $withdrawLog = new WithdrawLogLogic();
- if ($this->request->isPost()) {
- $post = $this->request->post();
- try {
- validate(ReturnServiceMoney::class)->check($post);
- } catch (ValidateException $e) {
- $this->error($e->getMessage());
- }
- $result = $withdrawLog->returnServiceMoney($post);
- if ($result !== true) {
- $this->error($result);
- }
- $this->success('成功');
- }
- $withdrawLog->getWithdrawLog($id);
- $this->assign('info', $withdrawLog);
- return $this->fetch();
- }
- }
|