聯(lián)系官方銷(xiāo)售客服
1835022288
028-61286886
模塊表單入庫(kù)附表,沒(méi)有自動(dòng)創(chuàng)建附表功能
http://m.223987.com/doc/956.html
$data = []; $data['title'] = '標(biāo)題測(cè)試'; $data['status'] = 1; $data['catid'] = 1; // 欄目id $data['cid'] = 1; // 內(nèi)容id $data['uid'] = (int)$this->member['uid']; $data['author'] = $this->member['username']; $data['inputip'] = \Phpcmf\Service::L('input')->ip_address(); $data['inputtime'] = SYS_TIME; $data['tableid'] = 0; $data['displayorder'] = 0; // 插入主表 $rt = \Phpcmf\Service::M()->table_site("模塊目錄_form_表單名稱(chēng)")->insert($data); if (!$rt['code']) { exit("插入失敗:".$rt['code']); } // 如果要使用附表分表就 按一定量進(jìn)行分表設(shè)置 比如50000 $data['tableid'] = floor($rt['code']/50000); \Phpcmf\Service::M()->table_site("模塊目錄_form_表單名稱(chēng)")->update($data['id'], ['tableid' => $data['tableid']]); $data2 = []; $data2['id'] = $rt['code']; $data2['uid'] = (int)$this->member['uid']; $data2['catid'] = 1; // 欄目id $data2['cid'] = 1; // 內(nèi)容id // 插入附表 $rt = \Phpcmf\Service::M()->table_site("模塊目錄_form_表單名稱(chēng)_data_".$data['tableid'])->insert($data2); if (!$rt['code']) { // 刪除主表 \Phpcmf\Service::M()->table_site("模塊目錄_form_表單名稱(chēng)")->delete($data['id']); exit("插入失?。?quot;.$rt['code']); } // 更新表單數(shù)量到模塊內(nèi)容主表 $total = \Phpcmf\Service::M()->table_site('模塊目錄_form_表單名稱(chēng)')->where('status', 1)->where('cid', $data['cid'])->counts(); \Phpcmf\Service::M()->table_site('模塊目錄')->update($data['cid'], [ '表單名稱(chēng)_total' => $total, ]);
是不是?
回復(fù)迅??蚣軇?chuàng)始人 這個(gè)值在后面附表插入數(shù)據(jù)后會(huì)更新不是
我是說(shuō)數(shù)據(jù)量到達(dá)設(shè)定量后,這個(gè)數(shù)據(jù)庫(kù)表不會(huì)自動(dòng)創(chuàng)建
是不是要加個(gè)is_data_table?
我自己處理吧,謝謝
回復(fù)迅??蚣軇?chuàng)始人
我知道這個(gè),我是想問(wèn),要不要這樣加一下