|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :InquiryFieldController.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/13 10:45
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bside\Inquiry;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Bside\BaseController;
|
|
|
|
use App\Models\Inquiry\InquiryField;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :詢盤字段映射
|
|
|
|
* @name :InquiryFieldController
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/13 10:45
|
|
|
|
*/
|
|
|
|
class InquiryFieldController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @remark :詢盤字段映射
|
|
|
|
* @name :lists
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/13 10:59
|
|
|
|
*/
|
|
|
|
public function lists(){
|
|
|
|
$inquiryModel = new InquiryField();
|
|
|
|
$lists = $inquiryModel->list($this->map);
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存數據
|
|
|
|
* @name :save
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/13 11:13
|
|
|
|
*/
|
|
|
|
public function save(){
|
|
|
|
$this->request->validate([
|
|
|
|
'data'=>'required',
|
|
|
|
],[
|
|
|
|
'data.required' => 'data不能为空',
|
|
|
|
]);
|
|
|
|
$inquiryModel = new InquiryField();
|
|
|
|
foreach ($this->param['data'] as $v){
|
|
|
|
if(isset($v['id']) && !empty($v['id'])){
|
|
|
|
$inquiryModel->edit(['en_name'=>$v['en_name']],['id'=>$v['id']]);
|
|
|
|
}else{
|
|
|
|
$inquiryModel->addReturnId(['name'=>$v['name'], 'en_name'=>$v['en_name']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :刪除數據
|
|
|
|
* @name :del
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/8/13 11:14
|
|
|
|
*/
|
|
|
|
public function del(){
|
|
|
|
|
|
|
|
$this->request->validate([
|
|
|
|
'id'=>'required',
|
|
|
|
],[
|
|
|
|
'id.required' => 'name不能为空',
|
|
|
|
]);
|
|
|
|
$inquiryModel = new InquiryField();
|
|
|
|
$inquiryModel->del(['id'=>['in',$this->param['id']]]);
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|