1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace huo\logic\conf;
- use huo\model\common\CommonModel;
- use huo\model\conf\PaywayModel;
- use huolib\constant\CommonConst;
- class PaywayLogic extends CommonModel {
- protected $base_field = '';
-
- public function getWhere($param = array()) {
- $_map = [];
- if (!empty($param['status'])) {
- $_map['status'] = $param['status'];
- }
- if (!empty($param['payname'])) {
- $_map['payname'] = $param['payname'];
- }
- if (!empty($param['code'])) {
- $_map['code'] = $param['code'];
- }
- if (!empty($param['is_config'])) {
- $_map['is_config'] = $param['is_config'];
- }
- return $_map;
- }
-
- public function getList($where = [], $page = '1,10', $order = '-id', $field = '') {
- $_rdata = [
- 'count' => CommonConst::CONST_ZERO,
- 'list' => []
- ];
- $_model = new PaywayModel();
- $_count = $_model->where($where)->count('id');
- if (empty($_count)) {
- return $_rdata;
- }
- $_order = $_model->orderFilter($order);
- $_list = $_model->where($where)
- ->field($field)
- ->order($_order)
- ->page($page)
- ->select();
- if (is_object($_list)) {
- $_list = $_list->toArray();
- }
- $_rdata['count'] = $_count;
- $_rdata['list'] = $_list;
- return $_rdata;
- }
-
- public function getAdminList($param = [], $page = '1,10', $order = '-id') {
- $_map = $this->getWhere($param);
- $_field = $this->base_field;
- $_rdata = $this->getList($_map, $page, $order, $_field);
- return $_rdata;
- }
- }
|