123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- use PHPUnit\Framework\TestCase;
- define('APP_ID', 'test');
- define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
- require_once(BASE_ROOT_PATH . '/global.php');
- require_once(BASE_CORE_PATH . '/lrlz.php');
- require_once(BASE_ROOT_PATH . '/fooder.php');
- require_once(BASE_HELPER_PATH . '/refill/ops/third_pcode.php');
- use refill\third_pcode;
- class TestRemote extends TestCase
- {
- public static function setUpBeforeClass(): void
- {
- Base::run_util();
- include(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
- }
- public function testMerchants()
- {
- $mod_merchant = Model('merchant');
- $items = $mod_merchant->table('merchant')
- ->field('mchid,name,company_name')
- ->where(['merchant_state' => 1])->limit(0,1000)->select();
- $result = [];
- foreach ($items as $item)
- {
- $mchid = $item['mchid'];
- $name = $item['company_name'];
- $result[$mchid] = $name;
- }
- $x = $result;
- }
- public function testProviders()
- {
- $items = Model('')->table('refill_provider,store')
- ->field('refill_provider.*,store.store_name')
- ->join('inner')
- ->on('store.store_id=refill_provider.store_id')
- ->where(['opened' => 1])
- ->limit(1000)
- ->select();
- $result = [];
- foreach ($items as $item)
- {
- // $data = [];
- // $data['channel_name'] = $item['name'];
- // $data['store_name'] = $item['store_name'];
- // $data['provider_id'] = $item['provider_id'];
- // $data['store_id'] = $item['store_id'];
- $store_id = $item['store_id'];
- $store_name = $item['store_name'];
- $result[$store_id] = $store_name;
- }
- $x = $result;
- }
- public function testProduce()
- {
- $node = [
- 'mch_id' => 1092, 'mch_price' => 10000, 'plat_code' => 'YZBIG20230731',
- 'store_id' => 151, 'store_price' => 9900, 'store_code' => 'YLBIG20230731',
- 'product_name' => '大面额一万元', 'product_amount' => 10000
- ];
- try {
- $pcoder = new third_pcode($node);
- $pcoder->produce();
- }
- catch (Exception $ex) {
- Log::record($ex->getMessage(),Log::ERR);
- }
- }
- }
|