wesmiler 3 months ago
parent
commit
63e5c4e675

+ 1 - 0
app/Http/Controllers/Admin/IndexController.php

@@ -105,6 +105,7 @@ class IndexController extends Backend
         RedisService::keyDel("caches:account*");
         RedisService::keyDel("caches:article*");
         RedisService::keyDel("caches:agents*");
+        RedisService::keyDel("caches:socials*");
         RedisService::keyDel("caches:member*");
         RedisService::keyDel("caches:config*");
         RedisService::keyDel("caches:stores*");

+ 2 - 1
app/Http/Controllers/Api/v1/IndexController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers\Api\v1;
 
 use App\Http\Controllers\Api\webApp;
+use App\Services\Api\SocialCircleService;
 use App\Services\Common\AdService;
 use App\Services\Common\NoticeService;
 use App\Services\ConfigService;
@@ -70,7 +71,7 @@ class IndexController extends webApp
             ];
 
             if($type==2){
-                $data['socials'] = SocialS
+                $data['socials'] = SocialCircleService::make()->getIndexList();
             }
             return showJson(1010, true, $data);
         } catch (\Exception $exception) {

+ 38 - 0
app/Models/SocialCircleModel.php

@@ -0,0 +1,38 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Models;
+
+/**
+ * 生活圈管理-模型
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Models
+ */
+class SocialCircleModel extends BaseModel
+{
+    // 设置数据表
+    protected $table = 'social_circles';
+
+    // 封面图
+    public function getLogoAttribute($value)
+    {
+        $value = $value ? get_image_url($value) : '';
+        return $value;
+    }
+
+    public function setLogoAttribute($value)
+    {
+
+        return $value ? get_image_path($value) : '';
+    }
+
+}

+ 80 - 0
app/Services/Api/SocialCircleService.php

@@ -0,0 +1,80 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Services\Api;
+
+use App\Models\NoticeModel;
+use App\Models\SocialCircleModel;
+use App\Services\BaseService;
+use App\Services\ConfigService;
+use App\Services\RedisService;
+
+/**
+ * 生活圈-服务类
+ * @author laravel开发员
+ * @since 2020/11/11
+ * @package App\Services\Api
+ */
+class SocialCircleService extends BaseService
+{
+    // 静态对象
+    protected static $instance = null;
+
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     */
+    public function __construct()
+    {
+        $this->model = new SocialCircleModel();
+    }
+
+    /**
+     * 静态入口
+     */
+    public static function make()
+    {
+        if (!self::$instance) {
+            self::$instance = new static();
+        }
+        return self::$instance;
+    }
+
+    /**
+     * 主页列表
+     * @param int $num
+     * @return array|mixed
+     */
+    public function getIndexList($num = 0)
+    {
+        $num = ConfigService::make()->getConfigByCode('show_social_num', 12);
+        $cacheKey = "caches:socials:list_{$num}";
+        $datas = RedisService::get($cacheKey);
+        if($datas){
+            return $datas;
+        }
+
+        $datas =  $this->model->where(['status'=>1,'mark'=>1])
+            ->select(['id','name','logo','link_type','app_id','sort','status'])
+            ->orderBy('sort','desc')
+            ->orderBy('id','asc')
+            ->limit($num)
+            ->get();
+        $datas = $datas? $datas->toArray() : [];
+        if($datas){
+            $datas = $datas?array_chunk($datas,6) : [];
+            RedisService::set($cacheKey, $datas, rand(300, 600));
+        }
+
+        return $datas;
+    }
+}

+ 4 - 4
app/Services/PaymentService.php

@@ -758,7 +758,7 @@ class PaymentService extends BaseService
                     $refundStatus = true;
                 } else {
                     DB::rollBack();
-                    $this->error = 2172;
+                    $this->error = '微信退款处理失败';
                     return false;
                 }
                 break;
@@ -775,16 +775,16 @@ class PaymentService extends BaseService
                 if ($payResult->code == 10000 || intval($payResult->code) == 40004) {
                     $refundStatus = true;
                 } else {
-                    $this->error = 2173;
+                    $this->error = '支付宝退款处理失败';
                     return false;
                 }
                 break;
             default:
-                $this->error = 2179;
+                $this->error = '退款支付类型错误';
                 return false;
         }
 
-        $this->error = 2176;
+        $this->error = '退款处理成功';
         return $refundStatus;
     }
 }