优化代码
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace app\massage\model;
|
||||
|
||||
use app\BaseModel;
|
||||
@@ -16,7 +17,8 @@ class Config extends BaseModel
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
public function dataAdd($data)
|
||||
{
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
@@ -25,13 +27,13 @@ class Config extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
public function dataUpdate($dis, $data)
|
||||
{
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
@@ -45,12 +47,10 @@ class Config extends BaseModel
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
public function dataList($dis, $page)
|
||||
{
|
||||
$data = $this->where($dis)->order('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -59,26 +59,16 @@ class Config extends BaseModel
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
public function dataInfo($dis)
|
||||
{
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
if(empty($data)){
|
||||
|
||||
if (empty($data)) {
|
||||
$this->dataAdd($dis);
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
}
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
return !empty($data) ? $data->toArray() : [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user