Beispiel #1
0
 public function append($id)
 {
     $topic = Topic::findOrFail($id);
     $this->authorOrAdminPermissioinRequire($topic->user_id);
     $markdown = new Markdown();
     $content = $markdown->convertMarkdownToHtml(Input::get('content'));
     $append = Append::create(['topic_id' => $topic->id, 'content' => $content]);
     App::make('Phphub\\Notification\\Notifier')->newAppendNotify(Auth::user(), $topic, $append);
     Flash::success(lang('Operation succeeded.'));
     return Redirect::route('topics.show', $topic->id);
 }
Beispiel #2
0
        $isExists = $mysql->field('count(1) as ct')->where(array('sku' => '"' . $_ary->sku . '"', 'lotid' => array('"' . $_ary->lotid . '"', '=', 'and'), 'supplyid' => array('"' . $_ary->supplyid . '"', '=', 'and')))->select('yy_reports');
        if ((int) $isExists[0]['ct'] == 0) {
            $data = array('sku' => $_ary->sku, 'lotid' => $_ary->lotid, 'spec' => $_ary->spec, 'cdname' => $_ary->cdname, 'cdcode' => $_ary->cdcode, 'supplyid' => $_ary->supplyid, 'spname' => $_ary->spname, 'spcode' => $_ary->spcode, 'picpath' => $_ary->picpath);
            $mysql->insert('yy_reports', $data);
            return true;
        }
        return false;
    }
    public function appendDataToMySql($ary)
    {
        foreach ($ary as $s) {
            $filename = $s;
            $file_extension = end(explode('.', $filename));
            if ($file_extension == 'json') {
                $filename = $this->_config['report']['jsonpath'] . '/' . $filename;
                $json_string = file_get_contents($filename);
                //Mysql
                if ($this->setData($json_string)) {
                    //echo $this->_config['msgs.success'];
                    copy($filename, $this->_config['report']['bak'] . $s);
                    unlink($filename);
                } else {
                    //
                }
            }
        }
    }
}
$ary = CommonFactory::Create()->getDir($configs['report']['jsonpath']);
$append = new Append($configs);
$append->appendDataToMySql($ary);