1557492053 1 ano atrás
pai
commit
b86bc5775c

+ 2 - 28
application/api/controller/Service.php

@@ -45,6 +45,7 @@ class Service extends Api
     public function fetchApp()
     {
         $params = (new BaseApiValidate([
+            'p_code' => "number",
             'category_id' => "number",
             'hot' => "number",
 //            'is_add_clock'
@@ -65,32 +66,6 @@ class Service extends Api
         ]);
     }
 
-
-
-    /// 根据地区筛选
-    public function fetchAppV2()
-    {
-        $params = (new BaseApiValidate([
-            'p_code' => "require|number",
-            'category_id' => "number",
-            'hot' => "number"
-        ]))->checkBody();
-        $user = $this->auth->getUser();
-
-        list($page, $size) = [$params['page'] ?? 1, $params['size'] ?? 10];
-        $paginate = $this->serviceModel->fetchServicesV2(\E_SERVICE_TYPE::App, $params, $page, $size, $user);
-        $items = collection($paginate->items())->toArray();
-
-        $membership_discount_rate = config("site.membership_discount_rate") / 100;
-        foreach ($items as &$item) {
-            $item["membership_discount_price"] = fixed2Float($item["real_price"] * $membership_discount_rate);
-        }
-        $this->success([
-            $items,
-            $paginate->total()
-        ]);
-    }
-
     /**
      * 获取球房服务分类
      */
@@ -131,8 +106,7 @@ class Service extends Api
             "page" => "require|number",
             "size" => "require|number"
         ]))->checkBody();
-        list($page, $size) = [$params['page'], $params['size']];
-        $paginate = $this->serviceModel->fetchServices(\E_SERVICE_TYPE::App, [isset($params["is_add_clock"]) ? $params["is_add_clock"] : null, "sift" => 1], $page, $size, $user);
+        $paginate = $this->serviceModel->fetchServices(\E_SERVICE_TYPE::App, ["is_add_clock" => $params["is_add_clock"] ?? null, "sift" => 1], $params['page'], $params['size'], $user);
         $items = collection($paginate->items())->toArray();
 
         $membership_discount_rate = config("site.membership_discount_rate") / 100;

+ 3 - 3
application/api/controller/Test.php

@@ -35,8 +35,8 @@ class Test extends Api
 
     function test1()
     {
-        $result = getenv(ENV_PREFIX . strtoupper(str_replace('.', '_', "wxpay.wx_applet_secret")));
-        var_dump($result);
+        dump(decbin(5));
+//        dump(5^5);
     }
 
 
@@ -103,7 +103,7 @@ class Test extends Api
      * @param $special  bool      是否需要特殊符号
      * @return string       返回随机字符串
      */
-    public static function getRandomStr($len, $special = false)
+    public static function getRandomStr($len, bool $special = false)
     {
         $chars = array(
             "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",

+ 4 - 32
application/api/model/service/Service.php

@@ -14,41 +14,13 @@ class Service extends BaseModel
     {
         $where = [
             'type' => $type,
-            'status' => \E_BASE_STATUS::Normal
+            'status' => \E_BASE_STATUS::Normal,
         ];
-        if (isset($params['category_id']) && $params['category_id'] > 0)
-            $where['category_id'] = $params['category_id'];
-        if (isset($params['hot']) && $params['hot'])
-            $where['hot'] = 1;
-        if (isset($params['store_id']) && $params['store_id'] > 0)
-            $where['store_id'] = $params['store_id'];
-        if (isset($params["sift"]) && $params['sift'])
-            $where['sift'] = 1;
-        if (!isset($params["is_add_clock"]) || $params["is_add_clock"] != 1) {
-            $where['is_add_clock'] = 0;
-        }
-        $q = ["id", "<>", "276"];
-        if ($user) {
-            $exist = RedisClient::of()->get("scan:qr:codes:" . $user["id"]);
-            if ($exist) {
-                $q = ["id", ">", "0"];
-            }
+
+        if(isset($params['p_code']) && $params['p_code'] > 0) {
+            $where['p_code'] = $params['p_code'];
         }
-        return $this->where($where)
-            ->where($q[0], $q[1], $q[2])
-            ->order('sort', 'desc')
-            ->order('real_price', 'ASC')
-            ->page($page)
-            ->paginate($size);
-    }
 
-    public function fetchServicesV2($type, $params, $page = 1, $size = 10, $user = null)
-    {
-        $where = [
-            'type' => $type,
-            'status' => \E_BASE_STATUS::Normal,
-            'p_code' => $params['p_code']
-        ];
         if (isset($params['category_id']) && $params['category_id'] > 0)
             $where['category_id'] = $params['category_id'];
         if (isset($params['hot']) && $params['hot'])

+ 1 - 1
public/assets/addons/fastchat/js/fastchat.js

@@ -53,7 +53,7 @@ var FastChat = {
                 }
 
                 // 构建ws的url
-                FastChat.ws.url = FastChat.buildUrl('mwebsocket.xunsoftware.com', modulename, 'ws', data.data.websocket_port);
+                FastChat.ws.url = FastChat.buildUrl('127.0.0.1', modulename, 'ws', data.data.websocket_port);
 
                 if (modulename === 'admin') {
                     // 立即链接 Websocket