137 行
8.3 KiB
PHP
可执行文件
137 行
8.3 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Common\Model;
|
||
//[1.6.9]
|
||
|
||
/**
|
||
* 门店表 之后的 StoreModel.class.php 删除
|
||
* Class RetailStoreModel
|
||
* @package Common\Model
|
||
*/
|
||
class RetailStoreModel extends BaseModel
|
||
{
|
||
protected $tableName = 'retail_store';
|
||
const ID = 'id'; //int(11) NOT NULL AUTO_INCREMENT,
|
||
const MERCHANT_ID = 'merchantid'; //varchar(255) DEFAULT NULL COMMENT '商户id',
|
||
const WAY_OF_DELIVERY = 'skip'; //tinyint(1) NULL DEFAULT NULL COMMENT '0支持商家配送 1不支持商家配送',
|
||
const SELF_PICK = 'self_pick'; //tinyint(1) DEFAULT '0' COMMENT '0支持到店自提 1不支持到店自提',
|
||
const SERVICE_RADIUS = 'math'; //varchar(255) DEFAULT NULL COMMENT '服务半径',
|
||
const STARTING_PRICE = 'smmoney'; //varchar(255) DEFAULT NULL COMMENT '起送价',
|
||
const LATITUDE = 'latitude'; //varchar(255) DEFAULT NULL COMMENT '纬度',
|
||
const LONGITUDE = 'longitude'; //varchar(255) DEFAULT NULL COMMENT '经度',
|
||
const STATUS = 'status'; //varchar(4) DEFAULT '0' COMMENT '是否开启商城 0关闭1开启',
|
||
const ADDRESS = 'address'; //varchar(255) DEFAULT NULL COMMENT '地址',
|
||
const ADD_TIME = 'addtime'; //varchar(15) DEFAULT NULL COMMENT '添加时间',
|
||
const BUSINESS = 'business'; //varchar(255) DEFAULT NULL COMMENT '配送时间12:00-13:00',
|
||
const PHONE = 'phone'; //varchar(20) DEFAULT NULL COMMENT '门店电话',
|
||
const STORE_STATUS = 'store_status'; //tinyint(2) DEFAULT '0' COMMENT '行业门店状态:0,开启,1,关闭',
|
||
const STORE_NAME = 'storetag'; //varchar(255) DEFAULT NULL COMMENT '门店名称',
|
||
const PROVINCE = 'province'; //varchar(255) DEFAULT NULL COMMENT '省',
|
||
const CITY = 'city'; //varchar(255) DEFAULT NULL COMMENT '市',
|
||
const AREA = 'area'; //varchar(255) DEFAULT NULL COMMENT '县',
|
||
const DETAIL_ADDRESS = 'detail_address'; //varchar(255) DEFAULT NULL COMMENT '详细地址',
|
||
const STORE_TYPE = 'store_type'; //tinyint(1) DEFAULT NULL COMMENT '门店类型:0,主店,1分店。',
|
||
const STATE = 'state'; //tinyint(1) DEFAULT '0' COMMENT '门店状态:0,正常,1,删除。',
|
||
const GUIDE_OPEN_STATE = 'openstate'; //tinyint(1) DEFAULT '1' COMMENT '导购开启状态:1.开启2.关闭',
|
||
const ATTRIBUTE = 'attribute'; //int(11) DEFAULT '0' COMMENT '门店类型',
|
||
const ORIGIN_SHOP_ID = 'origin_shop_id'; //varchar(255) DEFAULT '' COMMENT '门店编码,可自定义,但必须唯一;若不填写,则系统自动生成',
|
||
const DADA_USERNAME = 'username'; //varchar(255) DEFAULT NULL COMMENT '达达app账号',
|
||
const DADA_PASSWORD = 'data_password'; //varchar(255) DEFAULT '' COMMENT '达达密码',
|
||
const DADA_OPEN_STATE = 'dadastatus'; //tinyint(1) DEFAULT '1' COMMENT '达达1关闭 2开启',
|
||
const DADA_SYNC_STATE = 'synchronization'; //tinyint(1) DEFAULT '1' COMMENT '是否同步达达 1未同步 2同步',
|
||
const WARNING_DATE = 'warning'; //varchar(100) DEFAULT '1' COMMENT '商品过期预警时间',
|
||
const BUSINESS_TIME = 'business_time'; //varchar(20) DEFAULT NULL COMMENT '营业时间',
|
||
const PREFERENTIAL_STATE = 'preferential'; //tinyint(1) DEFAULT '0' COMMENT '是否开启折上折 0关闭 1开启',
|
||
const MANUAL_DISCOUNT_STATE = 'manual_discount'; //tinyint(1) DEFAULT '0' COMMENT '是否开启折上折-单品打折 0关闭 1开启',
|
||
const GOODS_EMPTY_SELL_STATE = 'goods_empty_sell_status'; //tinyint(1) DEFAULT '0' COMMENT '商品没有库存是否允许出售 0不允许 1允许',
|
||
const STORE_IMG_ID = 'shopimg_id'; //varchar(255) DEFAULT '0' COMMENT '门头照图片id',
|
||
const DEFAULT_DELIVERY = 'default_delivery'; //tinyint(1) DEFAULT '0' COMMENT '默认配送方式0未设置 1商家配送 2达达配送 3UU配送',
|
||
const EXPRESS_SEARCH_STATE = 'express_search'; //tinyint(1) DEFAULT '2' COMMENT '快递查询权限 1开启 2关闭',
|
||
const CUSTOMER_SERVICE = 'customer_service'; //tinyint(1) DEFAULT '1' COMMENT '客服类型 1.拨打电话 2.微信客服',
|
||
const MODIFY_ORDER_DAY = 'modify_order_day'; //varchar(255) DEFAULT '' COMMENT '多少天后自动修改商城订单状态',
|
||
const MODIFY_ORDER_STATE = 'modify_order_state'; //tinyint(1) DEFAULT '2' COMMENT '多少天后自动修改商城订单状态 1 开启 2关闭 ',
|
||
const SMALL_CHANGE_STATE = 'small_change_state'; //tinyint(1) DEFAULT '1' COMMENT '抹零方式 1抹分 2抹角 3抹元',
|
||
const BUSINESS_NON_ORDER = 'business_non_order'; //tinyint(1) DEFAULT '2' COMMENT '非营业时间是否支持下单 1开启 2关闭',
|
||
const DENSITY_FREE_STATE = 'density_free_state';//是否免密支付
|
||
const GUIDE_ONLINE_STATE = 'guide_online_state'; //tinyint(1) DEFAULT '1' COMMENT '线上导购开启状态:1.开启2.关闭',
|
||
const REFUND_TIME_LIMIT = 'refund_time_limit'; //int(4) DEFAULT '0' COMMENT '商城退款限制时间,超过改时段用户不得申请退款 0为不限制',
|
||
const CASHIER_REFUND_TIME = 'cashier_refund_time'; //int(4) DEFAULT '0' COMMENT '线下退款限制时间,超过改时段用户不得申请退款 0为不限制',
|
||
const SCREEN_TYPE = 'screen_type'; //1副屏显示与主屏一致 2显示图片或视频
|
||
const DEPOSIT_PRICE_STATE = 'deposit_price_state'; //会员现金支付是否提示存余额 0关闭 1显示
|
||
const SCREEN_PERCENT = 'screen_percent'; //副屏宣传图占比例
|
||
const STORE_CLASS = 'store_class';//tinyint(1) DEFAULT '1' COMMENT '1直营店 2加盟店',
|
||
const SUPPLIER_TYPE = 'supplier_type';//tinyint(1) DEFAULT '1' COMMENT '1常规供货商 2寄售供货商',
|
||
const DELIVERY_STATUS = 'delivery_status'; //tinyint(1) DEFAULT '0' COMMENT '免配送费 0关闭1开启'
|
||
const DELIVERY_COST = 'delivery_cost'; //decimal(10,2) DEFAULT 0.00 NULL COMMENT '配送费'
|
||
const AUTOMATIC_DELIVER = 'automatic_deliver'; // 自动发货
|
||
|
||
/**
|
||
* 临时把图片添加到图库,之后的image字段将废弃
|
||
*/
|
||
public function tempMoveImg()
|
||
{
|
||
$map = array(
|
||
'shopimg' => array(array('neq', '/Uploads'), array('neq', ''), array('exp', 'IS NOT NULL'), 'AND'),
|
||
'shopimg_id' => 0
|
||
);
|
||
$list = $this->getSelect($map, 'id,shopimg,shopimg_id,merchantid');
|
||
if ($list) {
|
||
$arr = array();
|
||
foreach ($list as $value) {
|
||
$save['shopimg_id'] = $this->addImage($value['shopimg'], $value['merchantid']);
|
||
$this->updateOrder(array('id' => $value['id']), $save);
|
||
$arr[] = $save;
|
||
}
|
||
}
|
||
}
|
||
|
||
protected function addImage($path, $merchant_id)
|
||
{
|
||
$time = time();
|
||
$menu = explode('/', $path);
|
||
$catalog = $menu;
|
||
$catalog = array_splice($catalog, $menu[count($menu) - 1], 1);
|
||
$item = array(
|
||
'merchant_id' => $merchant_id,
|
||
'path' => $path,
|
||
'add_time' => $time, //varchar(20) DEFAULT NULL,
|
||
'storage_type' => 1, //tinyint(1) DEFAULT '1',
|
||
'source_type' => 1, //tinyint(1) DEFAULT '1',
|
||
'name' => $menu[count($menu) - 1], //varchar(100) DEFAULT '',
|
||
'original_name' => $menu[count($menu) - 1], //varchar(255) DEFAULT '',
|
||
'size' => 0, //varchar(20) DEFAULT '',
|
||
'from_name' => '设置门头照', //varchar(50) DEFAULT NULL,
|
||
'from_type_id' => 18, //tinyint(3) DEFAULT '0',
|
||
'user_type' => 3, //tinyint(1) DEFAULT '0'
|
||
'catalog' => implode('/', $catalog), //varchar(255) DEFAULT NULL,
|
||
);
|
||
$id = M('image_gallery')->add($item);
|
||
return $id;
|
||
}
|
||
|
||
/**
|
||
* 获取当前门店的配置数据
|
||
* @param $param
|
||
* merchantid
|
||
* @return mixed
|
||
*/
|
||
public function getStoreListToCredit($where, $field, $desc, $page, $limit)
|
||
{
|
||
$list = $this->alias('s')
|
||
->join('ls_store_config as sc on sc.store_id = s.id', 'LEFT')
|
||
->field($field)
|
||
->where($where)
|
||
->order($desc)
|
||
->page($page, $limit)
|
||
->select();
|
||
|
||
$total = $this->alias('s')
|
||
->join('ls_store_config as sc on sc.store_id = s.id', 'LEFT')
|
||
->where($where)
|
||
->count();
|
||
|
||
$result['list'] = $list;
|
||
$result['total'] = $total;
|
||
return $result;
|
||
}
|
||
} |