更新
This commit is contained in:
parent
aa56785edf
commit
ea875280a4
@ -1064,9 +1064,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
||||
$product_source_id=0;
|
||||
$product_mer_id=0;
|
||||
if($cart['source']==103){
|
||||
$old_product_id=Db::name('product')->where('product_id',$cart['product_id'])->value('old_product_id');
|
||||
$old_product_id=Db::name('store_product')->where('product_id',$cart['product_id'])->value('old_product_id');
|
||||
if($old_product_id){
|
||||
$old_mer_id=Db::name('product')->where('product_id',$old_product_id)->value('mer_id');
|
||||
$old_mer_id=Db::name('store_product')->where('product_id',$old_product_id)->value('mer_id');
|
||||
$product_mer_id=$old_mer_id;
|
||||
$product_source_id=$old_product_id;
|
||||
}
|
||||
|
122
app/controller/admin/order/StoreOrderBehalf.php
Normal file
122
app/controller/admin/order/StoreOrderBehalf.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\controller\admin\store\order;
|
||||
|
||||
|
||||
|
||||
use crmeb\basic\BaseController;
|
||||
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use think\facade\Db;
|
||||
use think\App;
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
|
||||
/**代发订单
|
||||
* Class StoreOrder
|
||||
* @package app\controller\api\store\order
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
class StoreOrderBehalf extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var StoreOrderRepository
|
||||
*/
|
||||
protected $repository;
|
||||
protected $dao;
|
||||
|
||||
/**
|
||||
* StoreOrder constructor.
|
||||
* @param App $app
|
||||
* @param StoreOrderRepository $repository
|
||||
*/
|
||||
public function __construct(App $app, StoreOrderRepository $repository,StoreOrderDao $dao)
|
||||
{
|
||||
parent::__construct($app);
|
||||
$this->repository = $repository;
|
||||
$this->dao = $dao;
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$status = $this->request->param('status','all');
|
||||
$mer_id = $this->request->merId();
|
||||
if ($mer_id) {
|
||||
if($status=='all'){
|
||||
$where['status']=['>=',0];
|
||||
}else{
|
||||
$where['status']=['=',$status];
|
||||
}
|
||||
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
|
||||
}
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
} elseif ($status == 1) {
|
||||
$where['status'] = 3;
|
||||
}
|
||||
$where['source']=103;
|
||||
return app('json')->success($this->repository->getList($where,1, $limit));
|
||||
|
||||
}
|
||||
return app('json')->success([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function detail($id)
|
||||
{
|
||||
$order = $this->repository->getDetail((int)$id);
|
||||
if (!$order)
|
||||
return app('json')->fail('订单不存在');
|
||||
if ($order->order_type == 1) {
|
||||
$order->append(['take', 'refund_status']);
|
||||
}
|
||||
return app('json')->success($order->toArray());
|
||||
}
|
||||
|
||||
/**代发订单统计
|
||||
* @return mixed
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function number()
|
||||
{
|
||||
$mer_id=$this->request->merId();
|
||||
if ($mer_id) {
|
||||
$noPostage = Db::name('store_order_behalf')
|
||||
->where('mer_id', $mer_id)->where('status',0)
|
||||
->count();
|
||||
$noDeliver = Db::name('store_order_behalf')
|
||||
->where('mer_id', $mer_id)->where('status',1)
|
||||
->count();
|
||||
|
||||
}
|
||||
return app('json')->success(compact('noDeliver', 'noPostage',));
|
||||
}
|
||||
}
|
@ -77,18 +77,18 @@ class StoreOrderBehalf extends BaseController
|
||||
}else{
|
||||
$where['status']=['=',$status];
|
||||
}
|
||||
// $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
// if ($column) {
|
||||
// $where['order_id'] = $column;
|
||||
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
|
||||
// }
|
||||
}
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
} elseif ($status == 1) {
|
||||
$where['status'] = 3;
|
||||
}
|
||||
$where['source']=103;
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
return app('json')->success($this->repository->getList($where,1, $limit));
|
||||
|
||||
}
|
||||
return app('json')->success([]);
|
||||
|
@ -20,16 +20,19 @@ class StoreOrder extends BaseController
|
||||
// if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
|
||||
// $codes = explode(',', $order['user_address_code']);
|
||||
// if (count($codes) > 4) {
|
||||
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
|
||||
if ($order['source']==103) {
|
||||
$datas = [
|
||||
'master_mer_id' => $order['mer_id'],
|
||||
'mer_id' => $merchant_two['mer_id'],
|
||||
'order_id' => $order['order_id'],
|
||||
'status' => 0
|
||||
];
|
||||
Db::name('store_order_behalf')->insert($datas);
|
||||
}
|
||||
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
|
||||
$find = Db::name('store_order_product')->where('order_id', $order['order_id'])->field('product_source_id,product_mer_id');
|
||||
if ($order['source'] == 103 && $find) {
|
||||
$datas = [
|
||||
'master_mer_id' => $order['mer_id'],
|
||||
'product_mer_id' => $find['product_mer_id'],
|
||||
'product_source_id' => $find['product_source_id'],
|
||||
'order_id' => $order['order_id'],
|
||||
'delivery' => 0,
|
||||
'status' => 1,
|
||||
];
|
||||
Db::name('store_order_behalf')->insert($datas);
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user