Commit c6578754 by 朱继来

fix

parent 19a7de69
...@@ -176,7 +176,11 @@ Class AddOrderController extends Controller ...@@ -176,7 +176,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'ucoupon/bestusebyordersystem'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -244,7 +248,11 @@ Class AddOrderController extends Controller ...@@ -244,7 +248,11 @@ Class AddOrderController extends Controller
$data['k1'] = time(); $data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi'); $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'])) { if (!empty($response['data'])) {
return ['errcode' => 0, 'errmsg' => '', 'data' => $response['data']]; return ['errcode' => 0, 'errmsg' => '', 'data' => $response['data']];
...@@ -271,7 +279,11 @@ Class AddOrderController extends Controller ...@@ -271,7 +279,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/addByOrderSystem'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -293,7 +305,11 @@ Class AddOrderController extends Controller ...@@ -293,7 +305,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/switchSaleType'; $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']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
} }
...@@ -312,7 +328,11 @@ Class AddOrderController extends Controller ...@@ -312,7 +328,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/listsByOrderSystem'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -341,7 +361,11 @@ Class AddOrderController extends Controller ...@@ -341,7 +361,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/changeNumByOrderSystem'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -363,7 +387,11 @@ Class AddOrderController extends Controller ...@@ -363,7 +387,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/deleteByOrderSystem'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -396,7 +424,11 @@ Class AddOrderController extends Controller ...@@ -396,7 +424,11 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/confirm'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
...@@ -423,7 +455,11 @@ Class AddOrderController extends Controller ...@@ -423,7 +455,11 @@ Class AddOrderController extends Controller
foreach ($cart_info as $k=>$v) { foreach ($cart_info as $k=>$v) {
$data['id'] = $v['gid']; $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) { if ($sale_type == 1) {
// 现货订单--判断下单数量是否大于库存,若大于则弹出提示信息 // 现货订单--判断下单数量是否大于库存,若大于则弹出提示信息
...@@ -482,8 +518,12 @@ Class AddOrderController extends Controller ...@@ -482,8 +518,12 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'order/create'; $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) { if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>['order_id' => $response['data'], 'type' => $data['type']]]; return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>['order_id' => $response['data'], 'type' => $data['type']]];
} else { } else {
......
...@@ -1532,16 +1532,45 @@ Class OrderController extends Controller ...@@ -1532,16 +1532,45 @@ Class OrderController extends Controller
if (!$update) { if (!$update) {
errorLog(Error::E_UPDATE_FAILED, '延长失败'); errorLog(Error::E_UPDATE_FAILED, '延长失败');
return ['errcode'=>0, 'errmsg'=>'延长失败']; return ['errcode'=>1, 'errmsg'=>'延长失败'];
} }
// 操作记录 // 操作记录
$OrderActionLogModel = new OrderActionLogModel(); $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'=>'延长成功']; 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) public function tempCount(Request $request)
{ {
$current = strtotime(date('Y-m-d', time())); // 当天0点 $current = strtotime(date('Y-m-d', time())); // 当天0点
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
} }
// curl // 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'); if(!function_exists('curl_init')) exit('Need to open the curl extension');
$method = strtoupper($method); $method = strtoupper($method);
......
...@@ -133,7 +133,11 @@ ...@@ -133,7 +133,11 @@
if (cart_ids.length > 0) { if (cart_ids.length > 0) {
loading.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息 loading.confirm(user_id, address_id, cart_ids, user_coupon_id, goods_type, is_online); // 确认订单信息
} }
return false;
} }
layer.msg(resp.errmsg || '网络异常');
} }
}) })
} else { } else {
...@@ -161,7 +165,7 @@ ...@@ -161,7 +165,7 @@
type: 'post', type: 'post',
data: {user_id: user_id, inv_type: inv_type}, data: {user_id: user_id, inv_type: inv_type},
dataType: 'json', dataType: 'json',
success: function (resp) { console.log(resp) success: function (resp) {
if (resp.errcode == 0) { if (resp.errcode == 0) {
var data = resp.data; var data = resp.data;
...@@ -176,7 +180,11 @@ ...@@ -176,7 +180,11 @@
} else { } else {
$('#invoice').empty().append(inv_str); $('#invoice').empty().append(inv_str);
} }
return false;
} }
layer.msg(resp.errmsg || '网络异常');
} }
}) })
} else { } else {
...@@ -462,6 +470,7 @@ ...@@ -462,6 +470,7 @@
success: function(resp){ success: function(resp){
if (resp.errcode == 0) { if (resp.errcode == 0) {
loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表 loading.lists(user_id, goods_type, is_online, delivery_place); // 加载购物车列表
return false;
} }
layer.msg(resp.errmsg); layer.msg(resp.errmsg);
...@@ -839,14 +848,15 @@ ...@@ -839,14 +848,15 @@
} }
} }
} else { } else {
layer.msg(resp.errmsg || '网络异常');
$('.shop-lists').hide(); $('.shop-lists').hide();
if (is_online) { if (is_online) {
$('.order-info').hide(); $('.order-info').hide();
} else { } else {
$('.amount-section').hide(); $('.amount-section').hide();
} }
} }
}, },
}); });
...@@ -877,9 +887,11 @@ ...@@ -877,9 +887,11 @@
} else { } else {
$('#user_coupon').empty().append(str); $('#user_coupon').empty().append(str);
} }
return false;
} }
return false; layer.msg(resp.errmsg || '网络异常');
} }
}) })
}, },
...@@ -935,9 +947,11 @@ ...@@ -935,9 +947,11 @@
$('.amount-section').show(); $('.amount-section').show();
$('.order_amount').empty().text(data.order_amount_format); $('.order_amount').empty().text(data.order_amount_format);
} }
return false;
} }
return false; layer.msg(resp.errmsg || '网络异常');
} }
}) })
}, },
......
...@@ -668,11 +668,16 @@ ...@@ -668,11 +668,16 @@
<!-- 预付款 管理员完成首款对账后改变'对账'按钮 --> <!-- 预付款 管理员完成首款对账后改变'对账'按钮 -->
@if (in_array($order_info['status'], [2, 3]) && in_array('check_account', $userPerms)) @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'] != '')) @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 @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
@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)) @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> --> <!-- <a href="{{URL('send', ['order_id'=>$order_info['order_id']])}}" class="btn btn-default">订单发货</a> -->
......
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