95 lines
2.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\admin\v1\supplier;
use app\services\order\StoreOrderDeliveryServices;
use think\facade\App;
use app\controller\admin\AuthController;
use app\services\order\StoreOrderServices;
use app\common\controller\Order as CommonOrder;
use app\services\order\supplier\SupplierOrderServices;
/**
* Class StoreOrder
* @package app\controller\admin\v1\supplier
*/
class StoreOrder extends AuthController
{
use CommonOrder;
/**
* @var StoreOrderServices
*/
protected $services;
/**
* StoreOrder constructor.
* @param App $app
* @param StoreOrderServices $services
*/
public function __construct(App $app, StoreOrderServices $services)
{
parent::__construct($app);
$this->services = $services;
}
/**
* 订单列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index()
{
$where = $this->request->getMore([
['status', ''],
['real_name', ''],
['is_del', ''],
['data', '', '', 'time'],
['type', ''],
['pay_type', ''],
['order', ''],
['field_key', ''],
['supplier_id', -1]
]);
if ($where['supplier_id'] < 1) {
$where['supplier_id'] = -1;
}
$where['type'] = trim($where['type']);
$where['is_system_del'] = 0;
$where['store_id'] = 0;
$where['type'] = trim($where['type'], ' ');
return $this->success($this->services->getOrderList($where, ['*'], ['split' => function ($query) {
$query->field('id,pid');
}, 'pink', 'invoice', 'supplier']));
}
/**
* 提醒发货
* @param StoreOrderDeliveryServices $storeOrderDeliveryServices
* @param $supplierId
* @param $id
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function deliverRemind(StoreOrderDeliveryServices $storeOrderDeliveryServices, $supplierId, $id)
{
if (!$supplierId || !$id) return $this->fail('参数异常');
$storeOrderDeliveryServices->deliverRemind((int)$id);
return $this->success('提醒成功');
}
}