审查视图

app/admin/controller/OrderController.php 1.8 KB
xiaohu authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?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();
    }
魏强 authored
53 54 55 56 57 58 59 60 61 62
    public function delete(){
        $id=input('id');
        $map['id']=$id;
        $result=\db('order')->where($map)->delete();
        if ($result==1){
            return $this->success('操作成功!');
        }else{
            $this->error('编辑失败!');
        }
    }
xiaohu authored
63
}