|
@@ -15,23 +15,24 @@ class merchant_refillControl extends mbMerchantControl
|
|
|
{
|
|
|
$goods = refill\RefillFactory::instance()->goods();
|
|
|
|
|
|
- $oil_amount = $phone_amount = [];
|
|
|
- foreach ($goods as $type => $amounts)
|
|
|
+ $result = [];
|
|
|
+ foreach ($goods as $type => $specs)
|
|
|
{
|
|
|
- if($type == 'sinopec' || $type == 'petrochina') {
|
|
|
- $oil_amount = array_merge($oil_amount,$amounts);
|
|
|
- }
|
|
|
- elseif($type == 'chinamobile' || $type == 'chinaunicom' || $type == 'chinatelecom'){
|
|
|
- $phone_amount = array_merge($phone_amount,$amounts);
|
|
|
+ if($type == mtopcard\SinopecCard || $type == mtopcard\PetroChinaCard) {
|
|
|
+ foreach ($specs as $spec) {
|
|
|
+ $result['oil_amount'][] = $spec;
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- Log::record("goods err type:{$type}",Log::ERR);
|
|
|
+ foreach ($specs as $spec) {
|
|
|
+ $result['phone_amount'][] = $spec;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $oil_amount = array_unique($oil_amount);
|
|
|
+ $oil_amount = array_unique($result['oil_amount']);
|
|
|
sort($oil_amount);
|
|
|
- $phone_amount = array_unique($phone_amount);
|
|
|
+ $phone_amount = array_unique($result['phone_amount']);
|
|
|
sort($phone_amount);
|
|
|
|
|
|
return self::outsuccess(['oil_amount' => $oil_amount,'phone_amount' => $phone_amount]);
|
|
@@ -53,16 +54,6 @@ class merchant_refillControl extends mbMerchantControl
|
|
|
return [false,'卡类型无法识别'];
|
|
|
}
|
|
|
|
|
|
-// if($card_type === mtopcard\PetroChinaCard)
|
|
|
-// {
|
|
|
-// if(empty($params['idcard'])) {
|
|
|
-// return [false,'中石油需要参数没有包含身份证号码:idcard'];
|
|
|
-// }
|
|
|
-// if(empty($params['card_name'])) {
|
|
|
-// return [false,'参数没有包含身份证姓名:card_name'];
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
return [true,""];
|
|
|
}
|
|
|
|
|
@@ -84,9 +75,6 @@ class merchant_refillControl extends mbMerchantControl
|
|
|
return self::outerr(errcode::ErrParamter, "卡号格式错误或未上传");
|
|
|
}
|
|
|
|
|
|
- $idcard = $params['idcard'] ?? '';
|
|
|
- $card_name = $params['card_name'] ?? '';
|
|
|
-
|
|
|
//成功个数、失败个数
|
|
|
$success_no = $error_no = 0;
|
|
|
$data = [];
|
|
@@ -103,13 +91,22 @@ class merchant_refillControl extends mbMerchantControl
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [$state, $err] = refill\RefillFactory::instance()->add($mchid, $merchant_info['admin_id'], $amount, $no, '', $idcard, $card_name, '',1,time(),0);
|
|
|
- $arr['state'] = $state;
|
|
|
- $arr['err'] = $err;
|
|
|
- if($state === true) {
|
|
|
+ $params = [ 'mchid' => $this->mchid(),
|
|
|
+ 'buyer_id' => $this->adminid(),
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'card_no' => $card_no,
|
|
|
+ 'mch_order' => "",
|
|
|
+ 'notify_url' => ""];
|
|
|
+
|
|
|
+ $ret = refill\util::push_add($params);
|
|
|
+ if($ret) {
|
|
|
+ $arr['state'] = $ret;
|
|
|
+ $arr['err'] = '';
|
|
|
$success_no++;
|
|
|
}
|
|
|
else {
|
|
|
+ $arr['state'] = 202;
|
|
|
+ $arr['err'] = '提交失败';
|
|
|
$error_no++;
|
|
|
}
|
|
|
}
|