Просмотр исходного кода

1.完善节点单端口多用户配置(感谢杜若言叶测试)
2.paypal支付代码完善(还没做好)

zhangjiangbin 8 лет назад
Родитель
Сommit
04340bd4cd

+ 6 - 2
app/Http/Controllers/AdminController.php

@@ -403,6 +403,7 @@ class AdminController extends Controller
             $single_passwd = $request->get('single_passwd');
             $single_method = $request->get('single_method');
             $single_protocol = $request->get('single_protocol');
+            $single_obfs = $request->get('single_obfs');
             $sort = $request->get('sort');
             $status = $request->get('status');
 
@@ -429,6 +430,7 @@ class AdminController extends Controller
                 'single_passwd'   => $single ? $single_passwd : '',
                 'single_method'   => $single ? $single_method : '',
                 'single_protocol' => $single ? $single_protocol : '',
+                'single_obfs'     => $single ? $single_obfs : '',
                 'sort'            => $sort,
                 'status'          => $status,
             ]);
@@ -482,6 +484,7 @@ class AdminController extends Controller
             $single_passwd = $request->get('single_passwd');
             $single_method = $request->get('single_method');
             $single_protocol = $request->get('single_protocol');
+            $single_obfs = $request->get('single_obfs');
             $sort = $request->get('sort');
             $status = $request->get('status');
 
@@ -508,6 +511,7 @@ class AdminController extends Controller
                 'single_passwd'   => $single ? $single_passwd : '',
                 'single_method'   => $single ? $single_method : '',
                 'single_protocol' => $single ? $single_protocol : '',
+                'single_obfs'     => $single ? $single_obfs : '',
                 'sort'            => $sort,
                 'status'          => $status
             ];
@@ -1038,7 +1042,7 @@ class AdminController extends Controller
             $ssr_str = '';
             $ssr_str .= $node->server . ':' . ($node->single ? $node->single_port : $user->port);
             $ssr_str .= ':' . ($node->single ? $node->single_protocol : $user->protocol) . ':' . ($node->single ? $node->single_method : $user->method);
