Selaa lähdekoodia

Merge branch 'master' of http://git.9026.com/roobe/miao

YanaDH 7 vuotta sitten
vanhempi
commit
3039f06e7f

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

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

+ 15 - 12
miaomiao/www/js/config/router.js

xqd xqd
@@ -361,15 +361,15 @@
                 }
             }
         })
-            .state('app.recharge', {
-                url: '/home/recharge',
-                views: {
-                    'app-home': {
-                        templateUrl: 'templates/my/my-recharge.html',
-                        controller: 'payCtrl'
-                    }
+        .state('app.recharge', {
+            url: '/home/recharge',
+            views: {
+                'app-home': {
+                    templateUrl: 'templates/my/my-recharge.html',
+                    controller: 'rechargeCtrl'
                 }
-            })
+            }
+        })
         .state('app.my_setting', {
             url: '/my/setting',
             views: {
@@ -396,12 +396,15 @@
                         controller: 'payExplainCtrl'
                     }
                 }
-            }) .state('app.payDetail', {
-                url: '/my/payDetail',
+            }) .state('app.paySuccess', {
+                url: '/my/paySuccess',
+                params:{
+                  item:null
+                },
                 views: {
                     'app-my': {
-                        templateUrl: 'templates/my/payDetail.html',
-                        controller: 'payDetailCtrl'
+                        templateUrl: 'templates/my/paySuccess.html',
+                        controller: 'paySuccessCtrl'
                     }
                 }
             })

+ 13 - 11
miaomiao/www/js/controllers/home.js

xqd
@@ -632,17 +632,19 @@
                         };
                         // console.log("result: " + JSON.stringify(params));
                         Wechat.sendPaymentRequest(params, function (r) {
-                            $scope.clicksub = false;
-                            courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
-                                $timeout(function () {
-                                    $scope.closeRechargeModal();
-                                }, 500);
-                                homeService.myInfo().then(function (result) {
-                                    $scope.user = result.data.data;
-                                });
-                            }, function (erro) {
-                                // msg.alert("支付反馈失败:" + JSON.stringify(erro));
-                            });
+                            // $scope.clicksub = false;
+                            $timeout(function () {
+                                $scope.closeRechargeModal();
+                            }, 500);
+                            $scope.load(id,dream_user_id,interaction_id);
+                            // courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
+                                
+                            //     homeService.myInfo().then(function (result) {
+                            //         $scope.user = result.data.data;
+                            //     });
+                            // }, function (erro) {
+                            //     // msg.alert("支付反馈失败:" + JSON.stringify(erro));
+                            // });
                         }, function (reason) {
                             $scope.clicksub = false;
                             // msg.alert("支付失败:" + JSON.stringify(reason));

+ 39 - 98
miaomiao/www/js/controllers/my.js

xqd xqd xqd xqd xqd xqd
@@ -223,16 +223,18 @@
                 })
             };
         }]);
-    app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
-
-        }]);
-    app.controller('payDetailCtrl', ["$scope","$ionicTabsDelegate","$ionicHistory", "$state", "myService", "msg","storage"
-        , function ($scope,$ionicTabsDelegate,$ionicHistory, $state,myService, msg, storage) {
+    app.controller('paySuccessCtrl', ["$scope","$stateParams","$ionicTabsDelegate","$ionicHistory", "$state", "myService", "msg","storage"
+        , function ($scope,$stateParams,$ionicTabsDelegate,$ionicHistory, $state,myService, msg, storage) {
+            var item = $stateParams.item;
+            alert(item.out_trade_no);
             $scope.goBack = function(){
                 $ionicHistory.goBack();
             }
         }]);
+    app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
+        , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
+
+        }]);
     app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
         , function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
             $scope.vm={
@@ -397,10 +399,11 @@
                 });
             });
         }]);
