176 lines
3.1 KiB
PHP
176 lines
3.1 KiB
PHP
<?php
|
|
namespace app\farm\controller;
|
|
use app\AdminRest;
|
|
use app\farm\model\BalanceCard;
|
|
use app\farm\model\BalanceOrder;
|
|
|
|
|
|
use app\farm\model\LandList;
|
|
use app\farm\model\Massif;
|
|
use app\farm\server\Land;
|
|
use think\App;
|
|
use think\facade\Db;
|
|
|
|
|
|
class AdminMassif 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-14 14:43
|
|
* @功能说明:地块列表
|
|
*/
|
|
public function massifList(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','>',-1];
|
|
|
|
if(!empty($input['farmer_id'])){
|
|
|
|
$dis[] = ['farmer_id','=',$input['farmer_id']];
|
|
}
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$data = $this->massif_model->dataList($dis,$input['limit']);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-14 14:43
|
|
* @功能说明:地块列表下拉框
|
|
*/
|
|
public function massifSelect(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis[] = ['uniacid','=',$this->_uniacid];
|
|
|
|
$dis[] = ['status','=',1];
|
|
|
|
if(!empty($input['farmer_id'])){
|
|
|
|
$dis[] = ['farmer_id','=',$input['farmer_id']];
|
|
}
|
|
|
|
if(!empty($input['title'])){
|
|
|
|
$dis[] = ['title','like','%'.$input['title'].'%'];
|
|
}
|
|
|
|
$data = $this->massif_model->where($dis)->select()->toArray();
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-14 14:49
|
|
* @功能说明:添加地块
|
|
*/
|
|
public function massifAdd(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
|
|
$data = $this->massif_model->dataAdd($input);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-14 14:50
|
|
* @功能说明:编辑地块
|
|
*/
|
|
public function massifUpdate(){
|
|
|
|
$input = $this->_input;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$input['uniacid'] = $this->_uniacid;
|
|
//删除
|
|
if(isset($input['status'])&&$input['status']==-1){
|
|
|
|
$find = $this->land_model->landSomeFind($input['id'],1);
|
|
|
|
if($find==1){
|
|
|
|
$this->errorMsg('该地块服务正在被使用');
|
|
}
|
|
|
|
}
|
|
|
|
$data = $this->massif_model->dataUpdate($dis,$input);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @author chenniang
|
|
* @DataTime: 2021-12-14 14:50
|
|
* @功能说明:地块详情
|
|
*/
|
|
public function massifInfo(){
|
|
|
|
$input = $this->_param;
|
|
|
|
$dis = [
|
|
|
|
'id' => $input['id']
|
|
];
|
|
|
|
$data = $this->massif_model->dataInfo($dis);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|