Commit 6cad6d9f by 朱继来

Merge branch 'zjl_self_order_20180502'

parents 3ece1b25 62a3c1c7
Showing with 17 additions and 20 deletions
......@@ -1411,34 +1411,28 @@ Class OrderController extends Controller
public function ajaxSelfExpress(Request $request)
{
if ($request->isMethod('post')) {
$order_id = $request->input('order_id');
$shipping_type = $request->input('type');
$data['shipping_no'] = $request->input('express_no');
$data['shipping_id'] = $request->input('shipping_id');
$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();
//调用接口
$url = Config('website.api_domain').'order/send';
// 判断是否已存在快递信息
if ($shipping) {
$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;
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$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) {
// 更新订单状态
DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status'=>8]);
// $info = $this->orderDetail($request, $order_id);
// $sku = array();
......@@ -1455,6 +1449,9 @@ Class OrderController extends Controller
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