|
@@ -8,6 +8,8 @@
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
+use app\admin\model\books\Certificate;
|
|
|
+use app\admin\model\order\UserGoods;
|
|
|
use app\admin\model\video\Video as VideoModel; //视频
|
|
|
use app\admin\model\video\VideoFile; //视频
|
|
|
use app\common\controller\Api;
|
|
@@ -60,6 +62,16 @@ class Video extends Api
|
|
|
$VideoModel = new VideoModel();
|
|
|
$id = $data['id'];
|
|
|
$list = $VideoModel->where('id',$id)->where('is_deleted',1)->with(['file'])->find();
|
|
|
+ $list['is_pay'] = 1;
|
|
|
+ //判断是否已购买
|
|
|
+ if($this->auth->isLogin()){
|
|
|
+ $UserGoods = new UserGoods();
|
|
|
+ $uid = $this->auth->id;
|
|
|
+ $good = $UserGoods->where('user_id',$uid)->where('goods_type',1)->where('goods_id',$id)->find();
|
|
|
+ if($good){
|
|
|
+ $list['is_pay'] = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
if(!$list){
|
|
|
$this->error('教材不存在或已删除');
|
|
|
}
|