162 lines
2.8 KiB
PHP
162 lines
2.8 KiB
PHP
<?php
|
|
namespace app\farm\controller;
|
|
use app\AdminRest;
|
|
use app\farm\model\BalanceCard;
|
|
use app\farm\model\BalanceOrder;
|
|
|
|
|
|
use app\farm\model\Breed;
|
|
use app\farm\model\Farmer;
|
|
use app\farm\model\LandList;
|
|
use app\farm\model\Massif;
|
|
use app\farm\model\Source;
|
|
use app\farm\server\Land;
|
|
use think\App;
|
|
use think\facade\Db;
|
|
|
|
|
|
class AdminBreed extends AdminRest
|
|
{
|
|
|
|
|
|
protected $model;
|
|
|
|
protected $massif_model;
|
|
|
|
protected $land_model;
|
|
|
|
|
|
public function __construct(App $app) {
|
|
|
|
parent::__construct($app);
|
|
|
|
$this->model = new BalanceCard();
|
|
|
|
$this->massif_model = new Massif();
|
|
|
|
$this->land_model = new LandList();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-29 10:29
|
|
* @功能说明:养殖管理
|
|
*/
|
|
public function breedList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$breed_model = new Breed();
|
|
|
|
$dis[] = ['a.uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['a.status','>',-1];
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['a.title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
if(!empty($input['farmer_id'])){
|
|
|
|
$dis[] = ['b.farmer_id','=',$input['farmer_id']];
|
|
|
|
$dis[] = ['b.type','=',5];
|
|
}
|
|
|
|
$data = $breed_model->breedList($dis,$input['limit']);
|
|
|
|
if(!empty($data['data'])){
|
|
|
|
$farmer_model = new Farmer();
|
|
|
|
foreach ($data['data'] as &$v){
|
|
|
|
$v['farmer_name'] = $farmer_model->where('id','in',$v['farmer_id'])->column('title');
|
|
|
|
$v['farmer_name'] = implode(',',$v['farmer_name']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-29 10:30
|
|
* @功能说明:添加养殖管理
|
|
*/
|
|
public function breedAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$breed_model = new Breed();
|
|
|
|
$res = $breed_model->dataAdd($input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-29 10:34
|
|
* @功能说明:编辑养殖管理
|
|
*/
|
|
public function breedUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$breed_model = new Breed();
|
|
|
|
$res = $breed_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-29 10:34
|
|
* @功能说明:编辑养殖管理
|
|
*/
|
|
public function breedInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$breed_model = new Breed();
|
|
|
|
$res = $breed_model->dataInfo($dis);
|
|
|
|
return $this->success($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|