allowField(true)->save($data); if(!$ret){ $this->error = '操作失败'; return false; } return $this->getLastInsID(); } public function getInfo($id){ $info = $this ->where('id',$id) ->find() ->toArray(); if(!$info){ return false; } $info['userName'] = Db::name('user') ->where('id',$info['user_id']) ->value('real_name'); $info['goods'] = Db::name('company_dispatch_goods') ->alias('a') ->join('mate_goods b','a.goods_id=b.id') ->where('a.dispatch_id',$info['id']) ->field('a.*,b.title,b.unit,b.brand,b.spec') ->select(); return $info; } }