lizhen_gitee 1 рік тому
батько
коміт
02c41dbe2e

+ 10 - 44
application/api/controller/company/Package.php

@@ -260,17 +260,10 @@ class Package extends Apic
         $this->success('删除成功');
     }
 
-    public function showposter(){
-        $id = input('id',1);
-        $minicode = $this->getMiniCode($id,$this->auth->company_id);
-
-    }
 
     //仅返回套餐二维码
-    private function getMiniCode($id,$companyid)
+    private function getMiniCode($id,$package,$companyid)
     {
-        $package = Db::name('package')->where('id',$id)->find();
-
         $httpStr = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'];
         if (empty($package['mini_code'])) {
             $client = new Client();
@@ -294,48 +287,21 @@ class Package extends Apic
         } else {
             $miniCode = $httpStr.$package['mini_code'];
         }
-
-        $this->success('success',$miniCode);
-
+        return $miniCode;
     }
 
-    //生成我的视频海报
-    //生成邀请码二维码图片
-    public function inviteimage($introcode = '') {
-        $params['text'] = config('h5_url') . '/#/pages/index/detail/detail?id=5&introcode=' . $introcode;
-        $qrcode_service = \addons\qrcode\library\Service::qrcode($params);
-//        $mimetype = 'image/png';
-//        $response = Response::create()->header("Content-Type", $mimetype);
-
-        // 直接显示二维码
-//        header('Content-Type: ' . $qrcode_service->getContentType());
-//        $response->content($qrcode_service->writeString());
-        $qrcodePath = ROOT_PATH . 'public/uploads/qrcode/';
-        if (!is_dir($qrcodePath)) {
-            @mkdir($qrcodePath);
-        }
-        if (is_really_writable($qrcodePath)) {
-            $filename = md5(implode('', $params)) . '.png';
-            $filePath = $qrcodePath . $filename;
-            $qrcode_service->writeFile($filePath);
-        }
-
-        return '/uploads/qrcode/' . $filename;
-    }
-
-
     //生成视频分享海报
-    public function shareposter() {
-        $id = input('video_id', 0, 'intval'); //id
+    public function showposter() {
+        $id = input('id', 0, 'intval'); //id
         if (!$id) {
             $this->error('参数缺失');
         }
-        $info = Db::name('video')->where('id',$id)->find();
+        $info = Db::name('package')->where('id',$id)->find();
         if (!$info) {
-            $this->error('视频不存在');
+            $this->error('套餐不存在');
         }
 
-        $inviteimage = $this->inviteimage($this->auth->introcode);
+        $inviteimage = $this->getMiniCode($id,$info,$this->auth->company_id);
 
         $data = [
             [
@@ -344,7 +310,7 @@ class Package extends Apic
                 "type"=> "img",
                 "width"=> "45px",
                 "height"=> "45px",
-                "src"=> one_domain_image($this->auth->avatar)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg"
+                "src"=> one_domain_image($this->auth->company->image)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg"
             ],
             [
                 "left"=> "10px",
@@ -354,7 +320,7 @@ class Package extends Apic
                 "height"=> "38px",
                 "size"=> "11px",
                 "color"=> "#333333",
-                "content" => (iconv_strlen($info['name'], 'utf-8') <= 12 ? $info['name'] : mb_substr($info['name'], 0, 12) )
+                "content" => (iconv_strlen($info['title'], 'utf-8') <= 12 ? $info['title'] : mb_substr($info['title'], 0, 12) )
             ],
             [
                 "left"=> "60px",
@@ -364,7 +330,7 @@ class Package extends Apic
                 "height"=> "38px",
                 "size"=> "10px",
                 "color"=> "#666666",
-                "content" => (iconv_strlen($this->auth->nickname, 'utf-8') <= 8 ? $this->auth->nickname : mb_substr($this->auth->nickname, 0, 8))
+                "content" => (iconv_strlen($this->auth->company->name, 'utf-8') <= 8 ? $this->auth->nickname : mb_substr($this->auth->nickname, 0, 8))
             ],
             [
                 "left"=> "200px",

+ 16 - 0
application/common.php

@@ -1126,4 +1126,20 @@ if(!function_exists('is_mobile')) {
         }
         return false;
     }
+}
+if (!function_exists('httpurllocal')) {
+    /**
+     * 判断当前url是否为全路径,并返回全路径
+     */
+    function httpurllocal($path) {
+        if(!$path) return $path;
+        $host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
+        // 获取当前域名
+        if(strpos($path,'http://') === false && strpos($path,'https://') === false) {
+            $url = $host.$path;
+        } else {
+            $url = $path;
+        }
+        return $url;
+    }
 }

BIN
public/assets/img/posterbg.png