123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- namespace huomp\controller\share;
- use huo\controller\common\Base;
- use huolib\status\AgentStatus;
- use huolib\status\CommonStatus;
- use huolib\status\OrderStatus;
- use huomp\controller\agent\AgentState;
- use huomp\controller\game\GameMini;
- use huoMpQr\QrCode;
- class QrCodeOut extends Base {
-
- public function getQrCode(
- $mem_id, $app_id, $path, $width = 430, $auto_color = false, $line_color = '{"r":"0","g":"0","b":"0"}',
- $is_hyaline = false, $ag_id = 0
- ) {
- $_mpay_data = (new GameMini())->getLoginConf($app_id);
- $_mini_app_key = $_mpay_data['APP_KEY'];
- $_mini_app_secret = $_mpay_data['APP_SECRET'];
- if (empty($ag_id)) {
- $_scene = (new AgentState())->getCodeByMemApp($mem_id, $app_id);
- } else {
- $_scene = (new AgentState())->genAgentCode($ag_id);
- }
- $_image = (new QrCode())->getWxACodeUnLimit(
- $_mini_app_key, $_mini_app_secret, $path, $_scene, $width, $auto_color, $line_color, $is_hyaline
- );
- if (is_array($_image)) {
- $_code = CommonStatus::EXCEPTION;
- return $this->huoError($_code, AgentStatus::getMsg($_code), $_image);
- }
- $_rdata['image'] = $_image;
- $_code = CommonStatus::NO_ERROR;
- return $this->huoSuccess($_code, AgentStatus::getMsg($_code), $_rdata);
- }
-
- public function getOrderQrCode(
- $order_id, $app_id, $path, $width = 430, $auto_color = false, $line_color = '{"r":"0","g":"0","b":"0"}',
- $is_hyaline = false
- ) {
- if (empty($order_id)) {
- $_code = OrderStatus::ORDER_ID_EMPTY;
- return $this->huoError($_code, OrderStatus::getMsg($_code));
- }
- $_mpay_data = (new GameMini())->getLoginConf($app_id);
- $_mini_app_key = $_mpay_data['APP_KEY'];
- $_mini_app_secret = $_mpay_data['APP_SECRET'];
- $_image = (new QrCode())->getWxACodeUnLimit(
- $_mini_app_key, $_mini_app_secret, $path, $order_id, $width, $auto_color, $line_color, $is_hyaline
- );
- if (is_array($_image)) {
- $_code = CommonStatus::EXCEPTION;
- return $this->huoError($_code, AgentStatus::getMsg($_code), $_image);
- }
- $_rdata['image'] = $_image;
- $_code = CommonStatus::NO_ERROR;
- return $this->huoSuccess($_code, AgentStatus::getMsg($_code), $_rdata);
- }
- }
|