send('Foo'); $logger->send('Bar'); } public function testGener() { $generator = function() { $ret = yield 'yield1'; Log::record($ret,Log::DEBUG); $ret = yield 'yield2'; Log::record($ret,Log::DEBUG); }; $gen = $generator(); Log::record($gen->current(),Log::DEBUG); $ret = $gen->send('ret1'); Log::record($ret,Log::DEBUG); $ret = $gen->send('ret2'); Log::record($ret,Log::DEBUG); } public function testOrderStatsEx() { $normal = [ 'inner_status' => 0, 'refill_order.mchid' => 1093 ]; $scope = [ 'order_time' => [1617206400, 1617724800], 'add_time' => [1617206400, 1618156800] ]; $handler = new handler(); [$succ,$result] = $handler->refill_order_stat_ex(['normal' => $normal, 'time_scope' => $scope]); } public function testArrayMerge() { function array_add($a, $b) { $arr = array_intersect_key($a, $b); foreach ($b as $key => $value) { if (!array_key_exists($key, $a)) { $a[$key] = $value; } } foreach ($arr as $key => $value) { $a[$key] = $a[$key] + $b[$key]; } return $a; } $a = [ 'order_count' => 0, 'refill_amounts' => 0, 'channel_amounts' => 0, 'mch_amounts' => 0 ]; $b = [ 'order_count' => 1, 'refill_amounts' => 2, 'channel_amounts' => 3, 'mch_amounts' => 4 ]; $c = array_add($a,$b); $d = [ 'order_count' => 4, 'refill_amounts' => 3, 'channel_amounts' => 2, 'mch_amounts' => 1 ]; $e = array_add($c,$d); } }