瀏覽代碼

014900-002

Zory 6 天之前
父節點
當前提交
d09b4d7984

+ 14 - 13
app/controller/IndexController.php

@@ -9,19 +9,19 @@ class IndexController
 {
     public function index(Request $request)
     {
-        $api = new Api('http://127.0.0.1:3232', config('plugin.webman.push.app.app_key'),config('plugin.webman.push.app.app_secret'));
-        $api->trigger("user-_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u","message",[
-            "type"  =>  "text",
-            "time"  =>  time() * 1000,
-            "msgId" => time(),
-            "content"   => "哈稍等哈就说客家话",
-            "source" => 2,
-            "avatar"    => "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png",
-            "poi_id"    => "7644106137976965139",
-            "openid"  => "_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u",
-            "service_id"  => "105"
-        ]);
-        echo "asd";
+//        $api = new Api('http://127.0.0.1:3232', config('plugin.webman.push.app.app_key'),config('plugin.webman.push.app.app_secret'));
+//        $api->trigger("user-_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u","message",[
+//            "type"  =>  "text",
+//            "time"  =>  time() * 1000,
+//            "msgId" => time(),
+//            "content"   => "哈稍等哈就说客家话",
+//            "source" => 2,
+//            "avatar"    => "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png",
+//            "poi_id"    => "7644106137976965139",
+//            "openid"  => "_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u",
+//            "service_id"  => "105"
+//        ]);
+//        echo "asd";
 //        $param = [
 //            "events" => [
 //                [
@@ -32,6 +32,7 @@ class IndexController
 //        ];
 //        $key = hash_hmac('sha256', json_encode($param), config('plugin.webman.push.app.app_secret'), false);
 //        echo $key."\n";
+        return view('index');
     }
 
     public function view(Request $request)

+ 36 - 0
app/controller/api/Order.php

@@ -6,6 +6,7 @@ use app\extra\basic\Base;
 use app\extra\dyLife\Crypt;
 use app\extra\dyMini\Pay;
 use app\middleware\AuthMiddleware;
+use app\model\saas\SaasComplaint;
 use app\model\saas\SaasOrder;
 use app\model\saas\SaasOrderPrice;
 use app\service\saas\OrderService;
@@ -246,6 +247,41 @@ class Order extends Base
         }
     }
 
+    /**
+     * 订单投诉
+     * @param Request $request
+     * @return Response|void
+     */
+    #[PostMapping("complaint")]
+    public function setOrderComplaint(Request $request)
+    {
+        try {
+            $param = $this->_valid([
+                "content.require"   => trans("empty.require"),
+                "mobile.default"    => "",
+                "order.require"     => trans("empty.require"),
+                "text.require"      => trans("empty.require"),
+                "poi_id.require"    => trans("empty.require"),
+            ],$request->method());
+            if (!is_array($param)) return error($param);
+            $order = (new SaasOrder)->where("out_order_no",$param['order'])->findOrEmpty();
+            if ($order->isEmpty()) return error("该笔交易不存在");
+            if ($order['openid'] <> $request->user['openid']) return error("非法操作");
+            $state = (new SaasComplaint)->insertGetId([
+                "openid"    => $request->user['openid'],
+                "poi_id"    => $param['poi_id'],
+                "content"   => $param['content'],
+                "question"  => $param['text'],
+                "order_sn"  => $order['order'],
+                "mobile"    => $param['mobile']??$order['mobile'],
+            ]);
+            if (!$state) return error("提交失败");
+            return success("提交成功,请耐心等待");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
     protected function decrypt2code($private_key, $ciphertext_str) {
         // 解码 base64 密文
         $ciphertext = base64_decode($ciphertext_str);

+ 3 - 0
app/controller/api/Service.php

@@ -91,6 +91,9 @@ class Service extends Base
             }
             return $this->encode("ok",['store' => $store,'code' => 1,'sendId' => $request->user['openid'],'msg' => pageFormatMsg($msg),"serviceId" => $service['id']]); // 客服在线
         } catch (\Throwable $throwable) {
+            echo $throwable->getMessage()."\n";
+            echo $throwable->getFile()."\n";
+            echo $throwable->getLine()."\n";
             return error($throwable->getMessage());
         }
     }

+ 43 - 0
app/model/saas/SaasChatSet.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace app\model\saas;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property mixed $poi_id
+ */
+class SaasChatSet extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "saas_chat_set";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+
+}

+ 50 - 0
app/model/saas/SaasComplaint.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace app\model\saas;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property mixed $openid 
+ * @property mixed $poi_id 
+ * @property mixed $mobile 
+ * @property mixed $order_sn 
+ * @property string $question 
+ * @property string $content 
+ * @property integer $status 
+ * @property mixed $create_at
+ */
+class SaasComplaint extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "saas_complaint";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+
+}

+ 47 - 0
app/model/saas/SaasOrderVerify.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\model\saas;
+
+use app\extra\basic\Model;
+
+
+/**
+ * @property integer $id (主键)
+ * @property mixed $order_sn 
+ * @property mixed $certificate_id 
+ * @property mixed $verify_id 
+ * @property integer $status 0核销成功1撤销成功
+ * @property mixed $create_at
+ */
+class SaasOrderVerify extends Model
+{
+    /**
+     * The connection name for the model.
+     *
+     * @var string|null
+     */
+    protected $connection = 'mysql';
+    
+    /**
+     * The table associated with the model.
+     *
+     * @var string
+     */
+    protected string $table = "saas_order_verify";
+    
+    /**
+     * The primary key associated with the table.
+     *
+     * @var string
+     */
+    protected string $primaryKey = "id";
+    
+    /**
+     * Indicates if the model should be timestamped.
+     *
+     * @var bool
+     */
+    public bool $timestamps = false;
+
+
+}

+ 4 - 4
config/plugin/shopwwi/auth/app.php

@@ -7,13 +7,13 @@
          'admin' => [
              'key' => 'id',
              'field' => ['id','username'], //设置允许写入扩展中的字段
-             'num' => 2, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
+             'num' => 1, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
              'model'=> [\app\model\system\SystemUser::class,'thinkphp'] // 当为数组时 [app\model\Test::class,'thinkphp'] 来说明模型归属
          ],
          'user' => [
              'key' => 'openid',
              'field' => ['openid','mobile'], //设置允许写入扩展中的字段
-             'num' => 0, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
+             'num' => 1, //-1为不限制终端数量 0为只支持一个终端在线 大于0为同一账号同终端支持数量 建议设置为1 则同一账号同终端在线1个
              'model'=> [\app\model\saas\SaasUserOpen::class,'thinkphp']// 当为数组时 [app\model\Test::class,'thinkphp'] 来说明模型归属
          ]
      ],
@@ -26,11 +26,11 @@
          // access令牌秘钥
          'access_secret_key' => 'w5LgNx5luRRjmamZFSqz3cPHOp9KuQPExlvgi18DN4SdnSI9obcVEhiZVE0NIIC7',
          // access令牌过期时间,单位秒。默认 2 小时
-         'access_exp' => 36000,
+         'access_exp' => 1209600, // 14天
          // refresh令牌秘钥
          'refresh_secret_key' => 'w5LgNx5luRRjmamZFSqz3cPHOp9KuQPExlvgi18DN4SdnSI9obcVEhiZVE0NIIC7',
          // refresh令牌过期时间,单位秒。默认 7 天
-         'refresh_exp' => 72000,
+         'refresh_exp' => 1209600,
          // 令牌签发者
          'iss' => 'webman',
          // 令牌签发时间