123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?php
- namespace app\admin\controller\party;
- use app\common\controller\Backend;
- class Getvalue extends Backend
- {
-
-
- protected $model = null;
- public function _initialize()
- {
- parent::_initialize();
- $this->model = new \app\admin\model\party\Getvalue;
- }
- public function import()
- {
- parent::import();
- }
-
-
-
- public function index()
- {
-
- $this->relationSearch = true;
-
- $this->request->filter(['strip_tags', 'trim']);
- if ($this->request->isAjax()) {
-
- if ($this->request->request('keyField')) {
- return $this->selectpage();
- }
- list($where, $sort, $order, $offset, $limit) = $this->buildparams();
- $filter = $this->request->request('filter');
- $wheres = json_decode($filter,true);
- $where = [];
- isset($wheres["room_type"]) && $where["party.room_type"] = $wheres["room_type"];
- isset($wheres["live_type"]) && $where["party.live_type"] = $wheres["live_type"];
- isset($wheres["party_id"]) && $where["party.party_id"] = $wheres["party_id"];
- $listObj = \app\common\model\Party::alias("party")
- ->field("user.u_id,party.room_type,party.party_id,party.party_name,party.live_type,sum(getvalue.value) as value,lt.name as live_type,getvalue.createtime");
- if(isset($wheres["createtime"])) {
- $createtime = explode(" - ",$wheres["createtime"]);
- $starttime = strtotime($createtime[0]);
- $endtime = strtotime($createtime[1]);
- $listObj->join("hx_gift_user_party getvalue","party.id = getvalue.party_id and (getvalue.createtime between $starttime and $endtime ) ","left");
- } else {
- $listObj->join("hx_gift_user_party getvalue","party.id = getvalue.party_id","left");
- }
- $list = $listObj->join("hx_user user","user.id = party.user_id","left")
- ->join("hx_party_live_type lt","lt.id = party.live_type","left")
- ->order("value", "desc")
- ->where($where)
- ->group("party.party_id")
- ->select();
- $result = array("total" => 1, "rows" => $list);
- return json($result);
- }
- return $this->view->fetch();
- }
- }
|