123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\common\model;
- use think\Db;
- class MateSubGoods extends Base
- {
- protected $createTime = 'create_time';
- protected $updateTime = 'update_time';
- public $table = 'mate_sub_goods';
- protected $validateName = 'MateSubGoods';
- public function getList($offset,$size,$where,$order){
- $list =$this
- ->where($where)
- ->limit($offset,$size)
- ->order($order)
- ->select()
- ->toArray();
- foreach ($list as $k=>$v){
- $pInfo =Db::name('mate_goods')
- ->where('id',$v['pid'])
- ->find();
- $list[$k]['title'] = $pInfo?$pInfo['title']:"";
- $list[$k]['type'] = $pInfo?$pInfo['type']:"";
- $list[$k]['unit'] = $pInfo?$pInfo['unit']:"";
- $list[$k]['brand'] = $pInfo?$pInfo['brand']:"";
- $list[$k]['buy_time'] = $pInfo?$pInfo['buy_time']:"";
- $list[$k]['spec'] = $pInfo?$pInfo['spec']:"";
- }
- return $list;
- }
- public function getByList($where){
- $list =$this
- ->where($where)
- ->where('nums','>',0)
- ->select();
- $list = $list?$list->toArray():[];
- foreach ($list as $k=>$v){
- $pInfo =Db::name('mate_goods')
- ->where('id',$v['pid'])
- ->find();
- $list[$k]['title'] = $pInfo?$pInfo['title']:"";
- $list[$k]['type'] = $pInfo?$pInfo['type']:"";
- $list[$k]['unit'] = $pInfo?$pInfo['unit']:"";
- $list[$k]['brand'] = $pInfo?$pInfo['brand']:"";
- $list[$k]['buy_time'] = $pInfo?$pInfo['buy_time']:"";
- $list[$k]['spec'] = $pInfo?$pInfo['spec']:"";
- }
- return $list;
- }
- }
|