1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- /**
- * PaywayLogic.php UTF-8
- * 支付方式逻辑
- *
- * @date : 2020/3/10 10:55
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOOA 1.0
- */
- 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 = '';
- /**
- * 获取查询条件
- *
- * @param array $param
- *
- * @return array
- */
- 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;
- }
- /***
- * 获取列表
- *
- * @param array $where
- * @param string $page
- * @param string $order
- * @param string $field
- *
- * @return array
- */
- 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;
- }
- /****
- * 获取后台列表
- *
- * @param array $param
- * @param string $page
- * @param string $order
- *
- * @return array
- */
- 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;
- }
- }
|