__('Money'), 'score' => __('Score')]; } public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function user() { return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } public function getBill($user_id, $currency_type, $change_type, $relation_no) { return $this->where([ "user_id" => $user_id, "currency_type" => $currency_type, "change_type" => $change_type, "relation_no" => $relation_no ]) ->order("createtime", "desc") ->find(); } public function fetchBill($user_id, $currency_type, $change_types, $page = 1, $size = 10) { $query = $this->where([ "user_id" => $user_id, "currency_type" => $currency_type, "is_del" => 0 ]); if (!in_array("*", $change_types)) { $query->where("change_type", "in", $change_types); } return $query ->order("createtime", "desc") ->page($page) ->paginate($size); } }