OrderController.php 2.1 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: Powerless < wzxaini9@gmail.com>
// +----------------------------------------------------------------------
namespace app\user\controller;

use app\user\model\CommentModel;
use cmf\controller\UserBaseController;
use app\user\model\UserModel;
use think\Db;
use think\Request;

class OrderController extends UserBaseController
{

    //我的订单
    public function my_order()
    {
        $uid = session('user.id');
        $data = Db::name('order')
            ->alias('o')
            ->join('__GOODS__ g','o.gid = g.id')
            ->join('__USER__ u','u.id = o.uid')
            ->where(['uid'=>session('user.id'),'o.status'=>'1'])
            ->field('o.*,g.name,g.price')
            ->select()
            ->toArray();


        $this->assign('data',$data);
        return $this->fetch();
    }
    //订单详情
    public function order_details(Request $req){
        $id = $req->param('id');
        $data = Db::name('order')
            ->alias('o')
            ->join('__USER__ u','o.uid = u.id')
            ->where(['o.id'=>$id])
            ->field('o.*,u.*')
            ->find();
        $this->assign('data',$data);
        return $this->fetch();
    }
    //订单详情11
    public function order_details_1(Request $req){
        $id = $req->param('id');
        $data = Db::name('order')
            ->alias('o')
            ->join('__GOODS__ g','o.gid = g.id')
            ->where(['o.id'=>$id])
            ->field('g.*')
            ->find();
        $this->assign('data',$data);
        return $this->fetch();
    }

    //支付成功
    public function pay_success(){
        return $this->fetch();
    }



}