YanaDH 7 年之前
父节点
当前提交
758f72aa6e

二进制
.vs/miaomiao/v14/.suo


二进制
miaomiao/bin/Android/Debug/android-debug.apk


+ 2 - 1
miaomiao/config.xml

xqd xqd
@@ -1,5 +1,5 @@
 <?xml version='1.0' encoding='utf-8'?>
-<widget id="com.miaomiao.app" version="0.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+<widget id="com.miaomiao.app" version="0.1.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
     <name>瞄喵</name>
     <description>
         An Ionic Framework and Cordova project.
@@ -28,6 +28,7 @@
         <param name="ios-package" onload="true" value="CDVStatusBar" />
     </feature>
     <platform name="ios">
+        <icon height="1024" width="1024" src="resources/icon.png" width="1024"/>
         <icon height="57" src="resources/ios/icon/icon.png" width="57" />
         <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
         <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />

+ 0 - 0
miaomiao/resources/icon.png → miaomiao/resources/icon-1024.png


+ 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'));

+ 8 - 2
miaomiao/www/js/controllers/account.js

xqd xqd
@@ -1,12 +1,14 @@
 (function (app) {
-    app.controller('wechatLoginCtrl', ["$scope","userService","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","common",
-    function ($scope,userService,$ionicNavBarDelegate, storage, $state, msg, $http, util,common) {
+    app.controller('wechatLoginCtrl', ["$scope","userService","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","common","config",
+    function ($scope, userService, $ionicNavBarDelegate, storage, $state, msg, $http, util, common, config) {
             //$ionicNavBarDelegate.showBackButton(false);
             $scope.addvideo = function () {
                 common.chooseVideo().then(function (file) {
                     msg.loading();
                     common.uploadFiles(file, 2).then(function (result) {
                         msg.hide();
+                        alert(result.respons);
+                        console.log(result.respons);
                         var response = JSON.parse(result.response);
                         $scope.video.server = response.data.file;
                         var file = config.imgServer + response.data.file;
@@ -65,6 +67,10 @@
                                       $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
                                       $scope.user=storage.getObject('user');
                                       $state.go('app.home');
+                                      if(localStorage['jpush']){
+                                        console.log("jpush: " + localStorage['jpush']);
+                                        userService.jpush({ jpush: localStorage['jpush']}).then(function (result) {}, function (erro) {});
+                                      }
                                   }else{
                                       $state.go("loginAccount",{wechat:result.data.data.openid})
                                   }

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

xqd
@@ -33,7 +33,7 @@
                         //console.log("vpic:"+$scope.video.vpic);
                     }, function (error) {
                         msg.hide();
-                        // msg.error('视频上传失败');
+                        msg.error(JSON.stringify(error));
                     });
                 }, function (erro) {
                     console.log('选择视频失败');

+ 15 - 15
miaomiao/www/js/controllers/home.js

xqd xqd xqd xqd xqd
@@ -258,6 +258,8 @@
             $scope.$on('$ionicView.afterLeave', function () {
                 clearInterval(timerID);
                 timerID = null;
+                if($scope.multi.promise)$interval.cancel($scope.multi.promise);
+                if($scope.leftTimer)$interval.cancel($scope.leftTimer);
             });
             $scope.$on('$ionicView.beforeEnter', function () {
                 $scope.step = storage.getObject('user').step;
@@ -311,10 +313,7 @@
                     //msg.error(msg.data.error)
                 })
             };
-            $scope.$on('$ionicView.leave', function () {
-                if($scope.multi.promise)$interval.cancel($scope.multi.promise);
-                if($scope.leftTimer)$interval.cancel($scope.leftTimer);
-            });
+            
             $scope.toSort = function(){
                 //$scope.type = 3;
                 $scope.changeType(3)
@@ -559,7 +558,7 @@
                 id:id,
                 title:$scope.vm.title,
                 pics:$scope.imgs,
-                video:$scope.video.file
+                video:$scope.video.server
             };
             homeService.add_interaction(data).then(function(){
                 $scope.load(id);
@@ -567,22 +566,22 @@
             })
         };
 
-            $scope.showAbout = true;
-            $scope.hideAbout = false;
-            $scope.showText = function(){
+        $scope.showAbout = true;
+        $scope.hideAbout = false;
+        $scope.showText = function(){
             $scope.aboutStyle = {
                 "white-space" : "normal"
               };
             $scope.showAbout = false;
             $scope.hideAbout = true;
         };
-            $scope.hideText = function(){
-                $scope.aboutStyle = {
-                    "white-space" : "nowrap"
-                };
-                $scope.showAbout = true;
-                $scope.hideAbout = false;
+        $scope.hideText = function(){
+            $scope.aboutStyle = {
+                "white-space" : "nowrap"
             };
+            $scope.showAbout = true;
+            $scope.hideAbout = false;
+        };
         $scope.input = {
             placeholder: '评论',
             focus: false,
@@ -794,11 +793,12 @@
                         $scope.video.server = response.data.file;
                         var file = config.imgServer+response.data.file;
                         $scope.video.isOK = true;
-                        $scope.video.file = response.data.file;
+                        $scope.video.file = file;
                         $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
                     }, function (error) {
                         //msg.error('视频上传失败');
                         msg.hide();
+                        msg.error(JSON.stringify(error));
                     });
                 }, function (erro) {
                     console.log('选择视频失败');

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

xqd
@@ -770,6 +770,7 @@
                     }, function (error) {
                         //msg.error('视频上传失败');
                         msg.hide();
+                        msg.error(JSON.stringify(error));
                     });
                 }, function (erro) {
                     console.log('选择视频失败');

+ 15 - 2
miaomiao/www/js/services/commonservice.js

xqd xqd
@@ -140,10 +140,19 @@
                         }
                         VideoEditor.transcodeVideo(
                                   function (res) {
+                                      msg.loading();
+                                      ft.onprogress = function (progressEvent) {
+                                          if (progressEvent.lengthComputable) {
+                                              var per = (progressEvent.loaded / progressEvent.total) * 100;
+                                              msg.text('上传:' + Math.floor(per) + '%');
+                                          }
+                                      };
                                       ft.upload(res, encodeURI(config.server + "api/attachment/upload"), function (sucess) {
+                                        msg.hide();
                                           deferred.resolve(sucess);
                                           //  alert('上传成功' + JSON.stringify(sucess));
                                       }, function (fail) {
+                                        msg.hide();
                                           deferred.reject(fail);
                                           //alert('上传失败' + JSON.stringify(fail));
                                       }, uploadOptions);
@@ -161,12 +170,16 @@
                                       width: 1280,
                                       height: 720,
                                       fps: 30,
-                                      videoBitrate: 1000000, // 1 megabit
+                                      videoBitrate: 2000000, // 1 megabit
                                       audioChannels: 2,
                                       audioSampleRate: 44100,
                                       audioBitrate: 128000, // 128 kilobits
                                       progress: function (info) {
-                                         
+                                        var f=parseFloat(info)*100;
+                                        if(cordova.platformId === 'ios'){
+                                           var f=info; 
+                                        }
+                                        msg.text('压缩:'+Math.floor(f) + '%');
                                       }
                                   }
                               );

+ 3 - 3
miaomiao/www/js/services/msgservice.js

xqd
@@ -37,9 +37,9 @@
                     template: '<ion-spinner class="nerve-loading"></ion-spinner>'
                 });
                 //超时退出
-                setTimeout(function() {
-                    $ionicLoading.hide();
-                }, 11000);
+                // setTimeout(function() {
+                //     $ionicLoading.hide();
+                // }, 11000);
             },
             alert: function (title, template) {
                 var o = {

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

xqd
@@ -27,6 +27,13 @@
                     method: "get",
                 })
             },
+            jpush:function (data) {
+                return $http({
+                    url: config.server + 'api/user/jpush',
+                    method: "post",
+                    data: data
+                })
+            },
             isLogin: function () {
              return !util.empty(storage.get("token")) && storage.getObject("user");
             }

+ 2 - 2
server/app/Console/Commands/DreamDJS.php

xqd xqd
@@ -70,7 +70,7 @@ class DreamDJS extends Command
 
                 $dream_user = $item->user;
                 if (!empty($dream_user)) {
-                    $img = $item->img;  //梦想图片
+                   /* $img = $item->img;  //梦想图片
                     $arr = [
                         'from_type'=>'梦想币',
                         'from_id'=>$dream_user->id,
@@ -90,7 +90,7 @@ class DreamDJS extends Command
                     if (empty($exist)) {
 //                        AccountLog::firstOrCreate($arr);
                         AccountLog::create($arr);
-                    }
+                    }*/
 
 
 

+ 1 - 1
server/app/Helper/AttachmentHelper.php

xqd
@@ -20,7 +20,7 @@ trait AttachmentHelper
      * @param array $mimeType   文件mime类型限制,默认不限
      * @return array|string|int 返回:md5字串|ErrorCode或[md5字串|ErrorCode]
      */
-    public function uploadAttachment(Request $request, $key, $tag = 'files', $size = 10 * 1024 * 1024, array $mimeType = []) {
+    public function uploadAttachment(Request $request, $key, $tag = 'files', $size = 200 * 1024 * 1024, array $mimeType = []) {
         if ($request->hasFile($key)) {
             $rel_path = '/upload/' . $tag . '/' . date('Ymd');
             $path = public_path() . $rel_path;

+ 2 - 2
server/app/Helper/JpushHelper.php

xqd
@@ -17,9 +17,9 @@ trait JpushHelper
 //        $push->content = $content;
 //        $push->user_id = $userid;
 //        $res=$push->save();
-        if($userid){
+//        if($userid){
             $user = UserInfoModel::find($userid);
-        }
+//        }
         if($user&&$user->jpush){
             $regId = array($user->jpush);
             $options = array(

+ 1 - 1
server/app/Http/Controllers/Admin/Dream/InfoController.php

xqd
@@ -287,7 +287,7 @@ class InfoController extends Controller
             SystemInfoModel::create($info);
 
 //            长连接
-//            $this->jPush($message,'',$data['user_id']);
+            $this->jPush($message,'',$data['user_id']);
         }
         if($ok) {
             $url[] = array('url'=>U( 'Dream/Info/index'),'title'=>'返回列表');

+ 6 - 1
server/app/Http/Controllers/Admin/System/InfoController.php

xqd xqd
@@ -14,10 +14,13 @@ use Illuminate\Http\Request;
 use App\Repositories\Base\Criteria\OrderBy;
 use App\Repositories\System\Criteria\MultiWhere;
 use App\Repositories\System\InfoRepository;
+use App\Helper\JpushHelper;
+
 
 class InfoController extends Controller
 {
     private $repository;
+    use JpushHelper;
 
     public function __construct(InfoRepository $repository) {
         if(!$this->repository) $this->repository = $repository;
@@ -163,11 +166,13 @@ class InfoController extends Controller
         $arr = [] ;
         foreach ($users as $user) {
             $arr[] = [
-                'user_id' =>$user['id'],
+                'user_id' =>0,
+                'to_user_id' =>$user['id'],
                 'message' =>$message,
                 'created_at'=>date("Y-m-d H:i:s"),
                 'updated_at'=>date("Y-m-d H:i:s"),
             ];
+            $this->jPush($message,'',$user['id']);
         }
         $ok = SystemInfoModel::insert($arr);
         if ($ok) {

+ 4 - 1
server/app/Http/Controllers/Admin/User/Cash/OutController.php

xqd xqd
@@ -16,11 +16,13 @@ use Illuminate\Http\Request;
 use App\Repositories\Base\Criteria\OrderBy;
 use App\Repositories\User\Cash\Criteria\MultiWhere;
 use App\Repositories\User\Cash\OutRepository;
+use App\Helper\JpushHelper;
+
 
 class OutController extends Controller
 {
     private $repository;
-
+    use JpushHelper;
     public function __construct(OutRepository $repository) {
         if(!$this->repository) $this->repository = $repository;
     }
@@ -127,6 +129,7 @@ class OutController extends Controller
                     }
                 }
                 $message = '你提现的¥'.$data['cash'].'已经到账啦,去实现梦想吧!喵~';
+                $this->jPush($message,'',$data['user_id']);
             }
             $arr = [
                 'type_id'=>1,

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

xqd
@@ -101,7 +101,7 @@ class AttachmentController extends Controller
         }
 
         \Log::info($request);
-        $result = $this->uploadAttachment($request, $request->get('file'), $request->get('tag'), 50 * 1024 * 1024, [
+        $result = $this->uploadAttachment($request, $request->get('file'), $request->get('tag'), 200 * 1024 * 1024, [
             'image/jpeg',
             'image/png',
             'image/gif',

+ 7 - 2
server/app/Http/Controllers/Api/V1/DreamController.php

xqd xqd xqd xqd
@@ -535,7 +535,8 @@ class DreamController extends Controller
             SystemInfoModel::create($info);
 
 //            长连接
-//            $this->jPush($message,'',$user_id);
+            $mess ="{$nickname}为你《".$dream->name.'》支持了'.$coin.'梦想币';
+            $this->jPush($mess,'',$user_id);
 
 //            支持成功返回数据到当前页面   top3user
             $support_dream = SupportDreamModel::where('dream_id',$dream_id)->get();
@@ -594,6 +595,8 @@ class DreamController extends Controller
                 'attr_id'=>10,
             ];
             SystemInfoModel::create($arr);
+            $mess = "你已不是《".$dream->name."》的《梦主》啦!"."[$user->nickname] "."以$new_arr[0]分刚取代你的位置";
+            $this->jPush($mess,'',$old_top_user_id);
         }
     }
 
@@ -661,6 +664,7 @@ class DreamController extends Controller
             //                关注成功发送私信
             $message = BaseSettingsModel::where('category','message')->first();
             $message = empty($message) ? ""."<span style='color: #00c3da'>[$user->nickname]</span> 收藏了你的梦想《".$dream->name.'》' : $message->value;
+            $this->jPush($message,'',$dream->user_id);
             $info2 = [
                 'to_user_id' => $dream->user_id,
                 'message' => $message,
@@ -672,7 +676,8 @@ class DreamController extends Controller
             ];
             SystemInfoModel::firstOrCreate($info2);
             //            长连接
-//            $this->jPush($message,'',$dream->user_id);
+            $mess = $user->nickname."收藏了你的梦想《".$dream->name.">";
+            $this->jPush($mess,'',$dream->user_id);
         }else{
             UserCareDream::where('user_id',$user->id)->
             where('dream_id',$request->id)->delete();

+ 2 - 2
server/app/Http/Controllers/Api/V1/HomeController.php

xqd
@@ -230,8 +230,8 @@ class HomeController extends Controller
             }
             $arr[$k] = $score;
         }
-        $sup_id= iconv('UTF-8', 'GBK', array_search(max($arr),$arr));
-
+        if (!empty($arr)) $sup_id= iconv('UTF-8', 'GBK', array_search(max($arr),$arr));
+        else  $sup_id = 0;
         if ($user->id != $sup_id) return $this->error(ErrorCode::SUP_ERROR);
 //        见面成功写入数据记录
         $data = [

+ 3 - 4
server/app/Http/Controllers/Api/V1/InteractionController.php

xqd xqd
@@ -161,7 +161,7 @@ class InteractionController extends Controller
         $content = $request->content;
         $is_read = 1;
         $data = compact('user_id','user_avatar','user_nickname','interaction_id','content','is_read');*/
-
+        $toid = $request->input('to_user_id');
         $dream_id = InteractionInfo::find($request->id)->dream_id;
 //        $data['to_user_avatar'] = InteractionInfo::find($request->id)->dream->user_avatar;
 //        $data['to_user_nickname'] = InteractionInfo::find($request->id)->dream->user_nickname;
@@ -183,11 +183,10 @@ class InteractionController extends Controller
                     'interaction_id' => $request->input('id'),
                 ];
                 SystemInfoModel::create($info);
-
-//            长连接
-                $this->jPush($message,'',$data['to_user_id']);
             }
         }
+        $this->jPush($user->nickname."在你的互动上留言啦!点击去看看",'',$toid);
+
         if (!empty($request->input('u_id'))) {
             $message = ""."<span style='color: #00c3da'>[$user->nickname]</span> ".'提起了你哦~点击看看!';
             $info = [

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

xqd
@@ -202,6 +202,24 @@ class MyController extends Controller
         }
     }
 
+    /**
+     * 极光推送接口
+     * @param Request $request
+     * @return mixed
+     */
+    public function jpush(Request $request)
+    {
+        $user = $this->getUser();
+        $data = $request->except('_token');
+        $ok =  $user->update($data);
+        if ($ok == true) {
+            return $this->api('');
+        }else{
+            return $this->error(ErrorCode::SAVE_USER_FAILED);
+        }
+    }
+
+
     /**
      * @api {post} /api/my/recharge 充值
      * @apiDescription 充值

+ 1 - 1
server/app/Services/Base/Attachment.php

xqd
@@ -138,7 +138,7 @@ class Attachment
      */
 
 
-    public function localUpload($field, $request, $tag = 'files', $size = 2 * 1024 * 1024, array $mimeType = ['image/jpeg', 'image/png', 'image/gif']) {
+    public function localUpload($field, $request, $tag = 'files', $size = 200 * 1024 * 1024, array $mimeType = ['image/jpeg', 'image/png', 'image/gif']) {
         $tag = $request['folder'];
         $rel_path = $tag . '/' . date('Ymd');
         $path = public_path() . $rel_path;

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

xqd
@@ -278,7 +278,7 @@
 <body>
 <div style="height: 50px">
     <a href="https://fir.im/jt4h" 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: 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="">
         </div>

+ 5 - 1
server/routes/api.php

xqd
@@ -296,7 +296,11 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'interaction.destroy',
         'uses' => 'InteractionController@destroy',
     ]);
-
+    //jpush
+    $api->post('user/jpush', [
+        'as' => 'user.jpush',
+        'uses' => 'MyController@jpush',
+    ]);
     //支付宝支付回调
     $api->post('pay/alipay/notify', [
         'as' => 'pay.alipay.notify',