<?php
/**
 * @package merchant
 *
 * @author xaboy
 * @day 2020/6/1
 *
 * 
 */

namespace app\controller\api\store\order;


use app\common\model\user\UserBill;
use app\common\repositories\store\order\AgentOrderRepository;
use crmeb\basic\BaseController;
use crmeb\services\ExpressService;
use think\App;

/**
 * Class StoreOrder
 * @package app\controller\api\store\order
 * @author xaboy
 * @day 2020/6/10
 */
class AgentOrder extends BaseController
{
    /**
     * @var AgentOrderRepository
     */
    protected $repository;

    /**
     * StoreOrder constructor.
     * @param App $app
     * @param AgentOrderRepository $repository
     */
    public function __construct(App $app, AgentOrderRepository $repository)
    {
        parent::__construct($app);
        $this->repository = $repository;
    }


    /*生成订单*/
    public  function createOrder(){
        $params = $this->request->params([
            'type',
        ]);
        $uid = $this->request->uid();
        if (!$params['type']){
            return app('json')->fail('请检查参数');
        }
        $result =  $this->repository->createOrder($uid,$params['type']);
        if($result['code'] == 400){
            return  app('json')->fail($result['msg']);
        }
        return app('json')->success("成功",$result);
    }






}
