feat(store_order): 订单打印功能实现
This commit is contained in:
parent
9dde487cb9
commit
f1d5a04b46
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,5 @@
|
|||||||
.env
|
.env
|
||||||
/tests/tmp
|
/tests/tmp
|
||||||
/tests/.phpunit.result.cache
|
/tests/.phpunit.result.cache
|
||||||
public/uploads
|
public/uploads
|
||||||
|
public/image
|
@ -80,7 +80,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
|
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']);
|
||||||
// self::afterPay($order);
|
// self::afterPay($order);
|
||||||
Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$capitalFlowDao = new CapitalFlowLogic($user);
|
$capitalFlowDao = new CapitalFlowLogic($user);
|
||||||
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']);
|
$capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']);
|
||||||
// self::afterPay($order);
|
// self::afterPay($order);
|
||||||
Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
// Redis::send('push-platform-print', ['id' => $order['id']], 60);
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,11 +154,11 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
if ($order->pay_type == 9) {
|
if ($order->pay_type == 9) {
|
||||||
$extra['create_time'] = $order['create_time'];
|
$extra['create_time'] = $order['create_time'];
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||||
|
Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||||
} else {
|
} else {
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
// Db::name('order_middle')->insert(['c_order_id' => $order['id']]);
|
// Db::name('order_middle')->insert(['c_order_id' => $order['id']]);
|
||||||
}
|
}
|
||||||
Redis::send('push-platform-print', ['id' => $order['id']]);
|
|
||||||
if (!empty($extra['payer']['openid']) && $order->pay_type == 7) {
|
if (!empty($extra['payer']['openid']) && $order->pay_type == 7) {
|
||||||
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5);
|
Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5);
|
||||||
}
|
}
|
||||||
@ -281,10 +281,11 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
if ($order->pay_type == 9) {
|
if ($order->pay_type == 9) {
|
||||||
$extra['create_time'] = $order['create_time'];
|
$extra['create_time'] = $order['create_time'];
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]);
|
||||||
|
Redis::send('push-platform-print', ['id' => $order['id']]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']);
|
||||||
}
|
}
|
||||||
Redis::send('push-platform-print', ['id' => $order['id']]);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,12 @@ use app\common\logic\PayNotifyLogic;
|
|||||||
use app\common\logic\SystemStoreStaffLogic;
|
use app\common\logic\SystemStoreStaffLogic;
|
||||||
use app\store\controller\BaseAdminController;
|
use app\store\controller\BaseAdminController;
|
||||||
use app\common\logic\store_order\StoreOrderLogic;
|
use app\common\logic\store_order\StoreOrderLogic;
|
||||||
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
||||||
use app\common\model\store_order\StoreOrder;
|
use app\common\model\store_order\StoreOrder;
|
||||||
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
|
use app\common\model\system_store\SystemStoreStaff;
|
||||||
use app\common\model\user_recharge\UserRecharge;
|
use app\common\model\user_recharge\UserRecharge;
|
||||||
use app\store\validate\store_order\StoreOrderValidate;
|
use app\store\validate\store_order\StoreOrderValidate;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
@ -396,8 +401,35 @@ class StoreOrderController extends BaseAdminController
|
|||||||
}else{
|
}else{
|
||||||
return $this->fail('发送失败');
|
return $this->fail('发送失败');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单打印
|
||||||
|
*/
|
||||||
|
public function print(){
|
||||||
|
$id=$this->request->get('id');
|
||||||
|
$find = StoreOrder::where('id', $id)->find();
|
||||||
|
if ($find) {
|
||||||
|
$merchant = SystemStore::where('id', $find['store_id'])->field('name,phone')->find();
|
||||||
|
$mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin',1)->field('staff_name,phone')->find();
|
||||||
|
$user = User::where('id', $find['uid'])->field('nickname,mobile')->find();
|
||||||
|
$find['system_store_name'] = $merchant['name'];
|
||||||
|
$find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']);
|
||||||
|
$find['system_store_phone'] = $merchant['phone'];
|
||||||
|
$find['staff_name'] = $mer_user_info['staff_name'];
|
||||||
|
$find['staff_phone'] = $mer_user_info['phone'];
|
||||||
|
$find['nickname'] = $user['nickname']??'';
|
||||||
|
$find['user_mobile'] = $user['mobile']??'';
|
||||||
|
$find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) {
|
||||||
|
$goods = StoreBranchProduct::where(['store_id'=>$item['store_id'],'product_id'=>$item['product_id']])->field('store_name,unit')->find();
|
||||||
|
$item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name');
|
||||||
|
$item['store_name'] = $goods['store_name'];
|
||||||
|
$item['total_price'] = $item['cart_info']['total_price'];
|
||||||
|
$item['price'] = $item['cart_info']['price'];
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return $this->success('获取成功', $find);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user