where($map)->count(); return $count; } //读取分类列表 function contract_cate() { $cate = Db::name('ContractCate')->where(['status' => 1])->order('id desc')->select()->toArray(); return $cate; } //读取签约主体 function contract_subject() { $subject = Db::name('InvoiceSubject')->where(['status' => 1])->order('id desc')->select()->toArray(); return $subject; } //写入日志 function to_log($uid,$new,$old) { $log_data = []; $key_array = ['id', 'create_time', 'update_time', 'sign_did']; foreach ($new as $key => $value) { if (!in_array($key, $key_array)) { if(isset($old[$key]) && ($old[$key]!=$value)){ $log_data[] = array( 'field' => $key, 'contract_id' => $new['id'], 'admin_id' => $uid, 'old_content' => $old[$key], 'new_content' => $value, 'create_time' => time(), ); } } } Db::name('ContractLog')->strict(false)->field(true)->insertAll($log_data); }