update
This commit is contained in:
parent
627445edda
commit
4711c88013
@ -15,7 +15,7 @@
|
||||
namespace app\adminapi\lists\cost;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\cost\CostSubject;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
@ -38,7 +38,7 @@ class CostSubjectLists extends BaseAdminDataLists implements ListsSearchInterfac
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['sn', 'subject1'],
|
||||
'%like%' => ['sn', 'subject1', 'subject12'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,10 @@ class CostSubjectLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostSubject::create([
|
||||
'sn' => $params['sn'],
|
||||
'subject1' => $params['subject1'],
|
||||
'subject2' => $params['subject2'],
|
||||
'sn' => $params['sn'],
|
||||
'subject1' => $params['subject1'],
|
||||
'subject2' => $params['subject2'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -68,11 +67,11 @@ class CostSubjectLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
CostSubject::where('id', $params['id'])->update([
|
||||
'sn' => $params['sn'],
|
||||
'subject1' => $params['subject1'],
|
||||
'subject2' => $params['subject2'],
|
||||
'sn' => $params['sn'],
|
||||
'subject1' => $params['subject1'],
|
||||
'subject2' => $params['subject2'] ?? '',
|
||||
'update_time' => time()
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -105,6 +104,6 @@ class CostSubjectLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CostSubject::findOrEmpty($params['id'])->toArray();
|
||||
return CostSubject::field('id,sn,subject1,subject2')->findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user