OrderController.php 1.8 KB
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\controller;

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


class OrderController extends AdminBaseController
{


    public function index()
    {


        $param = $this->request->param();


        $mobile = empty($param['mobile']) ? '' : $param['mobile'];
        if (!empty($mobile)) {
            $where['u.mobile'] = $mobile;
        }

        $status = empty($param['status']) ? '' : $param['status'];
        if (!empty($status)) {
            $where['o.status'] = $status;
        }

        $where['o.create_time'] = array('gt','0');
        $list = DB::name('order')
            ->alias('o')
            ->join('qnb_user u','u.id=o.uid')
            ->join('qnb_goods g','g.id = o.gid')
            ->field('o.*,u.user_nickname,g.name as gname')
            ->where($where)
            ->paginate(15);

        $this->assign("list", $list->items());
        $this->assign('page', $list->render());

        return $this->fetch();
    }

    public function delete(){
        $id=input('id');
        $map['id']=$id;
        $result=\db('order')->where($map)->delete();
        if ($result==1){
            return $this->success('操作成功!');
        }else{
            $this->error('编辑失败!');
        }
    }
}