1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * AgentGame.php UTF-8
- * 小程序
- *
- * @date : 2018/10/15 17:38
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HuoMp 1.0
- */
- namespace huomp\controller\agent;
- use huo\controller\agent\AgentCache;
- use huo\controller\game\GameCache;
- use huolib\constant\GameConst;
- use huolib\status\CommonStatus;
- use huolib\status\GameStatus;
- use huomp\controller\share\QrCodeOut;
- class AgentGame {
- /**
- * 设置渠道二维码
- *
- * @param $ag_id
- *
- * @return int
- */
- public function setQrUrl($ag_id) {
- $_app_id = AgentCache::ins()->getAppIdByAgId($ag_id);
- if (empty($_app_id)) {
- return GameStatus::NOT_YET_ADDED_GAME;
- }
- $_game_data = GameCache::ins()->getInfoByAppId($_app_id);
- $_classify = substr($_game_data['classify'], 0, 1);
- if (GameConst::GAME_MP == $_classify) {
- $_mp_qr_arr = (new QrCodeOut())->getQrCode(
- 0, $_app_id, '', 430, false, '{"r":"0","g":"0","b":"0"}', false, $ag_id
- );
- if (CommonStatus::NO_ERROR != $_mp_qr_arr['code']) {
- return GameStatus::QR_URL_ERROR;
- }
- $_update_data['package_url'] = $_mp_qr_arr['data']['image'];
- AgentCache::ins()->updateAg($ag_id, $_update_data);
- }
- return GameStatus::NO_ERROR;
- }
- }
|