Wagent.php 864 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\DB;
  4. class Wagent extends BaseModel
  5. {
  6. protected $table = 'wagent';
  7. public $timestamps = false;
  8. function wagentlist($list = 10, $page, $where = '')
  9. {
  10. if (is_array ($where) && count ($where) > 0) {
  11. $data = $this->select($this->table.'.*')->orderby($this->table.'.id','desc')->where($where)->paginate ($list);
  12. }else{
  13. $data = $this->select($this->table.'.*')->orderby($this->table.'.id','desc')->paginate ($list);
  14. }
  15. for ($i=0; $i < count($data); $i++) {
  16. $data[$i]->auth_expire = date("Y-m-d",$data[$i]->auth_expire);
  17. }
  18. return $data->toArray ();
  19. }
  20. //唯一性
  21. function onlywagent($name){
  22. $res = $this->where ('agent_name', $name)->first ();
  23. if ($res) {
  24. return 2; //唯一性
  25. }
  26. return 1;
  27. }
  28. }