优化代码
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\farm\model;
|
namespace app\farm\model;
|
||||||
|
|
||||||
use app\BaseModel;
|
use app\BaseModel;
|
||||||
@@ -21,7 +22,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2022-03-02 17:12
|
* @DataTime: 2022-03-02 17:12
|
||||||
* @功能说明:
|
* @功能说明:
|
||||||
*/
|
*/
|
||||||
public function getTimeStatusAttr($value,$data){
|
public function getTimeStatusAttr($value, $data)
|
||||||
|
{
|
||||||
|
|
||||||
if (!empty($data['start_time']) && !empty($data['end_time'])) {
|
if (!empty($data['start_time']) && !empty($data['end_time'])) {
|
||||||
|
|
||||||
@@ -47,7 +49,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2021-12-30 11:22
|
* @DataTime: 2021-12-30 11:22
|
||||||
* @功能说明:
|
* @功能说明:
|
||||||
*/
|
*/
|
||||||
public function getImgsAttr($value,$data){
|
public function getImgsAttr($value, $data)
|
||||||
|
{
|
||||||
|
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
|
|
||||||
@@ -61,7 +64,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2021-12-30 11:22
|
* @DataTime: 2021-12-30 11:22
|
||||||
* @功能说明:
|
* @功能说明:
|
||||||
*/
|
*/
|
||||||
public function getIdcardImgsAttr($value,$data){
|
public function getIdcardImgsAttr($value, $data)
|
||||||
|
{
|
||||||
|
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
|
|
||||||
@@ -69,12 +73,14 @@ class Farmer extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chenniang
|
* @author chenniang
|
||||||
* @DataTime: 2020-09-29 11:04
|
* @DataTime: 2020-09-29 11:04
|
||||||
* @功能说明:添加
|
* @功能说明:添加
|
||||||
*/
|
*/
|
||||||
public function dataAdd($data){
|
public function dataAdd($data)
|
||||||
|
{
|
||||||
|
|
||||||
$data['create_time'] = time();
|
$data['create_time'] = time();
|
||||||
|
|
||||||
@@ -85,13 +91,13 @@ class Farmer extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chenniang
|
* @author chenniang
|
||||||
* @DataTime: 2020-09-29 11:05
|
* @DataTime: 2020-09-29 11:05
|
||||||
* @功能说明:编辑
|
* @功能说明:编辑
|
||||||
*/
|
*/
|
||||||
public function dataUpdate($dis,$data){
|
public function dataUpdate($dis, $data)
|
||||||
|
{
|
||||||
|
|
||||||
$res = $this->where($dis)->update($data);
|
$res = $this->where($dis)->update($data);
|
||||||
|
|
||||||
@@ -105,7 +111,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2020-09-29 11:06
|
* @DataTime: 2020-09-29 11:06
|
||||||
* @功能说明:列表
|
* @功能说明:列表
|
||||||
*/
|
*/
|
||||||
public function dataList($dis,$page=10){
|
public function dataList($dis, $page = 10)
|
||||||
|
{
|
||||||
|
|
||||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||||
|
|
||||||
@@ -119,7 +126,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2020-09-29 11:06
|
* @DataTime: 2020-09-29 11:06
|
||||||
* @功能说明:列表
|
* @功能说明:列表
|
||||||
*/
|
*/
|
||||||
public function dataDistanceList($dis,$alh,$alhs=[],$page=10){
|
public function dataDistanceList($dis, $alh, $alhs = [], $page = 10)
|
||||||
|
{
|
||||||
|
|
||||||
$data = $this->where($dis)->where($alhs)->field(['*', $alh])->order('distance asc,id desc')->paginate($page)->toArray();
|
$data = $this->where($dis)->where($alhs)->field(['*', $alh])->order('distance asc,id desc')->paginate($page)->toArray();
|
||||||
|
|
||||||
@@ -133,7 +141,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2021-12-30 11:26
|
* @DataTime: 2021-12-30 11:26
|
||||||
* @功能说明:后台列表
|
* @功能说明:后台列表
|
||||||
*/
|
*/
|
||||||
public function adminDataList($dis,$page=10,$where=[]){
|
public function adminDataList($dis, $page = 10, $where = [])
|
||||||
|
{
|
||||||
|
|
||||||
$data = $this->alias('a')
|
$data = $this->alias('a')
|
||||||
->join('lbfarm_user_list b', 'a.user_id = b.id', 'left')
|
->join('lbfarm_user_list b', 'a.user_id = b.id', 'left')
|
||||||
@@ -157,7 +166,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2020-09-29 11:43
|
* @DataTime: 2020-09-29 11:43
|
||||||
* @功能说明:
|
* @功能说明:
|
||||||
*/
|
*/
|
||||||
public function dataInfo($dis,$file='*'){
|
public function dataInfo($dis, $file = '*')
|
||||||
|
{
|
||||||
|
|
||||||
$data = $this->where($dis)->field($file)->find();
|
$data = $this->where($dis)->field($file)->find();
|
||||||
|
|
||||||
@@ -171,7 +181,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2022-02-22 11:30
|
* @DataTime: 2022-02-22 11:30
|
||||||
* @功能说明:检查用户是否是地主
|
* @功能说明:检查用户是否是地主
|
||||||
*/
|
*/
|
||||||
public function landlordCheck($user_id){
|
public function landlordCheck($user_id)
|
||||||
|
{
|
||||||
|
|
||||||
$cap_dis[] = ['user_id', '=', $user_id];
|
$cap_dis[] = ['user_id', '=', $user_id];
|
||||||
|
|
||||||
@@ -216,7 +227,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2022-02-22 11:53
|
* @DataTime: 2022-02-22 11:53
|
||||||
* @功能说明:初始化地主表
|
* @功能说明:初始化地主表
|
||||||
*/
|
*/
|
||||||
public function initLandLord($data,$uniacid){
|
public function initLandLord($data, $uniacid)
|
||||||
|
{
|
||||||
|
|
||||||
$dis = [
|
$dis = [
|
||||||
|
|
||||||
@@ -262,7 +274,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2020-10-21 15:21
|
* @DataTime: 2020-10-21 15:21
|
||||||
* @功能说明:保留两位小数
|
* @功能说明:保留两位小数
|
||||||
*/
|
*/
|
||||||
public function getDistanceAttr($value){
|
public function getDistanceAttr($value)
|
||||||
|
{
|
||||||
|
|
||||||
if (!empty($value)) {
|
if (!empty($value)) {
|
||||||
|
|
||||||
@@ -288,14 +301,13 @@ class Farmer extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author chenniang
|
* @author chenniang
|
||||||
* @DataTime: 2022-02-28 14:08
|
* @DataTime: 2022-02-28 14:08
|
||||||
* @功能说明:添加商品时农场主下拉框
|
* @功能说明:添加商品时农场主下拉框
|
||||||
*/
|
*/
|
||||||
public function goodsFarmerSelect($user_id){
|
public function goodsFarmerSelect($user_id)
|
||||||
|
{
|
||||||
|
|
||||||
$land_order_model = new LandOrder();
|
$land_order_model = new LandOrder();
|
||||||
|
|
||||||
@@ -322,7 +334,8 @@ class Farmer extends BaseModel
|
|||||||
* @DataTime: 2022-02-28 16:06
|
* @DataTime: 2022-02-28 16:06
|
||||||
* @功能说明:
|
* @功能说明:
|
||||||
*/
|
*/
|
||||||
public function farmerId($uniacid){
|
public function farmerId($uniacid)
|
||||||
|
{
|
||||||
|
|
||||||
$dis = [
|
$dis = [
|
||||||
|
|
||||||
@@ -338,7 +351,4 @@ class Farmer extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
4
vendor/topthink/framework/src/helper.php
vendored
4
vendor/topthink/framework/src/helper.php
vendored
@@ -698,9 +698,7 @@ if (!function_exists('is_dev')) {
|
|||||||
if (in_array($env, ['dev', 'development', 'local', 'test'], true)) {
|
if (in_array($env, ['dev', 'development', 'local', 'test'], true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (app()->environment('dev') || app()->environment('local') || app()->environment('test')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user