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

120 行
3.3 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace Common\Model;
use Think\Model\ViewModel;
//[1.8.50]
class RetailSpikeViewModel extends ViewModel
{
public $viewFields = array(
'RetailSpike' => array(
'_table' => 'ls_retail_seckill',
'id',
'gid',
'skuid' => 'sku_id',
'storeid' => 'store_id',
'goods_seckill_price' => 'spike_price',
'active_title' => 'name',
'active_starttime' => 'start_time',
'active_endtime' => 'end_time',
'active_limit_num' => 'stock',
'startbuy' => 'limit_state',
'active_personal_limit_num' => 'limit_num',
'active_status' => 'status',
'addtime' => 'add_time',
'send_type',
'sell_number',
'delivery_template_id',
'rise_num'
),
'RetailGoods' => array(
'_table' => 'ls_retail_goods',
'goods_name',
'goods_code',
'goods_number',
'goods_class_id',
'goods_brand_id',
'purchase_price',
'retail_price',
'online_price',
'goods_num',
'company',
'status' => 'goods_status',
'details',
'attribute_state',
'shop_mem_status',
'shop_mem_price',
'plus_mem_status',
'plus_price',
'goods_img_id',
'integral_mem_status',
'integral',
'weight_value',
'video_id',
'pricing_method',
'serial_number_state',
'third_goods_code',
'_on' => 'RetailSpike.gid = RetailGoods.id',
),
);
/**
* 查询单条数据(find)
* @param array $map 条件
* @param string $field 字段 '*'
* @return array|bool $find|false
*/
public function getFind($map, $field = '*')
{
if (!$map) {
return false;
}
$find = $this->field($field)->where($map)->find();
return $find;
}
/**
* 多条查询(select)
* @param [array] $map 条件
* @param [int] $page 分页
* @param [int] $limit 数量
* @return [array|bool] $res|false
*/
/**
* 多条查询(select)
* @param $map 条件
* @param string $field 获取的字段
* @param string $page 分页
* @param string $limit 数量
* @param string $order 排序
* @return bool $res|false
*/
public function getSelect($map, $field = '*', $page = '', $limit = '', $order = 'addtime desc')
{
if (!$map) {
return false;
}
if (!$page || !$limit) {
$select = $this->field($field)->where($map)->order($order)->select();
} else {
$select = $this->field($field)->where($map)->page($page, $limit)->order($order)->select();
}
return $select;
}
/**
* 统计数量(count)
* @parma [array] $map 条件
* @return [array|bool] $res|false
*/
public function getCount($map)
{
if (!$map) {
return 0;
}
$count = $this->where($map)->count();
return $count ? $count : 0;
}
}