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 del($id) { // 写入数据表 $result = $this->query()->where(['id'=>$id])->delete(); // 返回结果 return $result; } /** * 查询某条数据 * */ public function getOne($id,$field=''){ // 返回结果 $result = $field ? $this->query()->where([['id','=',$id]])->value($field) : $this->query()->where([['id','=',$id]])->first(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default','shop_type']); // 返回结果 return $result; } /** * 查询某条数据 * */ public function getListByCustom($uid){ // 返回结果 $result = $this->query()->where([['custom_uid','=',$uid]])->get(['id','custom_uid','contact_province','contact_city','contact_area','contact_addr','contact_name','contact_shop','contact_phone','is_default','shop_type']); // 返回结果 return $result; } }