-            $ssr_str .= ':' . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
+            $ssr_str .= ':' . ($node->single ? $node->single_obfs : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : $this->base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? $this->base64url_encode($user->port . ':' . $user->passwd) : $this->base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . $this->base64url_encode($node->name);
@@ -1062,7 +1066,7 @@ class AdminController extends Controller
             $txt .= "加密方法:" . ($node->single ? $node->single_method : $user->method) . "\r\n";
             $txt .= "协议:" . ($node->single ? $node->single_protocol : $user->protocol) . "\r\n";
             $txt .= "协议参数:" . ($node->single ? $user->port . ':' . $user->passwd : $user->protocol_param) . "\r\n";
-            $txt .= "混淆方式:" . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . "\r\n";
+            $txt .= "混淆方式:" . ($node->single ? $node->single_obfs : $user->obfs) . "\r\n";
             $txt .= "混淆参数:" . ($node->single ? '' : $user->obfs_param) . "\r\n";
             $txt .= "本地端口:1080\r\n路由:绕过局域网及中国大陆地址";
 

+ 78 - 82
app/Http/Controllers/PaymentController.php

@@ -1,11 +1,13 @@
 <?php
 namespace App\Http\Controllers;
 
+use App\Http\Models\Goods;
+use App\Http\Models\Paypal;
 use Illuminate\Http\Request;
 use Response;
 use Redirect;
-use Captcha;
 use Cache;
+use Log;
 
 use PayPal\Api\Amount;
 use PayPal\Api\Details;
@@ -33,11 +35,11 @@ class PaymentController extends Controller
             new OAuthTokenCredential(self::$config['paypal_client_id'], self::$config['paypal_client_secret'])
         );
         $this->apiContext->setConfig([
-            'mode' => 'sandbox',
+            'mode'           => 'sandbox',
             'log.LogEnabled' => true,
-            'log.FileName' => storage_path('logs/paypal.log'),
-            'log.LogLevel' => 'DEBUG', // PLEASE USE `INFO` LEVEL FOR LOGGING IN LIVE ENVIRONMENTS
-            'cache.enabled' => true,
+            'log.FileName'   => storage_path('logs/paypal.log'),
+            'log.LogLevel'   => 'DEBUG', // 测试DEBUG,生产环境INFO
+            'cache.enabled'  => true,
             // 'http.CURLOPT_CONNECTTIMEOUT' => 30
             // 'http.headers.PayPal-Partner-Attribution-Id' => '123123123'
             //'log.AdapterFactory' => '\PayPal\Log\DefaultLogFactory' // Factory class implementing \PayPal\Log\PayPalLogFactory
@@ -47,133 +49,112 @@ class PaymentController extends Controller
     // 创建支付
     public function create(Request $request)
     {
+        $oid = $request->get('oid');
+        $goods_id = $request->get('goods_id');
+        $user = $request->session()->get('user');
+
+        // 商品信息
+        $goods = Goods::query()->where('id', $goods_id)->first();
+        if (!$goods) {
+            //TODO:购买商品页需要做判断,出现异常时挂掉
+            $request->session()->flash('paypalErrorMsg', '创建支付订单失败:所购服务不存在');
+
+            return Redirect::back();
+        }
+
+        // 设置支付信息
         $payer = new Payer();
         $payer->setPaymentMethod("paypal");
 
-        // 商品1
+        // 设置所购商品信息,包含名称、数量、SKU、价格
         $item1 = new Item();
-        $item1->setName('Ground Coffee 40 oz')
-            ->setCurrency('USD')
-            ->setQuantity(1)
-            ->setSku("123123")
-            ->setPrice(20);
-
-        // 商品2
-        $item2 = new Item();
-        $item2->setName('Granola bars')
-            ->setCurrency('USD')
-            ->setQuantity(5)
-            ->setSku("456456")
-            ->setPrice(10);
-
-        // 写入商品列表
-        $itemList = new ItemList();
-        $itemList->setItems([$item1, $item2]);
+        $item1->setName($goods->name)->setCurrency('USD')->setQuantity(1)->setSku($goods->sku)->setPrice($goods->price / 100);
 
+        $itemList = new ItemList();
+        $itemList->setItems([$item1]);
 
+        /*
         // 设定收货地址信息,防止用户自付款时可改
         $address = new ShippingAddress();
-        $address->setRecipientName('什么名字')
-            ->setLine1('什么街什么路什么小区')
-            ->setLine2('什么单元什么号')
-            ->setCity('城市名')
+        $address->setRecipientName($user['username'])
+            ->setLine1('余杭区')
+            ->setLine2('文一西路969号西溪园区')
+            ->setCity('杭州市')
             ->setState('浙江省')
-            ->setPhone('12345678911')
-            ->setPostalCode('12345')
+            ->setPhone('+8613800000000')
+            ->setPostalCode('311100')
             ->setCountryCode('CN');
 
         // 商品列表写入设定好的地址信息
         $itemList->setShippingAddress($address);
+        */
 
-        // 订单详情,带入运费和税,小计
+        // 设置单据运费、税费、小计算
         $details = new Details();
-        $details->setShipping(5)
-            ->setTax(10)
-            ->setSubtotal(70);
+        $details->setShipping(0)->setTax(0)->setSubtotal($goods->price / 100);
 
         // 设定单据金额
         $amount = new Amount();
-        $amount->setCurrency("USD")
-            ->setTotal(85)
-            ->setDetails($details);
-
-        // 设定交易描述
-        $transaction = new Transaction();
-        $transaction->setAmount($amount)
-            ->setItemList($itemList)
-            ->setDescription("测试支付")
-            ->setInvoiceNumber(uniqid());
+        $amount->setCurrency("USD")->setTotal($goods->price / 100)->setDetails($details);
 
         // 跳转页
         $redirectUrls = new RedirectUrls();
-        $redirectUrls->setReturnUrl(url("payment/execute"))
-            ->setCancelUrl(url("payment/cancel"));
+        $redirectUrls->setReturnUrl(url("payment/execute?subtotal=" . $goods->price / 100))->setCancelUrl(url("payment/cancel"));
 
-        // 整个订单
-        $payment = new Payment();
-        $payment->setIntent("sale")
-            ->setPayer($payer)
-            ->setRedirectUrls($redirectUrls)
-            ->setTransactions([$transaction]);
-
-
-// For Sample Purposes Only.
-        $payment_request = clone $payment;
+        // 设定交易描述
+        $transaction = new Transaction();
+        $transaction->setAmount($amount)->setItemList($itemList)->setDescription("购买虚拟服务")->setInvoiceNumber(uniqid());
 
         // 创建支付
+        $payment = new Payment();
+        $payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions([$transaction]);
         try {
             $payment->create($this->apiContext);
         } catch (\Exception $ex) {
-            var_dump($ex);
-            exit(1);
+            Log::error($ex->getMessage());
+            Log::error('PayPal授权失败,可能是接口配置错误');
+
+            $request->session()->flash('paypalErrorMsg', 'PayPal授权失败,可能是接口配置错误');
+
+            return Redirect::back();
         }
 
         // 得到支付授权跳转页(给用户点确认付款用)
         $approvalUrl = $payment->getApprovalLink();
 
-        \Log::info($approvalUrl);
-        \Log::info('22222'.var_export($payment_request, true));
-        \Log::info('33333'.var_export($payment, true));
-
-        return $payment;
+        return Redirect::to($approvalUrl);
     }
 
     // 执行支付
     public function execute(Request $request)
     {
-        \Log::info('execute_params:'.var_export($request->all(), true));
+        \Log::info('execute_params:' . var_export($request->all(), true));
 
+        $subtotal = $request->get('subtotal');
         $paymentId = $request->get('paymentId');
         $token = $request->get('token');
         $PayerID = $request->get('PayerID');
 
-        // ### Approval Status
-// Determine if the user approved the payment or not
-\Log::info($paymentId);
-\Log::info($token);
-\Log::info($PayerID);
         if (empty($paymentId) || empty($token) || empty($PayerID)) {
-            exit("return_url支付回调地址错误");
+            $request->session()->flash('paypalErrorMsg', '支付回调地址错误');
+
+            return Redirect::to('user/goodsList');
         } else {
-            // 支付
+            // 根据支付单据获取支付信息
             $payment = Payment::get($paymentId, $this->apiContext);
 
-            // 执行支付
-            $execution = new PaymentExecution();
-            $execution->setPayerId($PayerID);
-
-            $transaction = new Transaction();
-
             $details = new Details();
-            $details->setShipping(5)->setTax(10)->setSubtotal(70);
+            $details->setShipping(0)->setTax(0)->setSubtotal($subtotal);
 
             $amount = new Amount();
-            $amount->setCurrency('USD');
-            $amount->setTotal(85);
-            $amount->setDetails($details);
+            $amount->setCurrency('USD')->setTotal($subtotal)->setDetails($details);
+
+            $transaction = new Transaction();
             $transaction->setAmount($amount);
 
-            $execution->addTransaction($transaction);
+            // 执行支付
+            $execution = new PaymentExecution();
+            $execution->setPayerId($PayerID)->addTransaction($transaction);
 
             try {
                 $result = $payment->execute($execution, $this->apiContext);
@@ -181,6 +162,7 @@ class PaymentController extends Controller
 
                 // 支付成功,写入支付单据信息
 
+
             } catch (\Exception $ex) {
                 var_dump($ex);
                 echo "支付失败";
@@ -204,6 +186,20 @@ class PaymentController extends Controller
     // 查询支付状态
     public function query()
     {
-        
+
+    }
+
+    // 写入日志
+    private function log($oid, $invoice_number = '', $items = '', $response_data = '', $error = '')
+    {
+        $paypal = new Paypal();
+        $paypal->oid = $oid;
+        $paypal->invoice_number = $invoice_number;
+        $paypal->items = $items;
+        $paypal->response_data = $response_data;
+        $paypal->error = $error;
+        $paypal->save();
+
+        return $paypal->id;
     }
 }

+ 4 - 0
app/Http/Controllers/ShopController.php

@@ -84,6 +84,10 @@ class ShopController extends Controller
             $obj->save();
 
             if ($obj->id) {
+                // 生成SKU
+                $obj->sku = 'S0000' . $obj->id;
+                $obj->save();
+
                 $request->session()->flash('successMsg', '添加成功');
             } else {
                 $request->session()->flash('errorMsg', '添加失败');

+ 3 - 3
app/Http/Controllers/SubscribeController.php

@@ -35,12 +35,12 @@ class SubscribeController extends Controller
         // 校验合法性
         $subscribe = UserSubscribe::query()->where('code', $code)->where('status', 1)->with('user')->first();
         if (empty($subscribe)) {
-            exit('非法请求或者被禁用,请联系管理员');
+            exit('非法请求或已被封禁,请联系管理员');
         }
 
         $user = User::query()->where('id', $subscribe->user_id)->whereIn('status', [0, 1])->where('enable', 1)->first();
         if (empty($user)) {
-            exit('非法请求或者被禁用,请联系管理员');
+            exit('非法请求或已被封禁,请联系管理员');
         }
 
         // 更新访问次数
@@ -71,7 +71,7 @@ class SubscribeController extends Controller
             $ssr_str = '';
             $ssr_str .= $node->server . ':' . ($node->single ? $node->single_port : $user->port);
             $ssr_str .= ':' . ($node->single ? $node->single_protocol : $user->protocol) . ':' . ($node->single ? $node->single_method : $user->method);
-            $ssr_str .= ':' . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
+            $ssr_str .= ':' . ($node->single ? $node->single_obfs : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : $this->base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? $this->base64url_encode($user->port . ':' . $user->passwd) : $this->base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . $this->base64url_encode($node->name);

+ 2 - 2
app/Http/Controllers/UserController.php

@@ -79,7 +79,7 @@ class UserController extends Controller
             $ssr_str = '';
             $ssr_str .= $node->server . ':' . ($node->single ? $node->single_port : $user->port);
             $ssr_str .= ':' . ($node->single ? $node->single_protocol : $user->protocol) . ':' . ($node->single ? $node->single_method : $user->method);
-            $ssr_str .= ':' . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
+            $ssr_str .= ':' . ($node->single ? $node->single_obfs : $user->obfs) . ':' . ($node->single ? $this->base64url_encode($node->single_passwd) : $this->base64url_encode($user->passwd));
             $ssr_str .= '/?obfsparam=' . ($node->single ? '' : $this->base64url_encode($obfs_param));
             $ssr_str .= '&protoparam=' . ($node->single ? $this->base64url_encode($user->port . ':' . $user->passwd) : $this->base64url_encode($protocol_param));
             $ssr_str .= '&remarks=' . $this->base64url_encode($node->name);
@@ -103,7 +103,7 @@ class UserController extends Controller
             $txt .= "加密方法:" . ($node->single ? $node->single_method : $user->method) . "\r\n";
             $txt .= "协议:" . ($node->single ? $node->single_protocol : $user->protocol) . "\r\n";
             $txt .= "协议参数:" . ($node->single ? $user->port . ':' . $user->passwd : $user->protocol_param) . "\r\n";
-            $txt .= "混淆方式:" . ($node->single ? 'tls1.2_ticket_auth' : $user->obfs) . "\r\n";
+            $txt .= "混淆方式:" . ($node->single ? $node->single_obfs : $user->obfs) . "\r\n";
             $txt .= "混淆参数:" . ($node->single ? '' : $user->obfs_param) . "\r\n";
             $txt .= "本地端口:1080\r\n路由:绕过局域网及中国大陆地址";
 

+ 1 - 0
app/Http/Models/Goods.php

@@ -14,6 +14,7 @@ class Goods extends Model
     protected $table = 'goods';
     protected $primaryKey = 'id';
     protected $fillable = [
+        'sku',
         'name',
         'logo',
         'traffic',

+ 24 - 0
app/Http/Models/Paypal.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * Paypal支付订单
+ * Class Paypal
+ * @package App\Http\Models
+ */
+class Paypal extends Model
+{
+    protected $table = 'paypal';
+    protected $primaryKey = 'id';
+    protected $fillable = [
+        'oid',
+        'invoice_number',
+        'items',
+        'response_data',
+        'error',
+    ];
+
+}

+ 1 - 0
app/Http/Models/SsNode.php

@@ -36,6 +36,7 @@ class SsNode extends Model
         'single_passwd',
         'single_method',
         'single_protocol',
+        'single_obfs',
         'sort',
         'status'
     ];

+ 5 - 21
readme.md

@@ -191,9 +191,9 @@ vim user-config.json
     "80": {
         "passwd": "统一认证密码", // 例如 SSRP4ne1,推荐不要出现除大小写字母数字以外的任何字符
         "method": "统一认证加密方式", // 例如 aes-128-ctr
-        "protocol": "统一认证协议", // 例如 auth_aes128_md5 或者 auth_aes128_sha1 或 auth_chain_a,其他没试过,请自行测试
+        "protocol": "统一认证协议", // 可选值:orgin、verify_deflate、auth_sha1_v4、auth_aes128_md5(推荐)、auth_aes128_sha1(推荐)、auth_chain_a(强烈推荐)
         "protocol_param": "#",
-        "obfs": "tls1.2_ticket_auth_compatible",
+        "obfs": "tls1.2_ticket_auth", // 可选值:plain、http_simple(该值下客户端可用http_post)、random_head、tls1.2_ticket_auth(强烈推荐)
         "obfs_param": ""
     },
     "443": {
@@ -201,7 +201,7 @@ vim user-config.json
         "method": "统一认证加密方式",
         "protocol": "统一认证协议",
         "protocol_param": "#",
-        "obfs": "tls1.2_ticket_auth_compatible",
+        "obfs": "tls1.2_ticket_auth",
         "obfs_param": ""
     }
 },
@@ -225,9 +225,7 @@ vim user-config.json
 混淆插件:tls1.2_ticket_auth
 协议参数:1026:SSRP4ne1 (SSR端口:SSR密码)
 
-经实测账号的协议可以是:auth_chain_a
-建议节点后端使用auth_sha1_v4_compatible,方便兼容
-
+经实测,节点后端使用auth_sha1_v4_compatible,可以兼容auth_chain_a
 注意:如果想强制所有账号都走80、443这样自定义的端口的话,记得把 user-config.json 中的 additional_ports_only 设置为 true
 警告:经实测单端口下如果用锐速没有效果,很可能是VPS供应商限制了这两个端口
 提示:配置单端口最好先看下这个WIKI,防止才踩坑:https://github.com/ssrpanel/ssrpanel/wiki/%E5%8D%95%E7%AB%AF%E5%8F%A3%E5%A4%9A%E7%94%A8%E6%88%B7%E7%9A%84%E5%9D%91
@@ -242,7 +240,7 @@ vim user-config.json
 4.多面板机-多节点-数据库分离 - 打不死,隐秘性强,数据通用
 5.多棉板机-多节点-数据库主从 - 打不死,隐秘性强,数据通用,灾备
 
-具体联系我运维,收费咨询,小白勿扰
+具体联系我,直接打赏(哪个自己看着办)并备注TG号我会联系你,小白勿扰
 ````
 
 ## 校时
@@ -287,17 +285,3 @@ ntpdate cn.pool.ntp.org
 18.Paypal在线支付接口
 19.兼容SS、SSRR
 ````
-
-## 预览
-![Wpy0e.png](https://s1.ax1x.com/2017/11/24/Wpy0e.png)
-![WpUYR.png](https://s1.ax1x.com/2017/11/24/WpUYR.png)
-![WpNk9.png](https://s1.ax1x.com/2017/11/24/WpNk9.png)
-![WpGmF.png](https://s1.ax1x.com/2017/11/24/WpGmF.png)
-![WpJw4.png](https://s1.ax1x.com/2017/11/24/WpJw4.png)
-![WpYTJ.png](https://s1.ax1x.com/2017/11/24/WpYTJ.png)
-![Wpaf1.png](https://s1.ax1x.com/2017/11/24/Wpaf1.png)
-![WpwSx.png](https://s1.ax1x.com/2017/11/24/WpwSx.png)
-![Wp0l6.png](https://s1.ax1x.com/2017/11/24/Wp0l6.png)
-![WpB6K.png](https://s1.ax1x.com/2017/11/24/WpB6K.png)
-![WpDOO.png](https://s1.ax1x.com/2017/11/24/WpDOO.png)
-![WpsmD.png](https://s1.ax1x.com/2017/11/24/WpsmD.png)

+ 25 - 7
resources/views/admin/addNode.blade.php

@@ -141,9 +141,24 @@
                                                         <label for="single_protocol" class="col-md-3 control-label">[单] 协议</label>
                                                         <div class="col-md-8">
                                                             <select class="form-control" name="single_protocol" id="single_protocol">
-                                                                <option value="auth_aes128_md5" selected>auth_aes128_md5</option>
+                                                                <option value="origin">origin</option>
+                                                                <option value="verify_deflate">verify_deflate</option>
+                                                                <option value="auth_sha1_v4">auth_sha1_v4</option>
+                                                                <option value="auth_aes128_md5">auth_aes128_md5</option>
                                                                 <option value="auth_aes128_sha1">auth_aes128_sha1</option>
-                                                                <option value="auth_chain_a">auth_chain_a</option>
+                                                                <option value="auth_chain_a" selected>auth_chain_a</option>
+                                                            </select>
+                                                            <span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
+                                                        </div>
+                                                    </div>
+                                                    <div class="form-group hidden single-setting">
+                                                        <label for="single_obfs" class="col-md-3 control-label">[单] 混淆</label>
+                                                        <div class="col-md-8">
+                                                            <select class="form-control" name="single_obfs" id="single_obfs">
+                                                                <option value="plain">plain</option>
+                                                                <option value="http_simple">http_simple</option>
+                                                                <option value="random_head">random_head</option>
+                                                                <option value="tls1.2_ticket_auth" selected>tls1.2_ticket_auth</option>
                                                             </select>
                                                             <span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
                                                         </div>
@@ -297,6 +312,7 @@
             var single_passwd = $('#single_passwd').val();
             var single_method = $('#single_method').val();
             var single_protocol = $('#single_protocol').val();
+            var single_obfs = $('#single_obfs').val();
             var sort = $('#sort').val();
             var status = $('#status').val();
 
@@ -304,7 +320,7 @@
                 type: "POST",
                 url: "{{url('admin/addNode')}}",
                 async: false,
-                data: {_token:'{{csrf_token()}}', name: name, group_id:group_id, country_code:country_code, server:server, desc:desc, method:method, custom_method:custom_method, traffic_rate:traffic_rate, protocol:protocol, protocol_param:protocol_param, obfs:obfs, obfs_param:obfs_param, bandwidth:bandwidth, traffic:traffic, monitor_url:monitor_url, compatible:compatible, single:single, single_force:single_force, single_port:single_port, single_passwd:single_passwd, single_method:single_method, single_protocol:single_protocol, sort:sort, status:status},
+                data: {_token:'{{csrf_token()}}', name: name, group_id:group_id, country_code:country_code, server:server, desc:desc, method:method, custom_method:custom_method, traffic_rate:traffic_rate, protocol:protocol, protocol_param:protocol_param, obfs:obfs, obfs_param:obfs_param, bandwidth:bandwidth, traffic:traffic, monitor_url:monitor_url, compatible:compatible, single:single, single_force:single_force, single_port:single_port, single_passwd:single_passwd, single_method:single_method, single_protocol:single_protocol, single_obfs:single_obfs, sort:sort, status:status},
                 dataType: 'json',
                 success: function (ret) {
                     layer.msg(ret.message, {time:1000}, function() {
@@ -332,15 +348,17 @@
 
         // 服务条款
         function showTnc() {
-            var content = '1.请勿直接复制以下内容,否则SSR会报错;'
-                + '<br>2.确保服务器时间为CST或UTC;'
+            var content = '1、请勿直接复制黏贴以下配置,SSR(R)会报错的;'
+                + '<br>2、确保服务器时间为CST或UTC;'
+                + '<br>3、请看<a href="https://github.com/ssrpanel/SSRPanel/wiki/%E5%8D%95%E7%AB%AF%E5%8F%A3%E5%A4%9A%E7%94%A8%E6%88%B7%E7%9A%84%E5%9D%91" target="_blank">WIKI</a>;'
+                + '<br>'
                 + '<br>additional_ports" : {'
                 + '<br>&ensp;&ensp;&ensp;&ensp;"80": {'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"passwd": "password",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"method": "aes-128-ctr",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol": "auth_aes128_md5",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol_param": "#",'
-                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth_compatible",'
+                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs_param": ""'
                 + '<br>&ensp;&ensp;&ensp;&ensp;},'
                 + '<br>&ensp;&ensp;&ensp;&ensp;"443": {'
@@ -348,7 +366,7 @@
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"method": "aes-128-ctr",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol": "auth_aes128_sha1",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol_param": "#",'
-                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth_compatible",'
+                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs_param": ""'
                 + '<br>&ensp;&ensp;&ensp;&ensp;}'
                 + '<br>},';

+ 23 - 5
resources/views/admin/editNode.blade.php

@@ -139,6 +139,9 @@
                                                         <label for="single_protocol" class="col-md-3 control-label">[单] 协议</label>
                                                         <div class="col-md-8">
                                                             <select class="form-control" name="single_protocol" id="single_protocol">
+                                                                <option value="origin" {{$node->single_protocol == 'origin' ? 'selected' : ''}}>origin</option>
+                                                                <option value="verify_deflate" {{$node->single_protocol == 'verify_deflate' ? 'selected' : ''}}>verify_deflate</option>
+                                                                <option value="auth_sha1_v4" {{$node->single_protocol == 'auth_sha1_v4' ? 'selected' : ''}}>auth_sha1_v4</option>
                                                                 <option value="auth_aes128_md5" {{$node->single_protocol == 'auth_aes128_md5' ? 'selected' : ''}}>auth_aes128_md5</option>
                                                                 <option value="auth_aes128_sha1" {{$node->single_protocol == 'auth_aes128_sha1' ? 'selected' : ''}}>auth_aes128_sha1</option>
                                                                 <option value="auth_chain_a" {{$node->single_protocol == 'auth_chain_a' ? 'selected' : ''}}>auth_chain_a</option>
@@ -146,6 +149,18 @@
                                                             <span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
                                                         </div>
                                                     </div>
+                                                    <div class="form-group single-setting {{!$node->single ? 'hidden' : ''}}">
+                                                        <label for="single_obfs" class="col-md-3 control-label">[单] 混淆</label>
+                                                        <div class="col-md-8">
+                                                            <select class="form-control" name="single_obfs" id="single_obfs">
+                                                                <option value="plain" {{$node->single_obfs == 'plain' ? 'selected' : ''}}>plain</option>
+                                                                <option value="http_simple" {{$node->single_obfs == 'http_simple' ? 'selected' : ''}}>http_simple</option>
+                                                                <option value="random_head" {{$node->single_obfs == 'random_head' ? 'selected' : ''}}>random_head</option>
+                                                                <option value="tls1.2_ticket_auth" {{$node->single_obfs == 'tls1.2_ticket_auth' ? 'selected' : ''}}>tls1.2_ticket_auth</option>
+                                                            </select>
+                                                            <span class="help-block"> 展示和生成配置用,后端配置注意保持一致 </span>
+                                                        </div>
+                                                    </div>
                                                 </div>
                                             </div>
                                             <!-- END SAMPLE FORM PORTLET-->
@@ -297,6 +312,7 @@
             var single_passwd = $('#single_passwd').val();
             var single_method = $('#single_method').val();
             var single_protocol = $('#single_protocol').val();
+            var single_obfs = $('#single_obfs').val();
             var sort = $('#sort').val();
             var status = $('#status').val();
 
@@ -304,7 +320,7 @@
                 type: "POST",
                 url: "{{url('admin/editNode')}}",
                 async: false,
-                data: {_token:_token, id:id, name: name, group_id:group_id, country_code:country_code, server:server, desc:desc, method:method, custom_method:custom_method, traffic_rate:traffic_rate, protocol:protocol, protocol_param:protocol_param, obfs:obfs, obfs_param:obfs_param, bandwidth:bandwidth, traffic:traffic, monitor_url:monitor_url, compatible:compatible, single:single, single_force:single_force, single_port:single_port, single_passwd:single_passwd, single_method:single_method, single_protocol:single_protocol, sort:sort, status:status},
+                data: {_token:_token, id:id, name: name, group_id:group_id, country_code:country_code, server:server, desc:desc, method:method, custom_method:custom_method, traffic_rate:traffic_rate, protocol:protocol, protocol_param:protocol_param, obfs:obfs, obfs_param:obfs_param, bandwidth:bandwidth, traffic:traffic, monitor_url:monitor_url, compatible:compatible, single:single, single_force:single_force, single_port:single_port, single_passwd:single_passwd, single_method:single_method, single_protocol:single_protocol, single_obfs:single_obfs, sort:sort, status:status},
                 dataType: 'json',
                 success: function (ret) {
                     layer.msg(ret.message, {time:1000}, function() {
@@ -332,15 +348,17 @@
 
         // 服务条款
         function showTnc() {
-            var content = '1.请勿直接复制以下内容,否则SSR会报错;'
-                + '<br>2.确保服务器时间为CST或UTC;'
+            var content = '1、请勿直接复制黏贴以下配置,SSR(R)会报错的;'
+                + '<br>2、确保服务器时间为CST或UTC;'
+                + '<br>3、请看<a href="https://github.com/ssrpanel/SSRPanel/wiki/%E5%8D%95%E7%AB%AF%E5%8F%A3%E5%A4%9A%E7%94%A8%E6%88%B7%E7%9A%84%E5%9D%91" target="_blank">WIKI</a>;'
+                + '<br>'
                 + '<br>"additional_ports" : {'
                 + '<br>&ensp;&ensp;&ensp;&ensp;"80": {'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"passwd": "password",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"method": "aes-128-ctr",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol": "auth_aes128_md5",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol_param": "#",'
-                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth_compatible",'
+                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs_param": ""'
                 + '<br>&ensp;&ensp;&ensp;&ensp;},'
                 + '<br>&ensp;&ensp;&ensp;&ensp;"443": {'
@@ -348,7 +366,7 @@
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"method": "aes-128-ctr",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol": "auth_aes128_sha1",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"protocol_param": "#",'
-                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth_compatible",'
+                + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs": "tls1.2_ticket_auth",'
                 + '<br>&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;"obfs_param": ""'
                 + '<br>&ensp;&ensp;&ensp;&ensp;}'
                 + '<br>},';

+ 3 - 1
resources/views/shop/goodsList.blade.php

@@ -37,6 +37,7 @@
                                 <thead>
                                 <tr>
                                     <th> ID </th>
+                                    <th> SKU </th>
                                     <th> 名称 </th>
                                     <th> 类型 </th>
                                     <th> 图片 </th>
@@ -56,11 +57,12 @@
                                     @foreach($goodsList as $goods)
                                         <tr class="odd gradeX">
                                             <td> {{$goods->id}} </td>
+                                            <td> {{$goods->sku}} </td>
                                             <td> {{$goods->name}} </td>
                                             <td> {{$goods->type == 1 ? '流量包' : '套餐'}} </td>
                                             <td> @if($goods->logo) <a href="{{$goods->logo}}" class="fancybox"><img src="{{$goods->logo}}"/></a> @endif </td>
                                             <td> {{$goods->traffic}} </td>
-                                            <td> {{$goods->price}} </td>
+                                            <td> {{$goods->price}} </td>
                                             <td> {{$goods->score}} </td>
                                             <td>
                                                 @if($goods->status)

+ 14 - 4
resources/views/user/addOrder.blade.php

@@ -54,8 +54,11 @@
                 </div>
             </div>
             <div class="row">
-                <div class="col-xs-12">
-                    <a class="btn btn-lg green-haze hidden-print uppercase print-btn" onclick="addOrder()"> {{trans('home.service_pay_button')}} </a>
+                <div class="col-xs-12" style="text-align: right;">
+                    @if($paypal_status)
+                        <a class="btn btn red hidden-print" onclick="paypalPay()"> PayPal支付 </a>
+                    @endif
+                    <a class="btn btn blue hidden-print uppercase" onclick="pay()"> {{trans('home.service_pay_button')}} </a>
                 </div>
             </div>
         </div>
@@ -106,8 +109,15 @@
             });
         }
 
-        // 添加订单
-        function addOrder() {
+        // PayPal在线支付
+        function paypalPay() {
+            var goods_id = '{{$goods->id}}';
+            var coupon_sn = $('#coupon_sn').val();
+            window.location.href="{{url('payment/create?goods_id=')}}" + goods_id + '&coupon_sn=' + coupon_sn;
+        }
+
+        // 余额支付
+        function pay() {
             var goods_id = '{{$goods->id}}';
             var coupon_sn = $('#coupon_sn').val();
 

+ 16 - 0
sql/db.sql

@@ -47,6 +47,7 @@ CREATE TABLE `ss_node` (
   `single_passwd` varchar(50) DEFAULT '' COMMENT '密码',
   `single_method` varchar(50) DEFAULT '' COMMENT '加密方式',
   `single_protocol` varchar(50) NOT NULL DEFAULT '' COMMENT '协议',
+  `single_obfs` varchar(50) NOT NULL DEFAULT '' COMMENT '混淆',
   `sort` int(3) NOT NULL DEFAULT '0' COMMENT '排序值,值越大越靠前显示',
   `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态:0-维护、1-正常',
   `created_at` datetime NOT NULL,
@@ -403,6 +404,7 @@ CREATE TABLE `ss_group_node` (
 -- ----------------------------
 CREATE TABLE `goods` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
+  `sku` varchar(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品服务SKU',
   `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品名称',
   `logo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品图片地址',
   `traffic` bigint(20) NOT NULL DEFAULT '0' COMMENT '商品内含多少流量,单位Mib',
@@ -805,6 +807,20 @@ CREATE TABLE `payment` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 
+CREATE TABLE `paypal` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `oid` int(11) NOT NULL DEFAULT '0' COMMENT '订单ID',
+  `invoice_number` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '账单号',
+  `items` text COLLATE utf8mb4_unicode_ci COMMENT '商品信息,json格式',
+  `response_data` text COLLATE utf8mb4_unicode_ci COMMENT '收货地址,json格式',
+  `error` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '错误信息',
+  `created_at` datetime DEFAULT NULL COMMENT '创建时间',
+  `updated_at` datetime DEFAULT NULL COMMENT '最后更新时间',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+
+
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;

+ 4 - 0
sql/update/20171228.sql

@@ -0,0 +1,4 @@
+-- 单端口多用户加入混淆字段
+ALTER TABLE `ss_node`
+ADD COLUMN `single_obfs`  varchar(50) NOT NULL DEFAULT '' COMMENT '混淆' AFTER `single_protocol`;
+