|
@@ -98,11 +98,16 @@ class Order extends Base
|
|
|
|
|
|
// 单个商品
|
|
|
if ($productId) {
|
|
|
+ $number = input('number',1,'intval');
|
|
|
$productId = \addons\unishop\extend\Hashids::decodeHex($productId);
|
|
|
$product = (new Product)->where(['id' => $productId, 'switch' => Product::SWITCH_ON, 'deletetime' => null])->find();
|
|
|
/** 产品基础数据 **/
|
|
|
$spec = input('spec', '');
|
|
|
- $productData[0] = $product->getDataOnCreateOrder($spec);
|
|
|
+
|
|
|
+ $productData = [];
|
|
|
+ for($i=1;$i<=$number;$i++){
|
|
|
+ $productData[] = $product->getDataOnCreateOrder($spec);
|
|
|
+ }
|
|
|
} else {
|
|
|
// 多个商品
|
|
|
$cart = input('cart');
|
|
@@ -123,7 +128,13 @@ class Order extends Base
|
|
|
}
|
|
|
|
|
|
/** 默认地址 **/
|
|
|
- $address = (new AddressModel)->where(['user_id' => $user_id, 'is_default' => AddressModel::IS_DEFAULT_YES])->find();
|
|
|
+ $address_map = ['user_id' => $user_id, 'is_default' => AddressModel::IS_DEFAULT_YES];
|
|
|
+
|
|
|
+ $delivery_id = input('delivery_id',0);
|
|
|
+ if($delivery_id){
|
|
|
+ $address_map = ['user_id' => $user_id, 'id' => $delivery_id];
|
|
|
+ }
|
|
|
+ $address = (new AddressModel)->where($address_map)->find();
|
|
|
if ($address) {
|
|
|
/*$area = (new Area)->whereIn('id', [$address->province_id, $address->city_id, $address->area_id])->column('name', 'id');
|
|
|
$address = $address->toArray();
|