<?php

namespace app\controller\admin;

use laytp\controller\Backend;
use think\facade\Config;
use laytp\library\CommonFun;
use app\validate\admin\bot\Add;
use app\validate\admin\bot\Edit;
use laytp\library\Str;
use think\facade\App;
use laytp\library\UploadDomain;
use app\service\Telegram as Telegrambot;
use think\facade\Request;
use GitWrapper\GitWrapper;

/**
 * 会员管理
 */
class Updata extends Backend
{

    /**
     * member模型对象
     * @var \app\model\Bot
     */
    protected $model;
	protected $hasSoftDel=1;//是否拥有软删除功能

    protected $noNeedLogin = []; // 无需登录即可请求的方法
    protected $noNeedAuth = ['index', 'info']; // 无需鉴权即可请求的方法

    public function _initialize()
    {
       
    }

    
    //查看和搜索列表
    //查看和搜索列表
    public function index(){
        $where  = $this->buildSearchParams();
        $order  = $this->buildOrder();
        //var_dump($where,$order);
        $data   = $this->model->where($where)->order($order)->with(['avatar_pic_file']);
        $paging = $this->request->param('paging', false);
        if ($paging) {
            $limit        = $this->request->param('limit', Config::get('paginate.limit'));
            $data         = $data->paginate($limit)->toArray();
            $data['data'] = $this->getSelectedData($data['data']);
        } else {
            $data = $data->select()->toArray();
        }
        return $this->success('数据获取成功', $data);
    }

    
    //添加
    public function updata()
    {
       
        $repoPath  = App::getRootPath();
      $output = shell_exec("cd {$repoPath} && git pull 2>&1");

        // 输出结果
        echo "Git Pull Output:\n";
        echo $output;
        
    }

    
    
}
