Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<?php
namespace wstmart\common\model;
use think\Model;
use think\Db;
/**
* ============================================================================
* 基础模型器
*/
class Base extends Model {
/**
* 获取空模型
*/
public function getEModel($tables){
$rs = Db::query('show columns FROM `'.config('database.prefix').$tables."`");
$obj = [];
if($rs){
foreach($rs as $key => $v) {
$obj[$v['Field']] = $v['Default'];
if($v['Key'] == 'PRI')$obj[$v['Field']] = 0;
}
}
return $obj;
}
}