|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- /**
- * 数据库表类 prod_img
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 倪宗锋
- * PhpStorm LoginController.php
- * Create By 2017/07/13 11:47 $
- */
-
- namespace common\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * 数据库表类 prod_img.
- * @property integer $id
- * @property integer $pro_cate_id
- * @property string $img_url
- * @property string $redirect_url
- * @property string $memo
- * @property integer $img_type
- * @property string $create_time
- */
- class ProdImg extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'prod_img';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['pro_cate_id', 'img_type'], 'integer'],
- [['create_time'], 'safe'],
- [['img_url', 'redirect_url', 'memo'], 'string', 'max' => 255],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'pro_cate_id' => 'Pro Cate ID',
- 'img_url' => 'Img Url',
- 'redirect_url' => 'Redirect Url',
- 'memo' => 'Memo',
- 'img_type' => 'Img Type',
- 'create_time' => 'Create Time',
- ];
- }
-
- /**
- * Des:获取产品的轮播图
- * Name: getProdImg
- * @param $pro_cate_id
- * @return array|ActiveRecord[]
- * @author 倪宗锋
- */
- public function getProdImg($pro_cate_id)
- {
- $select = [
- 'img_url',
- 'img_type',
- 'img_type'
- ];
- $where = [
- 'and',
- ['=', 'img_type', 1],
- ['=', 'pro_cate_id', $pro_cate_id]
- ];
- $getList = self::find()->select($select)
- ->where($where)
- ->asArray()
- ->all();
- if (count($getList) == 0) {
- return [];
- }
- return $getList;
- }
- }
|