wang jun 3 lat temu
rodzic
commit
7cb1c3cf78

+ 1 - 23
application/index/controller/Index.php

@@ -3,7 +3,7 @@
  * @Author: wang jun
  * @Date: 2022-01-18 10:57:14
  * @Last Modified by: wang jun
- * @Last Modified time: 2022-01-18 14:03:44
+ * @Last Modified time: 2022-01-19 10:38:56
  * 微信类
  */
 namespace app\index\controller;
@@ -13,28 +13,6 @@ use think\Controller;
 
 class Index extends Base
 {
-    /**
-     * 设置请求数据规则
-     * 20220107
-     * wj
-     */
-    protected function setrules()
-    {
-        $list = [
-            'getOpenid' => [
-                ['name' => 'code', 'title' => 'code', 'require' => true, 'type' => 'string'],
-            ],
-            'create_qrcode' => [
-                ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
-                ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
-            ],
-            'down_qrcode' => [
-                ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
-                ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
-            ],
-        ];
-        return $list;
-    }
     public function index()
     {
         echo "recruit";

+ 36 - 2
application/index/logic/wechatlogic.php

@@ -3,7 +3,7 @@
  * @Author: wang jun
  * @Date: 2022-01-18 11:12:23
  * @Last Modified by: wang jun
- * @Last Modified time: 2022-01-18 14:17:55
+ * @Last Modified time: 2022-01-19 10:38:13
  * 微信类
  */
 namespace app\index\logic;
@@ -11,8 +11,30 @@ namespace app\index\logic;
 use app\index\logic\wxBizDataCrypt;
 use app\index\model\usermodel;
 
-class wechatlogic
+class wechatlogic extends baselogic
 {
+    /**
+     * 设置请求数据规则
+     * 20220107
+     * wj
+     */
+    protected function setrules()
+    {
+        $list = [
+            'getOpenid' => [
+                ['name' => 'code', 'title' => 'code', 'require' => true, 'type' => 'string'],
+            ],
+            'create_qrcode' => [
+                ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
+                ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
+            ],
+            'down_qrcode' => [
+                ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
+                ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
+            ],
+        ];
+        return $list;
+    }
     public function getselfwxconfig()
     {
         $config = [
@@ -81,6 +103,10 @@ class wechatlogic
      */
     public function getOpenid($arr)
     {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
         $code = $arr['code'];
         $config = $this->getselfwxconfig();
         $appid = $config['appid'];
@@ -122,6 +148,10 @@ class wechatlogic
     //获得二维码
     public function create_qrcode($arr)
     {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
         $sharepage = request()->param();
         $qr_path = "./Uploads/";
         if (!file_exists($qr_path . 'user/')) {
@@ -204,6 +234,10 @@ class wechatlogic
      */
     public function download_qrcode($arr)
     {
+        $result = $this->checkparam(__FUNCTION__, $arr);
+        if (1 != $result['status']) {
+            return $result;
+        }
         $qr_path = "./Uploads/";
         if (!file_exists($qr_path . 'user/')) {
             mkdir($qr_path . 'user/', 0700, true); //判断保存目录是否存在,不存在自动生成文件目录