12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * 商品F码模型
- *
-
- */
- defined('InShopNC') or exit('Access Invalid!');
- class goods_fcodeModel extends Model {
- public function __construct(){
- parent::__construct('goods_fcode');
- }
- /**
- * 插入数据
- *
- * @param unknown $insert
- * @return boolean
- */
- public function addGoodsFCodeAll($insert) {
- return $this->insertAll($insert);
- }
- public function getUsableFcodeCount($mobile) {
- if(empty($mobile)) {
- return 0;
- }
- else {
- return $this->where(['mobile' => $mobile,'usable_time' => ['gt',time()],'fc_state' => 0])->count();
- }
- }
- /**
- * 取得F码列表
- *
- * @param array $condition
- * @param string $order
- */
- public function getGoodsFCodeList($condition, $order = 'fc_state asc,fc_id asc') {
- return $this->where($condition)->order($order)->select();
- }
- public function getFcodeList($condition,$field='*', $order = 'fc_state asc,fc_id asc',$page = 0,$limit = 0, $lock = false)
- {
- return $this->field($field)->where($condition)->page($page)->order($order)->limit($limit)->lock($lock)->select();
- }
-
- /**
- * 删除F码
- */
- public function delGoodsFCode($condition) {
- return $this->where($condition)->delete();
- }
- /**
- * 取得F码
- */
- public function getGoodsFCode($condition,$master=false) {
- return $this->where($condition)->lock($master)->find();
- }
- /**
- * 更新F码
- */
- public function editGoodsFCode($data, $condition) {
- return $this->where($condition)->update($data);
- }
- }
|