瀏覽代碼

设置复制手机号状态

15954078560 3 年之前
父節點
當前提交
5f0e7bf654
共有 3 個文件被更改,包括 158 次插入3 次删除
  1. 143 0
      application/api/controller/Mps.php
  2. 14 2
      application/api/controller/User.php
  3. 1 1
      application/common/library/Auth.php

+ 143 - 0
application/api/controller/Mps.php

@@ -0,0 +1,143 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+include_once '../vendor/aliyun/aliyun-php-sdk-core/Config.php';
+use Mts\Request\V20140618 as Mts;
+
+/**
+ * 示例接口
+ */
+class Mps extends Api
+{
+
+    //如果$noNeedLogin为空表示所有接口都需要登录才能请求
+    //如果$noNeedRight为空表示所有接口都需要验证权限才能请求
+    //如果接口已经设置无需登录,那也就无需鉴权了
+    //
+    // 无需登录的接口,*表示全部
+    protected $noNeedLogin = ['mpsvideo'];
+    // 无需鉴权的接口,*表示全部
+    protected $noNeedRight = [''];
+
+    //阿里云媒体处理视频
+    public function mpsvideo()
+    {
+//        $i = strpos('https://eyefate.oss-cn-hangzhou.aliyuncs.com/uploads/xuanzhuan.mp4','uploads');
+//        var_dump($i);
+//        $oss_input_object = substr('https://eyefate.oss-cn-hangzhou.aliyuncs.com/uploads/xuanzhuan.mp4', strpos('https://eyefate.oss-cn-hangzhou.aliyuncs.com/uploads/xuanzhuan.mp4', 'uploads'));
+//        var_dump($oss_input_object);
+//        $oss_output_object = str_replace('uploads', 'output', $oss_input_object);
+//        var_dump($oss_output_object);
+//        die;
+
+
+        $access_key_id = 'LTAI5tRun9ZQVSgeg9mbjzjh'; //AccessKey ID
+        $access_key_secret = 'nIkOAGe5Xttrjn7B5s0flk4z8zCdw8'; //AccessKey Secret
+        $mps_region_id = 'cn-hangzhou';
+        $pipeline_id = '0c4f9b648be54da09e29d8819f60a0df'; //管道id
+        $watermark_template_id = '0c09ed4ef64e424b89a3449bcc0de522'; //水印模板id
+        $template_id = '4c43c0ff9436425dbb6eaf2ce74e0ff0';//'S00000001-200030'; //转码模板id
+        $oss_location = 'oss-cn-hangzhou';
+        $oss_bucket = 'eyefate'; //bucket
+        $oss_input_object = 'uploads/2022330/ZWIFbwAxNmdF.mp4'; //输入文件
+        $oss_output_object = 'output/2022330/ZWIFbwAxNmdF.mp4'; //输出文件
+        $image_watermark_object = 'logo.png'; //水印logo地址
+//        $video_watermark_object = 'logo.mov';
+# DefaultAcsClient
+        $clientProfile = \DefaultProfile::getProfile(
+            $mps_region_id,                   # Region ID
+            $access_key_id,                   # AccessKey ID
+            $access_key_secret                # AccessKey Secret
+        );
+        $client = new \DefaultAcsClient($clientProfile);
+# request
+        $request = new Mts\SubmitJobsRequest();
+        $request->setAcceptFormat('JSON');
+# Input
+        $input = array('Location' => $oss_location,
+            'Bucket' => $oss_bucket,
+            'Object' => urlencode($oss_input_object));
+        $request->setInput(json_encode($input));
+# Output
+        $output = array('OutputObject' => urlencode($oss_output_object));
+# Ouput->TemplateId
+        $output['TemplateId'] = $template_id;
+## Image Watermark
+        $image_watermark_input = array(
+            'Location' => $oss_location,
+            'Bucket' => $oss_bucket,
+            'Object' => urlencode($image_watermark_object)
+        );
+        $image_watermark = array(
+            'WaterMarkTemplateId' => $watermark_template_id,
+            'Type' => 'Image',
+            'InputFile' => $image_watermark_input,
+//            'ReferPos' => 'TopRight',
+//            'Width' => 0.05,
+            'Dx' => 100,
+            'Dy'=> 50
+        );
+## Text Watermark
+       /* $text_config = array(
+            'Content' => '5rWL6K+V5paH5a2X5rC05Y2w',
+            'FontName' => 'SimSun',
+            'FontSize' => 16,
+            'FontColor' => 'Red',
+            'FontAlpha' => 0.5,
+            'Top' => 10,
+            'Left' => 10
+        );
+        $text_watermark = array(
+            'WaterMarkTemplateId' => $watermark_template_id,
+            'Type' => 'Text',
+            'TextWaterMark' => $text_config
+        );*/
+## Video Watermark
+        /*$video_watermark_input = array (
+            'Location' => $oss_location,
+            'Bucket' => $oss_bucket,
+            'Object' => urlencode($video_watermark_object)
+        );
+        $video_watermark = array(
+            'WaterMarkTemplateId' => $watermark_template_id,
+            'Type' => 'Image',
+            'InputFile'=> $video_watermark_input,
+            'ReferPos' => 'BottomLeft',
+            'Height' => 240,
+            'Dx' => 0,
+            'Dy' => 0
+        );*/
+# Output->Watermarks
+//        $watermarks = array($image_watermark, $text_watermark, $video_watermark);
+        $watermarks = array($image_watermark);
+        $output['WaterMarks'] = $watermarks;
+# Outputs
+        $outputs = array($output);
+        $request->setOUtputs(json_encode($outputs));
+        $request->setOutputBucket($oss_bucket);
+        $request->setOutputLocation($oss_location);
+# PipelineId
+        $request->setPipelineId($pipeline_id);
+# call api
+        try {
+            $response = $client->getAcsResponse($request);
+            print 'RequestId is:' . $response->{'RequestId'} . "\n";;
+            if ($response->{'JobResultList'}->{'JobResult'}[0]->{'Success'}) {
+                print 'JobId is:' .
+                    $response->{'JobResultList'}->{'JobResult'}[0]->{'Job'}->{'JobId'} . "\n";
+            } else {
+                print 'SubmitJobs Failed code:' .
+                    $response->{'JobResultList'}->{'JobResult'}[0]->{'Code'} .
+                    ' message:' .
+                    $response->{'JobResultList'}->{'JobResult'}[0]->{'Message'} . "\n";
+            }
+        } catch(ServerException $e) {
+            print 'Error: ' . $e->getErrorCode() . ' Message: ' . $e->getMessage() . "\n";
+        } catch(ClientException $e) {
+            print 'Error: ' . $e->getErrorCode() . ' Message: ' . $e->getMessage() . "\n";
+        }
+    }
+
+}

