<?php

namespace App\Models;
use Illuminate\Support\Facades\DB;
/**
 *
 */
class MoneyAgent extends BaseModel {
	protected $table = "money_agent";
	public $timestamps = false;
    //获取查询字段
    function getFild($num){
        $filds=array(
            '1'=>'id',
            '2'=>'agent_name',
            '3'=>'agent_identity',
            '4'=>'status',
        );
        return $filds[$num];
    }
    //获取列表内容
    function getApplyList($value,$num,$list=10){
        $model=$this;
        if(is_array($value)){
            $model=$model->where($value);
        }
        $data=$model->paginate($list);
        if(!$data){
            return -7012345;
        }
        return $data->toArray();
    }
    //获取详情
    function getInfo($value,$num){
        $fild=$this->getFild($num);
        $data=$this->where($fild,$value)->first();
        if(!$data){
            return -123455;
        }
        return $data->toArray();
    }
    //更新
    function updateInfo($data,$value,$num){
        $fild=$this->getFild($num);
        $res=$this->where($fild,$value)->update($data);
        if(!$res){
            return -213245345;
        }
        return 1;
    }
}

?>