xielin 5 anni fa
parent
commit
01e2b487e9

+ 0 - 30
app/Helper/helper.php

@@ -120,33 +120,3 @@ function http($url, $param, $method = 'post')
     );
     return $response;
 }
-
-function  geneOrderId()
-{
-
-    //订单号码主体(YYYYMMDDHHIISSNNNNNNNN)
-    $order_id_main = date('YmdHis') . rand(10000000,99999999);
-    //订单号码主体长度
-
-    $order_id_len = strlen($order_id_main);
-    $order_id_sum = 0;
-
-    for($i=0; $i<$order_id_len; $i++){
-
-        $order_id_sum += (int)(substr($order_id_main,$i,1));
-
-    }
-    //唯一订单号码(YYYYMMDDHHIISSNNNNNNNNCC)
-    $order_id = $order_id_main . str_pad((100 - $order_id_sum % 100) % 100,2,'0',STR_PAD_LEFT);
-    return $order_id;
-}
-
-function receiveTime($receiveType, $receiveTime)
-{
-    if($receiveType == 0){
-        $receiveTime = '次日达';
-    }elseif($receiveType == 1){
-        $receiveTime = date('m月d日', strtotime("+ $receiveTime days"));
-    }
-    return $receiveTime;
-}

+ 2 - 2
app/Http/Middleware/JwtAuthMiddleware.php

@@ -28,7 +28,7 @@ class JwtAuthMiddleware
                     'message' => 'token is required',
                     'code' => 401,
                 ];
-                return response()->json($error);
+                return response()->json($error)->setStatusCode(401);
             }
             $data = JWTAuth::decode($token)['user'];
             //检测token是否存在黑名单中
@@ -37,7 +37,7 @@ class JwtAuthMiddleware
                     'message' => 'token in blacklist',
                     'code' => 401,
                 ];
-                return response()->json($error);
+                return response()->json($error)->setStatusCode(401);
             }
             if ($data->sign !== md5($data->uid . config('customer.jwt_secret'))) {
                 $error = [

+ 0 - 93
app/RpcClient/ProductStockRpcClient.php

@@ -1,93 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: edz
- * Date: 2019-05-07
- * Time: 11:43
- */
-
-namespace App\RpcClient;
-
-
-use Illuminate\Support\Facades\Log;
-use PhpAmqpLib\Connection\AMQPStreamConnection;
-use PhpAmqpLib\Message\AMQPMessage;
-
-class ProductStockRpcClient
-{
-    private $connection;
-    private $channel;
-    private $callback_queue;
-    private $response;
-    private $corr_id;
-    private $queue = 'rpc_product_stock_queue';
-    public function __construct()
-    {
-
-        $this->connection = new AMQPStreamConnection(env('MQ_HOST'), env('MQ_PORT'), env('MQ_USERNAME'), env('MQ_PWD'), env('MQ_VHOST'));
-
-        $this->channel = $this->connection->channel();
-        list($this->callback_queue, ,) = $this->channel->queue_declare(
-            "",
-            false,
-            true,
-            true,
-            false
-        );
-        $this->channel->basic_consume(
-            $this->callback_queue,
-            '',
-            false,
-            true,
-            false,
-            false,
-            array(
-                $this,
-                'onResponse'
-            )
-        );
-    }
-
-    public function onResponse($rep)
-    {
-        if ($rep->get('correlation_id') == $this->corr_id) {
-            $this->response = $rep->body;
-        }
-    }
-
-    /**
-     * @param $param
-     * $array = [
-            ['sku_id' => 1, 'quantity' => -2],
-            ['sku_id' => 2, 'quantity' => -1]
-        ];
-     * @return null
-     * @throws \ErrorException
-     */
-    public function call($param)
-    {
-        Log::debug('开始调用');
-        $this->response = null;
-        $this->corr_id = uniqid();
-        $msg = new AMQPMessage(
-            (string)$param,
-            array(
-                'correlation_id' => $this->corr_id,
-                'reply_to' => $this->callback_queue
-            )
-        );
-        Log::debug('生成msg对象'.\GuzzleHttp\json_encode($msg));
-        $this->channel->basic_publish($msg, '', $this->queue);
-        Log::debug('发送消息');
-        while (!$this->response) {
-            $this->channel->wait();
-        }
-        return $this->response;
-    }
-    public function __destruct()
-    {
-        // TODO: Implement __destruct() method.
-        $this->channel->close();
-        $this->connection->close();
-    }
-}

+ 0 - 5
bootstrap/app.php

@@ -108,9 +108,4 @@ $app->router->group([
     require __DIR__.'/../routes/web.php';
 });
 
-
-$app->register(Hhxsv5\LaravelS\Illuminate\LaravelSServiceProvider::class);
-
-$app->register(Yansongda\LaravelPay\PayServiceProvider::class);
-
 return $app;

+ 0 - 2
routes/api.php

@@ -16,8 +16,6 @@ $api = app('Dingo\Api\Routing\Router');
 $api->version('v1', [
     'namespace' => 'App\Http\Controllers\V1',
 ], function ($api) {
-    //测试
-    $api->get('test', 'TestController@index');
 
     //登录+验签
     $api->group(['middleware' => ['chxq_jwt_auth','chxq_sign']], function ($api) {