Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-php into dev
This commit is contained in:
commit
9553526dda
@ -121,6 +121,9 @@ class StoreOrderOtherDao extends BaseDao
|
||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.uid', $where['uid']);
|
||||
})
|
||||
->when(isset($where['source']) && $where['source'] !== '', function ($query) use ($where) {
|
||||
$query->where('StoreOrderOther.source', $where['source']);
|
||||
})
|
||||
->when(isset($where['is_user']) && $where['is_user'] !== 0, function ($query) use ($where) {
|
||||
$query->where(function ($query) {
|
||||
$query->where('order_type', 0)->whereOr(function ($query) {
|
||||
|
@ -301,4 +301,12 @@ class StoreProduct extends BaseController
|
||||
$this->repository->updates($ids,$data);
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
public function copy(){
|
||||
$product=$this->repository->getAdminOneProduct(6300,0);
|
||||
$product = $product->toArray();
|
||||
$product['mer_id']=113;
|
||||
$product['old_product_id']=$product['product_id'];
|
||||
return $this->repository->create($product, 0,1);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,36 +4,49 @@ namespace app\controller\api\store\order;
|
||||
|
||||
use app\common\model\system\merchant\Merchant;
|
||||
use think\facade\Db;
|
||||
use crmeb\basic\BaseController;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 订单处理
|
||||
*/
|
||||
class StoreOrder extends BaseController
|
||||
class StoreProcessing extends BaseController
|
||||
{
|
||||
/**
|
||||
* 自动向市级供应链创建订单
|
||||
*/
|
||||
public function AutomaticallyCreateOrders($order)
|
||||
{
|
||||
// $merchant = Merchant::find($order['mer_id']);
|
||||
//添加到代发订单表里
|
||||
// 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();
|
||||
$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' => 0,
|
||||
];
|
||||
Db::name('store_order_behalf')->insert($datas);
|
||||
|
||||
|
||||
$merchant_two = Db::name('merchant')->where('mer_id', $order['mer_id'])->find();
|
||||
$order['uid'] = $merchant_two['uid'];
|
||||
$order['real_name'] =$merchant_two['mer_name'].'-'. $merchant_two['real_name'];
|
||||
$order['user_phone'] = $merchant_two['mer_phone'];
|
||||
$order['user_address'] = $merchant_two['mer_address'];
|
||||
|
||||
$store_group_order = Db::name('store_group_order')->where('group_order_id', $order['group_order_id'])->find();
|
||||
$store_group_order_other = Db::name('store_group_order_other')->where('group_order_sn', $order['order_sn'])->find();
|
||||
|
||||
if (!$store_group_order_other) {
|
||||
unset($store_group_order['group_order_id']);
|
||||
$group_order_id=Db::name('store_group_order_other')->insertGetId($store_group_order);
|
||||
}
|
||||
$select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select();
|
||||
if ($order['source'] == 103 && $select) {
|
||||
$arr=$select->toArray();
|
||||
unset($order['order_id'],$order['orderProduct'],$order['user'],$order['supply_chain_rate'],$order['logistics_code'],$order['logistics_phone']);
|
||||
$order['group_order_id']=$group_order_id;
|
||||
$order['mer_id']=$select[0]['product_mer_id'];
|
||||
$order['source']=104;
|
||||
$order_id=Db::name('store_order_other')->insertGetId($order);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['order_id'] = $order_id;
|
||||
$arr[$key]['source'] = 104;
|
||||
unset($arr[$key]['order_product_id']);
|
||||
}
|
||||
Db::name('store_order_product_other')->insertAll($arr);
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,12 @@ class OrderOther extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name']);
|
||||
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','source']);
|
||||
$where['mer_id'] = $this->request->merId();
|
||||
$where['paid']=1;
|
||||
if($where['source']<=0){
|
||||
$where['source']=105;
|
||||
}
|
||||
return app('json')->success($this->repository->merchantGetList($where, $page, $limit));
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class StoreOrderBehalf extends BaseController
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
}else{
|
||||
return app('json')->success([]);
|
||||
return app('json')->success(['list'=>[],'count'=>0]);
|
||||
}
|
||||
if ($status == 0) {
|
||||
$where['status'] = 2;
|
||||
@ -128,23 +128,24 @@ class StoreOrderBehalf extends BaseController
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
public function status($id)
|
||||
public function status()
|
||||
{
|
||||
$mer_id = $this->request->merId();
|
||||
$status = $this->request->param('status');
|
||||
$id = $this->request->param('id');
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
$res=0;
|
||||
if ($status == 1) {
|
||||
if($type_code=='TypeSupplyChain'){
|
||||
$res = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)
|
||||
->where('id',$id)->where('status',0)->update(['status'=>1]);
|
||||
->where('order_id',$id)->where('status',0)->update(['status'=>1]);
|
||||
}
|
||||
}
|
||||
if ($status == 3) {
|
||||
if($type_code!='TypeSupplyChain'){
|
||||
$res = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)
|
||||
->where('id',$id)->where('status',1)->update(['status'=>3]);
|
||||
->where('order_id',$id)->where('status',1)->update(['status'=>3]);
|
||||
}
|
||||
}
|
||||
if($res){
|
||||
@ -153,4 +154,28 @@ class StoreOrderBehalf extends BaseController
|
||||
return app('json')->fail('设置失败');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* TODO 订单头部统计
|
||||
* @return mixed
|
||||
* @author Qinii
|
||||
* @day 2020-08-17
|
||||
*/
|
||||
public function Chart()
|
||||
{
|
||||
$mer_id= $this->request->merId();
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
if($type_code=='TypeSupplyChain'){
|
||||
$column = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)->column('order_id');
|
||||
}else{
|
||||
$column = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)->column('order_id');
|
||||
}
|
||||
$where=[];
|
||||
if ($column) {
|
||||
$where['order_id'] = $column;
|
||||
}else{
|
||||
return app('json')->success(['list'=>[],'count'=>0]);
|
||||
}
|
||||
return app('json')->success($this->repository->OrderTitleNumberWhere($mer_id, $where));
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ use app\common\repositories\system\merchant\MerchantRepository;
|
||||
use crmeb\utils\DingTalk;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use app\controller\api\store\order\StoreProcessing;
|
||||
|
||||
/**
|
||||
* 支付后逻辑
|
||||
@ -30,14 +31,15 @@ class paySuccess
|
||||
public $index = 1;
|
||||
public $remain;
|
||||
|
||||
public function handle($event)
|
||||
public function handle($event,StoreProcessing $StoreProcessing)
|
||||
{
|
||||
try {
|
||||
$orderList = $event['groupOrder']['orderList'];
|
||||
$storeConsumptionUserDao = new StoreConsumptionUserDao();
|
||||
$storeConsumptionUserDao->check($event['groupOrder']['uid'], $event['groupOrder']['group_order_id']);
|
||||
foreach ($orderList as $k => $order) {
|
||||
|
||||
//
|
||||
$StoreProcessing->AutomaticallyCreateOrders($order);
|
||||
$this->recordOrderAddr($order);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
@ -186,6 +186,7 @@ Route::group(function () {
|
||||
Route::get('detail/:id', '/detail')->name('systemStoreProductDetail')->option([
|
||||
'_alias' => '详情',
|
||||
]);
|
||||
Route::get('copy', '/copy');
|
||||
Route::post('update/:id', '/update')->name('systemStoreProductUpdate')->option([
|
||||
'_alias' => '编辑',
|
||||
]);
|
||||
|
@ -323,6 +323,7 @@ Route::group(function () {
|
||||
//代发货订单
|
||||
Route::group('store/behalf_admin', function () {
|
||||
Route::get('/order_list', '/lst');
|
||||
Route::get('/chart', '/chart');
|
||||
Route::get('/code', '/logisticsCode');
|
||||
Route::get('/number', '/number');
|
||||
Route::post('/status', '/status');
|
||||
|
Loading…
x
Reference in New Issue
Block a user