YanaDH преди 7 години
родител
ревизия
450183a8e3

+ 2 - 2
miaomiao/www/js/config/config.js

xqd
@@ -1,11 +1,11 @@
 (function (app) {
     //全局配置 
     app.constant("config", {
-        server: 'http://q8.9026.com/',
+        // server: 'http://q8.9026.com/',
     //     imgServer: 'http://q8.9026.com/attachment/'
         //server: 'http://localhost:8092/',
         //imgServer: 'http://localhost:8092/attachment/',
-        // server: 'http://miao.beiyuesi.com/',
+        server: 'http://miao.beiyuesi.com/',
         imgServer: 'http://miao.beiyuesi.com/attachment/'
     });
 })(angular.module('app'));

+ 12 - 3
miaomiao/www/js/controllers/home.js

xqd xqd xqd
@@ -239,8 +239,8 @@
         });
     }]);
 
-    app.controller('dreamDetailCtrl', ["$scope","$location","$ionicHistory","$timeout","$ionicLoading", "$state", "WechatService","$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams","$ionicBackdrop", "$ionicScrollDelegate", "$interval"
-        , function ($scope,$location, $ionicHistory,$timeout,$ionicLoading,$state,WechatService,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams,$ionicBackdrop, $ionicScrollDelegate, $interval) {
+    app.controller('dreamDetailCtrl', ["$scope","$location","$ionicHistory","$timeout","$ionicLoading", "$state", 'userService',"WechatService","$ionicModal","storage","msg", "common", "config", "homeService", "$ionicTabsDelegate", "$stateParams","$ionicBackdrop", "$ionicScrollDelegate", "$interval"
+        , function ($scope,$location, $ionicHistory,$timeout,$ionicLoading,$state,userService,WechatService,$ionicModal, storage , msg, common, config, homeService, $ionicTabsDelegate, $stateParams,$ionicBackdrop, $ionicScrollDelegate, $interval) {
             var dream_user_id = $stateParams.dream_user_id;
             var id = $stateParams.id;
             var interaction_id = $stateParams.interaction_id;
@@ -268,6 +268,15 @@
                     });
                 }, 50000);
 
+                $scope.isTest = true;
+                userService.isTest().then(function(res){
+                    if(res.data.data==1){
+                        $scope.isTest = false;
+                    }else{
+                        $scope.isTest = true;
+                    }
+                })
+
             });
             $scope.$on('$ionicView.afterLeave', function () {
                 clearInterval(timerID);
@@ -937,7 +946,7 @@
             $scope.rechagemodal.show();
             $scope.vm.money = '';
             if($scope.ios.isIOS){
-                var productIds = ['apple1001','apple1002','apple1003','apple1004']; // <- Add your product Ids here
+                var productIds = ['apple10001','apple102','apple103','apple104']; // <- Add your product Ids here
                 msg.loading();
                 inAppPurchase.getProducts(productIds).then(function (products) {
                     msg.hide();

+ 1 - 1
miaomiao/www/js/controllers/my.js

xqd
@@ -440,7 +440,7 @@
                 }
             })
             if($scope.ios.isIOS){
-                var productIds = ['apple1001','apple1002','apple1003','apple1004']; // <- Add your product Ids here
+                var productIds = ['apple10001','apple102','apple103','apple104']; // <- Add your product Ids here
                 msg.loading();
                 inAppPurchase
                   .getProducts(productIds)

+ 1 - 1
miaomiao/www/templates/home/dream-detail.html

xqd
@@ -114,7 +114,7 @@
                             </div>
                         </div>
                     </div>
-                    <div class="item" style="padding:0 5px; border-top: 1px solid #E6E6E6;">
+                    <div class="item" style="padding:0 5px; border-top: 1px solid #E6E6E6;" ng-show="!isTest">
                         <div class="row">
                             <div class="col" style="text-align:left">
                                 <h2>{{dream.coin}}</h2>

+ 1 - 1
miaomiao/www/templates/my/my-recharge.html

xqd
@@ -15,7 +15,7 @@
                         <div>剩余梦想币</div>
                         <div class="re-num">{{vm.coin}}</div>
                     </div>
-                    <div ng-if="showWithdraw" class="col col-33" style="padding: 30px 0 0 20px">
+                    <div ng-if="showWithdraw" class="col col-33" style="padding: 30px 0 0 20px;display: none">
                         <a ng-click="withdraw()" style="border: 1px solid #00C3DA; color: #00C3DA; padding: 5px 25px; border-radius: 30px;">提现</a>
                     </div>
                 </div>

+ 26 - 6
server/app/Http/Controllers/Api/V1/DreamController.php

xqd xqd xqd
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api\V1;
 use App\Helper\JpushHelper;
 use App\Models\AccountLog;
 use App\Models\BaseSettingsModel;
+use App\Models\CommentInfoModel;
 use App\Models\DreamImages;
 use App\Models\DreamInfoModel;
 use App\Models\InteractionInfo;
@@ -232,9 +233,19 @@ class DreamController extends Controller
             }
         }
         if ($type == 'paihang') return $this->api($topuser);
-        $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
-            $query->orderBy('created_at');
-        }])->orderBy('id','desc')->get();
+        $interactions = InteractionInfo::where('dream_id',$id)->orderBy('id','desc')->get();
+        foreach ($interactions as $interaction) {
+//            被屏蔽的人
+            $arr = array_filter(explode(',',$interaction->black_list));
+           if(!empty($arr)){
+               $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->where(function ($query) use ($arr) {
+                   $query->whereNotIn('user_id',$arr)->whereNotIn('to_user_id',$arr);
+               })->orderBy('created_at')->get()->toArray();
+           }else{
+               $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->orderBy('created_at')->get()->toArray();
+           }
+        }
+
         /*dd($interactions);
         foreach ($interactions as $item) {
             $item->comments;
@@ -289,9 +300,18 @@ class DreamController extends Controller
 //        梦想互动
         $interaction_id = $request->input('interaction_id');
 
-        $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
-            $query->orderBy('created_at');
-        }])->orderBy('created_at','desc')->get();
+        $interactions = InteractionInfo::where('dream_id',$id)->orderBy('created_at','desc')->get();
+        foreach ($interactions as $interaction) {
+//            被屏蔽的人
+            $arr = array_filter(explode(',',$interaction->black_list));
+            if(!empty($arr)){
+                $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->where(function ($query) use ($arr) {
+                    $query->whereNotIn('user_id',$arr)->whereNotIn('to_user_id',$arr);
+                })->orderBy('created_at')->get()->toArray();
+            }else{
+                $interaction->comments = CommentInfoModel::where('interaction_id',$interaction->id)->orderBy('created_at')->get()->toArray();
+            }
+        }
         if (!empty($interaction_id)) {
             $data = InteractionInfo::with(['comments' => function ($query) {
                 $query->orderBy('created_at');

+ 46 - 0
server/app/Http/Controllers/Api/V1/InteractionController.php

xqd
@@ -421,4 +421,50 @@ class InteractionController extends Controller
             SystemInfoModel::firstOrCreate($info2);
         }
     }
+
+    /**
+     * @api {get} /api/interaction/add_comment_blackList 加入黑名单
+     * @apiDescription 隐藏某个人的评论
+     * @apiGroup Interaction
+     * @apiParam {int} dream_id       梦想id
+     * @apiParam {int} interaction_id       动态id
+     * @apiParam {int} user_id      加入黑名单用户id
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * {
+     *  "status": true,
+     *   "status_code": 0,
+     *   "message": "",
+     *   "data": ""
+     *}
+     * HTTP/1.1 200 OK
+     * @apiErrorExample {json} Error-Response:
+     * {
+     *   "status": false,
+     *   "status_code": 700,
+     *   "message": "操作失败",
+     *  "data": null
+     *}
+     * HTTP/1.1 400 Bad Request
+     */
+    public function addCommentBlackList(Request $request)
+    {
+        $user = $this->getUser();
+        $user_id = $request->input('user_id');
+        $interaction_id = $request->input('interaction_id');
+        $dream_id = $request->input('dream_id');
+        $login_user_id = $user->id;
+        $dream = DreamInfoModel::find($dream_id);
+       if (empty($dream)) return $this->error(ErrorCode::DREAM_NOT_EXIST);
+        if ($dream->user_id != $login_user_id) return $this->error(ErrorCode::NOT_ROOT);
+        $interaction = InteractionInfo::find($interaction_id);
+        if (empty($interaction)) return $this->error(ErrorCode::INTERACTION_NOT_EXIST);
+        $black_list = '';
+        $black_list .= $user_id.',';
+        $interaction->black_list =$interaction->black_list . $black_list;
+        $ok = $interaction->save();
+        if ($ok) return $this->api('');
+        return $this->error(ErrorCode::OPERATION_FAILED);
+    }
 }

