wysf
bruce 9 months ago
parent 653cca20e3
commit de38647f66
  1. 9
      app/api/controller/User.php
  2. 10
      app/common/service/qrcode/BaseQRcode.php

@ -15,6 +15,7 @@ namespace app\api\controller;
use app\api\model\Agreement as AgreementModel; use app\api\model\Agreement as AgreementModel;
use app\api\model\User as UserModel; use app\api\model\User as UserModel;
use app\api\model\Invite\InviteLog; use app\api\model\Invite\InviteLog;
use app\common\service\qrcode\BaseQRcode;
use app\store\model\User as StoreUserModel; use app\store\model\User as StoreUserModel;
use app\api\model\user\BalanceLog; use app\api\model\user\BalanceLog;
use app\api\model\user\GoodSource as GoodsSourceModel; use app\api\model\user\GoodSource as GoodsSourceModel;
@ -398,6 +399,8 @@ class User extends Controller
public function maintenance() public function maintenance()
{ {
$qrObj = new BaseQRcode();
$storeId = request()->header()['storeid']; $storeId = request()->header()['storeid'];
$list = Db::table('yoshop_maintenance_category') $list = Db::table('yoshop_maintenance_category')
->where(['store_id' => $storeId, 'status' => 1,]) ->where(['store_id' => $storeId, 'status' => 1,])
@ -409,8 +412,10 @@ class User extends Controller
->select() ->select()
->toArray(); ->toArray();
} }
return $this->renderSuccess($list); foreach ($list['tags'] ?? [] as &$item) {
$item['url'] = $qrObj->getOtherQrcode($storeId, $item['url']);
} }
return $this->renderSuccess($list);
}
} }

@ -48,6 +48,16 @@ class BaseQRcode extends BaseService
return $this->getH5Qrcode($storeId, $scene, $page, $channel); return $this->getH5Qrcode($storeId, $scene, $page, $channel);
} }
public function getOtherQrcode(int $storeId, string $url, string $channel = 'H5'): string
{
// 根据指定渠道生成不同的二维码
$savePath = $this->getFilePath($storeId, $url, "", $channel);
if (file_exists($savePath)) return $savePath;
// 生成二维码
\PHPQRCode\QRcode::png($url, $savePath, 'L', 15, 1);
return $savePath;
}
/** /**
* 保存微二维码到文件 (微信小程序码) * 保存微二维码到文件 (微信小程序码)
* @param int $storeId 商城ID * @param int $storeId 商城ID

Loading…
Cancel
Save