MoneyNagent.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\DB;
  4. /**
  5. *
  6. */
  7. class MoneyNagent extends BaseModel {
  8. protected $table = "money_nagent";
  9. public $timestamps = false;
  10. //获取查询字段
  11. function getFild($num){
  12. $filds=array(
  13. '1'=>'id',
  14. '2'=>'agent_name',
  15. '3'=>'agent_identity',
  16. '4'=>'status',
  17. );
  18. return $filds[$num];
  19. }
  20. //获取列表内容
  21. function getApplyList($value,$num,$list=10){
  22. $model=$this;
  23. if(is_array($value)){
  24. $model=$model->where($value);
  25. }
  26. $data=$model->paginate($list);
  27. if(!$data){
  28. return -7012345;
  29. }
  30. return $data->toArray();
  31. }
  32. //获取详情
  33. function getInfo($value,$num){
  34. $fild=$this->getFild($num);
  35. $data=$this->where($fild,$value)->first();
  36. if(!$data){
  37. return -123455;
  38. }
  39. return $data->toArray();
  40. }
  41. //更新
  42. function updateInfo($data,$value,$num){
  43. $fild=$this->getFild($num);
  44. $res=$this->where($fild,$value)->update($data);
  45. if(!$res){
  46. return -213245345;
  47. }
  48. return 1;
  49. }
  50. }