1
This commit is contained in:
parent
13779244a1
commit
87f691d2e8
@ -48,12 +48,20 @@ class CommonGoodsListForm extends Model
|
|||||||
private $fields;
|
private $fields;
|
||||||
|
|
||||||
|
|
||||||
|
public $cat1_id;
|
||||||
|
public $cat2_id;
|
||||||
|
public $cat3_id;
|
||||||
|
public $cat4_id;
|
||||||
|
public $cat5_id;
|
||||||
|
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['keywords', 'plugin_sign',], 'trim'],
|
[['keywords', 'plugin_sign',], 'trim'],
|
||||||
[['keywords', 'plugin_sign',], 'string'],
|
[['keywords', 'plugin_sign',], 'string'],
|
||||||
[['limit', 'page', 'cx_mch_id', 'status', 'goods_id', 'cat_id'], 'integer'],
|
[['limit', 'page', 'cx_mch_id', 'status', 'goods_id', 'cat_id'], 'integer'],
|
||||||
|
[['cat_id', 'cat1_id', 'cat2_id', 'cat3_id', 'cat4_id'], 'integer'],
|
||||||
[['page'], 'default', 'value' => 1],
|
[['page'], 'default', 'value' => 1],
|
||||||
[['limit'], 'default', 'value' => 20],
|
[['limit'], 'default', 'value' => 20],
|
||||||
[['status'], 'in', 'range' => [0, 1, 2]],
|
[['status'], 'in', 'range' => [0, 1, 2]],
|
||||||
@ -87,7 +95,11 @@ class CommonGoodsListForm extends Model
|
|||||||
])
|
])
|
||||||
->andFilterWhere([
|
->andFilterWhere([
|
||||||
'g.id' => $this->goods_id,
|
'g.id' => $this->goods_id,
|
||||||
'gc.cat_id' => $this->cat_id
|
'gc.cat_id' => $this->cat_id,
|
||||||
|
'gc.cat1_id' => $this->cat1_id,
|
||||||
|
'gc.cat2_id' => $this->cat2_id,
|
||||||
|
'gc.cat3_id' => $this->cat3_id,
|
||||||
|
'gc.cat4_id' => $this->cat4_id,
|
||||||
]);
|
]);
|
||||||
if ($this->status == 2) {
|
if ($this->status == 2) {
|
||||||
$query = $query->andWhere(['g.goods_stock' => 0]);//售罄
|
$query = $query->andWhere(['g.goods_stock' => 0]);//售罄
|
||||||
|
|||||||
@ -13,6 +13,11 @@
|
|||||||
namespace app\modules\api\controllers\mall\integral;
|
namespace app\modules\api\controllers\mall\integral;
|
||||||
|
|
||||||
use app\components\SiteHelper;
|
use app\components\SiteHelper;
|
||||||
|
use app\models\Cat;
|
||||||
|
use app\models\Cat1;
|
||||||
|
use app\models\Cat2;
|
||||||
|
use app\models\Cat3;
|
||||||
|
use app\models\Cat4;
|
||||||
use app\modules\api\behaviors\LoginBehavior;
|
use app\modules\api\behaviors\LoginBehavior;
|
||||||
use app\models\common\integral\mall\CommonIntegralMallActionForm;
|
use app\models\common\integral\mall\CommonIntegralMallActionForm;
|
||||||
use app\models\common\integral\mall\CommonIntegralMallGoodsListForm;
|
use app\models\common\integral\mall\CommonIntegralMallGoodsListForm;
|
||||||
@ -29,6 +34,7 @@ class GoodsController extends Controller
|
|||||||
'class' => LoginBehavior::className(),
|
'class' => LoginBehavior::className(),
|
||||||
'ignore' => [
|
'ignore' => [
|
||||||
'api/mall/integral/goods/index',
|
'api/mall/integral/goods/index',
|
||||||
|
'api/mall/integral/goods/index-cat',
|
||||||
'api/mall/integral/goods/tree',
|
'api/mall/integral/goods/tree',
|
||||||
'api/mall/integral/goods/detail',
|
'api/mall/integral/goods/detail',
|
||||||
]
|
]
|
||||||
@ -90,6 +96,82 @@ class GoodsController extends Controller
|
|||||||
return $this->responseHandler($data);
|
return $this->responseHandler($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hidedoc
|
||||||
|
* @catalog 冠军列表分类
|
||||||
|
* @title 冠军列表分类
|
||||||
|
* @description 本接口提供冠军列表分类
|
||||||
|
* @method get
|
||||||
|
* @url /api/mall/integral/goods/index-cat
|
||||||
|
* @return {"code":0,"msg":"ok","data":[{"id":"2","price":"111.00","date":"2023-11-27","sort":"100","subtitle":"111","created_at":"1701077489","name":"李四","cover_pic":"http://cxgj.com/upload/0/1/upload/image/2023/1127/1701077471438838.jpg","video_url":"","pic_urls":"[\"/upload/0/1/upload/image/2023/1127/1701077483860358.jpg\",\"/upload/0/1/upload/image/2023/1127/1701077486913290.jpg\",\"/upload/0/1/upload/image/2023/1127/1701077502452397.jpg\"]","created_at_cn":"2023-11-27 17:31:29","pic_arr":["http://cxgj.com/upload/0/1/upload/image/2023/1127/1701077483860358.jpg","http://cxgj.com/upload/0/1/upload/image/2023/1127/1701077486913290.jpg","http://cxgj.com/upload/0/1/upload/image/2023/1127/1701077502452397.jpg"]}],"count":"1","page_size":20,"page_count":1,"page_no":1,"end_flag":false}
|
||||||
|
* @return_param id int 分类ID
|
||||||
|
* @return_param name string 分类名称
|
||||||
|
* @remark
|
||||||
|
*/
|
||||||
|
public function actionIndexCat()
|
||||||
|
{
|
||||||
|
|
||||||
|
$cat_list = Cat::find()
|
||||||
|
->where([
|
||||||
|
'cx_mch_id' => $this->cx_mch_id,
|
||||||
|
'is_delete' => 0,
|
||||||
|
'type' => Cat::TYPE_GOODS,
|
||||||
|
])
|
||||||
|
->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC])
|
||||||
|
->select('id,name')->asArray()->all();
|
||||||
|
|
||||||
|
$cat_list1 = Cat1::find()
|
||||||
|
->where([
|
||||||
|
'cx_mch_id' => $this->cx_mch_id,
|
||||||
|
'is_delete' => 0,
|
||||||
|
'type' => Cat::TYPE_GOODS,
|
||||||
|
])
|
||||||
|
->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC])
|
||||||
|
->select('id,name')->asArray()->all();
|
||||||
|
|
||||||
|
$cat_list2 = Cat2::find()
|
||||||
|
->where([
|
||||||
|
'cx_mch_id' => $this->cx_mch_id,
|
||||||
|
'is_delete' => 0,
|
||||||
|
'type' => Cat::TYPE_GOODS,
|
||||||
|
])
|
||||||
|
->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC])
|
||||||
|
->select('id,name')->asArray()->all();
|
||||||
|
|
||||||
|
$cat_list3 = Cat3::find()
|
||||||
|
->where([
|
||||||
|
'cx_mch_id' => $this->cx_mch_id,
|
||||||
|
'is_delete' => 0,
|
||||||
|
'type' => Cat::TYPE_GOODS,
|
||||||
|
])
|
||||||
|
->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC])
|
||||||
|
->select('id,name')->asArray()->all();
|
||||||
|
|
||||||
|
$cat_list4 = Cat4::find()
|
||||||
|
->where([
|
||||||
|
'cx_mch_id' => $this->cx_mch_id,
|
||||||
|
'is_delete' => 0,
|
||||||
|
'type' => Cat::TYPE_GOODS,
|
||||||
|
])
|
||||||
|
->orderBy(['sort' => SORT_ASC, 'created_at' => SORT_DESC])
|
||||||
|
->select('id,name')->asArray()->all();
|
||||||
|
|
||||||
|
$list = [
|
||||||
|
'cat' => $cat_list,
|
||||||
|
'cat1' => $cat_list1,
|
||||||
|
'cat2' => $cat_list2,
|
||||||
|
'cat3' => $cat_list3,
|
||||||
|
'cat4' => $cat_list4,
|
||||||
|
];
|
||||||
|
|
||||||
|
$data['code'] = 0;
|
||||||
|
$data['msg'] = 'ok';
|
||||||
|
$data['data'] = $list;
|
||||||
|
|
||||||
|
return $this->responseHandler($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hidedoc
|
* hidedoc
|
||||||
* @catalog 积分商城/商品
|
* @catalog 积分商城/商品
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user