联系官方销售客服
1835022288
028-61286886
模块表单入库附表,没有自动创建附表功能
https://www.xunruicms.com/doc/956.html
$data = []; $data['title'] = '标题测试'; $data['status'] = 1; $data['catid'] = 1; // 栏目id $data['cid'] = 1; // 内容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_表单名称")->insert($data); if (!$rt['code']) { exit("插入失败:".$rt['code']); } // 如果要使用附表分表就 按一定量进行分表设置 比如50000 $data['tableid'] = floor($rt['code']/50000); \Phpcmf\Service::M()->table_site("模块目录_form_表单名称")->update($data['id'], ['tableid' => $data['tableid']]); $data2 = []; $data2['id'] = $rt['code']; $data2['uid'] = (int)$this->member['uid']; $data2['catid'] = 1; // 栏目id $data2['cid'] = 1; // 内容id // 插入附表 $rt = \Phpcmf\Service::M()->table_site("模块目录_form_表单名称_data_".$data['tableid'])->insert($data2); if (!$rt['code']) { // 删除主表 \Phpcmf\Service::M()->table_site("模块目录_form_表单名称")->delete($data['id']); exit("插入失败:".$rt['code']); } // 更新表单数量到模块内容主表 $total = \Phpcmf\Service::M()->table_site('模块目录_form_表单名称')->where('status', 1)->where('cid', $data['cid'])->counts(); \Phpcmf\Service::M()->table_site('模块目录')->update($data['cid'], [ '表单名称_total' => $total, ]);
是不是?
是不是要加个is_data_table?
我自己处理吧,谢谢