Browse Source

增加是否会员

ZxcZxc123 1 year ago
parent
commit
c48853f5f6
2 changed files with 11 additions and 8 deletions
  1. 8 5
      app/api/controller/PublicController.php
  2. 3 3
      app/models/store/StoreOrder.php

+ 8 - 5
app/api/controller/PublicController.php

@@ -31,8 +31,13 @@ use crmeb\services\upload\Upload;
  */
 class PublicController
 {
-    public function test(Request $request){
-        StoreOrder::set_parent($request->get('uid',0));
+    public function test(Request $request)
+    {
+        if (StoreOrder::set_parent($request->get('uid', 0))) {
+
+        } else {
+            var_dump(StoreOrder::getErrorInfo());
+        }
     }
 
     /**
@@ -306,7 +311,6 @@ class PublicController
     }
 
 
-
     /**
      * 门店详情
      * @param Request $request
@@ -323,11 +327,10 @@ class PublicController
         $info['distance'] = sqrt((pow((((float)$latitude - (float)$info['latitude']) * 111000), 2)) + (pow((((float)$longitude - (float)$info['longitude']) * 111000), 2)));
         //转换单位
         $info['range'] = bcdiv($info['distance'], 1000, 1);
-        return app('json')->successful('ok',compact('info'));
+        return app('json')->successful('ok', compact('info'));
     }
 
 
-
     /**
      * 查找城市数据
      * @param Request $request

+ 3 - 3
app/models/store/StoreOrder.php

@@ -856,14 +856,14 @@ class StoreOrder extends BaseModel
             $res = Users::setParentUser($uid, $parent, $parent_area);
             if ($res) {
                 BaseModel::commitTrans();
-                return app('json')->success('设置成功');
+                return true;
             } else {
                 BaseModel::rollbackTrans();
-                return app('json')->fail(Users::getErrorInfo('设置失败'));
+                return self::setErrorInfo('设置失败');
             }
         } catch (\Exception $e) {
             BaseModel::rollbackTrans();
-            return app('json')->fail('设置失败' . $e->getMessage());
+            return self::setErrorInfo('设置失败' . $e->getMessage());
         }
     }