85 行
3.1 KiB
PHP
可执行文件
85 行
3.1 KiB
PHP
可执行文件
<?php
|
||
namespace Common\Model;
|
||
use Think\Model\ViewModel;
|
||
//[1.8.68]
|
||
class RetailGroupOrderViewModel extends ViewModel
|
||
{
|
||
public $viewFields = array(
|
||
'RetailBillOrder' => array(
|
||
'_table' => 'ls_retail_bill_order',
|
||
'id','all_money','pay_state','pay_type','refund_status','type','order_type','add_time','vid','store_id','merchant_id','cashier_id','guide_id',
|
||
'order_no','uid','refund_no','refund_money','amount_received','give_change','zero_storage','finish_time','pay_money',
|
||
),
|
||
'RetailBillOnline' => array(
|
||
'_table' => 'ls_retail_bill_online',
|
||
'status','eval_status','cancel_time','refund_time','pickup_type','user_name','user_phone','remind_state','remind_time','pick_code','shopping_ids',
|
||
'delivery_type','cancel_delivery_status','delivery_fee','order_genre','remark','refund_delivery_state','delivery_record_id','user_address','delivery_time',
|
||
'receiving_goods_time','user_select_time','form_id',
|
||
'_on' => 'RetailBillOrder.id = RetailBillOnline.bill_id',
|
||
),
|
||
'RetailBillDiscount' => array(
|
||
'_table' => 'ls_retail_bill_discount',
|
||
'use_integral','coupon_money','vip_dis_money','coupon_id',
|
||
'coupon_type','small_changes_money','discount',
|
||
'cashier_dis_money','get_integral', 'integral_dis_money',
|
||
'pay_coupon_fee',
|
||
'_on' => 'RetailBillOrder.id = RetailBillDiscount.bill_id',
|
||
),
|
||
'RetailBillGroup' => array(
|
||
'_table' => 'ls_retail_bill_group',
|
||
'group_id','sku_id','parent_id','state','buy_number','end_time',
|
||
'_on' => 'RetailBillOrder.id = RetailBillGroup.bill_id',
|
||
'_type' => 'LEFT',
|
||
),
|
||
);
|
||
|
||
/**
|
||
* 查询单条数据(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
|
||
*/
|
||
public function getSelect($map,$field = '*',$page = '',$limit = '',$order = 'add_time 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;
|
||
}
|
||
|
||
} |