|
@@ -15,7 +15,7 @@ class RefillPhone extends refill\IRefillThird
|
|
|
parent::__construct($cfgs);
|
|
|
}
|
|
|
|
|
|
- private function req_params(int $phone, int $amount, $company_type, string $order_sn, $province, $card_id, $use_type)
|
|
|
+ private function req_params(int $phone, int $amount, $company_type, string $order_sn, $province, $card_id, $use_type, $city)
|
|
|
{
|
|
|
$params['userid'] = config::USER_ID;
|
|
|
$params['productid'] = config::product_id[$province][$amount];
|
|
@@ -27,11 +27,12 @@ class RefillPhone extends refill\IRefillThird
|
|
|
$params['sporderid'] = $order_sn;
|
|
|
$params['back_url'] = config::NOTIFY_URL;
|
|
|
|
|
|
+ $area = mtopcard\ProvinceList[$province];
|
|
|
$data = [
|
|
|
'product_type' => 3, 'userid' => $phone, 'username' => $card_id,
|
|
|
- 'type' => config::USE_TYPE[$use_type], 'area' => mtopcard\ProvinceList[$province]
|
|
|
+ 'type' => config::USE_TYPE[$use_type], 'area' => $area, 'city' => $city
|
|
|
];
|
|
|
- $params['account'] = json_encode($data, JSON_UNESCAPED_UNICODE);
|
|
|
+ $params['account'] = mb_convert_encoding(json_encode($data,JSON_UNESCAPED_UNICODE),"gb2312","UTF-8");
|
|
|
return $params;
|
|
|
}
|
|
|
|
|
@@ -48,11 +49,15 @@ class RefillPhone extends refill\IRefillThird
|
|
|
$card_id = $params['card_id'] ?? '';
|
|
|
$use_type = $params['use_type'];
|
|
|
$province = $params['province'] ?? -1;
|
|
|
+ $city = $params['city'] ?? '';
|
|
|
+ if(!empty($city)) {
|
|
|
+ $city = $this->city_filter($city);
|
|
|
+ }
|
|
|
if($province <= 0) {
|
|
|
return [false, '省份获取错误', false];
|
|
|
}
|
|
|
$product = $this->getProduct($params['product_code']);
|
|
|
- $params = $this->req_params($card_no, $product['refill_amount'], $company_type, $order_sn, $province, $card_id, $use_type);
|
|
|
+ $params = $this->req_params($card_no, $product['refill_amount'], $company_type, $order_sn, $province, $card_id, $use_type, $city);
|
|
|
|
|
|
if(empty($params['productid'])) {
|
|
|
return [false, '商品编号获取失败', false];
|
|
@@ -162,4 +167,10 @@ class RefillPhone extends refill\IRefillThird
|
|
|
$content .= "&sporderid={$params['sporderid']}&key={$key}";
|
|
|
return strtoupper(md5($content));
|
|
|
}
|
|
|
+
|
|
|
+ private function city_filter($city)
|
|
|
+ {
|
|
|
+ $endtxt = '市';
|
|
|
+ return mb_strcut($city, 0, strrpos($city, $endtxt));
|
|
|
+ }
|
|
|
}
|