文件
mashangyoujiu/Application/Common/Model/RetailCardGoodsModel.class.php

48 行
2.0 KiB
PHP
可执行文件

<?php
namespace Common\Model;
//[1.3.40]
/**
* 次卡,卡包关联商品
* Class RetailCardGoodsModel
* @package Common\Model
*/
class RetailCardGoodsModel extends BaseModel
{
protected $tableName = 'retail_card_goods';
const ID = 'id'; // `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
const MERCHANT_ID = 'merchant_id'; // `merchant_id` int(10) NOT NULL DEFAULT '0' COMMENT '商户id',
const STORE_ID = 'store_id'; // `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
const GOODS_ID = 'goods_id'; // `goods_id` int(10) NOT NULL DEFAULT '0' COMMENT '商品id',
const TYPE = 'type'; // `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '类型 0.次卡 1.卡包',
const C_ID = 'c_id'; // `c_id` int(10) NOT NULL DEFAULT '0' COMMENT '关联的次卡,卡包id',
const ADD_TIME = 'add_time'; // `add_time` varchar(15) NOT NULL DEFAULT '' COMMENT '创建时间',
const STATUS = 'status'; // `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 0.删除 1.正常',
const SKU_ID = 'sku_id'; // `sku_id` int(10) NOT NULL DEFAULT '0' COMMENT '规格id',
const NUMBER = 'number';
/**
* 关联商品查询
*/
public function getCardGoods($map,$field = '*',$page = '',$limit = '',$order = 'c.id desc')
{
if($page || $limit){
$data = $this->alias('c')
->join('ls_retail_goods as g on c.' . self::GOODS_ID . '=g.id')
->field($field)
->where($map)
->order($order)
->page(intval($page),intval($limit))
->select();
}else{
$data = $this->alias('c')
->join('ls_retail_goods as g on c.' . self::GOODS_ID . '=g.id')
->field($field)
->where($map)
->order($order)
->select();
}
return $data;
}
}