Coupon.php 578 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class Coupon extends Model
  5. {
  6. protected $connection = 'mysql';
  7. protected $pk = 'id';
  8. protected $name = 'coupon';
  9. public static function getpcarray($ptype = '')
  10. {
  11. $where['weid'] = weid();
  12. $where['status'] = 1;
  13. if (!empty($ptype)) {
  14. $where['ptype'] = $ptype;
  15. }
  16. $list = self::field('id,name')->where($where)
  17. ->order('sort asc')
  18. ->select()
  19. ->toArray();
  20. $array = [];
  21. foreach ($list as $k => $v) {
  22. $array[$k]['val'] = $v['id'];
  23. $array[$k]['key'] = $v['name'];
  24. }
  25. return $array;
  26. }
  27. }