WechatPlan.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class WechatPlan extends Model
  5. {
  6. // 自动写入时间戳字段
  7. protected $autoWriteTimestamp = 'int';
  8. // 定义时间戳字段名
  9. protected $createTime = 'createtime';
  10. protected $updateTime = 'updatetime';
  11. public static function lst($where)
  12. {
  13. $model = new self;
  14. $xwhere = null;
  15. $order = "id desc";
  16. if (isset($where['cid']) && $where['cid'] > 0) $xwhere['cid'] = $where['cid'];
  17. if (isset($where['plan_id']) && $where['plan_id'] > 0) $xwhere['plan_id'] = $where['plan_id'];
  18. if (isset($where['price']) && $where['price'] > 0) $xwhere['price'] = $where['price'];
  19. // if (isset($where['paid']) && $where['paid'] > -1) $xwhere['paid'] = $where['paid'];
  20. // if (isset($where['help_id']) && $where['help_id'] > -1) $xwhere['help_id'] = $where['help_id'];
  21. // if (isset($where['order']) && $where['order'] != '') $order = $where['order'];
  22. // if (isset($where['key']) && $where['key'] != '') $xwhere['name|contact|tel'] = ['like', "%{$where['key']}%"];
  23. $data = $model->where($xwhere)->order($order)->page($where['page'], $where['limit'])->select();
  24. $count = $model->where($xwhere)->count();
  25. return compact('count', 'data');
  26. }
  27. public static function read($where)
  28. {
  29. $model = new self;
  30. $xwhere = null;
  31. $order = "id desc";
  32. if (isset($where['id']) && $where['id'] > 0) $xwhere['id'] = $where['id'];
  33. $data = $model->where($xwhere)->order($order)->select();
  34. // $count = $model->where($xwhere)->count();
  35. return $data;
  36. }
  37. }