['name', 'custom_type', 'phone', 'credit_rating', 'province', 'city', 'status'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/11/11 22:10 */ public function lists(): array { return Custom::where($this->searchWhere) ->with('province') ->field(['*']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($item, $key){ if (!empty($item['other_contacts'])) { $otherContactsArray = json_decode($item['other_contacts'], true); if (is_array($otherContactsArray)) { $item['other_contacts'] = $otherContactsArray; } } return $item; })->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/11/11 22:10 */ public function count(): int { return Custom::where($this->searchWhere)->count(); } }