113 lines
6.0 KiB
PHP
113 lines
6.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2021年10月12日
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\api\controllers\mall\integral;
|
|
|
|
use app\modules\api\behaviors\LoginBehavior;
|
|
use app\models\common\integral\mall\CommonIntegralMallActionForm;
|
|
use app\models\common\integral\mall\CommonIntegralMallGoodsListForm;
|
|
use app\models\Goods;
|
|
use app\modules\api\controllers\Controller;
|
|
use app\components\SysConst;
|
|
|
|
class GoodsController extends Controller
|
|
{
|
|
public function behaviors() {
|
|
return array_merge(parent::behaviors(),[
|
|
'login' => [
|
|
'class' => LoginBehavior::className(),
|
|
'ignore' => [
|
|
'api/mall/integral/goods/index',
|
|
'api/mall/integral/goods/tree',
|
|
'api/mall/integral/goods/detail',
|
|
]
|
|
]
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* hidedoc
|
|
* @catalog 积分商城/商品
|
|
* @title 商品列表
|
|
* @description 本接口提供积分商品列表
|
|
* @method get
|
|
* @url /api/mall/integral/goods/index
|
|
* @param keywords 非必选 string 关键词
|
|
* @param page 必选 int 页码
|
|
* @param limit 非必选 int 每页记录数
|
|
* @return {"code":0,"msg":"ok","data":[{"id":"2","price":"100.00","goods_stock":"2100","virtual_sales":"100","sort":"100","created_at":"1633587356","payment_people":"0","payment_amount":"0.00","payment_num":"0","payment_order":"0","sales":"0","viewed_count":"0","name":"商品商品商品商品商品商品","cover_pic":"https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1007/1633576986491549.png","unit":"件","type":"0","integral_num":"1000","created_at_cn":"2021-10-07 14:15:56"}],"count":"3","page_size":20,"page_count":1,"page_no":1,"end_flag":false}
|
|
* @return_param count int 记录条数
|
|
* @return_param page_size int 每页记录数
|
|
* @return_param page_count int 总页数
|
|
* @return_param page_no int 当前页码
|
|
* @return_param end_flag bool 是否加载结束
|
|
* @remark
|
|
*/
|
|
public function actionIndex()
|
|
{
|
|
$form = new CommonIntegralMallGoodsListForm();
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$form->status = Goods::STATUS_ONLINE;
|
|
$form->plugin_sign = SysConst::$cxPluginSceneIntegralMall;
|
|
$form->setFields('g.id,g.price,g.goods_stock,g.virtual_sales,g.sort,g.created_at,g.payment_people,g.payment_amount,g.payment_num,g.payment_order,g.sales,g.viewed_count,gh.name,gh.cover_pic,gh.unit,gh.type,img.integral_num');
|
|
$data = $form->search();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
/**
|
|
* hidedoc
|
|
* @catalog 积分商城/商品
|
|
* @title 商品分类树
|
|
* @description 本接口提供积分商品分类树
|
|
* @method get
|
|
* @url /api/mall/integral/goods/tree
|
|
* @param param 必选 param_type param_desc
|
|
* @return {"code":0,"msg":"ok","data":[{"id":"8","name":"生鲜","parent_id":"0","goods_list":[{"id":"3","price":"199.00","goods_stock":"1000","virtual_sales":"100","sort":"100","created_at":"1634089711","payment_people":"0","payment_amount":"0.00","payment_num":"0","payment_order":"0","sales":"0","viewed_count":"0","name":"好丽友蛋糕","cover_pic":"https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1013/1634089675876184.png","unit":"包","type":"0","integral_num":"189","created_at_cn":"2021-10-13 09:48:31"}]}]}
|
|
* @return_param count int 记录条数
|
|
* @remark
|
|
*/
|
|
public function actionTree()
|
|
{
|
|
$form = new CommonIntegralMallActionForm();
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->getTree();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
/**
|
|
* hidedoc
|
|
* @catalog 积分商城/商品
|
|
* @title 商品详情
|
|
* @description 本接口提供积分商品详情
|
|
* @method get
|
|
* @url /api/mall/integral/goods/detail
|
|
* @param goods_id 必选 int 商品ID
|
|
* @return {"code":0,"msg":"ok","data":{"id":"3","price":"199.00","goods_stock":"1000","virtual_sales":"100","sort":"100","created_at":"1634089711","payment_people":"0","payment_amount":"0.00","payment_num":"0","payment_order":"0","sales":"0","viewed_count":"0","use_attr":"0","attr_groups":[{"attr_group_id":1,"attr_group_name":"规格","attr_list":[{"attr_id":2,"attr_name":"默认"}]}],"confine_count":"0","freight_id":"100","name":"好丽友蛋糕","subtitle":"","original_price":"199.00","cost_price":"199.00","detail":"<p>好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕好丽友蛋糕<img src=\"https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1013/1634089707550091.png\" title=\"1634089707550091.png\" alt=\"default_pic.png\"/></p>","cover_pic":"https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1013/1634089675876184.png","pic_urls":["https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1013/1634089678820003.png","https://app.tpl.dev.1nww.com/upload/0/1/upload/image/2021/1013/1634089681604548.png"],"video_url":"","unit":"包","type":"0","integral_num":"189","created_at_cn":"2021-10-13 09:48:31","goods_sales":0,"attr":[{"id":"42","goods_id":"3","price":"199.00","sign_id":"2","stock":"1000","serial_no":"","weight":"0","cover_pic":"","integral_num":"0"}]}}
|
|
* @return_param count int 记录条数
|
|
* @remark
|
|
*/
|
|
public function actionDetail()
|
|
{
|
|
$form = new CommonIntegralMallActionForm();
|
|
$form->scenario = 'detail';
|
|
$form->attributes = \Yii::$app->request->get();
|
|
$form->cx_mch_id = $this->cx_mch_id;
|
|
$data = $form->getGoodsdetail();
|
|
return $this->responseHandler($data);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|