瀏覽代碼

add pay subject name

fly 4 年之前
父節點
當前提交
6429a40d83

+ 1 - 1
app/Modules/Trade/Pay/AliOrderArousePay.php

@@ -14,7 +14,7 @@ class AliOrderArousePay extends OrderArousePayAbstract
         $pay_merchant_id = (int) $data['pay_merchant_id'];
         $ali_param = [
             'body' => '小说阅读',
-            'subject' => '追书云',
+            'subject' => $this->getSubjectName($data['distribution_channel_id']),
             'out_trade_no' => $data['trade_no'],
             'timeout_express' => '90m',
             'total_amount' => $data['price'] / 100,

+ 8 - 0
app/Modules/Trade/Pay/OrderArousePayAbstract.php

@@ -3,6 +3,7 @@
 namespace App\Modules\Trade\Pay;
 
 use App\Modules\Subscribe\Models\Order;
+use App\Modules\User\Models\QappPackage;
 
 abstract class OrderArousePayAbstract
 {
@@ -50,4 +51,11 @@ abstract class OrderArousePayAbstract
         ];
         Order::firstOrCreate($params);
     }
+
+    protected function getSubjectName(int $channel_id)
+    {
+        $package = QappPackage::where('channel_id', $channel_id)->select('name')->first();
+        $name = $package ? $package->name : '';
+        return "搜索快应用({$name})继续阅读,投诉电话:0571-56680189";
+    }
 }

+ 1 - 1
app/Modules/Trade/Pay/WxOrderArousePay.php

@@ -19,7 +19,7 @@ class WxOrderArousePay extends OrderArousePayAbstract
                 'trade_type'     => $data['trade_type'], // 交易类型
                 'trade_no'     => $data['trade_no'], // 订单号
                 'price'        => $data['price'], // 订单金额,单位:分
-                'body'             => '快应用 小说', // 订单描述
+                'body'             => $this->getSubjectName($data['distribution_channel_id']), // 订单描述
                 'create_ip' => _getIp(), // 支付人的 IP
                 'remark'            =>  $pay_merchant_id
             ];

+ 0 - 1
app/Modules/Trade/Services/PayMerchantService.php

@@ -9,7 +9,6 @@
 
 namespace App\Modules\Trade\Services;
 
-use App\Modules\BaseService;
 use App\Modules\Trade\Models\PayMerchant;
 
 class PayMerchantService

+ 2 - 1
app/Modules/User/Models/QappPackage.php

@@ -10,6 +10,7 @@ class QappPackage extends Model
 
     protected $fillable =
     [
+        'name',
         'package',
         'channel_id',
         'company',
@@ -21,7 +22,7 @@ class QappPackage extends Model
 
     static function getPackage($channel_id)
     {
-        return self::where('channel_id',$channel_id)->first();
+        return self::where('channel_id', $channel_id)->first();
     }
 
     public static function getPackageByPackage($package)