Quellcode durchsuchen

Wesmiler 人人车 初始化项目 0816

APPLE vor 3 Jahren
Ursprung
Commit
6736763352

+ 2 - 2
application/admin/controller/store/Taxi.php

@@ -88,7 +88,7 @@ class Taxi extends AdminController
             'taxi_user_id|所属司机' => 'require',
             'name|用车标题' => 'require',
             'cover_img|展示图片' => 'require',
-            'price|价格' => 'require',
+//            'price|价格' => 'require',
             'plate_number|车牌号' => 'require',
             'vehicle|车辆类型' => 'require'
         ]);
@@ -130,7 +130,7 @@ class Taxi extends AdminController
                 'cover_img|展示图片' => 'require',
                 'area|服务区域' => 'require',
                 'time_slot|服务时间' => 'require',
-                'price|价格' => 'require',
+//                'price|价格' => 'require',
                 'plate_number|车牌号' => 'require',
                 'vehicle|车辆类型' => 'require'
             ]);

+ 1 - 1
application/api/controller/v1/TaxiServiceCategory.php

@@ -24,7 +24,7 @@ class TaxiServiceCategory extends ApiController
         $params['page'] = input('page/d', 1);
         $params['limit'] = input('limit/d', 10);
 
-        $list = $this->model->field('id,name,image,url,type')
+        $list = $this->model->field('id,name,image,url,price,type')
             ->where('status', 1)
             ->page($params['page'], $params['limit'])
             ->select();

+ 3 - 3
public/manage/pages/store/taxi-service-category.html

@@ -81,9 +81,9 @@
                                 </div>
                             </div>
                             <div class="layui-form-item">
-                                <label class="layui-form-label layui-form-required">预估价格梯度</label>
+                                <label class="layui-form-label layui-form-required">价格梯度</label>
                                 <div class="layui-input-block">
-                                    <input name="price" placeholder="请输入预估价格梯度(如:0-1:2,1-3:3.5)" type="text" class="layui-input"
+                                    <input name="price" placeholder="请输入预估价格梯度(如:公里数:价格,公里数:价格)" type="text" class="layui-input"
                                            maxlength="80"
                                            lay-verType="tips" lay-verify="required" required/>
                                 </div>
@@ -200,7 +200,7 @@
                     }, width: 150
                 },
                 {field: 'name', title: '名称', width: 200},
-                {field: 'price', title: '预估价格梯度/元', width: 200},
+                {field: 'price', title: '价格梯度/元', width: 200},
                 {field: 'weigh', title: '权重'},
                 {
                     field: 'created_at', sort: true, templet: function (d) {

+ 7 - 7
public/manage/pages/store/taxi.html

@@ -90,21 +90,21 @@
                        lay-verType="tips" lay-verify="required" required/>
             </div>
         </div>
-        <div class="layui-form-item">
+        <!--<div class="layui-form-item">
             <label class="layui-form-label layui-form-required">用车价格</label>
             <div class="layui-input-block">
                 <input name="price" placeholder="请输入用车价格" type="number" class="layui-input" maxlength="20"
                        lay-verType="tips" lay-verify="required" required/>
             </div>
-        </div>
-        <div class="layui-form-item">
+        </div>-->
+        <!--<div class="layui-form-item">
             <label class="layui-form-label layui-form-required">价格阶梯</label>
             <div class="layui-input-block">
                 <input name="gradient" placeholder="请输入价格阶梯, 5km收十块 (5:10)" type="text" class="layui-input" maxlength="80"
                        lay-verType="tips" lay-verify="required" required/>
                 <div class="layui-word-aux">请输入价格阶梯,(公里数:价格,公里数:价格)</div>
             </div>
-        </div>
+        </div>-->
         <div class="layui-form-item">
             <label class="layui-form-label layui-form-required">车牌号</label>
             <div class="layui-input-block">
@@ -194,10 +194,10 @@
                     }, width: 150},
                 {field: 'area', title: '服务区域'},
                 {field: 'time_slot', title: '服务时间段'},
