|
|
@@ -19,7 +19,10 @@ use app\adminapi\logic\user\UserLogic;
|
|
|
use app\common\model\property\PropertyHead;
|
|
|
use app\common\logic\BaseLogic;
|
|
|
use app\common\model\user\User;
|
|
|
+use app\common\service\wechat\WeChatMnpService;
|
|
|
+use Exception;
|
|
|
use think\facade\Db;
|
|
|
+use think\facade\Log;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -158,4 +161,32 @@ class PropertyHeadLogic extends BaseLogic
|
|
|
{
|
|
|
return PropertyHead::where('id','>',0)->select()->toArray();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param $params
|
|
|
+ * @param $url
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ public static function getWechatQrcode($params,$url)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $mnp_page = 'pages/tabView/service';
|
|
|
+ $response = (new WeChatMnpService())->getUnlimitedQRCode(
|
|
|
+ 'property_head_id='.$params['id'],
|
|
|
+ $mnp_page,
|
|
|
+ env('miniprogram.mini_env_version', 'release'),
|
|
|
+ false
|
|
|
+ );
|
|
|
+ $qrcode = $response->getContent();
|
|
|
+ if(!is_dir('./uploads/wx_qrcode/'.date('Ymd'))){
|
|
|
+ mkdir('./uploads/wx_qrcode/'.date('Ymd'));
|
|
|
+ }
|
|
|
+ $file_name = 'uploads/wx_qrcode/'.date('Ymd').'/'.time().rand(1000,9999).'.png';
|
|
|
+ file_put_contents($file_name, $qrcode);
|
|
|
+ return $url.'/'.$file_name;
|
|
|
+ } catch (\Throwable $e) {
|
|
|
+ Log::info('getQRCode:'.$e->getMessage());
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|