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); } } }