LogisticsController.php 1.4 KB
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/7
 * Time: 19:11
 */

namespace app\portal\controller;


use app\portal\model\IndentGoodsModel;
use app\portal\model\IndentModel;
use cmf\controller\WeChatBaseController;

class LogisticsController extends WeChatBaseController
{
    public function index(){
        $indent_id = $this->request->param('indent_id',0,'intval');
        if(empty($indent_id)){
            $this->error('缺少必要参数','','','');
        }
        $birdController = new BirdController();
        $indentModel = new IndentModel();
        $where['id'] = ['eq',$indent_id];
        $data = $indentModel->findData($where);
        if(empty($data)){
            $this->error('查询为空','','','');
        }
        $result = $birdController->getOrder($indent_id);
        if(empty($result)){
            $this->error('未知错误','','');
        }
        if($result['code'] != 20000){
            $this->error($result['msg'],'','','');
        }
        $indent = $indentModel->findData(['id'=>$indent_id])->toArray();
        $indentGoodsModel = new IndentGoodsModel();
        $indent_goods = $indentGoodsModel->selectData(['indent_id'=>$indent_id]);
        $indent['indent_goods'] = $indent_goods;
        $this->assign('data',$result['data']);
        $this->assign('indent',$indent);
        return $this->fetch();
    }

}