浏览代码

用户观看行为(支付)

15954078560 2 年之前
父节点
当前提交
4d559df6b0
共有 1 个文件被更改,包括 45 次插入1 次删除
  1. 45 1
      application/api/controller/Index.php

+ 45 - 1
application/api/controller/Index.php

@@ -1432,7 +1432,7 @@ class Index extends Api
         $this->success('操作成功');
     }
 
-    //用户观看行为
+    //用户观看行为(大数据)
     public function userplay() {
         $id = input('id', 0, 'intval'); //视频id
         $sn = input('sn', '', 'trim'); //SN号
@@ -1538,4 +1538,48 @@ class Index extends Api
 
         $this->success('上报成功');
     }
+
+    //用户观看行为(支付)
+    public function payuserplay() {
+        $id = input('id', 0, 'intval'); //视频id
+        $sn = input('sn', '', 'trim'); //SN号
+        $start_time = input('start_time', '', 'trim'); //yyyymmddhhmmss (24小时制),节目开始播放时间
+        $end_time = input('end_time', '', 'trim'); //yyyymmddhhmmss (24小时制),节目结束播放时间,如果播放未结束,但是此时需要同步数据,填当前时间
+        $csource = input('csource', 0, ''); //1:从搜索结果访问2:从用户收藏/书签访问3:从EPG访问4:从推荐页面访问5、其他
+
+        if (!$id) {
+            $this->error('您的网络开小差了');
+        }
+
+        $info = Db::name('video')->where(['id' => $id])->find();
+        if (!$info) {
+            $this->error('数据不存在');
+        }
+
+        $content = [
+            'UserID' => $this->auth->mobile,
+            'city' => '14',
+            'start_time' => $start_time,
+            'end_time' => $end_time,
+            'service_type' => 1,
+            'albumid' => $id,
+            'albumname' => $info['title'],
+            'csource' => $csource,
+            'SN' => $sn,
+            'ip' => request()->ip(),
+            'fee_type' => $info['is_pay'] == 1 ? 1 : '',
+            'flow' => '',
+            'product' => '',
+            'product_name' => '',
+            'info_source' => '02'
+        ];
+
+        $content = join('|', $content);
+
+        $filename = date('Ymd').'_'.config('cp_id').'_userviewdata_1.dat';
+        $check_filename = date('Ymd').'_'.config('cp_id').'_userviewdata_1.chk';
+
+        error_log(print_r($content, 1) . PHP_EOL, 3, './dashuju/' . $filename);
+        error_log('', 3, './dashuju/' . $check_filename);
+    }
 }