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

【程序目录】更新开源v5.2.2版本

evoxwht 2 лет назад
Родитель
Сommit
20352cc696

+ 1 - 1
crmeb/app/Request.php

@@ -34,7 +34,7 @@ class Request extends \think\Request
      * @var array
      */
     protected $except = ['menu_path', 'api_url', 'unique_auth',
-        'description', 'custom_form', 'content', 'tableField','url'];
+        'description', 'custom_form', 'content', 'tableField', 'url'];
 
     /**
      * 获取请求的数据

+ 18 - 19
crmeb/app/services/activity/coupon/StoreCouponIssueServices.php

@@ -102,6 +102,23 @@ class StoreCouponIssueServices extends BaseServices
             return (int)$data['id'];
         }
 
+        if (empty($data['coupon_title'])) {
+            throw new AdminException(400759);
+        }
+
+        if (!in_array((int)$data['receive_type'], [1, 2, 3, 4])) {
+            throw new AdminException(400758);
+        }
+
+        if (!in_array((int)$data['is_permanent'], [0, 1])) {
+            throw new AdminException(400758);
+        }
+
+        $data['start_use_time'] = strtotime((string)$data['start_use_time']);
+        $data['end_use_time'] = strtotime((string)$data['end_use_time']);
+        $data['start_time'] = strtotime((string)$data['start_time']);
+        $data['end_time'] = strtotime((string)$data['end_time']);
+
         if ($data['start_time'] && $data['start_use_time']) {
 
             if ($data['start_time'] < date('Y-m-d 00:00:00')) {
@@ -110,34 +127,17 @@ class StoreCouponIssueServices extends BaseServices
             if ($data['start_use_time'] < date('Y-m-d 00:00:00')) {
                 throw new AdminException('开始使用时间不能小于当前时间');
             }
-
             if ($data['start_use_time'] < $data['start_time']) {
                 throw new AdminException(400513);
             }
         }
 
-        if (!in_array((int)$data['receive_type'], [1, 2, 3, 4])) {
-            throw new AdminException(400758);
-        }
-
-        if (!in_array((int)$data['is_permanent'], [0, 1])) {
-            throw new AdminException(400758);
-        }
-
-        if (empty($data['coupon_title'])) {
-            throw new AdminException(400759);
-        }
-
         if ($data['end_time'] && $data['end_use_time']) {
             if ($data['end_use_time'] < $data['end_time']) {
-                throw new AdminException('用户领取数量不能大于优惠券发布数量');
+                throw new AdminException('最后使用时间不能小于最后领取时间');
             }
         }
 
-        $data['start_use_time'] = strtotime((string)$data['start_use_time']);
-        $data['end_use_time'] = strtotime((string)$data['end_use_time']);
-        $data['start_time'] = strtotime((string)$data['start_time']);
-        $data['end_time'] = strtotime((string)$data['end_time']);
         $data['title'] = $data['coupon_title'];
         $data['remain_count'] = $data['total_count'];
         $data['category_id'] = implode(',', $data['category_id']);
@@ -150,7 +150,6 @@ class StoreCouponIssueServices extends BaseServices
             throw new AdminException(500031);
         }
 
-
         $data['add_time'] = time();
         $res = $this->dao->save($data);
         if (($data['product_id'] !== '' || $data['category_id'] !== '') && $res) {

+ 17 - 16
crmeb/app/services/out/OutInterfaceServices.php

@@ -5,6 +5,8 @@ namespace app\services\out;
 use app\dao\out\OutInterfaceDao;
 use app\Request;
 use app\services\BaseServices;
+use app\services\system\SystemRouteCateServices;
+use app\services\system\SystemRouteServices;
 use crmeb\exceptions\AdminException;
 use crmeb\exceptions\AuthException;
 
@@ -24,14 +26,14 @@ class OutInterfaceServices extends BaseServices
     {
         $rule = trim(strtolower($request->rule()->getRule()));
         $method = trim(strtolower($request->method()));
-        $authList = $this->dao->getColumn([['id', 'in', $request->outInfo()['rules']], ['type', '=', 1]], 'method,url');
+        $authList = app()->make(SystemRouteServices::class)->getColumn([['id', 'in', $request->outInfo()['rules']], ['app_name', '=', 'outapi']], 'method,path');
         $rolesAuth = [];
         foreach ($authList as $item) {
-            $rolesAuth[trim(strtolower($item['method']))][] = trim(strtolower(str_replace(' ', '', $item['url'])));
+            $rolesAuth[trim(strtolower($item['method']))][] = trim(strtolower(str_replace(' ', '', $item['path'])));
         }
         $rule = str_replace('<', '{', $rule);
         $rule = str_replace('>', '}', $rule);
-        if (in_array('/' . $rule, $rolesAuth[$method])) {
+        if (in_array($rule, $rolesAuth[$method])) {
             return true;
         } else {
             throw new AuthException(110000);
@@ -47,24 +49,23 @@ class OutInterfaceServices extends BaseServices
      */
     public function outInterfaceList(): array
     {
-        $list = $this->dao->selectList(['is_del' => 0], 'id,pid,method,type,name,name as title')->toArray();
-        $data = [];
-        foreach ($list as $key => $item) {
-            if ($item['pid'] == 0) {
-                $data[] = $item;
-                unset($list[$key]);
-            }
-        }
-        foreach ($data as &$item_p) {
-            foreach ($list as $item_c) {
-                if ($item_p['id'] == $item_c['pid']) {
-                    $item_p['children'][] = $item_c;
+        // 获取系统路由分类列表
+        $list = app()->make(SystemRouteCateServices::class)->selectList(['app_name' => 'outapi'], 'id,pid,name,name as title')->toArray();
+        // 获取系统路由列表
+        $data = app()->make(SystemRouteServices::class)->selectList(['app_name' => 'outapi'], 'id,cate_id as pid,name,name as title')->toArray();
+        // 遍历分类列表,将分类下的路由添加到对应的子节点中
+        foreach ($list as &$item) {
+            foreach ($data as $k => $v) {
+                if ($item['id'] == $v['pid']) {
+                    $item['children'][] = $v;
                 }
             }
         }
-        return $data;
+        // 返回完整的外部接口列表
+        return $list;
     }
 
+
     /**
      * 新增对外接口文档
      * @param $id

+ 1 - 1
crmeb/app/services/system/UpgradeServices.php

@@ -46,7 +46,7 @@ class UpgradeServices extends BaseServices
     /**
      * @var int $timeStamp
      */
-    private $timeStamp;
+    private $timeStamp = 0;
 
     /**
      * UpgradeServices constructor.

+ 2 - 1
crmeb/app/services/user/UserSignServices.php

@@ -215,7 +215,8 @@ class UserSignServices extends BaseServices
         $this->transaction(function () use ($uid, $title, $sign_point, $user, $sign_exp) {
             $this->setSignData($uid, $title, $sign_point, $user['integral'], (int)$user['exp'], $sign_exp);
             $user->integral = (int)$user->integral + (int)$sign_point;
-            if ($sign_exp) $user->exp = (int)$user->exp + (int)$sign_exp;
+//            if ($sign_exp) $user->exp = (int)$user->exp + (int)$sign_exp;
+            if ($sign_exp) $user->exp = bcadd($user->exp, $sign_exp, 2);
             if (!$user->save()) {
                 throw new ApiException(410287);
             }