container = $container; parent::__construct('jinling'); } public function configure() { parent::configure(); $this->setDescription('廖金灵测试'); } public function handle() { $this->buildPayPrams(); return; /** * @var MerchantService */ $merchantService = $this->container->make(MerchantService::class); /** * @var AppService */ $appService = $this->container->make(AppService::class); $merchant = $merchantService->createMerchant([ 'username' => 'elf', 'password' => '123456', 'email' => '360197197@qq.com', 'mobile' => '18760419185', 'ip' => '127.0.0.1' ]); $appService->createApp($merchant); } public function buildPayPrams() { $params = [ 'app_id' => '202304270000004', 'timestamp' => time(), 'nonce_str' => 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O', ]; $data = [ 'order_name' => '测试订单', 'currency' => 'CNY', 'amount' => '20', 'notify_url' => 'http://www.baidu.com', 'redirect_url' => 'http://www.google.com', 'out_order_no' => '1122', 'direct_pay' => 0, 'show_pc_pay_url' => 0, ]; $params['data'] = json_encode($data); $sign = Signer::sign($params, 'lSHKbuFngCXHN8Ue1s8QHAAzPvOL3u9O'); $params['sign'] = $sign; var_dump(json_encode($params)); } }