1 files added
1 files modified
| | |
| | | } |
| | | return pdo_fetchall($sql,$sqlParam); |
| | | } |
| | | |
| | | |
| | | public function getUserOrderList($param) { |
| | | $sqlParam = array(':invitationCode' => $param["invitationCode"]); |
| | | $sql = "select `date`, COUNT(id), SUM(amount) from ( |
| | | select *, FROM_UNIXTIME(endtime,'%Y年%m月') as date from ims_site_store_order where buyerid in (select uid from ims_users where invitation_code = :invitationCode) |
| | | ) as `order` ORDER BY `date`"; |
| | | return pdo_fetchall($sql,$sqlParam); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?php |
| | | /* |
| | | * 分页查询工具 |
| | | * @Author: 王腾宇 |
| | | * @Date: 2018-12-17 16:40:15 |
| | | * @Last Modified by: 王腾宇 |
| | | * @Last Modified time: 2018-12-17 18:09:19 |
| | | */ |
| | | |
| | | class Page { |
| | | |
| | | private $pageNum; |
| | | |
| | | private $pageSzie; |
| | | |
| | | private $sql; |
| | | |
| | | private $sqlParam; |
| | | |
| | | public function _construct($pageNum, $pageSzie, $sql, $sqlParam) { |
| | | this->$pageNum = $pageNum; |
| | | this->pageSzie = $pageSzie; |
| | | this->sql = $sql; |
| | | this->sqlParam = $sqlParam; |
| | | } |
| | | |
| | | public function count($countCol="*") { |
| | | return pdo_query('select '.$countCol.' as count from ('.$sql.') as countTable')[0]['count']; |
| | | } |
| | | |
| | | public function toQuery($countCol="*") { |
| | | $count = this->count($countCol); |
| | | return array( |
| | | 'total' => $count, |
| | | 'pageNum' => $pageNum, |
| | | 'pageSzie' => $pageSzie, |
| | | 'pageData' => pdo_fetchall('select '.$countCol.' as count from ('.$sql.') as pageTable limit' ,$sqlParam) |
| | | ); |
| | | } |
| | | } |