Commit c6578754 by 朱继来

fix

parent 19a7de69
......@@ -176,7 +176,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'ucoupon/bestusebyordersystem';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -244,7 +248,11 @@ Class AddOrderController extends Controller
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$response = json_decode(curlApi($url, $data, 'POST'), true);
$res = curlApi($url, $data, 'POST');
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if (!empty($response['data'])) {
return ['errcode' => 0, 'errmsg' => '', 'data' => $response['data']];
......@@ -271,7 +279,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/addByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -293,7 +305,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/switchSaleType';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
......@@ -312,7 +328,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/listsByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -341,7 +361,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/changeNumByOrderSystem';
}
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -363,7 +387,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/deleteByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -396,7 +424,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/confirm';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
......@@ -423,7 +455,11 @@ Class AddOrderController extends Controller
foreach ($cart_info as $k=>$v) {
$data['id'] = $v['gid'];
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($sale_type == 1) {
// 现货订单--判断下单数量是否大于库存,若大于则弹出提示信息
......@@ -482,7 +518,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'order/create';
$response = json_decode(curlApi($url, $data), true);
$res = curlApi($url, $data);
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$response = json_decode($res, true);
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>['order_id' => $response['data'], 'type' => $data['type']]];
......
......@@ -1532,16 +1532,45 @@ Class OrderController extends Controller
if (!$update) {
errorLog(Error::E_UPDATE_FAILED, '延长失败');
return ['errcode'=>0, 'errmsg'=>'延长失败'];
return ['errcode'=>1, 'errmsg'=>'延长失败'];
}
// 操作记录
$OrderActionLogModel = new OrderActionLogModel();
$actionLog = $OrderActionLogModel->addLog($order_id, $request->user->userId, 3, '延长付款时间,截止到:'.date('Y-m-d H:i:s', $delay_time));
$actionLog = $OrderActionLogModel->addLog($order_id, $request->user->userId, 2, '延长付款时间,截止到:'.date('Y-m-d H:i:s', $delay_time));
return ['errcode'=>0, 'errmsg'=>'延长成功'];
}
// 线下转账
public function offlinePaid(Request $request)
{
if ($request->isMethod('post')) {
$data['order_id'] = $request->input('order_id', '');
$data['order_sn'] = $request->input('order_sn', '');
$data['operator_id'] = $request->user->userId;
if (empty($data['order_id']) && empty($data['order_sn'])) return ['errcode'=>Error::E_NOT_EXISTS, 'errmsg'=>'参数不存在'];
$url = Config('website.api_domain').'order/offlinePaid';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$res = curlApi($url, $data, "POST");
if (!$res) return ['errcode'=>1, 'errmsg'=>'未访问到API接口,请重新尝试'];
$temp = json_decode($res, true); // 连接API
if ($temp['err_code'] != 0) {
return ['errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']];
}
return ['errcode'=>$temp['err_code'], 'errmsg'=>$temp['err_msg']];
}
}
public function tempCount(Request $request)
{
$current = strtotime(date('Y-m-d', time())); // 当天0点
......
......@@ -47,7 +47,7 @@
}
// curl
function curlApi( $url , $params = array(), $method = 'GET' , $multi = false, $extheaders = array())
function curlApi($url , $params = array(), $method = 'GET' , $multi = false, $extheaders = array())
{
if(!function_exists('curl_init')) exit('Need to open the curl extension');
$method = strtoupper($method);
......
......@@ -133,7 +133,11 @@
if (cart_ids.length > 0) {
loading.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
}
return false;
}
layer.msg(resp.errmsg || '网络异常');
}
})
} else {
......@@ -161,7 +165,7 @@
type: 'post',
data: {user_id: user_id, inv_type: inv_type},
dataType: 'json',
success: function (resp) { console.log(resp)
success: function (resp) {
if (resp.errcode == 0) {
var data = resp.data;
......@@ -176,7 +180,11 @@
} else {
$('#invoice').empty().append(inv_str);
}
return false;
}
layer.msg(resp.errmsg || '网络异常');
}
})
} else {
......@@ -462,6 +470,7 @@
success: function(resp){
if (resp.errcode == 0) {
loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
return false;
}
layer.msg(resp.errmsg);
......@@ -839,6 +848,8 @@
}
}
} else {
layer.msg(resp.errmsg || '网络异常');
$('.shop-lists').hide();
if (is_online) {
......@@ -846,7 +857,6 @@
} else {
$('.amount-section').hide();
}
}
},
});
......@@ -877,10 +887,12 @@
} else {
$('#user_coupon').empty().append(str);
}
}
return false;
}
layer.msg(resp.errmsg || '网络异常');
}
})
},
......@@ -935,10 +947,12 @@
$('.amount-section').show();
$('.order_amount').empty().text(data.order_amount_format);
}
}
return false;
}
layer.msg(resp.errmsg || '网络异常');
}
})
},
}
......
......@@ -668,12 +668,17 @@
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
@if (in_array($order_info['status'], [2, 3]) && in_array('check_account', $userPerms))
@if ($order_info['status'] == 3 && (!empty($order_pay_log) && $order_pay_log[0]['pay_type'] != ''))
<a href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-success last-check">对账</a>
<!-- <a href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-success last-check">对账</a> -->
@else
<a href="{{URL('checkPay', ['order_id'=>$order_info['order_id']])}}" class="btn btn-success">对账</a>
<!-- <a href="{{URL('checkPay', ['order_id'=>$order_info['order_id']])}}" class="btn btn-success">对账</a> -->
@endif
@endif
<!-- 线下转账 -->
@if (in_array($order_info['status'], [2, 3]) && in_array('offline_paid', $userPerms))
<a href="javascript:;" data-id="{{$order_info['order_id']}}" data-sn="{{$order_info['order_sn']}}" class="btn btn-success offline-paid">线下转账</a>
@endif
@if (in_array($order_info['status'], array(4, 7, 8, 10)) && in_array('order_send', $userPerms))
<!-- <a href="{{URL('send', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">订单发货</a> -->
@endif
......
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