-    app.controller('rechargeCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$state", "myService", "msg"
-  , function ($scope,$timeout, $ionicHistory,$ionicTabsDelegate,$state, myService, msg) {
+    app.controller('rechargeCtrl', ["$scope","$ionicModal","$timeout","$ionicHistory","$ionicTabsDelegate", "$state", "myService", "msg"
+  , function ($scope,$ionicModal,$timeout, $ionicHistory,$ionicTabsDelegate,$state, myService, msg) {
         $scope.$on('$ionicView.beforeEnter', function () {
             $ionicTabsDelegate.showBar(false);
+            $scope.vm = {}
             myService.myInfo().then(function(result){
                 $scope.vm = result.data.data;
                 $scope.vm.number = '';
@@ -427,6 +430,23 @@
             // },500)
         });
       };
+      $ionicModal.fromTemplateUrl('paysuccess-modal.html', {
+        scope: $scope,
+        animation: 'slide-in-up'
+      }).then(function(modal) {
+        $scope.modal = modal;
+      });
+      $scope.openModal = function() {
+        $scope.modal.show();
+      };
+      $scope.closeModal = function() {
+        $scope.modal.hide();
+      };
+      //当我们用到模型时,清除它!
+      $scope.$on('$destroy', function() {
+        $scope.modal.remove();
+      });
+
       //充值
       $scope.charge = function(number){
           if (!number) {
@@ -437,6 +457,9 @@
               //todo:result需要返回支付宝或者微信的签名信息
               console.log("result: " + JSON.stringify(result));
               var payInfo = result.data.data;
+              var orderID = payInfo.transaction_id
+              $scope.vm.transaction_id = payInfo.transaction_id;
+              $scope.vm.price = payInfo.price;
               if ($scope.vm.payType == 1) { //支付宝
                   cordova.plugins.AliPay.pay(payInfo, function success(e) {
                       //e.resultStatus  状态代码  e.result  本次操作返回的结果数据 e.memo 提示信息
@@ -472,10 +495,16 @@
               // console.log("result: " + JSON.stringify(params));
                   Wechat.sendPaymentRequest(params, function (r) {
                       $scope.clicksub = false;
-                      courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
+                      // $state.go("app.paySuccess")
+                      // $state.go('app.paySuccess',{item:payInfo})
+                      $scope.openModal();
+                      // alert(orderID);
+                      myService.orderStatus(orderID).then(function (result) {
                           //  alert(result);
                           //支付成功
                         //  $state.go('app.my');
+                        
+
                       }, function (erro) {
                           // msg.alert("支付反馈失败:" + JSON.stringify(erro));
                       });
@@ -491,95 +520,7 @@
       }
 
   }]);
-    app.controller('payCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$timeout","$ionicHistory","$state", "myService", "msg"
-        , function ($scope,$timeout,$ionicHistory,$ionicTabsDelegate, $timeout,$ionicHistory,$state, myService, msg) {
-            $scope.$on('$ionicView.beforeEnter', function () {
-                myService.myInfo().then(function(result){
-                    $scope.vm = result.data.data;
-                    $scope.vm.money = '';
-                    $scope.vm.payType = 2;
-                })
-            });
-            $scope.payExplain = function(){
-                $state.go("app.explain")
-            };
-            $scope.withdraw = function(){
-                $state.go("app.payout")
-            };
-            //充值
-            $scope.testcharge = function(number){
-                if (!number) {
-                    msg.text('请输入充值金额');
-                    return;
-                }
-                myService.testcharge(number,2).then(function (result) {
-                    msg.text("充值成功");
-                    $scope.vm.coin = parseInt($scope.vm.coin) + parseInt(number);
-                    $timeout(function(){
-                        $ionicHistory.goBack();
-                    },500)
-                });
-            }
-            //充值
-            $scope.charge = function(number){
-                if (!number) {
-                    msg.text('请输入充值金额');
-                    return;
-                }
-                myService.charge(number,2).then(function (result) {
-                    //todo:result需要返回支付宝或者微信的签名信息
-                    console.log("result: " + JSON.stringify(result));
-                    var payInfo = result.data;
-                    if ($scope.vm.payType == 1) { //支付宝
-                        cordova.plugins.AliPay.pay(payInfo, function success(e) {
-                            //e.resultStatus  状态代码  e.result  本次操作返回的结果数据 e.memo 提示信息
-                            //e.resultStatus  9000  订单支付成功 ;8000 正在处理中  调用function success
-                            //e.resultStatus  4000  订单支付失败 ;6001  用户中途取消 ;6002 网络连接出错  调用function error
-                            //当e.resultStatus为9000时,请去服务端验证支付结果
-                            $scope.clicksub = false;
-                            if (e.resultStatus == '9000') {
-                                alert(orderID);
-                                //支付成功
-                                // $state.go('app.my');
-                            } else {
-                                msg.error("支付失败");
-                                // msg.error("支付失败:" + JSON.stringify(e));
-                            }
-                        }, function error(e) {
-                            $scope.clicksub = false;
-                            // msg.error("支付失败:" + JSON.stringify(e));
-                            msg.error("支付失败");
-                        });
-                    }
-                    if ($scope.vm.payType == 2) { //微信
-                        var obj = JSON.parse(payInfo);
-                        var params = {
-                            partnerid: obj.partnerid, // merchant id
-                            prepayid: obj.prepayid, // prepay id
-                            noncestr: obj.noncestr, // nonce
-                            timestamp: obj.timestamp, // timestamp
-                            sign: obj.sign, // signed string
-                        };
-                        Wechat.sendPaymentRequest(params, function (r) {
-                            $scope.clicksub = false;
-                            courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
-                                //  alert(result);
-                                //支付成功
-                                //  $state.go('app.my');
-                            }, function (erro) {
-                                msg.alert("支付反馈失败:" + JSON.stringify(erro));
-                            });
-                        }, function (reason) {
-                            $scope.clicksub = false;
-                            msg.alert("支付失败:" + JSON.stringify(reason));
-                        });
-                    }
-                    // msg.text("充值成功");
-                    //   $state.go('app.my');
-                });
-            }
-
-        }]);
+ 
     app.controller('accountCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
         , function ($scope,$ionicTabsDelegate, $state, myService, msg) {
             $scope.$on('$ionicView.beforeEnter', function () {

+ 7 - 0
miaomiao/www/js/services/myservice.js

xqd
@@ -27,6 +27,13 @@
                     data: { number:number,goods:1,type:type}
                 })
             },
+            orderStatus:function(number,type){
+                return $http({
+                    url:config.server + "api/pay/order_status",
+                    method:"post",
+                    data: { number:number,goods:1,type:type}
+                })
+            },
             setting:function(){
                 return $http({
                     url:config.server + "api/my/setting",

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

xqd xqd
@@ -1,7 +1,7 @@
 <ion-view view-title="充值">
     <ion-nav-buttons side="right">
         <button class="button button-clear" ng-click="payExplain()">
-            支付记录
+            交易记录
         </button>
     </ion-nav-buttons>
     <ion-content>
@@ -44,4 +44,27 @@
             </button>
         </div>
     </ion-content>
+
+    <script id="paysuccess-modal.html" type="text/ng-template">
+        <div class="modal">
+            <ion-header-bar class="bar-calm bar bar-header has-tabs-top">
+                <h1 class="title">支付成功</h1>
+                <button class="button button-clear" ng-click="closeModal()">关闭</button>
+            </ion-header-bar>
+            <ion-content style="text-align: center; color: #0A0A0A;">
+                <p style=" margin: 80px auto; ">
+                    <i class="icon ion-checkmark-circled" style="color: #148F2C; font-size: 50px;"></i>
+                </p>
+                <p style="font-size: 22px">
+                    已成功充值{{vm.price}}元!
+                </p>
+                <p style="font-size: 20px;margin-top: 60px">
+                    交易号:{{vm.transaction_id}}
+                </p>
+            </ion-content>
+            <div style="width: 100%; position: fixed; bottom: 0; padding: 60px">
+                <button ng-click="closeModal()" class="button button-block button-calm">确认</button>
+            </div>
+        </div>
+    </script>
 </ion-view>

+ 2 - 2
miaomiao/www/templates/my/payExplain.html

xqd
@@ -1,7 +1,7 @@
-<ion-view view-title="支付记录">
+<ion-view view-title="交易记录">
     <ion-content>
         <div class="list">
-            <a ui-sref="app.payDetail" class="item reply-item" >
+            <a class="item reply-item" >
                 <div class="item" style="height:90px; border-bottom: 2px solid #EFEFEF">
                     <div style="float:left;">
                         <img style="width: 45px; height: 45px;border-radius: 100%; border: 1px solid #D8D8D8" ng-src="{{ user.avatar | avator }}" />

+ 1 - 1
miaomiao/www/templates/my/payDetail.html → miaomiao/www/templates/my/paySuccess.html

xqd
@@ -1,4 +1,4 @@
-<ion-view view-title="支付记录">
+<ion-view view-title="交易记录">
     <ion-content style="text-align: center; color: #0A0A0A;">
         <p style=" margin: 80px auto; ">
             <i class="icon ion-checkmark-circled" style="color: #148F2C; font-size: 50px;"></i>

+ 7 - 7
server/app/Helper/PayHelper.php

xqd xqd
@@ -149,7 +149,7 @@ trait PayHelper
         $order = [
             'body'              => $data['subject'],
             'out_trade_no'      => $data['transaction_id'],
-            'total_fee'         => $data['amount']*100,
+            'total_fee'         => $data['amount'],
             'spbill_create_ip'  => Request::ip(),
             'fee_type'          => 'CNY'
         ];
@@ -163,12 +163,12 @@ trait PayHelper
             if ($profile == 'wechatpay_app' || $profile == 'wechatpay') {
                 $orderString = $response->getAppOrderData();
             }
-            if ($profile == 'wechatpay_native') {
-                $code_url = $response->getCodeUrl();
-                $code_path = public_path('qrcodes/'.$data['code'].'.png');
-                QrCode::format('png')->size(500)->generate($code_url,$code_path);
-                $orderString =  env('APP_URL').'/qrcodes/'.$data['code'].'.png';
-            }
+//            if ($profile == 'wechatpay_native') {
+//                $code_url = $response->getCodeUrl();
+//                $code_path = public_path('qrcodes/'.$data['code'].'.png');
+//                QrCode::format('png')->size(500)->generate($code_url,$code_path);
+//                $orderString =  env('APP_URL').'/qrcodes/'.$data['code'].'.png';
+//            }
             \Log::debug($orderString);
 
             //写订单

+ 72 - 6
server/app/Http/Controllers/Admin/Interaction/InfoController.php

xqd xqd xqd xqd
@@ -16,7 +16,9 @@ class InfoController extends Controller
     public function view(Request $request)
     {
         $dream_id = $request->id;
-        $dream = DreamInfoModel::where('id',$request->id)->with('interactions')->first();
+        $dream = DreamInfoModel::where('id',$request->id)->with(['interactions'=> function ($query) {
+            $query->orderBy('id','desc');
+        }])->first();
         $list = $dream->interactions;
         foreach ($list as $item){
             $comments = CommentInfoModel::where('interaction_id',$item->id)->orderBy('created_at')->get();
@@ -101,6 +103,12 @@ class InfoController extends Controller
             }
         }
         $data->imgs = $arr;
+        if (empty($data->video)) {
+            $data->is_video = 0;
+        }else{
+            $data->is_video = 1;
+
+        }
         return view('admin.interaction.info.edit',compact('data'));
     }
 
@@ -135,16 +143,50 @@ class InfoController extends Controller
             }
 
             $a = array_values($a);
+            $c = -1;
             for ($i = 1; $i <=9; $i++) {
                 if (empty($interaction['pic'.($i)])) {
-                    $c = -1;
                     $c++;
-                    $interaction['pic'.($i)] = getenv('APP_URL').$a[$c];
+                    if (array_key_exists($c,$a)) {
+                        $interaction['pic'.($i)] = getenv('APP_URL').$a[$c];
+                    }
+
                 }
             }
-
         }
-        $ok = InteractionInfo::find(request('id'))->update($interaction);
+        if (!empty(request("file"))) {
+            $file = request("file");
+            $fileSize = $file->getSize();
+            $size =  200 * 1024 * 1024;
+            if ($fileSize > $size) {
+                return back()->with('error','请上传小于200 MB的文件!');
+            }
+            $mimeType = [
+                'video/mp4',
+            ];
+            $fileMimeType = $file->getMimeType();
+            if (!empty($mimeType) && !in_array($fileMimeType, $mimeType)) {
+                return back()->with('error','File type allow MP4!');
+            }
+            if (!$file = VideoUpload::mvFile('file')) return back()->with('error','上传失败');
+            $interaction["video"] = $file;
+        }else{
+//            更新是视频不存在则删除
+            $info = InteractionInfo::find(request('id'));
+            if (is_file('.'.str_replace(getenv('APP_URL'),'',$info->video))) {
+                unlink('.'.str_replace(getenv('APP_URL'),'',$info->video));
+            }
+//            $info->update(['video'=>'']);
+            $info->video = null;
+            $info->save();
+//            dd($info);
+        }
+        if (empty(request("file"))) {
+            $ok = InteractionInfo::find(request('id'))->update($interaction);
+        }else{
+            InteractionInfo::find(request('id'))->update($interaction);
+            $ok=1;
+        }
         if($ok) {
             $url[] = array('url'=>U( 'Interaction/Info/index'),'title'=>'返回列表');
             return $this->showMessage('操作成功',urldecode(request('_referer')));
@@ -159,7 +201,31 @@ class InfoController extends Controller
      */
     public function destroy(Request $reqeust)
     {
-
+        //        删除动态的图片 视频 评论...
+        $data = InteractionInfo::find($reqeust->get('id'));
+        $arr = [];
+        for ($i = 1; $i <=9; $i++) {
+            if (!empty($data['pic'.($i)])) {
+                $arr[] = $data['pic'.($i)];
+            }
+        }
+//        删除图片
+        if (!empty($arr)) {
+            foreach ($arr as $old_pic){
+                if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
+                    unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
+                }
+                BaseAttachmentModel::where('url',$old_pic)->delete();
+            }
+        }
+//        删除视频
+        if (!empty($data->video)) {
+            if (is_file('.'.str_replace(getenv('APP_URL'),'',$data->video))) {
+                unlink('.'.str_replace(getenv('APP_URL'),'',$data->video));
+            }
+        }
+//        删除评论
+        CommentInfoModel::where('interaction_id',$reqeust->get('id'))->delete();
         $ok = InteractionInfo::destroy($reqeust->get('id'));
         if ($ok) {
             return $this->showMessage('操作成功');

+ 9 - 1
server/app/Http/Controllers/Api/V1/AuthController.php

xqd xqd
@@ -114,6 +114,14 @@ class AuthController extends Controller
             $phone_user = UserInfoModel::where('phone',$phone)->first();
             if(!empty($phone_user)){
                 return $this->error(ErrorCode::USER_DOES_EXIST);
+//                if (Auth::attempt(['phone'=>$phone,'password'=>$password])) {
+//                    $user = Auth::user();
+//                    \Log::info($user);
+//                    $token = $user->createToken($user->phone)->accessToken;
+//                    return $this->api(compact( 'user', 'code','token'));
+//                }else{
+//                    return $this->error(ErrorCode::INCORRECT_USER_OR_PASS);
+//                }
             }
         }
         if (empty($user)) {
@@ -310,7 +318,7 @@ class AuthController extends Controller
         $keyexist = $this->keySmsCodeExist . $phone;
         $times = Cache::store('file')->get($keyexist);
 
-        if($times>20) {
+        if($times>40) {
             return $this->error(ErrorCode::VERIFY_CODE_TOO_MUCH);
         }else{
             $times++;

+ 3 - 0
server/app/Http/Controllers/Api/V1/DreamController.php

xqd xqd xqd
@@ -16,6 +16,7 @@ use App\Models\UserCareUser;
 use App\Models\UserInfoModel;
 use Illuminate\Http\Request;
 use App\Services\Base\ErrorCode;
+use Illuminate\Support\Facades\Log;
 
 class DreamController extends Controller
 {
@@ -440,6 +441,7 @@ class DreamController extends Controller
             $dream->mark += $coin*$number;
             $dream->save();
 //            在支持梦想时 如果梦主排名配取代时发送系统消息
+            dd($old_top_user_id);
             $this->systemInfo($dream->id,$user->id,$old_top_user_id);
 
 
@@ -546,6 +548,7 @@ class DreamController extends Controller
         }else{
             $top_user_id = $old_top_user_id;
         }
+        Log::info('-----------'.$top_user_id.'-----------'.$old_top_user_id.'-----------');
         if ($top_user_id != $old_top_user_id) {   //新的最大支持者不是以前的最大支持者时
             $arr = [
                 'user_id'=>0,

+ 3 - 0
server/app/Http/Controllers/Api/V1/MyController.php

xqd xqd xqd
@@ -264,6 +264,7 @@ class MyController extends Controller
             if (count($data1) >= 5) {
                 $data1[0]['message'] = "已经有".count($data1)."个人支持了你的梦想!";
                 $data2[0]['is_url'] = 1;
+                $data2[0]['is_reply'] = 0;
                 $new_data1[] = $data1[0];
             }else{
                 $new_data1 = $data1;
@@ -275,6 +276,7 @@ class MyController extends Controller
             if (count($data2) >= 5) {
                 $data2[0]['message'] = "已经有".count($data2)."个人收藏了你的梦想!";
                 $data2[0]['is_url'] = 1;
+                $data2[0]['is_reply'] = 0;
                 $new_data2[] = $data2[0];
             }else{
                 $new_data2 = $data2;
@@ -286,6 +288,7 @@ class MyController extends Controller
             if (count($data3) >= 5) {
                 $data3[0]['message'] = "你的互动已经有".count($data3)."个留言啦!快点击看看!";
                 $data2[0]['is_url'] = 1;
+                $data2[0]['is_reply'] = 0;
                 $new_data3[] = $data3[0];
             }else{
                 $new_data3 = $data3;

+ 91 - 4
server/app/Http/Controllers/Api/V1/PayController.php

xqd xqd xqd
@@ -167,9 +167,9 @@ class PayController extends Controller
                     $order->save();
 
                     //记日志
-//                    $this->logAccount($tp, $u->id, $u->name,
-//                        AccountLog::OP_CHARGE, $cType, $master_amount,
-//                        AccountLog::DIRECTION_INC, $cType == AccountLog::TYPE_BALANCE ? $u->balance : $u->credit, AccountLog::CHANNEL_WECHATPAY);
+                    $this->logAccount($tp, $u->id, $u->name,
+                        AccountLog::OP_CHARGE, $cType, $master_amount,
+                        AccountLog::DIRECTION_INC, $cType == AccountLog::TYPE_BALANCE ? $u->balance : $u->credit, AccountLog::CHANNEL_WECHATPAY);
 
                     \Log::info('支付完成');
 
@@ -199,7 +199,7 @@ class PayController extends Controller
     /**
      * @api {post} /api/pay/charge 充值
      * @apiDescription 充值(向平台充值)
-     * @apiGroup Merchant
+     * @apiGroup User
      * @apiPermission Passport
      * @apiVersion 0.1.0
      * @apiParam {int}  [goods=1]   充值商品(1:梦想币)
@@ -289,4 +289,91 @@ class PayController extends Controller
         return $this->api($result);
     }
 
+
+
+    /**
+     * @api {post} /api/pay/order_status 订单状态查询
+     * @apiDescription 订单状态查询
+     * @apiGroup User
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiParam {int}  [goods=1]   充值商品(1:梦想币)
+     * @apiParam {int}  number      充值数量,人民币,以分表示
+     * @apiParam {int}  type        支付类型(1:支付宝,2:微信支付)
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "state": true,
+     *     "code": 0,
+     *     "message": "",
+     *     "data": {
+     *         "id": 2,
+     *         "code": "ALIPAY_201610231314145719",
+     *         "transaction_id": "201610231314145719",
+     *         "user_type": 2,
+     *         "user_id": 1,
+     *         "goods_type": 1,
+     *         "price": 1,
+     *         "number": 1,
+     *         "amount": 1,
+     *         "pay_type": 1,
+     *         "status": 0,
+     *         "created_at": "2016-10-23 13:14:14",
+     *         "updated_at": "2016-10-23 13:14:14",
+     *         "orderString": "alipay_sdk=lokielse%2Fomnipay-alipay&app_id=2016091201894867&biz_content=%7B%22subject%22%3A%22%5Cu7532%5Cu8c61%5Cu8054%5Cu5408-%5Cu4f59%5Cu989d%5Cu5145%5Cu503c%22%2C%22out_trade_no%22%3A%22201610231314145719%22%2C%22total_amount%22%3A0.01%2C%22product_code%22%3A1%7D&charset=UTF-8&format=JSON&method=alipay.trade.app.pay&notify_url=http%3A%2F%2Fweb%2Fapi%2Fpay%2Falipay%2Fnotify&sign_type=RSA&timestamp=2016-10-23+13%3A14%3A14&version=1.0&sign=oxKM0qGMHLWDlMrXHIiy9%2Fk2BXJq3rC3RKdmcfFwkBJVRXvtG6cBoAYPll6VxJYOMQWeu78Ibfov%2FxIVCuN9yUfzEiokfQrzBoptc94bCQ5k0pNyJcSdgezOUKHB12P5Zmm3Hd6AAbGRDV9UCaLVz0wYkFJPrCyUv1ZfhrM%2BBqc%3D"
+     *     }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     * 1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+
+    public function orderStatus(Request $request)
+    {
+
+        $validator = Validator::make($data = $request->all(),
+            [
+                'number' => 'required|integer|min:1',
+                'type' => 'required|in:' . join(',', $pTypes),
+                'goods' => 'in:' . join(',', $gTypes),
+            ],
+            [
+                'number.required' => '请输入梦想币数量',
+                'number.integer' => '梦想币数量必须为整数',
+                'number.min' => '充值梦想币数量至少为1',
+                'type.required' => '支付类型必填',
+                'type.in' => '支付类型非法',
+                'goods.in' => '充值商品非法',
+            ]
+        );
+
+        if ($validator->fails()) {
+            return $this->validatorError($validator->messages()->all(), ErrorCode::CLIENT_WRONG_PARAMS);
+        }
+        $order = new OrderInfoModel();
+        $order->code            = $data['code'];
+        $order->transaction_id  = $data['transaction_id'];
+        $order->user_id         = $data['user_id'];
+        $order->goods_id        = $data['goods_id'];
+        $order->price           = $data['price'];
+        $order->number          = $data['number'];
+        $order->amount          = $data['amount'];
+        $order->pay_type        = $data['pay_type'];
+        if (isset($data['ext_info'])) {
+            $order->ext_info = $data['ext_info'];
+        }
+
+        if ($order->save()) {
+            return $order->find($order->id);
+        }
+        return false;
+    }
+
 }

+ 2 - 0
server/app/Models/AccountLog.php

xqd xqd
@@ -21,6 +21,7 @@ class AccountLog extends Model
     const OP_CHARGE         = 'CHARGE';
     const OP_SUPPORT        = 'SUPPORT';
     const OP_WITHDRAW       = 'WITHDRAW';
+    const OP_DREAM          = 'DREAM';
 
     //货币类型定义
     const TYPE_BALANCE      = 1;
@@ -41,6 +42,7 @@ class AccountLog extends Model
         self::OP_CHARGE         => '充值',
         self::OP_SUPPORT        => '支持梦想',
         self::OP_WITHDRAW       => '提现',
+        self::OP_DREAM          => '梦想结束',
     ];
 
     //货币类型枚举

+ 6 - 2
server/database/migrations/2017_04_02_113151_create_account_logs_table.php

xqd
@@ -22,15 +22,19 @@ class CreateAccountLogsTable extends Migration
             $table->string('from_type', 20)->comment('操作类型,1、余额,2、梦想币,3、现金');
             $table->unsignedInteger('from_id')->comment('来源对象id');
             $table->string('from_name', 100)->nullable()->comment('来源对象名称');
-            $table->string('op', 20)->comment('操作,charge:冲值,support:消耗,withdraw:提现');
+            $table->string('op', 20)->comment('操作,charge:冲值,support:消耗,withdraw:提现,dream:梦想结束');
             $table->unsignedInteger('from_amount')->comment('操作金额from');
             $table->string('to_type', 20)->comment('操作类型,1、余额,2、梦想币,3、现金');
             $table->unsignedInteger('to_id')->comment('目标对象id');
             $table->string('to_name', 100)->nullable()->comment('来源目标对象名称');
             $table->unsignedInteger('to_amount')->comment('操作金额to');
             $table->string('channel', 50)->nullable()->comment('交易渠道,支付宝/微信/平台内等');
+            $table->string('avatar', 255)->nullable()->comment('头像');
+            $table->string('transaction_id', 255)->nullable()->comment('交易流水号');
             $table->string('note', 255)->nullable()->comment('备注');
-            $table->nullableTimestamps();
+
+            $table->timestamps();
+            $table->softDeletes();
 
             $table->index(['from_id'], 'idx_from');
             $table->index(['to_id'], 'idx_to');

+ 2 - 2
server/resources/views/admin/interaction/info/edit.blade.php

xqd xqd
@@ -64,7 +64,7 @@
                                             @endif>
                                         <label class="control-label col-sm-3" >&nbsp;</label>
                                         <div class="col-sm-9" style="width: 50%;height: 50%">
-                                            <video style="width: 300px" src="{{ $data['video'] or ''}}" poster="{{ $data['poster'] or ''}}" controls >
+                                            <video style="width: 300px" src="{{ $data['video'] or ''}}" controls >
                                             </video>
                                         </div>
                                     </div>
@@ -115,7 +115,7 @@
 @endsection
 @section('footer')
     <script>
-        if ($('input:radio[name="data[type_id]"]:checked').val() == 1) {
+        if ($('input:radio[name="data[is_video]"]:checked').val() == 1) {
             $('#is_video').show();
             $('#data_media').hide();
         }else{

+ 6 - 0
server/routes/api.php

xqd
@@ -306,4 +306,10 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'uses' => 'PayController@charge',
     ]);
 
+    //商户充值
+    $api->get('pay/order_status', [
+        'as' => 'pay.order_status',
+        'uses' => 'PayController@orderStatus',
+    ]);
+
 });