RoutineCode.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\models\routine;
  3. use crmeb\services\MiniProgramService;
  4. /**
  5. * TODO 小程序二维码Model
  6. * Class RoutineCode
  7. * @package app\models\routine
  8. */
  9. class RoutineCode{
  10. /**
  11. * TODO 获取小程序二维码
  12. * @param $thirdId
  13. * @param $thirdType
  14. * @param $page
  15. * @param $imgUrl
  16. * @return array|bool
  17. * @throws \think\Exception
  18. * @throws \think\db\exception\DataNotFoundException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. * @throws \think\exception\DbException
  21. */
  22. public static function getShareCode($thirdId, $thirdType, $page, $imgUrl){
  23. $res = RoutineQrcode::routineQrCodeForever($thirdId,$thirdType,$page,$imgUrl);
  24. $resCode = MiniProgramService::qrcodeService()->appCodeUnlimit($res->id,$page,280);
  25. if($resCode){
  26. if($res) return ['res'=>$resCode,'id'=>$res->id];
  27. else return false;
  28. }else return false;
  29. }
  30. /**
  31. * TODO 获取小程序页面带参数二维码不保存数据库
  32. * @param string $page
  33. * @param string $pramam
  34. * @param int $width
  35. * @return mixed
  36. */
  37. public static function getPageCode($page = '', $pramam = "?uid=1&product=1",$width = 280){
  38. return MiniProgramService::qrcodeService()->appCodeUnlimit($pramam,$page,$width);
  39. }
  40. }