Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9b23667f
authored
Nov 18, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询药品列表
parent
49ae6fc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
app/Api/Controllers/DrugController.php
+22
-18
No files found.
app/Api/Controllers/DrugController.php
View file @
9b23667f
...
...
@@ -26,28 +26,29 @@ public function test()
// $drug->save();
// $drug->limit_buy_7 = 5;
// $drug->save();
$mobile
=
'18321861540'
;
$templateName
=
'verification_code'
;
$templateData
=
[
'code'
=>
'1234'
];
$smsService
=
new
SmsService
();
$response
=
$smsService
->
sendSms
(
$mobile
,
$templateName
,
$templateData
);
//
$mobile = '18321861540';
//
$templateName = 'verification_code';
//
$templateData = ['code' => '1234'];
//
$smsService = new SmsService();
//
$response = $smsService->sendSms($mobile, $templateName, $templateData);
return
response
()
->
json
(
$response
);
//
return response()->json($response);
return
$this
->
success
(
'ok'
);
//
return $this->success('ok');
//
$search_input = '测试';
//
$data = PharmacyDrugModel::where('pharmacy_id', 1)
//
->whereHas('drug', function ($query) use ($search_input) {
//
$query->where('name', 'LIKE', "%{$search_input}%")
//
->orWhere('code', 'LIKE', "%{$search_input}%"); // 这里的'%筛选条件%'是你想要匹配的药品名称
//
})
//
->paginate(10);
$search_input
=
'测试'
;
$data
=
PharmacyDrugModel
::
where
(
'pharmacy_id'
,
1
)
->
whereHas
(
'drug'
,
function
(
$query
)
use
(
$search_input
)
{
$query
->
where
(
'name'
,
'LIKE'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'code'
,
'LIKE'
,
"%
{
$search_input
}
%"
);
// 这里的'%筛选条件%'是你想要匹配的药品名称
})
->
paginate
(
10
);
// // $drugs = $data->map(function ($row) {
// // return $row->drug;
// // });
// return $this->success($data);
$data
->
map
(
function
(
$row
)
{
return
$row
->
drug
;
});
return
$this
->
success
(
$data
);
}
// 药品列表
...
...
@@ -70,6 +71,9 @@ public function drugList(Request $request)
}
})
->
paginate
(
10
);
$data
->
map
(
function
(
$row
)
{
return
$row
->
drug
;
});
return
$this
->
success
(
$data
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment