コード例 #1
0
 public function show($condition = '')
 {
     $sql = "SELECT * FROM " . DB_PREFIX . "audit_record WHERE  type = 'qingjia'" . $condition;
     $q = $this->db->query($sql);
     $data = $audit_record = array();
     $bill_id = $space = '';
     while ($row = $this->db->fetch_array($q)) {
         if ($row['bill_id']) {
             $bill_id .= $space . $row['bill_id'];
             $space = ',';
             $data[] = $row;
         }
     }
     if ($bill_id) {
         include_once CUR_CONF_PATH . 'lib/qingjia_record.class.php';
         $bill = new qingjia_record();
         $bill_info = $tmp = array();
         $tmp = $bill->show(' AND id IN(' . $bill_id . ')');
         // print_r($tmp);
         if ($tmp) {
             foreach ($tmp as $k => $v) {
                 $bill_info[$v['id']] = array('is_approve' => $v['is_approve'], 'remark' => $v['remark'], 'start_time' => $v['start_time'], 'end_time' => $v['end_time'], 'sort_id' => $v['sort_id'], 'cause' => $v['cause'], 'user_id' => $v['user_id'], 'user_name' => $v['user_name'], 'sort_name' => $v['sort_name'], 'img' => $v['img'], 'real_start_time' => $v['xiaojia']['start_time'], 'real_end_time' => $v['xiaojia']['end_time']);
             }
             foreach ($data as $k => $v) {
                 $data[$k]['bill'] = $bill_info[$v['bill_id']];
             }
         }
     }
     include_once CUR_CONF_PATH . 'lib/qingjia_record.class.php';
     $message = new qingjia_record();
     $message_info = $message_tmp = array();
     $message_tmp = $message->show_qingjia_message();
     // print_r($tmp);
     foreach ($data as $k => $v) {
         foreach ($message_tmp as $key => $vo) {
             if ($v['bill_id'] == $vo['record_id']) {
                 $message_info[$v['id']][] = array('reason' => $vo['reason'], 'remark' => $vo['remark'], 'user_id' => $vo['user_id'], 'user_name' => $vo['user_name'], 'create_time' => $vo['create_time']);
             }
         }
     }
     foreach ($data as $k => $v) {
         if ($message_info) {
             $data[$k]['message'] = $message_info[$v['id']];
         }
     }
     return $data;
 }