public function checkAdd(&$model, array $param) { if (Validate::isNullStr($_POST['name'])) { $this->message[] = '物流公司名称不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['url'])) { $this->message[] = '物流公司网址不得为空'; $this->flag = false; } if (Validate::checkStrLength($_POST['url'], 40, 'max')) { $this->message[] = '品牌网址不得大于40位'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_in'])) { $this->message[] = '省内起步费用必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_out'])) { $this->message[] = '省外起步费用必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_add'])) { $this->message[] = '额外费用必须为数字'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '该物流公司已被占用'; $this->flag = false; } return $this->flag; }
public function isShow() { if (!Validate::isNullStr($this->R['id']) && !Validate::isNullStr($this->R['act'])) { if ($this->R['act'] == 'yes') { return parent::update(array("id='{$this->R['id']}'"), array('state' => '1')); } elseif ($this->R['act'] == 'no') { return parent::update(array("id='{$this->R['id']}'"), array('state' => '0')); } } }
public function checkAdd(&$model, array $param) { if (Validate::isNullStr($_POST['name'])) { $this->message[] = '商品名不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['nav'])) { $this->message[] = '种类不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['sn'])) { $this->message[] = '编号不得为空'; $this->flag = false; } if (!Validate::isNumeric($_POST['weight'])) { $this->message[] = '商品重量必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_sale'])) { $this->message[] = '商品销售价必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_market'])) { $this->message[] = '商品成本价必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['price_cost'])) { $this->message[] = '商品成本价必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['inventory'])) { $this->message[] = '库存必须为数字'; $this->flag = false; } if (!Validate::isNumeric($_POST['warn_inventory'])) { $this->message[] = '库存告急必须为数字'; $this->flag = false; } if (Validate::checkStrLength($_POST['name'], 20, 'max')) { $this->message[] = '商品名不得大于20位'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '商品已被占用'; $this->flag = false; } return $this->flag; }
public function checkUpdate(&$model) { if (Validate::isNullStr($_POST['link'])) { $this->message[] = '链接地址不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['thumb'])) { $this->message[] = '图片地址不得为空'; $this->flag = false; } if (Validate::checkStrLength($_POST['link'], 40, 'max')) { $this->message[] = '链接地址不得大于50位'; $this->flag = false; } return $this->flag; }
public function checkAdd(&$model, array $param) { if (Validate::isNullStr($_POST['content'])) { $this->message[] = '评论内容不得为空'; $this->flag = false; } if (Validate::checkStrLength($_POST['content'], 200, 'max')) { $this->message[] = '评论内容不得大于200字'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '一个订单只能评论一次'; $this->flag = false; } return $this->flag; }
public function checkUpdate(&$model) { if (Validate::checkStrLength($_POST['pwd'], 6, 'min')) { $this->message[] = '密码不得小于6位'; $this->flag = false; } if (Validate::isNullStr($_POST['pwd'])) { $this->message[] = '密码不得为空'; $this->flag = false; } if (!Validate::checkStrEquals($_POST['pwd'], $_POST['notpwd'])) { $this->message[] = '密码和确认码必须一致'; $this->flag = false; } if (Validate::isNullStr($_POST['level'])) { $this->message[] = '管理员等级不得为空'; $this->flag = false; } return $this->flag; }
public function checkUpdate(&$model) { if (Validate::isNullStr($_POST['url'])) { $this->message[] = '品牌网址不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['type'])) { $this->message[] = '品牌类型不得为空'; $this->flag = false; } if (Validate::checkStrLength($_POST['info'], 200, 'max')) { $this->message[] = '品牌简介不得大于20位'; $this->flag = false; } if (Validate::checkStrLength($_POST['url'], 40, 'max')) { $this->message[] = '品牌网址不得大于20位'; $this->flag = false; } return $this->flag; }
public function checkAdd(&$model, array $param) { if (Validate::checkStrLength($_POST['name'], 20, 'max')) { $this->message[] = '售后服务名称不得超过20位'; $this->flag = false; } if (Validate::isNullStr($_POST['name'])) { $this->message[] = '售后服务名称不得为空'; $this->flag = false; } if (Validate::isNullStr($_POST['content'])) { $this->message[] = '售后服务内容不得为空'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '该售后服务已被占用'; $this->flag = false; } return $this->flag; }
public function checkAdd(&$model, array $param) { if (Validate::checkStrLength($_POST['name'], 2, 'min')) { $this->message[] = '属性名长度不得小于2位'; $this->flag = false; } if (Validate::isNullStr($_POST['name'])) { $this->message[] = '属性名不得为空'; $this->flag = false; } if (Validate::checkStrLength($_POST['name'], 4, 'max')) { $this->message[] = '属性名长度不得大于4位'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '属性名已被占用'; $this->flag = false; } return $this->flag; }
public function checkAdd(&$model, array $param) { if (Validate::isNullStr($_POST['name'])) { $this->message[] = '收货人长度不得小于2位'; $this->flag = false; } if (!Validate::isLength($_POST['code'], 6)) { $this->message[] = '邮政编码必须为6位'; $this->flag = false; } if (Validate::checkStrLength($_POST['name'], 20, 'max')) { $this->message[] = '收货人不得大于20位'; $this->flag = false; } if (!Validate::checkEmail($_POST['email'])) { $this->message[] = '邮箱格式不正确'; $this->flag = false; } if ($model->isOne($param)) { $this->message[] = '收货人已被占用'; $this->flag = false; } return $this->flag; }
public function getListGoods() { $id = $this->getId(); $priceSql = ''; $attrSql = ''; $brandSql = ''; $attrSql = ''; if ($this->R['price']) { $priceSql = 'AND price_sale BETWEEN ' . str_replace(',', ' AND ', $this->R['price']); } if ($this->R['brand']) { $brandSql = ' AND brand=' . $this->R['brand']; } if ($this->R['attr']) { // $attrSql =str_replace('-', '%', $this->R['attr']); // $attrSql =" AND attr LIKE '%$attrSql%'"; $temp = explode('-', $this->R['attr']); foreach ($temp as $key => $value) { $attrSql .= " AND attr LIKE '%{$value}%' "; } } $this->tables = array(DB_FREFIX . 'goods g'); $allGoods = parent::select(array('id', 'name', 'thumb', 'price_sale', 'price_market', 'unit', 'sale_count', 'thumb_small', 'nav', '(SELECT COUNT(*) FROM mall_commend c WHERE c.goods_id=g.id) AS count'), array('where' => array("nav IN ('{$id}') {$priceSql} {$brandSql} {$attrSql}", 'is_up=1'), 'order' => 'date DESC', 'limit' => $this->limit)); $this->tables = array(DB_FREFIX . 'goods'); foreach ($allGoods as $value) { if (Validate::isNullStr($value->thumb_small)) { $img = new Image($value->thumb); $img->thumb(220, 220); $img->outImage('220x220'); parent::update(array("id='{$value->id}'"), array('thumb_small' => $img->getPath())); $value->thumb_small = $img->getPath(); } } return $allGoods; }