-                {field: 'price', title: '价格', templet: function (d) {
+            /*    {field: 'price', title: '价格', templet: function (d) {
                         return "&yen;" + d.price;
-                    }},
-                {field: 'gradient', title: '价格梯度', width: 200},
+                    }},*/
+                // {field: 'gradient', title: '价格梯度', width: 200},
                 {field: 'vehicle', title: '车型',templet:function(d){
                     //0:三轮车 1:电动车 2:小轿车 3:货车
                         var cle = "未知";

+ 0 - 186
vendor/lcobucci/jwt/test/functional/HmacTokenTest.php

@@ -1,186 +0,0 @@
-<?php
-/**
- * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS
- *
- * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
- */
-
-namespace Lcobucci\JWT\FunctionalTests;
-
-use Lcobucci\JWT\Builder;
-use Lcobucci\JWT\Parser;
-use Lcobucci\JWT\Token;
-use Lcobucci\JWT\Signature;
-use Lcobucci\JWT\Signer\Hmac\Sha256;
-use Lcobucci\JWT\Signer\Hmac\Sha512;
-
-/**
- * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
- * @since 2.1.0
- */
-class HmacTokenTest extends \PHPUnit\Framework\TestCase
-{
-    /**
-     * @var Sha256
-     */
-    private $signer;
-
-    /**
-     * @before
-     */
-    public function createSigner()
-    {
-        $this->signer = new Sha256();
-    }
-
-    /**
-     * @test
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Signer\Key
-     * @covers Lcobucci\JWT\Signer\BaseSigner
-     * @covers Lcobucci\JWT\Signer\Hmac
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
-     */
-    public function builderCanGenerateAToken()
-    {
-        $user = (object) ['name' => 'testing', 'email' => 'testing@abc.com'];
-
-        $token = (new Builder())->setId(1)
-                              ->setAudience('http://client.abc.com')
-                              ->setIssuer('http://api.abc.com')
-                              ->set('user', $user)
-                              ->setHeader('jki', '1234')
-                              ->sign($this->signer, 'testing')
-                              ->getToken();
-
-        $this->assertAttributeInstanceOf(Signature::class, 'signature', $token);
-        $this->assertEquals('1234', $token->getHeader('jki'));
-        $this->assertEquals('http://client.abc.com', $token->getClaim('aud'));
-        $this->assertEquals('http://api.abc.com', $token->getClaim('iss'));
-        $this->assertEquals($user, $token->getClaim('user'));
-
-        return $token;
-    }
-
-    /**
-     * @test
-     *
-     * @depends builderCanGenerateAToken
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Parser
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Parsing\Decoder
-     */
-    public function parserCanReadAToken(Token $generated)
-    {
-        $read = (new Parser())->parse((string) $generated);
-
-        $this->assertEquals($generated, $read);
-        $this->assertEquals('testing', $read->getClaim('user')->name);
-    }
-
-    /**
-     * @test
-     *
-     * @depends builderCanGenerateAToken
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Parser
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Signer\Key
-     * @covers Lcobucci\JWT\Signer\BaseSigner
-     * @covers Lcobucci\JWT\Signer\Hmac
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
-     */
-    public function verifyShouldReturnFalseWhenKeyIsNotRight(Token $token)
-    {
-        $this->assertFalse($token->verify($this->signer, 'testing1'));
-    }
-
-    /**
-     * @test
-     *
-     * @depends builderCanGenerateAToken
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Parser
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Signer\Key
-     * @covers Lcobucci\JWT\Signer\BaseSigner
-     * @covers Lcobucci\JWT\Signer\Hmac
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha512
-     */
-    public function verifyShouldReturnFalseWhenAlgorithmIsDifferent(Token $token)
-    {
-        $this->assertFalse($token->verify(new Sha512(), 'testing'));
-    }
-
-    /**
-     * @test
-     *
-     * @depends builderCanGenerateAToken
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Parser
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Signer\Key
-     * @covers Lcobucci\JWT\Signer\BaseSigner
-     * @covers Lcobucci\JWT\Signer\Hmac
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
-     */
-    public function verifyShouldReturnTrueWhenKeyIsRight(Token $token)
-    {
-        $this->assertTrue($token->verify($this->signer, 'testing'));
-    }
-
-    /**
-     * @test
-     *
-     * @covers Lcobucci\JWT\Builder
-     * @covers Lcobucci\JWT\Parser
-     * @covers Lcobucci\JWT\Token
-     * @covers Lcobucci\JWT\Signature
-     * @covers Lcobucci\JWT\Signer\Key
-     * @covers Lcobucci\JWT\Signer\BaseSigner
-     * @covers Lcobucci\JWT\Signer\Hmac
-     * @covers Lcobucci\JWT\Signer\Hmac\Sha256
-     * @covers Lcobucci\JWT\Claim\Factory
-     * @covers Lcobucci\JWT\Claim\Basic
-     * @covers Lcobucci\JWT\Parsing\Encoder
-     * @covers Lcobucci\JWT\Parsing\Decoder
-     */
-    public function everythingShouldWorkWhenUsingATokenGeneratedByOtherLibs()
-    {
-        $data = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXUyJ9.eyJoZWxsbyI6IndvcmxkIn0.Rh'
-                . '7AEgqCB7zae1PkgIlvOpeyw9Ab8NGTbeOH7heHO0o';
-
-        $token = (new Parser())->parse((string) $data);
-
-        $this->assertEquals('world', $token->getClaim('hello'));
-        $this->assertTrue($token->verify($this->signer, 'testing'));
-    }
-}

+ 0 - 225
vendor/lettered/support/src/Uploader.php

@@ -1,225 +0,0 @@
-<?php
-
-namespace Lettered\Support;
-
-use Lettered\Support\Exceptions\EvidentException;
-use think\File;
-
-class Uploader
-{
-    /**
-     * @var array|mixed
-     */
-    protected $config = [];
-
-    /**
-     * @var string
-     */
-    protected $driver = 'local';
-
-    /**
-     * @var string
-     */
-    protected $path = '';
-
-    /**
-     * @var string
-     */
-    protected $saveName = "";
-
-    /**
-     * Auth constructor.
-     * @param array $config
-     */
-    public function __construct($config = [])
-    {
-        if (empty($config)){
-            $this->config = config('upload.');
-        }else{
-            $this->config = $config;
-        }
-
-    }
-
-    /**
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:32
-     *
-     * @param $path
-     * @return $this
-     */
-    public function setPath($path)
-    {
-        $this->path = $path;
-
-        return $this;
-    }
-
-    /**
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:32
-     *
-     * @return mixed
-     */
-    public function getPath()
-    {
-        return $this->path;
-    }
-
-    /**
-     * 指定存储名
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/7/2 10:05
-     *
-     * @param $name
-     * @return $this
-     */
-    public function setName($name){
-
-        $this->saveName = $name;
-
-        return $this;
-    }
-
-    /**
-     * 指定驱动
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:24
-     *
-     * @param string $driver
-     * @return $this
-     */
-    public function setDriver($driver)
-    {
-        $this->driver = $driver;
-
-        return $this;
-    }
-
-    /**
-     * 获取驱动
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:25
-     *
-     * @return string
-     */
-    public function getDriver()
-    {
-        return $this->driver;
-    }
-
-    /**
-     * 自己的验证
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/9/20 19:28
-     *
-     * @param File $file
-     * @return mixed
-     * @throws EvidentException
-     */
-    private function validate(File $file)
-    {
-        // 文件信息
-        $fileinfo = $file->getInfo();
-        // 文件后缀
-        $ext =  get_file_ext($fileinfo['name']);
-        // 组合上传类型
-        $extension = $this->config['upload_file_ext'] . "," . $this->config['upload_image_ext'];
-        // 格式和大小检查
-        if ($fileinfo['size'] > (int)($this->config['upload_file_size'] ?: 1e9) * 1024){
-            throw new EvidentException([
-                'errmsg' => '[local] upload fail: 上传文件大小超过限制'
-            ]);
-        }
-        if (!in_array($ext, str2arr($extension))){
-            throw new EvidentException([
-                'errmsg' => '[local] upload fail: 不支持的上传文件类型'
-            ]);
-        }
-        return $fileinfo;
-    }
-    /**
-     * 上传
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:22
-     *
-     * @param File $file
-     * @return mixed
-     */
-    public function upload(File $file)
-    {
-        // 调用驱动上传--返回文件名称
-        $filename = $this->{$this->getDriver()}($file);
-        return [
-            'path' => $this->getPath(),
-            'url' => $filename,
-            'size' => $file->getInfo()['size'],
-            'driver' => $this->getDriver()
-        ];
-    }
-
-    /**
-     * 本地上传
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:40
-     *
-     * @param File $file
-     * @return mixed
-     * @throws EvidentException
-     */
-    private function local(File $file)
-    {
-        // 自己先验证一遍
-        $this->validate($file);
-        // 组合上传类型
-        $extension = $this->config['upload_file_ext'] . "," . $this->config['upload_image_ext'];
-        // 移动到框架应用根目录/uploads/ 目录下
-        $result = $file->validate(['size' => ($this->config['upload_file_size'] ?: 1e9) * 1024,'ext' => $extension])->move(
-            'uploads' . $this->getPath(),
-            $this->saveName != "" ? $this->saveName : md5(time() . $file->hash())
-        );
-        if (!$result){
-            throw new EvidentException([
-               'errmsg' => '[local] upload fail:' . $file->getError()
-            ]);
-        }
-        return $result->getSaveName();
-    }
-
-    /**
-     *
-     * @author 许祖兴 < zuxing.xu@lettered.cn>
-     * @date 2020/3/20 0:53
-     *
-     * @param File $file
-     * @return string|null
-     * @throws \Exception
-     */
-    private function qiniu(File $file)
-    {
-        // 验证
-        $fileinfo = $this->validate($file);
-        // 文件后缀
-        $ext =  get_file_ext($fileinfo['name']);
-        // 上传到七牛后保存的文件名
-        $filename = strtolower(get_rand_char()) .'.'. $ext;
-        // 文件夹处理
-        $filepath = $this->getPath();
-        $filepath =  ($filepath == "/") ? "" : (substr($filepath, 1 ) . "/");
-
-        // QiniuMgr 初始化
-        $QiniuMgr = new QiniuMgr($this->config['qiniu']);
-        $QiniuMgr->upload($filepath . $filename,$file->getInfo()['tmp_name']);
-
-        return $filename;
-
-    }
-}

+ 130 - 0
vendor/lettered/support/src/WebPush.php

@@ -0,0 +1,130 @@
+<?php
+
+
+namespace Lettered\Support;
+
+
+class WebPush
+{
+    /**
+     * @var string restUrl
+     */
+    protected $restUrl = 'http://webpush.lettered.cn/publish';
+
+    private $appKey = null;
+
+    private $channel = null;
+
+    protected static $instance = null;
+
+    /**
+     * WebPush constructor.
+     * @param string $key
+     * @param string $channel
+     */
+    private function __construct($key, $channel)
+    {
+        $this->appKey = $key;
+
+        $this->channel = $channel;
+    }
+
+    /**
+     * 单例初始化
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/3/23 16:05
+     *
+     * @param $key
+     * @param $channel
+     * @return Goeasy|null
+     */
+    public static function init($key, $channel)
+    {
+        if (is_null(self::$instance)){
+            self::$instance = new self($key, $channel);
+        }
+        return self::$instance;
+    }
+
+    /**
+     * 消息推送
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/3/23 16:01
+     *
+     * @param array $content 消息内容
+     * @return bool|string
+     */
+    public function send($content = [])
+    {
+        return $this->curlPost($this->restUrl, [
+            'token' => $this->appKey,
+            'channel' => $this->channel,
+            'content' => json_encode($content)
+        ]);
+    }
+
+    /**
+     * curlGet
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/3/19 18:48
+     *
+     * @param string $url 请求地址
+     * @param array $options 选填
+     * @return bool|string
+     */
+    private static function curlGet($url = '', $options = [])
+    {
+        $ch = curl_init($url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
+        if (!empty($options)) {
+            curl_setopt_array($ch, $options);
+        }
+        //https请求 不验证证书和host
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        $data = curl_exec($ch);
+        curl_close($ch);
+        return $data;
+    }
+
+    /**
+     * curlPost
+     *
+     * @author 许祖兴 < zuxing.xu@lettered.cn>
+     * @date 2020/3/19 18:48
+     *
+     * @param string $url 请求url
+     * @param string|array $postData 请求数据
+     * @param array $options 选填
+     * @return bool|string
+     */
+    private function curlPost($url = '', $postData = '', $options = [])
+    {
+        if (is_array($postData)) {
+            $postData = http_build_query($postData);
+        }
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
+        curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置cURL允许执行的最长秒数
+        if (!empty($options)) {
+            curl_setopt_array($ch, $options);
+        }
+        //https请求 不验证证书和host
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+        // 设置请求头
+        curl_setopt($ch, CURLOPT_HTTPHEADER, [
+            'Content-type:application/x-www-form-urlencoded'
+        ]);
+        $data = curl_exec($ch);
+        curl_close($ch);
+        return $data;
+    }
+}

+ 53 - 0
vendor/qeq66/jwt/test/functional/Keys.php

@@ -0,0 +1,53 @@
+<?php
+namespace Lcobucci\JWT;
+
+use Lcobucci\JWT\Signer\Keychain;
+
+/**
+ * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com>
+ */
+trait Keys
+{
+    /**
+     * @var array
+     */
+    protected static $rsaKeys;
+
+    /**
+     * @var array
+     */
+    protected static $ecdsaKeys;
+
+    /**
+     * @beforeClass
+     */
+    public static function createRsaKeys()
+    {
+        $keychain = new Keychain();
+        $dir = 'file://' . __DIR__;
+
+        static::$rsaKeys = [
+            'private' => $keychain->getPrivateKey($dir . '/rsa/private.key'),
+            'public' => $keychain->getPublicKey($dir . '/rsa/public.key'),
+            'encrypted-private' => $keychain->getPrivateKey($dir . '/rsa/encrypted-private.key', 'testing'),
+            'encrypted-public' => $keychain->getPublicKey($dir . '/rsa/encrypted-public.key')
+        ];
+    }
+
+    /**
+     * @beforeClass
+     */
+    public static function createEcdsaKeys()
+    {
+        $keychain = new Keychain();
+        $dir = 'file://' . __DIR__;
+
+        static::$ecdsaKeys = [
+            'private' => $keychain->getPrivateKey($dir . '/ecdsa/private.key'),
+            'private-params' => $keychain->getPrivateKey($dir . '/ecdsa/private2.key'),
+            'public1' => $keychain->getPublicKey($dir . '/ecdsa/public1.key'),
+            'public2' => $keychain->getPublicKey($dir . '/ecdsa/public2.key'),
+            'public-params' => $keychain->getPublicKey($dir . '/ecdsa/public3.key'),
+        ];
+    }
+}