query()->insertGetId($data); // 如果操作失败 if( !$id ) return $id; // 返回结果 return $id; } /** * 添加数据 * */ public function edit($id,$data) { // 更新时间 $data['update_time'] = time(); // 写入数据表 $result = $this->query()->where(['id'=>$id])->update($data); // 失败返回0 if( !$result ) return ''; // 返回结果 return $id; } /** * 添加数据 * */ public function getListByWeibanExtid($weibanExtid) { // 返回结果 $list = $this->query()->where([['weiban_extid','=',$weibanExtid]])->get(['id','staff_id','staff_name','staff_avatar','phone_number','status','remark','remark_state','weiban_extid','remark_corp_name'])->toArray(); // 返回结果 if( !$list ) return []; // 数据结构 return $list; } }