Attenders.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * 签到表模型
  4. */
  5. namespace app\admin\model;
  6. use daswork\Model;
  7. class Attenders extends Model
  8. {
  9. public function __construct($tablename = '')
  10. {
  11. parent::__construct();
  12. // if ($tablename) {
  13. // $this->tablename = $tablename;
  14. // } else {
  15. // $this->tablename = uncamelize(basename(__CLASS__));
  16. // }
  17. $this->tablename = 'attenders';
  18. }
  19. public function dataList($where = '')
  20. {
  21. $sql = "select id,truename,organization,position,sex,phone,email,fee_type,is_report,report_title,hotel_type,room_type,is_share,pay_type,is_pay,money,tax_type,tax_title,tax_number,bank_account,company_address,company_phone,mailing_address,postcode,remark,create_time from $this->tablename $where;";
  22. // echo $sql;
  23. // exit;
  24. return $this->select($sql);
  25. }
  26. public function getByTruenameAndPhone($name = '', $phone = '')
  27. {
  28. $query = "select * from attenders where truename='$name' and phone='$phone'";
  29. $result = $this->query($query)->fetch_assoc();
  30. return $result;
  31. }
  32. /**
  33. * deleteByIds
  34. */
  35. public function deleteById($id)
  36. {
  37. if (is_array($id)) {
  38. $sql = "DELETE FROM `$this->tablename` WHERE `id` IN(";
  39. for ($i=0; $i < count($id); $i++) {
  40. $sql .= $id[$i] . ',';
  41. }
  42. $sql = rtrim($sql, ',');
  43. $sql .= ");";
  44. } else {
  45. $sql = "DELETE FROM `$this->tablename` WHERE `id`=$id;";
  46. }
  47. return $this->query($sql);
  48. }
  49. public function exportToExcel()
  50. {
  51. }
  52. }