Commit 62a3c1c7 by 朱继来

调整填写快递单

parent 9c2e9243
Showing with 28 additions and 31 deletions
...@@ -1325,49 +1325,46 @@ Class OrderController extends Controller ...@@ -1325,49 +1325,46 @@ 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');
$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';
// 判断是否已存在快递信息 $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);
// $sku = array();
// $info = $this->orderDetail($request, $order_id); // foreach ($info['order_items_info'] as $v) {
// $sku = array(); // $sku[$v['rec_id']] = $v['goods_number'];
// }
// $res = json_decode($this->unlockSku($order_id, $sku, true));
// foreach ($info['order_items_info'] as $v) { // if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'锁定库存失败'];
// $sku[$v['rec_id']] = $v['goods_number'];
// }
// $res = json_decode($this->unlockSku($order_id, $sku, true));
// if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'锁定库存失败']; // return ['errcode'=>0, 'errmsg'=>'填写快递单成功并锁定库存'];
}
// return ['errcode'=>0, 'errmsg'=>'填写快递单成功并锁定库存']; 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