| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\Config;
- use app\common\model\MoneyLog;
- use app\common\model\News;
- /**
- * 首页接口
- */
- class Index extends Api
- {
- protected $noNeedLogin = ['base'];
- protected $noNeedRight = ['*'];
- /**
- * 首页
- *
- */
- public function base()
- {
- $data['logo'] = (new Config())->getValue('logo');
- $data['app_name'] = (new Config())->getValue('name');
- $data['code'] = [
- ['code' => '86', 'country' => __('中国')],
- ['code' => '1', 'country' => __('美国')],
- ];
- $this->success('', $data);
- }
- /**
- * 首页
- *
- */
- public function index()
- {
- $user = $this->auth->getUser();
- $data = [];
- $data['notice'] = '滚动显示的公告信息';
- $data['banner_list'] = ['https://dapp-static.oss-cn-shenzhen.aliyuncs.com/jue-jin-lu/3.pnggS02ouwrJfiF65979ec74db73','https://dapp-static.oss-cn-shenzhen.aliyuncs.com/jue-jin-lu/intro.pngkSx1GTBiuFzY65979f0cd34e1'];
- $data['balance'] = $user['balance'];
- $data['bonus_sum'] = $user['bonus_sum'];
- $data['service_link'] = $user['service_link'];
- $data['icon_list'] = [
- 'https://www.estyzl38.com/static/img/binance.ebc27893.png',
- 'https://www.estyzl38.com/static/img/ibank.11f8808d.png',
- 'https://www.estyzl38.com/static/img/gate.ef718121.png',
- 'https://www.estyzl38.com/static/img/trustwallet.3e39f1f7.png',
- 'https://www.estyzl38.com/static/img/gemini.90d29b68.png',
- 'https://www.estyzl38.com/static/img/11.png',
- 'https://www.estyzl38.com/static/img/metamask.5cc72a6d.png',
- 'https://www.estyzl38.com/static/img/22.png',
- ];
- $this->success(__('请求成功'), $data);
- }
- /**
- * 团队
- * @return void
- */
- public function team()
- {
- $user = $this->auth->getUser();
- $info_list = (new \app\common\model\Users())
- ->alias('u')
- ->join('users_path p', 'p.user_id = u.id')
- ->where('p.parent_id', $user['id'])
- ->field('u.avatar,u.bonus_sum,u.mobile,u.nickname')
- ->order('u.bonus_sum DESC')
- ->paginate($this->pageSize);
- // foreach ($info_list as $k => $v) {
- // $paginator[$k]['status_name'] = (new OrderModel())->getStatusNames($v['status']);
- // }
- $res_data = $this->buildResp($info_list->total(), $info_list->currentPage(), $info_list->items());
- $res_data['bonus_today'] = MoneyLog::where('user_id', $user['id'])
- ->where('create_time', '>=', strtotime('today'))
- ->where('action', 'in', [1,2])
- ->sum('amount');
- $res_data['bonus_sum'] = $user['bonus_sum'];
- $res_data['team_num'] = $user['team_num'];
- $this->success('', $res_data);
- }
- public function news_list()
- {
- $info_list = (new News())
- ->field('img_url,content', true)
- ->where('type_id', 2)//常见问题
- ->order('id DESC')
- ->paginate($this->pageSize);
- // foreach ($info_list as $k => $v) {
- // $paginator[$k]['status_name'] = (new OrderModel())->getStatusNames($v['status']);
- // }
- $res_data = $this->buildResp($info_list->total(), $info_list->currentPage(), $info_list->items());
- $this->success('', $res_data);
- }
- public function news()
- {
- $news_id = $this->request->post('id');
- $type_id = $this->request->post('type_id');
- $where['type_id'] = $type_id;
- if(!empty($news_id)){
- $where['id'] = $news_id;
- }
- $info_list = (new News())
- //->field('title,content')
- ->where($where)
- ->order('id desc')
- ->find();
- $this->success('', $info_list);
- }
- }
|