/** * 构造方法 */ public function __construct(Wechat $wechat, array $optionsOfUnifiedorder) { parent::__construct($wechat, $optionsOfUnifiedorder); $response = $this->getResponse(); $options = array('appid' => $wechat['appid'], 'mch_id' => $wechat['mchid'], 'prepay_id' => $response['prepay_id'], 'nonce_str' => uniqid(), 'return_code' => self::SUCCESS, 'result_code' => self::SUCCESS); ksort($options); $signature = http_build_query($options); $signature = urldecode($signature); $signature = strtoupper(md5($signature . '&key=' . $wechat['mchkey'])); $options['sign'] = $signature; $this->options = $options; }
/** * 构造方法 */ public function __construct(Wechat $wechat, array $optionsOfUnifiedorder) { parent::__construct($wechat, $optionsOfUnifiedorder); }
/** * 构造方法 */ public function __construct(Wechat $wechat, array $optionsForUnifiedorder) { // 将 trade_type 强制设为 JSAPI $optionsForUnifiedorder['trade_type'] = self::TRADE_TYPE; parent::__construct($wechat, $optionsForUnifiedorder); }