| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?phpnamespace 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)->order('po.id desc')->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)->order('po.id desc')->autopage()->select();            $this->success('success',$result);        }    }}
 |