فهرست منبع

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

YanaDH 7 سال پیش
والد
کامیت
b6453e93f0
33فایلهای تغییر یافته به همراه710 افزوده شده و 179 حذف شده
  1. 1 1
      miaomiao/www/chcp.json
  2. 34 14
      miaomiao/www/chcp.manifest
  3. 23 19
      miaomiao/www/js/controllers/account.js
  4. 41 46
      miaomiao/www/js/controllers/my.js
  5. 1 1
      miaomiao/www/js/services/httpinterceptor.js
  6. 4 3
      miaomiao/www/js/services/myservice.js
  7. 3 4
      miaomiao/www/js/services/userservice.js
  8. 1 2
      miaomiao/www/templates/account/login.html
  9. 5 5
      miaomiao/www/templates/my/my-recharge.html
  10. 198 0
      server/app/Helper/PayHelper.php
  11. 23 0
      server/app/Http/Controllers/Admin/Share/InfoController.php
  12. 8 3
      server/app/Http/Controllers/Api/V1/AuthController.php
  13. 2 2
      server/app/Http/Controllers/Api/V1/Controller.php
  14. 1 6
      server/app/Http/Controllers/Api/V1/DreamController.php
  15. 2 1
      server/app/Http/Controllers/Api/V1/IndexController.php
  16. 3 0
      server/app/Http/Controllers/Api/V1/InteractionController.php
  17. 20 68
      server/app/Http/Controllers/Api/V1/PayController.php
  18. 1 0
      server/app/Models/InteractionInfo.php
  19. 66 0
      server/app/Models/OrderInfoModel.php
  20. 1 1
      server/app/Models/UserInfoModel.php
  21. 2 1
      server/app/Services/Base/ErrorCode.php
  22. 4 0
      server/composer.json
  23. 3 0
      server/config/app.php
  24. 56 0
      server/config/laravel-omnipay.php
  25. 26 0
      server/config/wechat_pay/apiclient_cert.pem
  26. 28 0
      server/config/wechat_pay/apiclient_key.pem
  27. 52 0
      server/database/migrations/2017_05_30_113210_create_orders_table.php
  28. 32 0
      server/database/migrations/2017_08_29_180011_add_video_to_interaction_info_table.php
  29. 1 0
      server/public/base/img/down.svg
  30. 1 0
      server/public/base/img/up.svg
  31. 60 0
      server/resources/views/admin/share.blade.php
  32. 4 1
      server/routes/admin.php
  33. 3 1
      server/routes/api.php

+ 1 - 1
miaomiao/www/chcp.json

xqd
@@ -1,5 +1,5 @@
 {
   "update": "now",
   "content_url": "http://i.9026.com/miaomiao",
-  "release": "2017.08.24-18.40.21"
+  "release": "2017.08.28-18.17.55"
 }

+ 34 - 14
miaomiao/www/chcp.manifest

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -13,7 +13,7 @@
   },
   {
     "file": ".idea/workspace.xml",
-    "hash": "210b8584491c81a232e780073afb48c4"
+    "hash": "f8fbc73e7836d0d9dcd0f64e832b8e1f"
   },
   {
     "file": ".idea/www.iml",
@@ -29,7 +29,7 @@
   },
   {
     "file": "css/style.css",
-    "hash": "31b444c02568e09999f96319c1e0c401"
+    "hash": "d122efc072fbd75047590e193a9d603a"
   },
   {
     "file": "img/alipay.png",
@@ -235,6 +235,14 @@
     "file": "img/icon_login.svg",
     "hash": "6fba134229a619ae1fa3238f281326e6"
   },
+  {
+    "file": "img/icon_man_h.svg",
+    "hash": "06f2d108ed01aa834e79c17048ff1756"
+  },
+  {
+    "file": "img/icon_man_n.svg",
+    "hash": "6dc44d426f5063a2b2a84d27de0fa8b8"
+  },
   {
     "file": "img/icon_me_h.svg",
     "hash": "bbe62c82366c43f407904e44f056b700"
@@ -267,6 +275,10 @@
     "file": "img/icon_mymessage.svg",
     "hash": "b9b67323fb1a78b2def9cbe0f7455ff1"
   },
+  {
+    "file": "img/icon_ok.svg",
+    "hash": "1d9d230b9aa221031c0ce8fbcb44cd5b"
+  },
   {
     "file": "img/icon_photo.svg",
     "hash": "b0d69756e3e68aa931c6db9459c02808"
@@ -307,6 +319,14 @@
     "file": "img/icon_weibo.svg",
     "hash": "e28527e5a3e7203e8b99aa1bbe64e4d0"
   },
