| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
-
- namespace App\Models\Api\Website;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- /**
- * 通知成员
- * @author: 唐远望
- * @version: 1.0
- * @date: 2026-03-06
- */
- class LeadNotice extends Model
- {
- use HasFactory;
- // 与模型关联的表名
- protected $table = 'website_lead_notice';
- // 是否主动维护时间戳
- public $timestamps = false;
- // 定义时间戳字段名
- // const CREATED_AT = 'insert_time';
- // const UPDATED_AT = 'update_time';
- protected $connection = 'mysql';
- /**
- * 添加数据
- *
- */
- public function add($data)
- {
- // 时间
- $data['insert_time'] = time();
- $data['update_time'] = time();
- // 写入数据表
- $id = $this->query()->insertGetId($data);
- // 返回结果
- return $id;
- }
- /**
- * 添加数据
- *
- */
- public function edit($id,$data)
- {
- // 更新时间
- $data['update_time'] = time();
- // 写入数据表
- $result = $this->query()->where(['id'=>$id])->update($data);
- // 返回结果
- return $result;
- }
- /**
- * 获取单个信息
- *
- */
- public function getOne($id,$field=''){
- // 返回结果
- $result = $this->query()->find($id);
- // 返回结果
- $result = $result ? $result->toArray() : [];
- // 返回值
- return empty($field) ? $result : ( isset($result[$field]) ? $result[$field] : null);
- }
- /**
- * 获取单个信息
- *
- */
- public function getList(){
- // 返回结果
- $list = $this->query()->where([['status','=',0]])->get(['id','phone'])->toArray();
- // 返回值
- return $list;
- }
- }
|