12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\user\model;
- use think\Model;
- class PayPlugin extends Model{
-
- protected $updateTime = 'update_time'; // 每次更新时间
- protected $autoWriteTimestamp = 'datetime'; // 开启自动写入时间戳字段
-
- public function initialize(){
- parent::initialize();
- }
-
- /**
- * 获取数据信息
- * @param int $page 页码
- * @param array $where 查询条件
- */
- public function getInfo($page, $where = array()){
- return $this->db()
- ->where($where)
- ->page($page, config('paginate.list_rows'))
- ->select();
- }
-
- /**
- * 获取分页信息
- * @param array $where 查询条件
- */
- public function getPage($where = array()){
- $query = getPaginatiorQuery();
- $total = $this->db()->where($where)->count();
- // 查询条件
- $config = ['query'=>$query];
- $paginate = $this->db()->where($where)->paginate(config('paginate.list_rows'), $total, $config);
-
- return $paginate->render();
- }
-
- /**
- * 根据id找到支付信息
- * @param int $id
- * @return array|\think\db\false|PDOStatement|string|\think\Model
- */
- public function getPayPluginById($id){
- return $this->db()->where(['id'=>$id])->find();
- }
-
- /**
- * 根据状态找到支付信息
- * @param int $type
- * @return mixed|array|array[]|object[]
- */
- public function getPayPluginByType($type){
- return $this->db()->where(['type'=>$type])->find()->getData();
- }
- }
|