wesmiler před 2 roky
rodič
revize
e71a6960c2

+ 32 - 0
app/Http/Controllers/Api/v1/VideoController.php

@@ -51,6 +51,23 @@ class VideoController extends webApp
         }
     }
 
+    /**
+     * 短剧列表
+     * @return array
+     */
+    public function shortList()
+    {
+        try {
+            $params = request()->post();
+            $pageSize = request()->post('pageSize', 0);
+            $datas = VideoService::make()->getShortlist($params, $pageSize,'', $this->userId);
+
+            return showJson(1010, true, $datas);
+        } catch (\Exception $exception){
+            RedisService::set("caches:request:error_video_short_list", ['error'=>$exception->getMessage(),'trace'=>$exception->getTrace()], 7200);
+            return showJson(1018, false, ['error'=>env('APP_DEBUG')? $exception->getTrace() : '']);
+        }
+    }
 
     /**
      * 详情
@@ -68,6 +85,21 @@ class VideoController extends webApp
 
     }
 
+    /**
+     * 详情
+     * @return array
+     */
+    public function shortInfo()
+    {
+        $id = request()->post('id', 0);
+        $info = VideoService::make()->getShortInfo($id, $this->userId);
+        if($info){
+            return showJson(1010, true, $info);
+        }else{
+            return showJson(1009, false);
+        }
+
+    }
 
     /**
      * 发布

+ 108 - 1
app/Services/Api/VideoService.php

@@ -192,7 +192,7 @@ class VideoService extends BaseService
         if($datas){
             return $datas;
         }
-        $where = ['a.mark' => 1,'a.status'=>2,'b.mark'=>1];
+        $where = ['a.mark' => 1,'a.status'=>2,'a.is_short'=>2,'b.mark'=>1];
         $field = $field? $field : 'lev_a.*';
         $order = 'rand()';
         $model = $this->model->with(['member'])->from('videos as a')
@@ -471,6 +471,113 @@ class VideoService extends BaseService
         return $data;
     }
 
+    /**
+     * 短剧列表
+     * @param $params
+     * @param int $pageSize
+     * @param string $field
+     * @param $userId
+     * @return array
+     */
+    public function getShortlist($params, $pageSize=18,$field='', $userId)
+    {
+        $where = ['a.mark' => 1,'a.is_short'=>1,'a.pid'=>0,'b.mark'=>1];
+        $field = $field? $field : 'lev_a.*';
+        $order = 'lev_a.id desc';
+        $list = $this->model->with(['member'])->from('videos as a')
+            ->leftJoin('member as b', 'b.id', '=', 'a.user_id')
+            ->where($where)
+            ->where(function ($query) use ($params, $userId) {
+                $uid = isset($params['uid']) ? $params['uid'] : 0;
+                if ($uid > 0) {
+                    $query->where('a.user_id', $uid);
+                }else{
+                    $query->where('a.status', 2);
+                }
+
+                $id = isset($params['id']) ? $params['id'] : 0;
+                if ($id > 0) {
+                    $query->whereNotIn('a.id', [$id]);
+                }
+
+            })
+            ->where(function ($query) use ($params) {
+                $keyword = isset($params['kw']) ? $params['kw'] : '';
+                if ($keyword) {
+                    $query->where('a.title', 'like', "%{$keyword}%")
+                        ->orWhere('a.tags', 'like', "%{$keyword}%")
+                        ->orWhere('a.description', 'like', "%{$keyword}%");
+                }
+            })
+            ->selectRaw($field)
+            ->orderByRaw($order)
+            ->paginate($pageSize > 0 ? $pageSize : 9999999);
+
+        $list = $list ? $list->toArray() : [];
+        if ($list && $list['data']) {
+            foreach ($list['data'] as &$item) {
+                $item['time_text'] = isset($item['create_time']) ? dateFormat($item['create_time'], 'Y-m-d H:i') : '';
+                $item['thumb'] = isset($item['thumb']) && $item['thumb'] ? get_image_url($item['thumb']) : '';
+
+                if(isset($item['file_url'])){
+                    $item['file_url'] = $item['file_url']? get_image_url($item['file_url']) : '';
+                }
+
+                $member = isset($item['member'])? $item['member'] : [];
+                if($member){
+                    $member['avatar'] = isset($member['avatar']) && $member['avatar']? get_image_url($member['avatar']) : get_image_url('/images/member/logo.png');
+                }
+                $item['tags'] = isset($item['tags']) && $item['tags']? explode(',', $item['tags']) : [];
+                $item['like_num'] = isset($item['like_num']) && $item['like_num']? intval($item['like_num']) : 0;
+                $item['member'] = $member;
+            }
+        }
+
+        return [
+            'pageSize' => $pageSize,
+            'total'    => isset($list['total']) ? $list['total'] : 0,
+            'list'     => isset($list['data']) ? $list['data'] : []
+        ];
+    }
+
+    /**
+     * 详情
+     * @param $id
+     * @return array
+     */
+    public function getShortInfo($id, $userId=0, $field=[])
+    {
+        $field = $field? $field : ['a.*'];
+        $info = $this->model->from('videos as a')->with(['member','playList'])
+            ->leftJoin('member as b','b.id','=','a.user_id')
+            ->where(['a.id'=> $id,'a.mark'=>1,'b.mark'=>1])
+            ->select($field)
+            ->first();
+
+        $info = $info? $info->toArray() : [];
+        if($info){
+            if(isset($info['thumb'])){
+                $info['thumb'] = $info['thumb']? get_image_url($info['thumb']) : '';
+            }
+            if(isset($info['file_url'])){
+                $info['file_url'] = $info['file_url']? get_image_url($info['file_url']) : '';
+            }
+
+            $member = isset($info['member'])? $info['member'] : [];
+            if($member){
+                $member['avatar'] = isset($member['avatar']) && $member['avatar']? get_image_url($member['avatar']) : get_image_url('/images/member/logo.png');
+            }
+            $info['member'] = $member;
+            $info['tags'] = isset($info['tags']) && $info['tags']? explode(',', $info['tags']) : [];
+            $info['like_num'] = isset($info['like_num']) && $info['like_num']? intval($info['like_num']) : 0;
+            $info['collect_num'] = isset($info['collect_num']) && $info['collect_num']? intval($info['collect_num']) : 0;
+            $info['views'] = isset($info['views']) && $info['views']? intval($info['views']) : 0;
+            $info['time_text'] = isset($info['create_time']) ? dateFormat($info['create_time'], 'Y-m-d H:i') : '';
+        }
+
+        return $info;
+    }
+
 
     /**
      * 发布

+ 213 - 0
resources/lang/en/api.php

@@ -11,6 +11,50 @@ return [
     '1009'=> 'not data',
     '1010'=> 'Ok',
 
+    '1011'=> 'Verify send success',
+    '1012'=> 'request timeout',
+    '1013'=> 'modify success',
+    '1014'=> 'modify failed',
+    '1015'=> 'has updated',
+    '1016'=> 'update failed',
+    '1017'=> 'update success',
+    '1018'=> 'request failed,service error',
+    '1019'=> 'setting success',
+    '1020'=> 'setting failed',
+    '1021'=> 'param type error',
+    '1022'=> 'param value error',
+    '1023' => 'publish success',
+    '1024' => 'publish failed',
+    '1025' => 'delete success',
+    '1026' => 'delete failed',
+    '1027' => 'add success',
+    '1028' => 'add failed',
+    '1029' => 'Insufficient balance, please recharge first',
+    '1030' => 'Payment method not supported',
+    '1031' => 'error in type',
+    '1032' => '单页文章ID未配置',
+    '1033' => '请选择操作数据',
+    '1034' => '请不要频繁操作,稍后再试',
+    '1035' => '钱包api_key未配置',
+    '1036' => '出帐钱包地址未配置',
+    '1037' => '入账钱包地址未配置',
+    '1038' => '出账钱包地址未配置或余额不足,请先充值',
+    '1039' => '数据不存在',
+    '1040' => '请先设置交易密码',
+    '1041' => 'Account does not exist',
+    '1042' => '账户处理失败',
+    '1043' => '账户明细处理失败',
+    '1044' => '供应链接口未配置,请联系客服',
+    '1045' => '供应链请求失败,请联系客服',
+    '1046' => '供应链授权失败,请联系客服',
+    '1047' => 'Frequent requests',
+    '1048' => 'The wallet address has been used',
+    '1049' => 'The wallet address is illegal or invalid',
+    '1050' => 'Shopping cart is full, please clear before adding',
+    '1051' => 'The shopping cart is empty',
+    '1052' => 'The inventory of this style is insufficient',
+    '1053' => 'Please do not place duplicate orders',
+
     // 登录注册
     '2001'=> 'Illegal or nonexistent account',
     '2002'=> 'Login password error',
@@ -21,8 +65,177 @@ return [
     '2007'=> 'Account registration failed',
     '2008'=> 'Account registration succeeded',
 
+    '2009'=> '邮箱地址已被使用',
+    '2010'=> '邮箱验证码发送失败',
+    '2011'=> '邮箱验证码发送频繁,请60秒后重试',
+    '2012'=> '邮箱验证码已失效或错误',
+    '2013'=> '邮箱验证码错误',
+    '2014'=> 'missing parameter',
+    '2015'=> 'The account has been frozen, please contact customer service',
+    '2016'=> '微信授权失败',
+    '2017'=> '账号不可用或已被冻结,请稍后再试或联系客服',
+    '2018'=> '商家账号不可用或已冻结,请联系客服',
+    '2019'=> '邮件接口参数未配置',
+    '2020'=> 'Email verification code sent successfully',
+    '2021'=> 'Email verification code sending failed',
+    '2022'=> 'Registration successful, please download and install the app before logging in and using it',
+    '2023'=> 'You have registered. Please download and install the app before logging in and using it',
+    '2024'=> 'Your account may have been frozen, please contact customer service',
+    '2025'=> '收款账号不存在或已被冻结,请联系客服',
+    '2026'=> '您的星豆余额不足,请先充值或刷新后重试',
+    '2027'=> '您的交易额度不足,请先充值或刷新后重试',
+    '2028'=> '账户处理失败,请刷新后重试',
+    '2029'=> '账户明细处理失败,请刷新后重试',
+    '2030'=> '转账成功',
+    '2031'=> '请先选择或填写充值金额',
+    '2032'=> '请先选择充值支付方式',
+    '2033'=> '充值订单提交失败',
+    '2034'=> '充值订单提交成功,入账中~',
+    '2035'=> '您的USDT余额不足,请先充值~',
+    '2036'=> 'USDT余额扣除失败,请刷新重试~',
+    '2037'=> '充值成功',
+    '2038'=> '交易密码错误',
+    '2039'=> '账户未入驻或非法,请联系客服',
+
+    '2040'=> '抱歉,您还未获得开播权限,请先升级',
+    '2041'=> '开播成功',
+    '2042'=> '开播失败',
+
     // 语言设置
     '2101'=> 'Language parameter error',
     '2102'=> 'Switch language succeeded',
     '2103'=> 'Failed to switch languages',
+
+    '2207'=> '没有获取到数据',
+    '2208'=> '保存封面失败,请返回重试',
+    '2209'=> '保存背景音乐文件失败,请返回重试',
+    '2210'=> '保存相册文件失败,请返回重试',
+    '2211'=> '请选择相册文件',
+    '2212'=> '保存视频文件失败,请返回重试',
+    '2213'=> '请选择或拍摄视频',
+
+    '2301'=> '该直播已结束',
+    '2302'=> '该直播间未开启打赏功能',
+    '2303'=> '礼物参数错误',
+    '2304'=> '账户星豆余额不足,请先充值',
+    '2305'=> '打赏支付失败',
+    '2306'=> '打赏成功',
+
+    '2401'=>'请填写提现金额',
+    '2402'=>'提现金额不能超过账户USDT余额',
+    '2403'=>'提现账户地址未绑定,请先到用户中心绑定地址',
+    '2404'=>'提现账户类型错误',
+    '2405'=>'创建提现订单失败',
+    '2406'=>'提现账户扣款失败',
+    '2407'=>'提现账户处理失败',
+
+    '2420'=> '参数错误',
+    '2421'=> '转账账户不存在或不交易',
+    '2422'=> '转账金额不能超过USDT余额',
+    '2423'=> '转账交易处理失败',
+    '2424'=> '转账交易处理失败',
+    '2425'=> '转账成功',
+
+    '2451'=> '已绑定邀请码不可修改',
+    '2452'=> '不可绑定自己为推荐人',
+    '2453'=> '该邀请码账号不存在或不可用,请更换绑定',
+    '2454'=> '不可绑定自己下级团队用户为推荐人',
+
+    '2501'=> '该节点参数配置错误,请联系客服',
+    '2502'=> '您已购买过该节点',
+    '2503'=> '购买成功',
+
+    '2511'=> '该等级参数错误,请联系客服',
+    '2512'=> '当前等级已升级过,请刷新后重试',
+    '2513'=> '当前等级已经是最高级别',
+    '2514'=> '抱歉,您的累计收益未满足升级条件',
+
+
+    '2601'=> '直推奖收益结算处理失败',
+    '2602'=> '直推奖收益明细处理失败',
+    '2603'=> '点对点收益结算处理失败',
+    '2604'=> '点对点收益明细处理失败',
+    '2605'=> '管理奖收益结算处理失败',
+    '2606'=> '管理奖收益明细处理失败',
+    '2607'=> '升级用户等级参数错误',
+    '2608'=> '升级收益结算成功',
+
+
+    '2701'=> '获取供应链授权Token失败',
+    '2702'=> '供应链参数未配置完整',
+
+    '2801'=> '您已成功入驻店铺,无需申请',
+    '2802'=> '您的店铺已被冻结',
+    '2803'=> '行业类目不存在或无效',
+    '2804'=> '请上传店铺LOGO',
+    '2805'=> '请至少填写一种联系方式',
+    '2806'=> '请填写店铺国家/地址信息',
+    '2807'=> '请选择交易货币',
+    '2808'=> '请上传店铺营业执照',
+    '2809'=> '更新入驻申请信息成功,请耐心等候审核',
+    '2810'=> '申请入驻失败,请返回重试',
+    '2811'=> '申请入驻成功,请耐心等候审核',
+    '2812'=> '账号入驻,请先申请入驻并审核通过后使用',
+
+    '2901'=> '请先选择购买或结算的商品',
+    '2902'=> '请添加或选择您的收货地址',
+    '2903'=> '没有有效的商品',
+    '2904'=> '订单商品参数错误',
+    '2905'=> '商品库存不足,请联系客服',
+    '2906'=> '付款金额错误,请刷新后重试',
+    '2907'=> '订单创建失败,请刷新后重试',
+    '2908'=> '订单处理失败,请刷新后重试',
+    '2909'=> '订单支付失败,请刷新后重试',
+    '2910'=> '购买成功',
+    '2911'=> '下单成功,请支付',
+    '2912'=> '订单不存在',
+    '2913'=> '您无权操作该订单',
+    '2914'=> '订单状态不可操作',
+    '2915'=> '订单售后处理中,请耐心等候审核',
+    '2916'=> '订单申请售后成功,请耐心等候审核',
+    '2917'=> '订单申请售后失败,请返回重试',
+    '2918'=> '没有可售后的商品,请联系客服',
+    '2919'=> '订单商品存在不可售后商品,请联系客服',
+    '2920'=> '多商品售后暂未开放,请联系客服处理',
+    '2921'=> '该商品不支持售后,请联系客服处理',
+    '2922'=> '请选择有效的售后类型',
+
+    '2923'=> '请选择操作的商品',
+    '2924'=> '暂无物流信息',
+    '2925'=> '售后申请失败,请联系客服',
+    '2926'=> '暂无售后信息',
+    '2927'=> '无可取消售后订单',
+    '2928'=> '无可取消售后的商品',
+    '2929'=> '取消售后失败,请返回重试或联系客服',
+    '2930'=> '取消售后成功',
+    '2931'=> '订单不可操作完成,请检查是否已售后处理完成',
+    '2932'=> '订单更新失败',
+    '2933'=> '无可售后处理的商品',
+    '2934'=> '售后商品处理失败',
+    '2935'=> '无售后退款金额',
+    '2936'=> '售后审核通过',
+
+
+    '3001'=> '订单更新处理中',
+    '3002'=> '订单结算中',
+    '3003'=> '订单用户不存在',
+    '3004'=> '订单结算金额错误',
+    '3005'=> '没有奖励可结算',
+    '3006'=> '没到时间发放',
+    '3007'=> '每日积分发放参数设置错误',
+    '3008'=> '积分账户结算失败',
+    '3009'=> '待返积分返还参数错误',
+    '3010'=> '没有可结算的金额',
+
+
+    '112009'=> '供应商账户余额不足,请联系客服',
+    '我正在直播,快来看看吧'=>'我正在直播,快来看看吧',
+    '打赏消费通知'=>'打赏消费通知',
+    '打赏消费通知内容'=>'您在:time(UTC+8)打赏了:money星豆给主播:live_name',
+    '打赏通知'=>'打赏通知',
+    '打赏通知内容'=>':nickname在:time(UTC+8)给您打赏了:money星豆',
+    '打赏推荐奖励通知'=>'打赏推荐奖励通知',
+    '打赏推荐奖励通知内容'=>'您在:time(UTC+8)获得了主播:live_name的打赏奖励:score 待返积分',
+
+
 ];

+ 2 - 0
routes/api.php

@@ -70,6 +70,8 @@ Route::prefix('v1')->group(function(){
 
     // 短视频
     Route::post('/video/index', [\App\Http\Controllers\Api\v1\IndexController::class, 'videos']);
+    Route::post('/video/shortList', [\App\Http\Controllers\Api\v1\VideoController::class, 'shortList']);
+    Route::post('/video/shortInfo', [\App\Http\Controllers\Api\v1\VideoController::class, 'shortInfo']);
     Route::post('/video/list', [\App\Http\Controllers\Api\v1\VideoController::class, 'list']);
     Route::post('/video/info', [\App\Http\Controllers\Api\v1\VideoController::class, 'info']);
     Route::post('/video/publish', [\App\Http\Controllers\Api\v1\VideoController::class, 'publish']);