|
@@ -52,36 +52,41 @@ Class Manage
|
|
|
|
|
|
if ($id) {
|
|
|
$data = Dever::db('work/info')->find($id);
|
|
|
- $where['where_id'] = $id;
|
|
|
+ $update['where_id'] = $info['id'];
|
|
|
if ($type == 1) {
|
|
|
- $where['status'] = 4;
|
|
|
+ $update['status'] = 4;
|
|
|
} else {
|
|
|
- $where['status'] = 3;
|
|
|
+ $update['status'] = 3;
|
|
|
}
|
|
|
- $where['fdate'] = time();
|
|
|
- $where['chdate'] = time();
|
|
|
- $app = Dever::db('work/appoint')->getAdmin(array('info_id'=>$data['id'],'admin'=>$data['audit_admin']));
|
|
|
- if ($app && $app['admin']) {
|
|
|
- $where['fpeople'] = $app['admin'];
|
|
|
- } else {
|
|
|
- $where['fpeople'] = $data['audit_admin'];
|
|
|
- }
|
|
|
- // if ($app['admin_id'] != $data['audit_admin']){
|
|
|
+ $update = $this->finish($update, $info);
|
|
|
+ Dever::db('work/info')->update($update);
|
|
|
+ return 'ok';
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // }
|
|
|
- Dever::db('work/info')->update($where);
|
|
|
- $log = Dever::db('work/info_log')->find(array('info_id'=>$id));
|
|
|
- if ($log) {
|
|
|
- $w['where_id'] = $log['id'];
|
|
|
- $w['fdate'] = time();
|
|
|
- if($type == 1){
|
|
|
- $w['cloce_date'] = time();
|
|
|
- }
|
|
|
- Dever::db('work/info_log')->update($w);
|
|
|
+ private function finish($update, $info)
|
|
|
+ {
|
|
|
+ $update['fdate'] = time();
|
|
|
+ $update['chdate'] = time();
|
|
|
+ $app = Dever::db('work/appoint')->getAdmin(array('info_id'=>$info['id'],'admin'=>$info['audit_admin']));
|
|
|
+ if ($app && $app['admin']) {
|
|
|
+ $update['fpeople'] = $app['admin'];
|
|
|
+ } else {
|
|
|
+ $update['fpeople'] = $data['audit_admin'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $log = Dever::db('work/info_log')->find(array('info_id'=>$info['id']));
|
|
|
+ if ($log) {
|
|
|
+ $w = array();
|
|
|
+ $w['where_id'] = $log['id'];
|
|
|
+ $w['fdate'] = time();
|
|
|
+ if($type == 1){
|
|
|
+ $w['cloce_date'] = time();
|
|
|
}
|
|
|
-
|
|
|
- return 'ok';
|
|
|
+ Dever::db('work/info_log')->update($w);
|
|
|
}
|
|
|
+
|
|
|
+ return $update;
|
|
|
}
|
|
|
public function insertInfo($id,$name,$data) {
|
|
|
$mobile = Dever::param('mobile',$data);
|
|
@@ -153,6 +158,10 @@ Class Manage
|
|
|
$w['appoint_id'] = $branch_id[1];
|
|
|
}
|
|
|
|
|
|
+ if ($info['status'] == 3 || $info['status'] == 4) {
|
|
|
+ $w = $this->finish($w, $info);
|
|
|
+ }
|
|
|
+
|
|
|
if ($w) {
|
|
|
$w['where_id'] = $id;
|
|
|
Dever::db('work/info')->update($w);
|