+ 14 - 2
application/api/controller/User.php

@@ -915,7 +915,7 @@ class User extends Api
 //
 //        if(!$userInfo){
             // 获取用户信息
-            $field = 'id,avatar,nickname,is_goddess,is_auth,recharge_auth,vipStatus(vip_duetime) as is_vip,age,lng,lat,city_name,district_name,constellation,hobby_ids,profession,declaration,wechat,income';
+            $field = 'id,avatar,nickname,is_goddess,is_auth,recharge_auth,vipStatus(vip_duetime) as is_vip,age,lng,lat,city_name,district_name,constellation,hobby_ids,profession,declaration,wechat,income,copy_mobile';
             $userInfo = \app\common\model\User::field($field)->where(['id'=>$user_id])->find();
             $userInfo['hobby_ids'] = \app\common\model\Hobby::getHobbyNames($userInfo['hobby_ids']);
             // 获取是否有眼缘
@@ -957,7 +957,7 @@ class User extends Api
 //
 //        if(!$userInfo){
             // 获取用户信息
-            $field = 'id,avatar,avatar_auth,gender,nickname,nickname_auth,is_goddess,is_auth,vipStatus(vip_duetime) as is_vip,vip_duetime,age,city_name,district_name,constellation,hobby_ids,expect_ids,profession,declaration,declaration_auth,money,wechat,wechat_auth,pre_user_id';
+            $field = 'id,avatar,avatar_auth,gender,nickname,nickname_auth,is_goddess,is_auth,vipStatus(vip_duetime) as is_vip,vip_duetime,age,city_name,district_name,constellation,hobby_ids,expect_ids,profession,declaration,declaration_auth,money,wechat,wechat_auth,pre_user_id,copy_mobile';
             $userInfo = \app\common\model\User::field($field)->where(['id'=>$user_id])->find();
             $userInfo['vip_duetime'] = $userInfo['vip_duetime']?date('Y-m-d',$userInfo['vip_duetime']):"";
             if($userInfo['pre_user_id']>0) {
@@ -1343,4 +1343,16 @@ class User extends Api
         $res['recharge_auth'] = \app\common\model\User::where(['id'=>$user_id])->value("recharge_auth");
         $this->success("获取成功!",$res);
     }
+    
+    //设置复制手机号状态
+    public function setcopymobile() {
+        $status = $this->auth->copy_mobile == 1 ? 2 : 1;
+
+        $rs = Db::name('user')->where(['id' => $this->auth->id, 'copy_mobile' => $this->auth->copy_mobile])->setField('copy_mobile', $status);
+        if (!$rs) {
+            $this->error('设置失败');
+        }
+
+        $this->success('设置成功', $status);
+    }
 }

+ 1 - 1
application/common/library/Auth.php

@@ -30,7 +30,7 @@ class Auth
         'province','city','district','province_name','city_name','district_name','lng', 'lat',
         'money','frozen','expect_ids','constellation','hobby_ids','profession','wechat','vip_duetime',
         'wechat_auth','wechat_time','declaration','tag_ids','auth_time','is_auth','is_goddess',
-        'income','recharge_auth','view_count','invite_no','pre_user_id','invite_time','emcid'];
+        'income','recharge_auth','view_count','invite_no','pre_user_id','invite_time','emcid', 'copy_mobile'];
 
     public function __construct($options = [])
     {