Commit bf11d352 by 朱继来

Merge branch 'zjl_self_order_20180502' into development

parents 76121af5 62a3c1c7
Showing with 17 additions and 20 deletions
...@@ -1411,34 +1411,28 @@ Class OrderController extends Controller ...@@ -1411,34 +1411,28 @@ Class OrderController extends Controller
public function ajaxSelfExpress(Request $request) public function ajaxSelfExpress(Request $request)
{ {
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$order_id = $request->input('order_id');
$shipping_type = $request->input('type'); $shipping_type = $request->input('type');
$data['shipping_no'] = $request->input('express_no'); //调用接口
$data['shipping_id'] = $request->input('shipping_id'); $url = Config('website.api_domain').'order/send';
$data['order_shipping_type'] = 1;
$data['update_time'] = time();
$shipping = DB::connection('order')->table('lie_order_shipping')->where(['order_id'=>$order_id, 'shipping_type'=>$shipping_type])->first();
// 判断是否已存在快递信息 $data['k1'] = time();
if ($shipping) { $data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$result = DB::connection('order')->table('lie_order_shipping')->where(['order_id'=>$order_id, 'shipping_type'=>$shipping_type])->update($data);
} else {
$data['order_id'] = $order_id;
$data['shipping_type'] = $shipping_type;
$data['status'] = 1;
$result = DB::connection('order')->table('lie_order_shipping')->insert($data); $resData = array(
} "k1" => $data['k1'],
"k2" => $data['k2'],
'order_id' => $request->input('order_id'),
'shipping_type' => $shipping_type,
'shipping_no' => $request->input('express_no'),
'shipping_id' => $request->input('shipping_id'),
);
if (!$result) return ['errcode'=>-1, 'errmsg'=>'填写快递单失败']; $temp = json_decode(curlApi($url, $resData, "POST"), true);
if ($temp['err_code'] == 0) {
// 填写快递单时锁定库存 // 填写快递单时锁定库存
if ($shipping_type == 1) { if ($shipping_type == 1) {
// 更新订单状态
DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status'=>8]);
// $info = $this->orderDetail($request, $order_id); // $info = $this->orderDetail($request, $order_id);
// $sku = array(); // $sku = array();
...@@ -1455,6 +1449,9 @@ Class OrderController extends Controller ...@@ -1455,6 +1449,9 @@ Class OrderController extends Controller
return ['errcode'=>0, 'errmsg'=>'填写快递单成功']; return ['errcode'=>0, 'errmsg'=>'填写快递单成功'];
} }
return ['errcode'=>-1, 'errmsg'=>'填写快递单失败'];
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment