Bläddra i källkod

增加订购同步关系

15954078560 2 år sedan
förälder
incheckning
435b2a845c
1 ändrade filer med 80 tillägg och 4 borttagningar
  1. 80 4
      application/api/controller/Notify.php

+ 80 - 4
application/api/controller/Notify.php

@@ -954,7 +954,73 @@ class Notify extends Api
     
     //订购关系同步地址
     public function ordersync() {
-        
+        $data = file_get_contents('php://input');
+        if (!$data) {
+            $this->error('参数缺失');
+        }
+
+        $jsonxml = json_encode(simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA));
+        $data = json_decode($jsonxml, true);
+        if (!$data) {
+            $this->error('参数缺失');
+        }
+        $phoneNumber = $data['orderRelationSyncRequest']['phoneNumber']; //手机号
+        $apppId = $data['orderRelationSyncRequest']['apppId']; //订购的HDC业务产品编码
+
+        if ($apppId != config('product_code')) {
+            echo 'meiyou';
+            exit;
+        }
+
+        //用户增值产品包当前订购快照
+        $content = [
+            'UserID' => $phoneNumber,
+            'prod_code' => $apppId,
+            'prod_name' => '月包会员',
+            'eff_time' => date('Y-m-d H:i:s', time()),
+            'exp_time' => date('Y-m-d H:i:s', time() + 30 * 86400),
+            'price' => 2900
+        ];
+
+        $content = join(json_decode('"\u0001"', true), $content);
+        $filename = date('Ymd').'_'.config('data_cp_id').'_userefforderdata_1.dat';
+        $check_filename = date('Ymd').'_'.config('data_cp_id').'_userefforderdata_1.chk';
+
+        error_log(print_r($content, 1) . PHP_EOL, 3, './dashuju/' . $filename);
+        error_log('', 3, './dashuju/' . $check_filename);
+        $finish_filename = date('Ymd') . '_' . config('data_cp_id') . '_userefforderdata.finish';
+        error_log('', 3, './dashuju/' . $finish_filename);
+
+        //用户增值产品包订购行为数据
+        $user_id = Db::name('user')->where(['mobile' => $phoneNumber])->value('id');
+        $order_info = Db::name('rechar_order')->where(['user_id' => $user_id, 'purpose' => 3, 'pay_type' => 'zhuowang', 'status' => 1])->order('id desc')->find();
+
+        $content = [
+            'orderid' => $order_info['order_no'],
+            'order_time' => date('Y-m-d H:i:s', time()),
+            'order_type' => 1,
+            'UserID' => $phoneNumber,
+            'prod_code' => $apppId,
+            'prod_name' => '月包会员',
+            'eff_time' => date('Y-m-d H:i:s', time()),
+            'exp_time' => date('Y-m-d H:i:s', time() + 30 * 86400),
+            'csource' => 99,
+            'trace_id' => '',
+            'price' => 2900,
+            'paytype' => 0,
+            'cpid' => config('data_cp_id'),
+            'albumid' => '',
+            'albumname' => ''
+        ];
+
+        $content = join(json_decode('"\u0001"', true), $content);
+        $filename = date('Ymd').'_'.config('data_cp_id').'_userorderdata_1.dat';
+        $check_filename = date('Ymd').'_'.config('data_cp_id').'_userorderdata_1.chk';
+
+        error_log(print_r($content, 1) . PHP_EOL, 3, './dashuju/' . $filename);
+        error_log('', 3, './dashuju/' . $check_filename);
+        $finish_filename = date('Ymd') . '_' . config('data_cp_id') . '_userorderdata.finish';
+        error_log('', 3, './dashuju/' . $finish_filename);
     }
 
     //(补漏)视频注入中兴
@@ -1088,7 +1154,7 @@ class Notify extends Api
     //媒资数据专辑粒度
     public function mediadataalbum() {
         $hu_video = Db::name('video');
-        $list = $hu_video->where(['search_status' => 1])->order('id')->select();
+        $list = $hu_video->where(['inject_status' => 2, 'mediaalbum_status' => 0])->order('id')->select();
 
         if (!$list) {
             echo 'mei shu ju';
@@ -1154,7 +1220,7 @@ class Notify extends Api
     //媒资数据节目/内容粒度
     public function mediadatavideo() {
         $hu_video = Db::name('video');
-        $list = $hu_video->where(['search_status' => 1])->order('id')->select();
+        $list = $hu_video->where(['inject_status' => 2, 'mediavideo_status' => 0])->order('id')->select();
 
         if (!$list) {
             echo 'mei shu ju';
@@ -1212,7 +1278,7 @@ class Notify extends Api
     //产品包和媒资所属关系
     public function productmediarelation() {
         $hu_video = Db::name('video');
-        $list = $hu_video->where(['search_status' => 1])->order('id')->select();
+        $list = $hu_video->where(['inject_status' => 2, 'productmedia_status' => 0])->order('id')->select();
 
         if (!$list) {
             echo 'mei shu ju';
@@ -1240,4 +1306,14 @@ class Notify extends Api
             }
         }
     }
+
+    //用户观看行为数据文件上传到卓望ftp
+    public function uploadpayftp() {
+
+    }
+
+    //大数据文件上传到大数据ftp
+    public function uploaddataftp() {
+
+    }
 }