|
@@ -113,7 +113,12 @@ class lzrefillControl extends lzbaseControl
|
|
|
if(empty($params['product_code'])) {
|
|
|
return -9;
|
|
|
}
|
|
|
- if(empty($params['quantity'])) {
|
|
|
+ $pcode = $params['product_code'];
|
|
|
+ if($this->check_pcode($pcode)) {
|
|
|
+ return -10;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(empty($params['quantity']) || intval($params['quantity']) < 1) {
|
|
|
return -9;
|
|
|
}
|
|
|
|
|
@@ -153,9 +158,11 @@ class lzrefillControl extends lzbaseControl
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private function check_pcode()
|
|
|
+ private function check_pcode($pcode)
|
|
|
{
|
|
|
- //todo
|
|
|
+ $mod_third = Model('thrid_refill');
|
|
|
+ $product = $mod_third->getProduct(['system_code' => $pcode]);
|
|
|
+ return !empty($product);
|
|
|
}
|
|
|
|
|
|
public function add_thirdOp()
|
|
@@ -194,7 +201,6 @@ class lzrefillControl extends lzbaseControl
|
|
|
'notify_url' => $notify_url,
|
|
|
'org_quality' => $quality,
|
|
|
'card_type' => $card_type,
|
|
|
-
|
|
|
'card_no' => $card_no,
|
|
|
'product_code' => $product_code,
|
|
|
'quantity' => $quantity,
|
|
@@ -264,47 +270,86 @@ class lzrefillControl extends lzbaseControl
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ if(empty($refill_info))
|
|
|
+ {
|
|
|
+ $ret = refill\util::query_queue($mchid,$order_sn);
|
|
|
+ if ($ret > 0) {
|
|
|
+ $state = 0;
|
|
|
+ $msg = "{$order_sn}-充值中";
|
|
|
+ $remark = "";
|
|
|
+ $content = "|{$state}|{$msg}|{$remark}";
|
|
|
+ echo $content;
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ $state = 3;
|
|
|
+ $msg = "{$order_sn}-无此订单";
|
|
|
+ $remark = "";
|
|
|
+ $content = "|{$state}|{$msg}|{$remark}";
|
|
|
+ echo $content;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$vr_order = Model('vr_order');
|
|
|
$order_info = $vr_order->getOrderInfo(['order_sn' => $refill_info['order_sn']]);
|
|
|
|
|
|
- $order_state = $order_info['order_state'];
|
|
|
- if($order_state == ORDER_STATE_SEND || $order_state == ORDER_STATE_PAY || $order_state == ORDER_STATE_NEW) {
|
|
|
+ if($refill_info['is_retrying'])
|
|
|
+ {
|
|
|
QueueClient::push("QueryRefillState",['order_id' => $refill_info['order_id']]);
|
|
|
$state = 0;
|
|
|
$msg = "{$order_sn}-充值中";
|
|
|
$remark = "";
|
|
|
}
|
|
|
- elseif($order_state == ORDER_STATE_CANCEL) {
|
|
|
- $state = 2;
|
|
|
- $msg = "{$order_sn}-充值失败";
|
|
|
- $remark = "";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $order_state = $order_info['order_state'];
|
|
|
+ if($order_state == ORDER_STATE_SEND || $order_state == ORDER_STATE_PAY || $order_state == ORDER_STATE_NEW) {
|
|
|
+ QueueClient::push("QueryRefillState",['order_id' => $refill_info['order_id']]);
|
|
|
+ $state = 0;
|
|
|
+ $msg = "{$order_sn}-充值中";
|
|
|
+ $remark = "";
|
|
|
+ }
|
|
|
+ elseif($order_state == ORDER_STATE_CANCEL) {
|
|
|
+ $state = 2;
|
|
|
+ $msg = "{$order_sn}-充值失败";
|
|
|
+ $remark = "";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $state = 1;
|
|
|
+ $msg = "{$order_sn}-充值成功";
|
|
|
+ $remark = "{$refill_info['official_sn']}";
|
|
|
+ }
|
|
|
}
|
|
|
- else {
|
|
|
- $state = 1;
|
|
|
- $msg = "{$order_sn}-充值成功";
|
|
|
- $remark = "{$refill_info['official_sn']}";
|
|
|
+
|
|
|
+ if($refill_info['card_type'] == mtopcard\ThirdRefillCard) {
|
|
|
+ $remark = $this->third_remark($refill_info);
|
|
|
}
|
|
|
|
|
|
$content = "|{$state}|{$msg}|{$remark}";
|
|
|
echo $content;
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private function format($order_info,$refill_info)
|
|
|
+ private function third_remark($refill_info)
|
|
|
{
|
|
|
- $result = [];
|
|
|
-
|
|
|
- $result['mchid'] = $refill_info['mchid'];
|
|
|
- $result['trade_no'] = $refill_info['order_sn'];
|
|
|
- $result['order_sn'] = $refill_info['mch_order'];
|
|
|
- $result['card_no'] = $refill_info['card_no'];
|
|
|
- $result['card_type'] = $refill_info['card_type'];
|
|
|
- $result['refill_amount'] = $refill_info['refill_amount'];
|
|
|
- $result['order_amount'] = $refill_info['mch_amount'];
|
|
|
- $result['order_time'] = $refill_info['order_time'];
|
|
|
- $result['success_time'] = $refill_info['notify_time'];
|
|
|
- $result['order_state'] = $order_info['order_state'];
|
|
|
-
|
|
|
- return $result;
|
|
|
+ $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $this->mchid()]);
|
|
|
+ $mod_third = Model('thrid_refill');
|
|
|
+ $thrid_info = $mod_third->getThird($refill_info['order_id']);
|
|
|
+ $secure_key = $mchinfo['secure_key'];
|
|
|
+
|
|
|
+ $remark = '';
|
|
|
+ if (!empty($thrid_info))
|
|
|
+ {
|
|
|
+ $card_info = $thrid_info['card_info'];
|
|
|
+ if (!empty($card_info)) {
|
|
|
+ $encrypt = openssl_encrypt($card_info,'AES-128-CBC',$secure_key);
|
|
|
+ if($encrypt != false) {
|
|
|
+ $remark = $encrypt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $remark;
|
|
|
}
|
|
|
}
|