12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /**
- * ${CARET}
- * @file:CpService.php
- * @Created by gnitif
- * @Date: 2023/3/21
- * @Time: 20:24
- */
- namespace Modules\CpManage\Services\CpManage;
- use Illuminate\Contracts\Pagination\LengthAwarePaginator;
- use Illuminate\Support\Facades\DB;
- use Modules\CpManage\Models\Cp\Cps;
- class CpService
- {
- public static function selectOptions($cpName = "")
- {
- $list = Cps::select('cp_id','cp_name','cp_nick','cp_company');
- if (!empty($cpName)){
- $list->where('cp_name','like',"%{$cpName}%");
- }
- return $list->get();
- }
- /**
- * 查询产品列表
- * name: getCpList
- * @param $where
- * @param int $pageSize
- * @return LengthAwarePaginator
- * date 2023/03/22 20:49
- */
- public static function getCpList($where , int $pageSize = 20)
- {
- $list = DB::table('cps')->where($where)->orderBy('cp_id','desc')->paginate($pageSize);
- if(!$list->isEmpty()){
- foreach ($list as $value){
- $value->book_count = 0;
- }
- }
- return $list;
- }
- }
|