You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
879 B
30 lines
879 B
<?php
|
|
namespace app\common\shipping;
|
|
|
|
use think\facade\Db;
|
|
use app\common\shipping\ShippingStrategy;
|
|
use app\common\User;
|
|
|
|
class Shipping
|
|
{
|
|
//使用靜態方法,建立物流單
|
|
public static function createShipping($shippingcode,$order_sn)
|
|
{
|
|
//取得訂單資料
|
|
$order = Db::name('order_info')
|
|
->field('order_id,order_sn,user_id,order_amount,consignee,mobile,address,shipping_id,pay_id')
|
|
->where('order_sn',$order_sn)
|
|
->find();
|
|
|
|
|
|
//取得商品資料
|
|
$order['goods_list'] = Db::name('order_goods')->where('order_id',$order['order_id'])->select()->toArray();
|
|
try{
|
|
$shipping = new ShippingStrategy($shippingcode);
|
|
$result = $shipping->request($order);
|
|
return $result;
|
|
}catch(\Exception $e){
|
|
throw new \Exception($e->getMessage());
|
|
}
|
|
}
|
|
} |