1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace Act\Lib;
- use Dever;
- class Manage
- {
- //{source_id} > 0 ? ("{name}" ? "{name}" : Dever::load("sad/supply-one#name", {source_id})) : "{name}"
- public function load($source_table, $id)
- {
- $table = Dever::config('base')->type_table[$source_table];
- $data = Dever::db($table)->one($id);
- if ($data && isset($data['name']) && $data['name']) {
- return $data['name'];
- }
- if ($data && isset($data['content']) && $data['content']) {
- return $data['content'];
- }
- return '未知';
- }
- # 根据data_id获取data_name
- public function getName_api()
- {
- $data = Dever::db('act/comment')->state();
- if ($data) {
- foreach ($data as $k => $v) {
- $name = $this->load($v['type'], $v['data_id']);
- if ($name && $name != $v['data_name']) {
- Dever::db('act/comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
- }
- }
- }
- $data = Dever::db('act/live_comment')->state();
- if ($data) {
- foreach ($data as $k => $v) {
- $name = $this->load($v['type'], $v['data_id']);
- if ($name && $name != $v['data_name']) {
- Dever::db('act/live_comment')->update(array('where_id' => $v['id'], 'data_name' => $name));
- }
- }
- }
- }
- }
|