修复错误
This commit is contained in:
parent
c3d2ed3244
commit
cca85a62b4
@ -14,6 +14,8 @@
|
||||
namespace app\controller\api\store\order;
|
||||
|
||||
|
||||
use app\common\repositories\store\order\PresellOrderRepository;
|
||||
use app\common\repositories\store\order\StoreGroupOrderRepository;
|
||||
use app\common\repositories\store\order\StoreOrderCreateRepository;
|
||||
use app\common\repositories\store\product\ProductRepository;
|
||||
use crmeb\basic\BaseController;
|
||||
@ -45,7 +47,11 @@ class StoreMicropayOrder extends BaseController
|
||||
}
|
||||
public function addCart(){
|
||||
$bar_code = $this->request->param('bar_code', 0);
|
||||
$mer_id = $this->request->param('mer_id', 0);
|
||||
// $mer_id = $this->request->param('mer_id', 0);
|
||||
$user = $this->request->userInfo();
|
||||
|
||||
$mer_id =Db::name('store_service')->where('uid',$user['uid'])->where('status',1)->value('mer_id');
|
||||
|
||||
if ($mer_id==0) return app('json')->fail('商户id不能为空');
|
||||
if (strlen($bar_code)==1) return app('json')->fail('条形码不能为空');
|
||||
$find=Db::name('store_product_attr_value')->where('mer_id',$mer_id)->where('bar_code', $bar_code)->find();
|
||||
@ -58,7 +64,6 @@ class StoreMicropayOrder extends BaseController
|
||||
'product_id'=>$find['product_id'],
|
||||
'spread_id'=>'',
|
||||
];
|
||||
$user = $this->request->userInfo();
|
||||
event('user.cart.before',compact('user','data'));
|
||||
switch ($data['product_type'])
|
||||
{
|
||||
@ -92,7 +97,7 @@ class StoreMicropayOrder extends BaseController
|
||||
public function v2CreateOrder(StoreCartRepository $cartRepository, StoreOrderCreateRepository $orderCreateRepository)
|
||||
{
|
||||
$cartId = (array)$this->request->param('cart_id', []);
|
||||
$mer_id = $this->request->param('mer_id', 0);
|
||||
// $mer_id = $this->request->param('mer_id', 0);
|
||||
$post=[];
|
||||
$couponIds=[];
|
||||
$takes=[];
|
||||
@ -102,11 +107,12 @@ class StoreMicropayOrder extends BaseController
|
||||
$mark = [];
|
||||
$payType = 'routine';
|
||||
$source = 2; // 默认来源为2 普通商品订单
|
||||
$product_type = 100;//
|
||||
$uid = $this->request->uid();
|
||||
$mer_id =Db::name('store_service')->where('uid',$uid)->where('status',1)->value('mer_id');
|
||||
if (!$mer_id&&$mer_id!=0){
|
||||
return app('json')->fail('商户id不能为空');
|
||||
}
|
||||
|
||||
$addressId=Db::name('user_address')->where('uid',$uid)->find();
|
||||
$merchant=Db::name('merchant')->where('mer_id',$mer_id)->find();
|
||||
if (!$addressId){
|
||||
@ -114,6 +120,9 @@ class StoreMicropayOrder extends BaseController
|
||||
if (!$merchant_address){
|
||||
return app('json')->fail('商户地址不存在');
|
||||
}
|
||||
if ($merchant_address['area_id']==0||$merchant_address['street_id']==0||$merchant_address['village_id']==0){
|
||||
return app('json')->fail('商户地址不完整');
|
||||
}
|
||||
$area_name=Db::name('geo_area')->where('area_code',$merchant_address['area_id'])->value('area_name');
|
||||
$street_name=Db::name('geo_street')->where('street_code',$merchant_address['street_id'])->value('street_name');
|
||||
$district_id=Db::name('city_area')->where('name',$area_name)->value('id');
|
||||
@ -146,8 +155,8 @@ class StoreMicropayOrder extends BaseController
|
||||
if (!($count = count($cartId)) || $count != count($cartRepository->validIntersection($cartId, $uid)))
|
||||
return app('json')->fail('数据无效');
|
||||
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post,$source) {
|
||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post,$source);
|
||||
$groupOrder = app()->make(LockService::class)->exec('order.create', function () use ($orderCreateRepository, $receipt_data, $mark, $extend, $cartId, $payType, $takes, $couponIds, $useIntegral, $addressId, $post,$source,$product_type) {
|
||||
return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post,$source,$product_type);
|
||||
});
|
||||
try {
|
||||
$param['order_sn']=$groupOrder['group_order_sn'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user