Browse Source

各种接口

lizhen_gitee 3 months ago
parent
commit
9b5b5f4f17

+ 22 - 0
application/api/controller/Area.php

@@ -12,6 +12,28 @@ class Area extends Api
     protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
 
+    public function city_area(){
+        $zimuarr = ['A'=>[],'B'=>[],'C'=>[],'D'=>[],'E'=>[],'F'=>[],'G'=>[],'H'=>[],'J'=>[],'K'=>[],'L'=>[],'M'=>[],'N'=>[],'P'=>[],'Q'=>[],'R'=>[],'S'=>[],'T'=>[],'W'=>[],'X'=>[],'Y'=>[],'Z'=>[]];
+
+        $list = Db::name('area')->field('id,name,first')->where('level',2)->select();
+
+        foreach($list as $key => $val){
+            if(isset($zimuarr[$val['first']])){
+                $zimuarr[$val['first']][] = $val;
+            }
+        }
+
+        $result = [];
+        foreach($zimuarr as $k => $v){
+            $result[] = [
+                'zimu'=>$k,
+                'child' => $v,
+            ];
+        }
+
+        $this->success(1,$result);
+    }
+
     public function area_list(){
         $pid = input_post('pid',0);
 

+ 4 - 18
application/api/controller/Baseconfig.php

@@ -15,26 +15,12 @@ class Baseconfig extends Api
    
     public function index(){
         $config = [
-            'no_screenshot' => config('site.no_screenshot'),
-            'show_wechat_pay' => config('site.show_wechat_pay'),
-            'show_ali_pay' => config('site.show_ali_pay'),
-            'show_intimacy' => config('site.show_intimacy'),
+            'no_screenshot' => config('site.no_screenshot'),  //禁止截图
+            'show_wechat_pay' => config('site.show_wechat_pay'), //是否显示微信支付
+            'show_ali_pay' => config('site.show_ali_pay'),   //是否显示支付宝支付
+            'show_intimacy' => config('site.show_intimacy'),  //是否显示亲密度等级差
         ];
 
-        //首页三个头像
-        $map = [
-            'status' => 1,
-            'is_kefu' => 0,
-            'gender' => $this->auth->gender == 1 ? 0 : 1,
-            'avatar' => ['NOTIN',[config('avatar_boy'),config('avatar_girl')]],
-        ];
-        $index_three_avatar = Db::name('user')->where($map)->where('avatar','NEQ','')->field('id,avatar')->orderRaw('rand()')->limit(3)->select();
-        $index_three_avatar = list_domain_image($index_three_avatar,['avatar']);
-        $index_three_avatar = array_column($index_three_avatar,'avatar');
-        $config['index_top_three_avatar'] = $index_three_avatar;
-
-        $config['index_top_joinnumber'] = config('site.index_top_joinnumber') + Db::name('user')->count();
-
         $this->success('success',$config);
     }
 

+ 0 - 20
application/api/controller/Common.php

@@ -225,26 +225,6 @@ class Common extends Api
     }
 
 
-    // 返回执行日期所在周的第一天(周一)日期
-    public function firstOfWeek($date) {
-        $now = strtotime($date);    //当时的时间戳
-        $number = date("w",$now);  //当时是周几
-        $number = $number == 0 ? 7 : $number; //如遇周末,将0换成7
-        $diff_day = $number - 1; //求到周一差几天
-        return date("Ymd",$now - ($diff_day * 60 * 60 * 24));
-    }
-
-    /**
-     * 数字转化
-     */
-    public function changeW($val) {
-        return $val > 10000 ? round($val/10000,2)."w":$val;
-    }
-
-    public function getModelName($type)
-    {
-        return "app\common\model\\" . ucfirst($type);
-    }
 
 
     /** 上传文件到 本地+cos

+ 2 - 2
application/api/controller/User.php

@@ -162,8 +162,8 @@ class User extends Api
         $edit_data['gender'] = $gender;
         $edit_data['avatar'] = $gender == 1 ? config('avatar_boy') : config('avatar_girl'); //头像
 
-        $rs = Db::name('user')->where(['id' => $user_id, 'gender' => $this->auth->gender])->setField($edit_data);
-        if (!$rs) {
+        $rs = Db::name('user')->where(['id' => $user_id])->update($edit_data);
+        if ($rs === false) {
             $this->error('您的网络开小差啦~');
         }
 

+ 0 - 1
application/extra/site.php

@@ -97,5 +97,4 @@ return array (
   'boy_vip_free_greet_num' => '5',
   'rmb_to_gold' => '10',
   'withdraw_min_money' => '100',
-  'index_top_joinnumber' => '10000',
 );