1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?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();
- }
- 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' => 210, '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);
- }
- }
- }
|