This commit is contained in:
parent
8014a361da
commit
c369003a28
|
|
@ -18,18 +18,17 @@ class AddressRepo
|
|||
/**
|
||||
* 创建一个address记录
|
||||
* @param $data
|
||||
* @return int
|
||||
* @return mixed
|
||||
*/
|
||||
public static function create($data)
|
||||
{
|
||||
$address = Address::query()->create($data);
|
||||
return $address;
|
||||
return Address::query()->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $address
|
||||
* @param $data
|
||||
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|mixed
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function update($address, $data)
|
||||
|
|
@ -46,7 +45,7 @@ class AddressRepo
|
|||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|null
|
||||
* @return mixed
|
||||
*/
|
||||
public static function find($id)
|
||||
{
|
||||
|
|
@ -65,6 +64,13 @@ class AddressRepo
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取某个客户地址列表
|
||||
*
|
||||
* @param $customer
|
||||
* @return mixed
|
||||
*/
|
||||
public static function listByCustomer($customer)
|
||||
{
|
||||
if (gettype($customer) != 'object') {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
namespace Beike\Repositories;
|
||||
|
||||
use Beike\Models\Address;
|
||||
use Carbon\Carbon;
|
||||
use Beike\Models\Order;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -148,8 +149,8 @@ class OrderRepo
|
|||
$shippingAddressId = $current['shipping_address_id'] ?? 0;
|
||||
$paymentAddressId = $current['payment_address_id'] ?? 0;
|
||||
|
||||
$shippingAddress = AddressRepo::find($shippingAddressId);
|
||||
$paymentAddress = AddressRepo::find($paymentAddressId);
|
||||
$shippingAddress = Address::query()->findOrFail($shippingAddressId);
|
||||
$paymentAddress = Address::query()->findOrFail($paymentAddressId);
|
||||
|
||||
$shippingMethodCode = $current['shipping_method_code'] ?? '';
|
||||
$paymentMethodCode = $current['payment_method_code'] ?? '';
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Illuminate\Http\Request;
|
|||
|
||||
class CheckoutController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
public function index()
|
||||
{
|
||||
$data = (new CheckoutService)->checkoutData();
|
||||
return view('checkout', $data);
|
||||
|
|
|
|||
|
|
@ -86,11 +86,8 @@ class CheckoutService
|
|||
DB::commit();
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
dd($e);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// Notification::endmail();
|
||||
// Notification::sendsms();
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue