Bladeren bron

给广告那边的接口

lizhen_gitee 2 jaren geleden
bovenliggende
commit
e66938046e
2 gewijzigde bestanden met toevoegingen van 52 en 3 verwijderingen
  1. 0 3
      application/api/controller/Adminapi.php
  2. 52 0
      application/api/controller/Advertapi.php

+ 0 - 3
application/api/controller/Adminapi.php

@@ -238,7 +238,4 @@ class Adminapi
         $response = Response::create($result, $type, $code)->header($header);
         throw new HttpResponseException($response);
     }
-
-
-
 }

+ 52 - 0
application/api/controller/Advertapi.php

@@ -0,0 +1,52 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+use think\Db;
+
+class Advertapi extends Api
+{
+    protected $noNeedLogin = ['*'];
+    protected $noNeedRight = ['*'];
+
+    public function __construct(){
+        parent::__construct();
+
+        $this->login();
+    }
+
+    public function login()
+    {
+        $account = input('mobile');
+        $password = input('password');
+        if (!$account || !$password) {
+            $this->error('no login');
+        }
+        $ret = $this->auth->login($account, $password);
+        if ($ret) {
+            //$data = $this->userInfo('return');
+            //$this->success(__('Logged in successful'), $data);
+        } else {
+            $this->error($this->auth->getError());
+        }
+    }
+
+    public function index(){
+        $type = input('type',1);
+        $uid = $this->auth->id;
+
+        $fields = [
+            'po.id,po.pay_no,po.status,po.money,po.payment_class,FROM_UNIXTIME(po.createtime) as createtime,user.mobile,user.id as user_id'
+        ];
+
+        if($type == 1){
+            $result = Db::name('pay_order')->alias('po')->field($fields)->join('user','po.user_id = user.id','LEFT')->where('po.user_id',$uid)->find();
+            $this->success('success',$result);
+        }else{
+            $result = Db::name('pay_order')->alias('po')->field($fields)->join('user','po.user_id = user.id','LEFT')->where('po.user_id',$uid)->autopage()->select();
+            $this->success('success',$result);
+        }
+    }
+
+}