count('id'); $lists = $model->order('id', 'desc') ->page($get['page'], $get['limit']) ->select(); foreach ($lists as &$item) { $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); $item['region'] = AreaServer::getAddress([ $item['province_id'], $item['city_id'], $item['district_id'], ]); } return ['count' => $count, 'lists' => $lists]; } /** * @notes 所有发件人模板 * @author 张无忌 * @date 2021/9/27 15:40 */ public static function all() { $model = new FaceSheetSender(); return $model->order('id', 'desc')->select(); } /** * @notes 获取发件人模板详细 * @param $id * @return FaceSheetSender * @author 张无忌 * @date 2021/9/26 15:51 */ public static function detail($id) { return FaceSheetSender::where(['id'=>$id])->find(); } /** * @notes 新增发件人模板 * @param $post * @return bool|string * @author 张无忌 * @date 2021/9/26 15:18 */ public static function add($post) { try { FaceSheetSender::create([ 'name' => $post['name'], 'mobile' => $post['mobile'], 'province_id' => $post['province_id'], 'city_id' => $post['city_id'], 'district_id' => $post['district_id'], 'address' => $post['address'], 'create_time' => time(), 'update_time' => time(), ]); return true; } catch (Exception $e) { return $e->getMessage(); } } /** * @notes 编辑发件人模板 * @param $post * @return bool|string * @author 张无忌 * @date 2021/9/26 15:23 */ public static function edit($post) { try { FaceSheetSender::update([ 'name' => $post['name'], 'mobile' => $post['mobile'], 'province_id' => $post['province_id'], 'city_id' => $post['city_id'], 'district_id' => $post['district_id'], 'address' => $post['address'], 'update_time' => time(), ], ['id'=>$post['id']]); return true; } catch (Exception $e) { return $e->getMessage(); } } /** * @notes 删除发件人模板 * @param $id * @return bool|string * @author 张无忌 * @date 2021/9/26 15:45 */ public static function del($id) { try { FaceSheetSender::destroy($id); return true; } catch (Exception $e) { return $e->getMessage(); } } }