AdminGetController.php 3.1 KB
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <bronet@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\AdminBaseController;
use think\Db;

/**
 * Class AdminGetController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'提现记录',
 *     'action' =>'default',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'提现记录'
 * )
 */
class AdminGetController extends AdminBaseController
{
    /**
     * 提现记录
     * @adminMenu(
     *     'name'   => '提现记录',
     *     'parent' => 'portal/AdminGet/default',
     *     'display'=> true,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '提现记录',
     *     'param'  => ''
     * )
     */
    public function index()
    {
        $data = $this->request->param();
        $return = $this->adminIndex($data);
        $page_arr = $return['page_arr'];
        if(!empty($return['where_arr']['create_time'])){
            $where_vehicle['g.create_time'] = $return['where_arr']['create_time'];
        }

        if(!empty($data['keyword'])){
            $page_arr['keyword'] = $data['keyword'];
            $where_vehicle['m.name'] = array('like','%'.$data['keyword'].'%');
            $this->assign('keyword', $data['keyword']);
        }

        $where_vehicle['g.status'] = array('neq',9);
        $list = Db::name('GetMoney')->alias('g')
            ->where($where_vehicle)
            ->join('Member m','m.id = g.user_id')
            ->join('Order o','o.id = g.order_id')
            ->field('g.*,m.name as user_name ,m.id as user_id , o.order_sn')
            ->order('create_time desc')
            ->paginate(10,false,['query'=>$page_arr]);
        $page = $list->render();
        $this->assign('page', $page);
        $this->assign('list', $list);

        return $this->fetch();
    }

    /**
     * 删除提现记录
     * @adminMenu(
     *     'name'   => '删除提现记录',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '删除提现记录',
     *     'param'  => ''
     * )
     */
    public function delete()
    {
        $data = $this->request->param();
        $where_stock['id'] = $data['id'];
        $up['status'] = 9;
        $up['update_time'] = time();
        $is_candel = Db::name('GetMoney')->where($where_stock)->update($up);
        if($is_candel){
            $this->success('删除成功');
        }else{
            $this->error('删除失败');
        }
    }
}