|
@@ -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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|