更新
This commit is contained in:
parent
aa56785edf
commit
ea875280a4
@ -1064,9 +1064,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$product_source_id=0;
|
$product_source_id=0;
|
||||||
$product_mer_id=0;
|
$product_mer_id=0;
|
||||||
if($cart['source']==103){
|
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){
|
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_mer_id=$old_mer_id;
|
||||||
$product_source_id=$old_product_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{
|
}else{
|
||||||
$where['status']=['=',$status];
|
$where['status']=['=',$status];
|
||||||
}
|
}
|
||||||
// $column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
$column = Db::name('store_order_behalf')->where('mer_id', $mer_id)->where($where)->page($page)->limit($limit)->column('order_id');
|
||||||
// if ($column) {
|
if ($column) {
|
||||||
// $where['order_id'] = $column;
|
$where['order_id'] = $column;
|
||||||
|
|
||||||
// }
|
}
|
||||||
if ($status == 0) {
|
if ($status == 0) {
|
||||||
$where['status'] = 2;
|
$where['status'] = 2;
|
||||||
} elseif ($status == 1) {
|
} elseif ($status == 1) {
|
||||||
$where['status'] = 3;
|
$where['status'] = 3;
|
||||||
}
|
}
|
||||||
$where['source']=103;
|
$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([]);
|
return app('json')->success([]);
|
||||||
|
@ -21,12 +21,15 @@ class StoreOrder extends BaseController
|
|||||||
// $codes = explode(',', $order['user_address_code']);
|
// $codes = explode(',', $order['user_address_code']);
|
||||||
// if (count($codes) > 4) {
|
// 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();
|
// $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) {
|
$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 = [
|
$datas = [
|
||||||
'master_mer_id' => $order['mer_id'],
|
'master_mer_id' => $order['mer_id'],
|
||||||
'mer_id' => $merchant_two['mer_id'],
|
'product_mer_id' => $find['product_mer_id'],
|
||||||
|
'product_source_id' => $find['product_source_id'],
|
||||||
'order_id' => $order['order_id'],
|
'order_id' => $order['order_id'],
|
||||||
'status' => 0
|
'delivery' => 0,
|
||||||
|
'status' => 1,
|
||||||
];
|
];
|
||||||
Db::name('store_order_behalf')->insert($datas);
|
Db::name('store_order_behalf')->insert($datas);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user