+  {
+    "file": "img/icon_woman_h.svg",
+    "hash": "084e6b4a0e6fa0590ff707d7e3f9b767"
+  },
+  {
+    "file": "img/icon_woman_n.svg",
+    "hash": "ba6973e442f2325984c019268d15b320"
+  },
   {
     "file": "img/image.png",
     "hash": "bfd00daa47f311d54bd790e521f22671"
@@ -373,7 +393,7 @@
   },
   {
     "file": "js/config/config.js",
-    "hash": "8f4884a65c00024ae26f0202ed33cb3a"
+    "hash": "2912f063f9c6351bd7e3b88951b73c84"
   },
   {
     "file": "js/config/router.js",
@@ -381,7 +401,7 @@
   },
   {
     "file": "js/controllers/account.js",
-    "hash": "66b3cf6b86a8768db44c4a8999c00cf9"
+    "hash": "6146403bc7cd12c82e98c4b215bfece5"
   },
   {
     "file": "js/controllers/add.js",
@@ -389,11 +409,11 @@
   },
   {
     "file": "js/controllers/home.js",
-    "hash": "d26d0c77be3f7f68014fb49af5af1731"
+    "hash": "9562ec274dff28576297d96970d3a566"
   },
   {
     "file": "js/controllers/my.js",
-    "hash": "aa1f6f5f801802075c3af039588eac13"
+    "hash": "080ffa833f483b9f3719c7adce29edd4"
   },
   {
     "file": "js/controllers/tabs.js",
@@ -405,7 +425,7 @@
   },
   {
     "file": "js/filters/filter.js",
-    "hash": "1d8e1b2e57bc381c3e8bb48aa0f4e5f2"
+    "hash": "e65502153a2711717677ef7899d8c4b0"
   },
   {
     "file": "js/platformOverrides.js",
@@ -445,7 +465,7 @@
   },
   {
     "file": "js/services/userservice.js",
-    "hash": "133aeffa93550f16a20a238935e1ba5e"
+    "hash": "32f8718adf3b661502a52e5dd398843b"
   },
   {
     "file": "js/services/utilservice.js",
@@ -725,11 +745,11 @@
   },
   {
     "file": "templates/account/login.html",
-    "hash": "12230625b514919df06b4aad59bcb310"
+    "hash": "c7567c4be58e2221bd5a6c91f4b62066"
   },
   {
     "file": "templates/account/loginAccount.html",
-    "hash": "c42b621513548233e6d9e2e552420663"
+    "hash": "917519c0d9d0a9aa86d17660eb91c354"
   },
   {
     "file": "templates/add/addExplain.html",
@@ -741,11 +761,11 @@
   },
   {
     "file": "templates/home/dream-detail.html",
-    "hash": "6842b9976094aab85e99f52f62ccdce2"
+    "hash": "a259875e360d2c792baed20c01917d7c"
   },
   {
     "file": "templates/home/index.html",
-    "hash": "05e7de1aeb3097a3af063ef606554945"
+    "hash": "c9466f12e7d16ebca25acdb4ffa5e8ed"
   },
   {
     "file": "templates/home/oldDream.html",
@@ -797,7 +817,7 @@
   },
   {
     "file": "templates/my/my-dream.html",
-    "hash": "e2e3ca673469c30dfb5bad01f9a19a23"
+    "hash": "1934bf569df975f6cd65a81c32b569ae"
   },
   {
     "file": "templates/my/my-message-reply.html",
@@ -813,7 +833,7 @@
   },
   {
     "file": "templates/my/my-profile.html",
-    "hash": "d8bc358da36911ba43f35a8c4239170c"
+    "hash": "0f3f4a8933172a2d9bee6ad6600d593d"
   },
   {
     "file": "templates/my/my-recharge.html",

+ 23 - 19
miaomiao/www/js/controllers/account.js

xqd
@@ -1,37 +1,41 @@
 (function (app) {
-    app.controller('wechatLoginCtrl', ["$scope","$timeout", "userService","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","$timeout",
-        function ($scope,$timeout, userService,$ionicNavBarDelegate, storage, $state, msg, $http, util, $timeout) {
+    app.controller('wechatLoginCtrl', ["$scope","userService","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util",
+        function ($scope,userService,$ionicNavBarDelegate, storage, $state, msg, $http, util) {
              //$ionicNavBarDelegate.showBackButton(false);
-            $scope.loginbywx = function(){
+            $scope.wechat_login = function(){
                 var scope = "snsapi_userinfo", state = "_" + (+new Date());
-                Wechat.auth(scope, state, function (response) {
-                    alert("response:"+JSON.stringify(response.code));
-                     //response.code;
+                // Wechat.auth(scope, state, function (response) {
+                    // alert("response:"+JSON.stringify(response));
+                    var response={code:1231};
                     if(response.code){
-                        userService.loginbywx(response.code).then(function(result){
-                            alert("loginbywx success: " + JSON.stringify(result));
+                        msg.loading('登录中...');
+                        userService.wechat_login(response.code).then(function(result){
                             msg.hide();
-                            storage.setObject('user', result.data.data.user);
-                            storage.set('token', result.data.data.token);
-                            $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
-                            $scope.user=storage.getObject('user');
-                            $state.go('app.home');
+                            // alert("wechat_login success: " + JSON.stringify(result));
+                            if(result.data.data){
+                                storage.setObject('user', result.data.data.user);
+                                storage.set('token', result.data.data.token);
+                                $http.defaults.headers.common["Authorization"] = 'Bearer ' + result.data.data.token;
+                                $scope.user=storage.getObject('user');
+                                $state.go('app.home');
+                            }else{
+                                $state.go("loginAccount",{wechat:response.code})
+                            }
                         },function(error){
-                            alert("loginbywx Failed: " + JSON.stringify(error));
+                            // alert("loginbywx Failed: " + JSON.stringify(error));
                             $state.go("loginAccount",{wechat:$scope.wecaht});
                         });
                     }
-                }, function (error) {
-                    console("Failed: " + JSON.stringify(error));
-                });
+                // }, function (error) {
+                //     console.log("Failed: " + JSON.stringify(error));
+                // });
                 //$state.go("loginAccount");
-
             };
     }]);
     app.controller('loginCtrl', ["$scope", "userService","$stateParams","$ionicNavBarDelegate", "storage", "$state", "msg", "$http", "util","$timeout",
         function ($scope, userService,$stateParams,$ionicNavBarDelegate, storage, $state, msg, $http, util, $timeout) {
             //$ionicNavBarDelegate.showBackButton(false);
-            $scope.wecaht = $stateParams.wechat;
+            $scope.wechat = $stateParams.wechat;
             $scope.vm = {
                 mobile: '',
                 verify_code: '',

+ 41 - 46
miaomiao/www/js/controllers/my.js

xqd xqd xqd xqd
@@ -1,6 +1,6 @@
 (function (app) {
-    app.controller('myCtrl', ["$scope","$ionicTabsDelegate", "$state", "$http", "storage", "myService", "common", "config", "msg","$timeout"
-        , function ($scope,$ionicTabsDelegate, $state, $http, storage, myService, common, config, msg, $timeout) {
+    app.controller('myCtrl', ["$scope","$ionicTabsDelegate", "$state", "$http", "storage", "myService", "common", "config", "msg"
+        , function ($scope,$ionicTabsDelegate, $state, $http, storage, myService, common, config, msg) {
         $scope.$on('$ionicView.beforeEnter', function (viewResult) {
             $ionicTabsDelegate.showBar(true);
             myService.myInfo().then(function(result){ 
@@ -11,23 +11,35 @@
             common.setAvator().then(function (result) {
                 var response = JSON.parse(result.response);
                 console.log(response.data.file);
-                $timeout(function () {
-                    $scope.user.avatar = config.imgServer + response.data.file;
-                });
+                $scope.user.avatar = config.imgServer + response.data.file;
             });
         };
     }]);
-    app.controller('profileCtrl', ["$scope", "$timeout","$ionicTabsDelegate","$state","$filter", "storage", "myService", "msg", "common"
-      , function ($scope, $timeout, $ionicTabsDelegate, $state, $filter, storage, myService, msg, common) {
+    app.controller('profileCtrl', ["$scope","$ionicTabsDelegate","$state","$filter", "storage", "myService", "msg", "config", "common"
+      , function ($scope, $ionicTabsDelegate, $state, $filter, storage, myService, msg, config, common) {
             $scope.$on('$ionicView.beforeEnter', function () {
                 $ionicTabsDelegate.showBar(false);
+                msg.loading();
+                myService.myInfo().then(function(result){
+                  // alert(JSON.stringify(result.data.data));
+                  $scope.vm = result.data.data;
+                    console.log($scope.vm.avatar)
+                  $scope.vm.sex = $scope.vm.sex+'';
+                  $scope.vm.emotion = $scope.vm.emotion+'';
+                  if($scope.vm.birthday){
+                      var arr1 = $scope.vm.birthday.split("-");
+                      $scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]); 
+                  }
+                  msg.hide();
+                },function(error){
+                  msg.hide();
+                  // msg.error(error.data.message);
+                })
             });
             $scope.setAvator = function () {
                 common.setAvator().then(function (result) {
                     var response = JSON.parse(result.response);
-                    $timeout(function () {
-                        $scope.user.avatar = config.imgServer + response.data.file;
-                    });
+                    $scope.vm.avatar = config.imgServer + response.data.file;
                 });
             };
           
@@ -41,25 +53,7 @@
                 tall:"",
                 nickname:"",
                 birthday1:""
-            };
-            $scope.$on('$ionicView.beforeEnter', function () {
-                msg.loading();
-                myService.myInfo().then(function(result){
-                  // alert(JSON.stringify(result.data.data));
-                  $scope.vm = result.data.data;
-                  $scope.vm.sex = $scope.vm.sex+'';
-                  $scope.vm.emotion = $scope.vm.emotion+'';
-                  if($scope.vm.birthday){
-                      var arr1 = $scope.vm.birthday.split("-");
-                      $scope.vm.birthday1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]); 
-                  }
-                  msg.hide();
-
-                },function(error){
-                  msg.hide();
-                  // msg.error(error.data.message);
-                })
-            });
+            }; 
  
             $scope.saveMaterial = function(){
                 var data = {
@@ -378,29 +372,30 @@
         }]);
     app.controller('rechargeCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
   , function ($scope, $ionicTabsDelegate,$state, myService, msg) {
-            $scope.$on('$ionicView.beforeEnter', function () {
-                $ionicTabsDelegate.showBar(false);
-                myService.myInfo().then(function(result){
-                    $scope.vm = result.data.data;
-                    $scope.vm.money = '';
-                    $scope.vm.payType = 2;
-                })
-            });
-            $scope.payExplain = function(){
-                $state.go("app.payExplain")
-            };
-            $scope.withdraw = function(){
-                $state.go("app.withdraw")
-            };
+        $scope.$on('$ionicView.beforeEnter', function () {
+            $ionicTabsDelegate.showBar(false);
+            myService.myInfo().then(function(result){
+                $scope.vm = result.data.data;
+                $scope.vm.number = '';
+                $scope.vm.payType = 2;
+            })
+        });
+        $scope.payExplain = function(){
+            $state.go("app.payExplain")
+        };
+        $scope.withdraw = function(){
+            $state.go("app.withdraw")
+        };
            
       //充值
-      $scope.recharge = function(money){
-          if (!$scope.vm.money) {
+      $scope.charge = function(number){
+          if (!number) {
               msg.text('请输入充值金额');
               return;
           }
-          myService.recharge(money).then(function (result) {
+          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) {

+ 1 - 1
miaomiao/www/js/services/httpinterceptor.js

xqd
@@ -30,7 +30,7 @@
                 return response;
             },
             'responseError': function (rejection) {
-                // console.log(JSON.stringify(rejection));
+                console.log(JSON.stringify(rejection));
                 if (rejection.status == 401||rejection.data.message=="Unauthenticated.") {
                     storage.remove('user');
                     storage.remove('token');

+ 4 - 3
miaomiao/www/js/services/myservice.js

xqd
@@ -14,10 +14,11 @@
                     data: { password: password }
                 })
             },
-            recharge:function(money){
+            charge:function(number,type){
                 return $http({
-                    url:config.server + "api/my/recharge?coin="+money,
-                    method:"post"
+                    url:config.server + "api/pay/charge",
+                    method:"post",
+                    data: { number:number,goods:1,type:type}
                 })
             },
             setting:function(){

+ 3 - 4
miaomiao/www/js/services/userservice.js

xqd
@@ -1,11 +1,10 @@
 (function (app) {
     app.factory('userService', ['$http', 'config', "util", 'storage', function ($http, config, util, storage) {
         return {
-            loginbywx:function(wechat){
+            wechat_login:function(wechat){
                 return $http({
-                    url: config.server + 'api/auth/wechat_login',
-                    method: "post",
-                    data: { wechat: wechat}
+                    url: config.server + 'api/auth/wechat_login?wechat=' + wechat,
+                    method: "get",
                 })
             },
             login: function (phone, verify_code,wechat) {

+ 1 - 2
miaomiao/www/templates/account/login.html

xqd
@@ -4,8 +4,7 @@
             <img ng-src="img/icon_login.svg"  style="margin:0 auto;display:block;width:100px;border-radius:50px"/>
             <span style="font-size: 15px; color: #E1E1E1; margin-top: 30px">- 微信登录 -</span>
             <div class="lgsocial">
-                <!--<img  ng-src="img/icon_weibo.svg"/>-->
-                <img ng-click="loginbywx()" ng-src="img/icon_wechat.svg"/>
+                <img ng-click="wechat_login()" ng-src="img/icon_wechat.svg"/>
             </div>
         </div>
     </ion-content>

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

xqd xqd
@@ -21,8 +21,8 @@
                 </div>
             </div>
             <div class="item item-input" style="padding-top: 20px; padding-bottom: 20px">
-                <span class="input-label" style="width: 60px">金额</span>
-                <input type="number" placeholder="请输入充值金额" ng-model="vm.money">
+                <span class="input-label" style="width: 60px">梦想币</span>
+                <input type="tel" placeholder="请输入数量" ng-model="vm.number">
             </div>
             <div class="item" style="color: #969696; padding-top: 40px">
                选择支付方式
@@ -32,14 +32,14 @@
                     <img ng-src="img/icon_ WeChat Pay.svg" />
                     <span>微信支付</span>
                 </ion-radio>
-                <ion-radio ng-model="vm.payType" ng-value="1">
+                <!-- <ion-radio ng-model="vm.payType" ng-value="1">
                     <img ng-src="img/icon_ Alipay.svg" />
                     <span>支付宝支付</span>
-                </ion-radio>
+                </ion-radio> -->
             </ion-list>
         </div>
         <div class="padding">
-            <button  class="button button-block button-calm" ng-click="recharge(vm.money)">
+            <button  class="button button-block button-calm" ng-click="charge(vm.number)">
                 支付
             </button>
         </div>

+ 198 - 0
server/app/Helper/PayHelper.php

xqd
@@ -0,0 +1,198 @@
+<?php
+namespace App\Helper;
+
+use Omnipay\Omnipay;
+use App\Models\OrderInfoModel;
+use Config, Request,QrCode;
+
+trait PayHelper
+{
+    private function prepare() {
+//        Pingpp::setApiKey(env('PINGPP_APP_KEY'));
+//        Pingpp::setPrivateKeyPath(config_path() . 'ppp_pri_key.pem');
+    }
+
+    /**
+     * 验签
+     * @param $data
+     * @param $sig
+     * @return int
+     */
+    public function checkPppSignature($data, $sig) {
+        $pubKey = file_get_contents(config_path() . 'ppp_pub_key.pem');
+        return openssl_verify($data, $sig, $pubKey, 'sha256');
+    }
+
+    private function saveOrder($data) {
+        $order = new OrderInfoModel();
+        $order->code            = $data['code'];
+        $order->transaction_id  = $data['transaction_id'];
+        $order->user_type       = $data['user_type'];
+        $order->user_id         = $data['user_id'];
+        $order->goods_type      = $data['goods'];
+        $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;
+    }
+
+    public function createAlipayCharge($data, $profile = 'alipay') {
+        $gateways = Config::get('laravel-omnipay.gateways');
+        if (array_key_exists($profile, $gateways)) {
+            $config = $gateways[$profile];
+        } else {
+            \Log::error('alipay: 不支持的支付类型, ' . $profile);
+            return false;
+        }
+        $gateway = Omnipay::create($config['driver']);
+        $gateway->setEnvironment($config['options']['environment']);
+        $gateway->setAppId($config['options']['appid']);
+        $gateway->setEncryptKey($config['options']['encrypt_key']);
+        $gateway->setPrivateKey($config['options']['prikey']);
+        $gateway->setAlipayPublicKey($config['options']['ali_pubkey']);
+        $gateway->setNotifyUrl($config['options']['notify_url']);
+
+        $goodsTypes = OrderInfoModel::getAllGoodsTypes();
+        if (!isset($data['subject'])) {
+            $data['subject'] = sprintf("甲象联合%s充值%d", $goodsTypes[$data['goods']], $data['number']);
+        }
+        if (!isset($data['goods_id'])) {
+            $data['goods_id'] = 0;
+        }
+        $data['transaction_id'] = date('YmdHis') . mt_rand(1000, 9999);
+        $data['code'] = 'ALIPAY_' . $data['transaction_id'];
+        $data['price'] = 1;
+        $data['amount'] = $data['number'] * $data['price']*100;
+        $data['pay_type'] = OrderInfoModel::PAY_TYPE_ALIPAY;
+
+        $request = $gateway->purchase();
+        $request->setBizContent([
+            'subject'      => $data['subject'],
+            'out_trade_no' => $data['transaction_id'],
+            'total_amount' => round($data['amount'] / 100, 2),
+            'product_code' => 'QUICK_MSECURITY_PAY',//固定值
+        ]);
+        if ($profile == 'alipay_f2f') {
+            $request->setBizContent([
+                'subject'      => $data['subject'],
+                'out_trade_no' => $data['transaction_id'],
+                'total_amount' => round($data['amount'] / 100, 2),
+            ]);
+        }
+//        dd($request);
+
+        $response = $request->send();
+
+        if ($response->isSuccessful()) {
+            if ($profile == 'alipay_app' || $profile == 'alipay') {
+                $orderString = $response->getOrderString();
+            }
+            if ($profile == 'alipay_f2f') {
+                $code_url = $response->getQrCode();
+                $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::info("支付宝生成订返回:".$orderString);
+
+            //写订单
+            $order = $this->saveOrder($data);
+            if ($order !== false) {
+                $result = $order->toArray();
+                $result['orderString'] = $orderString;
+                return $result;
+            }
+            \Log::error('save order failed');
+            return false;
+        } else {
+            \Log::error('alipay response failed'.$response->getMessage());
+            return false;
+        }
+    }
+
+    public function createWechatpayCharge($data, $profile = 'wechatpay') {
+        $gateways = Config::get('laravel-omnipay.gateways');
+        if (array_key_exists($profile, $gateways)) {
+            $config = $gateways[$profile];
+        } else {
+            \Log::error('wechatpay: 不支持的支付设置, ' . $profile);
+            return false;
+        }
+
+        $gateway = Omnipay::create($config['driver']);
+//        $gateway->setEnvironment('sandbox');
+        $gateway->setAppId($config['options']['appid']);
+        $gateway->setMchId($config['options']['merchant_id']);
+        $gateway->setApiKey($config['options']['apikey']);
+        $gateway->setNotifyUrl($config['options']['notify_url']);
+
+        $goodsTypes = OrderInfoModel::getAllGoodsTypes();
+        if (!isset($data['subject'])) {
+            $data['subject'] = sprintf("甲象联合%s充值%d", $goodsTypes[$data['goods']], $data['number']);
+        }
+        if (!isset($data['goods_id'])) {
+            $data['goods_id'] = 0;
+        }
+        $data['transaction_id'] = date('YmdHis') . mt_rand(1000, 9999);
+        $data['code'] = 'WECHATPAY_' . $data['transaction_id'];
+        $data['price'] = 1;
+        $data['amount'] = $data['number'] * $data['price'];
+        $data['pay_type'] = OrderInfoModel::PAY_TYPE_WECHATPAY;
+
+        $order = [
+            'body'              => $data['subject'],
+            'out_trade_no'      => $data['transaction_id'],
+            'total_fee'         => $data['amount']*100,
+            'spbill_create_ip'  => Request::ip(),
+            'fee_type'          => 'CNY'
+        ];
+
+        $request  = $gateway->purchase($order);
+        $response = $request->send();
+
+//        dd($response);
+
+        if ($response->isSuccessful()) {
+            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';
+            }
+            \Log::debug($orderString);
+
+            //写订单
+            $order = $this->saveOrder($data);
+            if ($order !== false) {
+                $result = $order->toArray();
+                $result['orderString'] = $orderString;
+                return $result;
+            }
+            \Log::error('save order failed');
+            return false;
+        } else {
+            \Log::error($response->getData());
+            return false;
+        }
+
+        //available methods
+//        $response->isSuccessful();
+//        $response->getData(); //For debug
+//        $response->getAppOrderData(); //For WechatPay_App
+//        $response->getJsOrderData(); //For WechatPay_Js
+//        $response->getCodeUrl(); //For Native Trade Type
+    }
+
+}

+ 23 - 0
server/app/Http/Controllers/Admin/Share/InfoController.php

xqd
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Http\Controllers\Admin\Share;
+
+use App\Models\DreamInfoModel;
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+
+class InfoController extends Controller
+{
+    public function view(Request $request){
+        $dream = DreamInfoModel::with('img')->find($request->id);
+        $times = (strtotime($dream->end_time) -strtotime( $dream->created_at));
+        if ($times>=3600*24) {
+            $days =floor($times/3600/24)  .'天';
+        } elseif($times>3600 && $times< 3600*24){
+            $days = floor($times/3600) .'小时';
+        }else{
+            $days =floor ($times/60) .'分钟';
+        }
+        return view('admin.share',compact('dream','days'));
+    }
+}

+ 8 - 3
server/app/Http/Controllers/Api/V1/AuthController.php

xqd xqd xqd xqd
@@ -99,6 +99,11 @@ class AuthController extends Controller
             ]);
             $user->status=1;
             $user->save();
+        }else{
+            //用户已经存在,重新绑定
+            $user->wechat=$wechat;
+            $user->password=bcrypt(123456);
+            $user->save();
         }
         $status =empty($user) ? 0 : $user->status;
         if ($status == 0) return $this->error(ErrorCode::LOCK_USER);
@@ -119,7 +124,7 @@ class AuthController extends Controller
 
 //    第三方登录  微信
     /**
-     * @api {post} /api/auth/wechat_login 微信登陆(login)
+     * @api {get} /api/auth/wechat_login 微信登陆(login)
      * @apiDescription 微信登陆(login)
      * @apiGroup Auth
      * @apiPermission none
@@ -163,7 +168,7 @@ class AuthController extends Controller
             return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
         $user = UserInfoModel::where('wechat',$request->wechat)->first();
         if (empty($user)) {
-           $this->login($request);
+//            return $this->error(ErrorCode::LOGIN_FAILED);
         }else{
             $token = $user->createToken($user->phone)->accessToken;
             return $this->api(compact( 'user', 'code','token'));
@@ -347,7 +352,7 @@ class AuthController extends Controller
             $result = array_shift($result);
         }
         if (is_string($result)) {
-            $user->avatar = config('app.url')."api/attachment/download/".$result;
+            $user->avatar = config('app.url')."/attachment/".$result;
             if (!$user->save()) {
                 return $this->error(ErrorCode::SAVE_USER_FAILED);
             }

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

xqd
@@ -29,8 +29,8 @@ class Controller extends BaseController
 
         $this->middleware('auth:api', [
             'except' => [
-                'upload', 'getCode', 'reset', 'login', 'get', 'register', 'alipayNotify', 'wechatpayNotify',
-                'get', 'area', 'download',  'test'
+                'upload', 'getCode', 'login', 'wechatLogin', 'alipayNotify', 'wechatpayNotify',
+                'download',  'test'
             ]
         ]);
 

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

xqd
@@ -687,12 +687,7 @@ class DreamController extends Controller
 
         if ($dream_id) {
 //            梦想创建成功 关联关系中最新动态+1
-            /*         $info = UserCareUser::where('other_user_id',$user->id)->paginate(20);
-                     foreach ($info as $item) {
-                         $item->dream_num += 1;
-                         $item->updated_at = date('Y-m-d H:i:s');
-                         $item->save();
-                     }*/
+            UserCareUser::where('other_user_id',$user->id)->increment('dream_number',1);
             $pics = $request->pics;
             $video = $request->video;
             if (!is_array($pics) && empty($pics) && empty($video)) {

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

xqd
@@ -119,7 +119,8 @@ class IndexController extends Controller
         $dtusers =UserCareUser::where('user_id',$id)->with('other_user')->
         where('dream_number','>',0)->orderBy('created_at')->get()->toArray();
         $hdusers = CommentInfoModel::where(function ($query) use ($id) {
-            $query->where('user_id',$id)->orWhere('to_user_id',$id);
+//            $query->where('user_id',$id)->orWhere('to_user_id',$id);
+            $query->where('user_id',$id);
         })->where('is_read',0)->with('to_user')->orderBy('created_at')->get()->toArray();
         $users = [] ;
         foreach ($dtusers as $k => $v){

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

xqd xqd xqd
@@ -20,6 +20,7 @@ class InteractionController extends Controller
      * @apiVersion 0.1.0
      * @apiParam {int} id                 梦想ID
      * @apiParam {string} title           互动标题
+     * @apiParam {string} [video]           视频
      * @apiParam {array} pics[]           图片数组
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
@@ -66,6 +67,7 @@ class InteractionController extends Controller
         $title = $request->title;
         $data['dream_id'] = $dream_id;
         $data['title'] = $title;
+        $data['video'] = $request->video;
         $ok = InteractionInfo::create($data);
         if ($ok) {
 //            收藏梦想最新动态加一
@@ -178,6 +180,7 @@ class InteractionController extends Controller
 
         $user = $this->getUser();
         $data['to_user_id'] = $user->id;
+        $data['user_id'] =CommentInfoModel::find($request->id)->user_id;
         $data['interaction_id'] = $request->interaction_id;
         $data['content'] = $request->content;
 

+ 20 - 68
server/app/Http/Controllers/Api/V1/PayController.php

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -2,53 +2,18 @@
 
 namespace App\Http\Controllers\Api\V1;
 
-use App\Http\HelperTraits\LogHelper;
-use App\Http\HelperTraits\PayHelper;
-use App\Http\HelperTraits\JpushHelper;
-use Omnipay\Omnipay;
-use App\User;
-use App\Models\MerchantMemberService;
-use App\Models\Order;
+use App\Helper\PayHelper;
+use App\UserInfoModel;
+use App\Models\OrderInfoModel;
 use App\Models\AccountLog;
-use Request, Config, DB;
+use App\Services\Base\ErrorCode;
+use Illuminate\Http\Request;
+use Config, Auth, DB ,Validator;
 
 class PayController extends Controller
 {
-    use PayHelper, LogHelper,JpushHelper;
+    use PayHelper;
 
-    /**
-     * p++ webhooks通知
-     */
-//    public function pppNotify() {
-//        $sig = Request::header('x-pingplusplus-signature');
-//        $request = Request::instance();
-//        $data = $request->getContent();
-//
-//        if (!$this->checkPppSignature($data, $sig)) {//验签失败
-//            header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
-//            exit("fail");
-//        }
-//
-//        $event = json_decode($data);
-//        if (!isset($event->type)) {
-////            return Response::make('fail', 400);
-//            header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
-//            exit("fail");
-//        }
-//        switch ($event->type) {
-//            case "charge.succeeded":
-//                // 开发者在此处加入对支付异步通知的处理代码
-//                header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
-//                break;
-//            case "refund.succeeded":
-//                // 开发者在此处加入对退款异步通知的处理代码
-//                header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK');
-//                break;
-//            default:
-//                header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
-//                break;
-//        }
-//    }
 
     public function alipayNotify() {
         $rawInfo = Request::all();
@@ -99,7 +64,7 @@ class PayController extends Controller
                     $tp = 'Member';
                     //Not handled here
                 }
-                $u = User::find($order->user_id);
+                $u = UserInfoModel::find($order->user_id);
                 if (!$u) {
                     \Log::error('用户不存在' . $order->user_type . ', ' . $order->user_id);
                     return 'success';
@@ -134,7 +99,6 @@ class PayController extends Controller
                             AccountLog::DIRECTION_INC, $cType == AccountLog::TYPE_BALANCE ? $u->balance : $u->credit, AccountLog::CHANNEL_ALIPAY);
                     } else {
                         //续消费
-                        $this->continue_consume($order);
 
                         $this->logAccount($tp, $u->id, $u->name,
                             AccountLog::OP_CC, $cType, $master_amount,
@@ -211,7 +175,7 @@ class PayController extends Controller
                     $tp = 'Member';
                     //Not handled here
                 }
-                $u = User::find($order->user_id);
+                $u = UserInfoModel::find($order->user_id);
                 if (!$u) {
                     \Log::error('用户不存在' . $order->user_type . ', ' . $order->user_id);
                     return 'success';
@@ -276,12 +240,6 @@ class PayController extends Controller
     }
 
 
-    function continue_consume($order){
-
-    }
-
-
-
 
     /**
      * @api {post} /api/pay/charge 充值
@@ -289,7 +247,7 @@ class PayController extends Controller
      * @apiGroup Merchant
      * @apiPermission Passport
      * @apiVersion 0.1.0
-     * @apiParam {int}  [goods=1]   充值商品(1:余额,2:卡金
+     * @apiParam {int}  [goods=1]   充值商品(1:梦想币
      * @apiParam {int}  number      充值数量,人民币,以分表示
      * @apiParam {int}  type        支付类型(1:支付宝,2:微信支付)
      * @apiSuccessExample {json} Success-Response:
@@ -325,24 +283,23 @@ class PayController extends Controller
      * }
      * 可能出现的错误代码:
      * 1000    CLIENT_WRONG_PARAMS             传入参数不正确
-     * 1300    MERCHANT_NOT_EXIST              商户不存在
      */
     public function charge(Request $request)
     {
-        $goodsTypes = Order::getAllGoodsTypes();
+        $goodsTypes = OrderInfoModel::getAllGoodsTypes();
         $gTypes = array_keys($goodsTypes);
-        $payTypes = Order::getAllPayTypes();
+        $payTypes = OrderInfoModel::getAllPayTypes();
         $pTypes = array_keys($payTypes);
-        $validator = Validator::make($data = $request->input(),
+        $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',
+                'number.required' => '请输入梦想币数量',
+                'number.integer' => '梦想币数量必须为整数',
+                'number.min' => '充值梦想币数量至少为1',
                 'type.required' => '支付类型必填',
                 'type.in' => '支付类型非法',
                 'goods.in' => '充值商品非法',
@@ -354,19 +311,14 @@ class PayController extends Controller
         }
 
         $user = Auth::user();
-        $merchant = Merchant::where('user_id', '=', $user->id)->first();//模型支持单用户多商户,业务只设计单商户
-        if (!$merchant) {
-            return $this->error(ErrorCode::MERCHANT_NOT_EXIST);
-        }
-
         $data['goods_id'] = 0;
         if (!isset($data['goods'])) {//默认充余额
-            $data['goods'] = Order::GOODS_TYPE_BALANCE;
+            $data['goods'] = OrderInfoModel::GOODS_TYPE_COIN;
         }
 
-        $data['user_type'] = Order::USER_TYPE_MERCHANT;
-        $data['user_id'] = $user->id;//$merchant->id;
-        if ($data['type'] == Order::PAY_TYPE_ALIPAY) {
+        $data['user_type'] = OrderInfoModel::USER_TYPE_USER;
+        $data['user_id'] = $user->id;
+        if ($data['type'] == OrderInfoModel::PAY_TYPE_ALIPAY) {
             $result = $this->createAlipayCharge($data);
         } else {
             $result = $this->createWechatpayCharge($data);

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

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

+ 66 - 0
server/app/Models/OrderInfoModel.php

xqd
@@ -0,0 +1,66 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OrderInfoModel extends Model
+{
+    //
+    protected $table = 'order_info';
+    protected $primaryKey = 'id';
+
+    //用户类型定义
+    const USER_TYPE_USER    = 1;
+
+    //用户类型枚举
+    private static $_user_types = [
+        self::USER_TYPE_USER    => '会员',
+    ];
+
+    //商品类型定义
+    const GOODS_TYPE_COIN  = 1;
+//    const GOODS_TYPE_COSUME   = 3;
+
+    //商品类型枚举
+    private static $_goods_types = [
+        self::GOODS_TYPE_COIN    => '梦想币',
+//        self::GOODS_TYPE_COSUME     => '续消现金',
+    ];
+
+    //支付类型定义
+    const PAY_TYPE_ALIPAY     = 1;
+    const PAY_TYPE_WECHATPAY  = 2;
+
+    //支付类型枚举
+    private static $_pay_types = [
+        self::PAY_TYPE_ALIPAY       => '支付宝',
+        self::PAY_TYPE_WECHATPAY    => '微信支付',
+//        self::PAY_TYPE_UNIONPAY     => '银联支付',
+    ];
+
+    //订单状态定义
+    const STATUS_PENDING    = 0;
+    const STATUS_FINISHED   = 1;
+    const STATUS_CANCELED   = 2;
+
+    //订单状态枚举
+    private static $_status = [
+        self::STATUS_PENDING    => '待处理',
+        self::STATUS_FINISHED   => '已完成',
+        self::STATUS_CANCELED   => '已取消',
+    ];
+
+
+    public static function getAllGoodsTypes() {
+        return self::$_goods_types;
+    }
+
+    public static function getAllStatus() {
+        return self::$_status;
+    }
+
+    public static function getAllPayTypes() {
+        return self::$_pay_types;
+    }
+}

+ 1 - 1
server/app/Models/UserInfoModel.php

xqd
@@ -1,6 +1,6 @@
 <?php
 namespace App\Models;
-use App\Models\BaseModel;
+
 use Illuminate\Foundation\Auth\User as Authenticatable;
 use Laravel\Passport\HasApiTokens;
 use Illuminate\Notifications\Notifiable;

+ 2 - 1
server/app/Services/Base/ErrorCode.php

xqd xqd
@@ -66,7 +66,7 @@ final class ErrorCode {
     const CLIENT_WRONG_PARAMS = 1000;
     const DREAM_NOT_EXIST = 1308;
     const LOCK_USER = 1309;
-//    const MERCHANT_BALANCE_NOT_ENOUGH = 1311;
+    const LOGIN_FAILED = 1311;
     const KEY_ERROR = 1310;
     const SUP_TOP = 1410;
     const SUP_ERROR = 1411;
@@ -130,6 +130,7 @@ final class ErrorCode {
         self::VERIFY_CODE_TOO_MUCH => '24小时内验证码发送过多',
         self::DELETE_OP_FAILED => '删除操作失败',
         self::CLIENT_WRONG_PARAMS => '输入不正确',
+        self::LOGIN_FAILED => '登录失败',
         self::LOCK_USER=> '当前账号已被封号,请联系管理员',
         self::KEY_ERROR => '参数错误',
         self::verify => '系统审核中',

+ 4 - 0
server/composer.json

xqd
@@ -9,10 +9,14 @@
         "barryvdh/laravel-ide-helper": "^2.3",
         "dingo/api": "1.0.x@dev",
         "doctrine/dbal": "^2.5",
+        "ignited/laravel-omnipay": "2.*",
         "jpush/jpush": "^3.5",
         "laravel/framework": "5.4.*",
         "laravel/passport": "^2.0",
         "laravel/tinker": "~1.0",
+        "league/oauth2-server": "5.1.4",
+        "lokielse/omnipay-alipay": "^2.0",
+        "lokielse/omnipay-wechatpay": "^1.0",
         "orangehill/iseed": "^2.4",
         "php-ffmpeg/php-ffmpeg": "^0.9.5",
         "simplesoftwareio/simple-qrcode": "1.5.*"

+ 3 - 0
server/config/app.php

xqd xqd
@@ -181,6 +181,7 @@ return [
         Laravel\Passport\PassportServiceProvider::class,
         Dingo\Api\Provider\LaravelServiceProvider::class,
         Orangehill\Iseed\IseedServiceProvider::class,
+//        Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider::class,
         SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class,
 
     ],
@@ -231,6 +232,8 @@ return [
         'URL' => Illuminate\Support\Facades\URL::class,
         'Validator' => Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
+
+        'Omnipay' => Ignited\LaravelOmnipay\Facades\OmnipayFacade::class,
         'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class
     ],
 

+ 56 - 0
server/config/laravel-omnipay.php

xqd
@@ -0,0 +1,56 @@
+<?php
+
+$alipay_options = [
+    'environment'   => 'production',//production or sandbox
+    'appid'         => '2016091201894867',
+    'prikey'        => file_get_contents(config_path() . '/alipay/pri_key.pem'),
+    'encrypt_key'   => 'jw3nnqmrlqunkd1f9g9v206q24jqbuxa',
+    'ali_pubkey'    => file_get_contents(config_path() . '/alipay/pub_key.pem'),
+    'notify_url'    => env('APP_URL') . '/api/pay/alipay/notify',
+];
+
+$wechatpay_options = [
+    'appid'         => 'wx768e4862b2125a3a',
+    'apikey'        => 'a1891122765718911227657189112276',
+    'merchant_id'   => '1408696902',
+    'notify_url'    => env('APP_URL') . '/api/pay/wechatpay/notify',
+];
+
+return [
+
+	// The default gateway to use
+	'default' => 'wechatpay',
+
+	// Add in each gateway here
+	'gateways' => [
+        //支付宝app支付
+        'alipay_app'    => [
+            'driver'        => 'Alipay_AopApp',
+            'options'       => $alipay_options,
+        ],
+        'alipay'    => [//与上面一致,兼容处理
+            'driver'        => 'Alipay_AopApp',
+            'options'       => $alipay_options,
+        ],
+        //支付宝面对面支付
+        'alipay_f2f'    => [
+            'driver'        => 'Alipay_AopF2F',
+            'options'       => $alipay_options,
+        ],
+        //微信app支付
+        'wechatpay_app'     => [
+            'driver'        => 'WechatPay_App',
+            'options'       => $wechatpay_options,
+        ],
+        'wechatpay'     => [//与上面一致,兼容处理
+            'driver'        => 'WechatPay_App',
+            'options'       => $wechatpay_options,
+        ],
+        //微信原生扫码支付
+        'wechatpay_native'     => [
+            'driver'        => 'WechatPay_Native',
+            'options'       =>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7uheRR270LXYaDECgYB50fETE6fGapyIDt8NCbpg
+d/ha7anCbIdqf7IQAZ1+2EtcoL5FpVbxzD0CmLjP9VAbCzflymOXuoWn72VmtmTT
+KNjHDQenl/SmWz/rKkZB+zIxwecmtUm+xuYao6/yOmZTjKlr2Ka6Z7+yHvzRgaRx
+2EuDVav7ES2ftD8fgFsjAA==
+-----END PRIVATE KEY-----

+ 52 - 0
server/database/migrations/2017_05_30_113210_create_orders_table.php

xqd
@@ -0,0 +1,52 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+/**
+ * Migration auto-generated by Sequel Pro Laravel Export
+ * @see https://github.com/cviebrock/sequel-pro-laravel-export
+ */
+class CreateOrdersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('code', 50)->comment('订单流水号');
+            $table->string('transaction_id', 255)->nullable()->comment('交易流水号');
+            $table->unsignedInteger('user_id')->comment('用户id');
+            $table->unsignedInteger('goods_id')->default(1)->comment('商品id:1梦想币');
+            $table->unsignedInteger('price')->default(1)->comment('商品单价');
+            $table->unsignedInteger('number')->default(1)->comment('商品数量');
+            $table->unsignedInteger('amount')->comment('交易金额');
+            $table->tinyInteger('pay_type')->default(1)->comment('支付类型,1:支付宝,2:微信支付,3:银联卡');
+            $table->tinyInteger('status')->comment('订单状态:0,待处理,1,已完成,2,已取消');
+            $table->string('ext_info', 255)->nullable();
+            $table->nullableTimestamps();
+
+            $table->index('code', 'idx_code');
+            $table->index('transaction_id', 'idx_tid');
+            $table->index('user_id', 'idx_user');
+
+            
+
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('orders');
+    }
+}

+ 32 - 0
server/database/migrations/2017_08_29_180011_add_video_to_interaction_info_table.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddVideoToInteractionInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('interaction_info', function (Blueprint $table) {
+            $table->string('video')->comment('动态视频地址')->nullable()->after('title');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('interaction_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 1 - 0
server/public/base/img/down.svg

xqd
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1503989256857" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1840" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><defs><style type="text/css"></style></defs><path d="M532.207 718.134v0c3.079-1.777 6.39-3.079 9.112-5.802 0.477-0.594 0.827-1.064 1.303-1.539 0.594-0.709 1.539-0.946 2.128-1.54l319.434-331.383c8.519-8.757 12.781-20.121 12.781-31.483 0-11.836-4.733-23.79-13.964-32.666-18.107-17.398-46.871-16.924-64.265 1.183l-288.071 298.956-283.922-300.139c-17.28-18.225-46.040-19.057-64.265-1.777-18.226 17.281-19.057 46.040-1.777 64.265l316.355 334.462c13.844 14.676 35.149 17.399 52.429 9.113 0.945-0.35 1.777-1.182 2.722-1.653v0zM532.207 718.134z" p-id="1841" fill="#1296db"></path></svg>

+ 1 - 0
server/public/base/img/up.svg

xqd
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1503989399657" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1844" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20"><defs><style type="text/css"></style></defs><path d="M880.102 710.827c18.020 17.82 47.144 17.82 65.097 0 17.954-17.753 17.954-46.611 0-64.429l-401.157-395.954c-18.020-17.82-47.077-17.82-65.097 0l-401.157 395.953c-17.954 17.82-18.020 46.611 0 64.429s47.21 17.82 65.097 0.067l368.641-350.142 368.576 350.076z" p-id="1845" fill="#1296db"></path></svg>

+ 60 - 0
server/resources/views/admin/share.blade.php

xqd
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>分享梦想页</title>
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
+    <style>
+        body{
+            padding: 0;
+            margin: 0;
+        }
+        p{
+            -webkit-margin-before: 0.1em;
+            -webkit-margin-after: 0.1em;
+        }
+    </style>
+</head>
+<body>
+<h4 style="text-align: center; font-weight: normal; width: 100%; border-bottom: 1px solid #DEDEDE; padding-bottom: 15px">分享梦想页</h4>
+<img style="width: 100%; height: 100%;" src="{{!empty($dream->img) ? $dream->img->pic : ''}}
+
+">
+<p style="font-size: 17px; padding: 0 10px">{{$dream->name}}</p>
+<div style="border-bottom: 1px solid #DEDEDE">
+    <p style="font-size: 13px; padding: 0 10px; color: #919191">
+        {{mb_substr($dream->about,0,8)}} ...
+    </p>
+  {{--  <p style="text-align: center">
+        <img src="/base/img/down.svg" alt="">
+        <img src="/base/img/up.svg" alt="">
+    </p>--}}
+</div>
+<div style="border-bottom: 1px solid #DEDEDE; height: 50px; padding: 5px 10px;">
+    <div style="float:left;">
+        <p>{{$days}}</p>
+        <p style="font-size: 13px; color: #919191">剩余时间</p>
+    </div>
+    <div style="float:right;">
+        <p style="text-align: right">{{$dream->mark}}</p>
+        <p style="font-size: 13px;; color: #919191">当前获得梦想分数</p>
+    </div>
+</div>
+<div style="clear:both; height: 50px; padding: 5px 10px;">
+    <div style="float:left;">
+        <p>{{$dream->get_coin}}</p>
+        <p style="font-size: 13px; color: #919191">目前已获梦想币</p>
+    </div>
+    <div style="float:right;">
+        <p style="text-align: right">{{$dream->coin}}</p>
+        <p style="font-size: 13px; color: #919191">我要求的梦想币</p>
+    </div>
+</div>
+<div style="padding: 0 10px">
+    <div style="background-color:#E6E6E6; width: 100%;">
+        <div style="width: {{($dream->get_coin / $dream->coin)}} %; background: #FF6600; height: 5px">
+        </div>
+    </div>
+</div>
+</body>
+</html>

+ 4 - 1
server/routes/admin.php

xqd xqd
@@ -18,6 +18,9 @@ Route::get('logout', 'Auth\LoginController@logout');
 Route::get('noauth', 'Auth\LoginController@noauth');
 
 
+//    分享返回页面
+Route::get('share/view', 'Share\InfoController@view');
+
 Route::group(['middleware' => ['auth.admin']], function() {
 //参数设置
     Route::get('setting/banner/index', 'Settings\SettingsController@banner');
@@ -43,9 +46,9 @@ Route::group(['middleware' => ['auth.admin']], function() {
     Route::get('Interaction/Info/view', 'Interaction\InfoController@view');
     Route::post('Interaction/Info/update/{id}', 'Interaction\InfoController@update');
 
+
 //后台显示二维码
 //    Route::get('/Dream/Info/show_code', 'Dream\InfoController@showCode');
-
     $uri =  request()->path();
     $uri = str_replace('admin/' ,'', $uri);
     $uri = str_replace('admin' ,'', $uri);

+ 3 - 1
server/routes/api.php

xqd xqd
@@ -18,6 +18,8 @@
 
 
 
+
+
 $api = app('Dingo\Api\Routing\Router');
 
 $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {
@@ -56,7 +58,7 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'auth.login',
         'uses' => 'AuthController@login',
     ]);
-    $api->post('auth/wechat_login', [
+    $api->get('auth/wechat_login', [
         'as' => 'auth.wechat_login',
         'uses' => 'AuthController@wechatLogin',
     ]);