|
@@ -17,11 +17,13 @@ require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
|
|
|
const LocalTest = 1;
|
|
|
const NetTest = 2;
|
|
|
|
|
|
-const CurrentTest = NetTest;
|
|
|
+const CurrentTest = LocalTest;
|
|
|
|
|
|
class TestRefill extends TestCase
|
|
|
{
|
|
|
private $mReqHost = '';
|
|
|
+ private $mKey='';
|
|
|
+ private $mMchid = 0;
|
|
|
|
|
|
public function __construct(?string $name = null, array $data = [], $dataName = '')
|
|
|
{
|
|
@@ -29,9 +31,13 @@ class TestRefill extends TestCase
|
|
|
|
|
|
if(CurrentTest == LocalTest) {
|
|
|
$this->mReqHost = BASE_SITE_URL;
|
|
|
+ $this->mMchid = 1;
|
|
|
+ $this->mKey = '1ff02223b771c0414468c8892151c602';
|
|
|
}
|
|
|
else {
|
|
|
$this->mReqHost = 'https://www.xyzshops.cn';
|
|
|
+ $this->mMchid = 1092;
|
|
|
+ $this->mKey = '210fe406954220f56085997d6a4c5b80';
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -193,42 +199,10 @@ class TestRefill extends TestCase
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function testAddPhoe()
|
|
|
- {
|
|
|
- $phones = [//13911129867,
|
|
|
- 18500608333,
|
|
|
- 18510683168,
|
|
|
- 18513846008,
|
|
|
- 18518237398];
|
|
|
- $amount = 10;
|
|
|
-
|
|
|
- for ($i = 0; $i < 3; $i++)
|
|
|
- {
|
|
|
- foreach ($phones as $phone) {
|
|
|
- $url = $this->mReqHost . "/mobile/index.php";
|
|
|
- $params = ['mchid' => 1092,
|
|
|
- 'cardno' => $phone,
|
|
|
- 'amount' => $amount,
|
|
|
- "act"=>"refill",
|
|
|
- "op"=>"add",
|
|
|
- 'order_sn' => $this->make_sn(),
|
|
|
- 'notifyurl'=> $this->mReqHost . "/mobile/refill_xyz.php"];
|
|
|
-
|
|
|
- $resp = $this->send_md5($url,$params);
|
|
|
- Log::record($resp,Log::DEBUG);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public function testGoods()
|
|
|
{
|
|
|
- // $req_url = 'https://www.xyzshops.cn/mobile/index.php';
|
|
|
- // $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
|
|
|
-
|
|
|
- $req_url = BASE_SITE_URL . '/mobile/index.php';
|
|
|
- $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
|
|
|
-
|
|
|
- $params = ['mchid' => 1,
|
|
|
+ $req_url = $this->mReqHost . '/mobile/index.php';
|
|
|
+ $params = ['mchid' => $this->mMchid,
|
|
|
"act"=>"refill",
|
|
|
"op"=>"goods"];
|
|
|
|
|
@@ -348,7 +322,7 @@ class TestRefill extends TestCase
|
|
|
private function send_md5($url,$params)
|
|
|
{
|
|
|
$body = $this->body($params);
|
|
|
- $body .= "&key=210fe406954220f56085997d6a4c5b80";
|
|
|
+ $body .= "&key={$this->mKey}";
|
|
|
$params['sign'] = md5($body);
|
|
|
|
|
|
$resp = http_request($url,$params,'POST');
|