+ 1 - 0
server/app/Models/InteractionInfo.php

xqd
@@ -20,6 +20,7 @@ class InteractionInfo extends Model
         'pic8',
         'pic9',
         'video',
+        'black_list',
     ];
     public function comments()
     {

+ 4 - 4
server/app/Models/OrderInfoModel.php

xqd
@@ -50,10 +50,10 @@ class OrderInfoModel extends Model
 
     //苹果支付类型
     const Apple_Product1    = 'apple10000';
-    const Apple_Product2    = 'apple10000';
-    const Apple_Product3    = 'apple10002';
-    const Apple_Product4    = 'apple10003';
-    const Apple_Product5    = 'apple10004';
+    const Apple_Product2    = 'apple10001';
+    const Apple_Product3    = 'apple102';
+    const Apple_Product4    = 'apple103';
+    const Apple_Product5    = 'apple104';
 
     //订单状态定义
     const STATUS_PENDING    = 0;

+ 4 - 0
server/app/Services/Base/ErrorCode.php

xqd
@@ -73,10 +73,14 @@ final class ErrorCode {
     const DREAM_STATUS = 1412;
     const verify = 1413;
     const OPERATION_SUCCESS = 200;
+    const INTERACTION_NOT_EXIST = 2001;
+    const NOT_ROOT = 2002;
 
     //错误常量枚举
     private static $_msg = [
+        self::NOT_ROOT => '没有操作权限',
         self::DREAM_NOT_EXIST => '梦想不存在',
+        self::INTERACTION_NOT_EXIST => '动态不存在',
         self::DREAM_STATUS => '梦想暂未实现',
         self::SUP_ERROR => '你不是最大支持者',
         self::SUP_TOP => '支持已达上限',

+ 32 - 0
server/database/migrations/2018_01_31_160618_add_black_list_to_interaction_table.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBlackListToInteractionTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('interaction_info', function (Blueprint $table) {
+           $table->string('black_list')->comment('黑名单列表')->nullable()->after('status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('interaction_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 1 - 1
server/resources/views/admin/share1.blade.php

xqd
@@ -277,7 +277,7 @@
 </head>
 <body>
 <div style="height: 50px">
-    <a href="https://fir.im/jt4h" style="height: 50px; background: #00c3da; position: fixed; z-index: 99; width: 100%">
+    <a href="      " style="height: 50px; background: #00c3da; position: fixed; z-index: 99; width: 100%">
         <div style="float: left;color: #fff;line-height: 50px;padding-left: 5px">支持({{empty($dream->user) ? '' : $dream->user->nickname}})的梦想!现在就下载瞄喵</div>
         <div style="float: right;padding: 5px">
             <img style="width: 40px;height: 40px;" src="http://firicon.fir.im/396004d5e7b572efbefdfee976338331a457282b" alt="">

+ 4 - 0
server/routes/api.php

xqd
@@ -296,6 +296,10 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'interaction.delete',
         'uses' => 'InteractionController@delete',
     ]);
+    $api->get('/interaction/add_comment_blackList', [  //加入黑名单
+        'as' => 'interaction.add_comment_blackList',
+        'uses' => 'InteractionController@addCommentBlackList',
+    ]);
     $api->get('/interaction/destroy', [  //删除动态
         'as' => 'interaction.destroy',
         'uses' => 'InteractionController@destroy',