1.提交缺失的东西
This commit is contained in:
@ -20,6 +20,7 @@ use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\GoodsLists;
|
||||
use app\adminapi\logic\GoodsLogic;
|
||||
use app\adminapi\validate\GoodsValidate;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
@ -39,9 +40,29 @@ class GoodsController extends BaseAdminController
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new GoodsLists());
|
||||
$goods_category_list = Db::name('goods_category')->where(['del'=>0])->column('name','id');
|
||||
$result = $this->dataLists(new GoodsLists());
|
||||
foreach($result['list'] as $item){
|
||||
$item['cat_name'] = self::getCateName($goods_category_list, $item);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public static function getCateName($cates, $item)
|
||||
{
|
||||
if(isset($cates[$item['third_category_id']])) {
|
||||
return $cates[$item['third_category_id']];
|
||||
}
|
||||
|
||||
if(isset($cates[$item['second_category_id']])) {
|
||||
return $cates[$item['second_category_id']];
|
||||
}
|
||||
|
||||
if(isset($cates[$item['first_category_id']])) {
|
||||
return $cates[$item['first_category_id']];
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
|
||||
@ -55,7 +55,18 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function lists(): array
|
||||
{
|
||||
return Goods::where($this->searchWhere)
|
||||
->field(['id', 'name', 'code', 'first_category_id', 'second_category_id', 'third_category_id', 'brand_id', 'supplier_id', 'status', 'image', 'video', 'poster', 'remark', 'content', 'sort', 'sales_sum', 'virtual_sales_sum', 'click_count', 'virtual_click', 'spec_type', 'max_price', 'min_price', 'market_price', 'stock', 'stock_warn', 'is_show_stock', 'free_shipping_type', 'free_shipping', 'free_shipping_template_id', 'is_commission', 'first_ratio', 'second_ratio', 'three_ratio', 'is_share_bouns', 'region_ratio', 'shareholder_ratio', 'is_new', 'is_best', 'is_like', 'is_team', 'is_integral', 'is_member', 'give_integral_type', 'give_integral', 'del', 'is_express', 'is_selffetch'])
|
||||
->field(['id', 'name', 'code', 'first_category_id', 'second_category_id',
|
||||
'third_category_id', 'brand_id', 'supplier_id', 'status', 'image',
|
||||
'video', 'poster', 'remark', 'content', 'sort',
|
||||
'sales_sum', 'virtual_sales_sum', 'click_count',
|
||||
'virtual_click', 'spec_type', 'max_price', 'min_price',
|
||||
'market_price', 'stock', 'stock_warn', 'is_show_stock',
|
||||
'free_shipping_type', 'free_shipping', 'free_shipping_template_id',
|
||||
'is_commission', 'first_ratio', 'second_ratio', 'three_ratio',
|
||||
'is_share_bouns', 'region_ratio', 'shareholder_ratio', 'is_new',
|
||||
'is_best', 'is_like', 'is_team', 'is_integral', 'is_member',
|
||||
'give_integral_type', 'give_integral', 'del', 'is_express',
|
||||
'is_selffetch','cat_name','price','total_sales_sum'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
|
||||
Reference in New Issue
Block a user