You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/models/infoBokunData_model.php

116 lines
2.9 KiB
PHTML

5 years ago
<?php
/**
* 新建infoBokunData表主要是用来保存抓取下来的bokun数据
*
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class InfoBokunData_model extends CI_Model {
public function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
var $ibd_ic_id;
var $ibd_parentId=0;
var $ibd_ItemName;
var $ibd_Itemvalue;
var $ibd_ItemType="";
var $ibd_ItemDescription="";
/**
* @description: 增加一条bokun产品的新附加属性
* @param {type}
* @return:
* @Date Changed:
*/
function Add(){
$sql = "
INSERT INTO [infoBokunData]
([ibd_ic_id]
,[ibd_parentId]
,[ibd_ItemName]
,[ibd_Itemvalue]
,[ibd_ItemType]
,[ibd_ItemDescription])
VALUES
(?,?,?,?,?,?)
";
$query = $this->HT->query($sql,array(
$this->ibd_ic_id,
$this->ibd_parentId,
$this->ibd_ItemName,
(string)$this->ibd_Itemvalue,
$this->ibd_ItemType,
$this->ibd_ItemDescription
));
return $this->HT->query("select max(ibd_id) as ibd_id from infoBokunData")->row("ibd_id") ;
}
/**
* @description: 根据ID更新
* @param {type}
* @return:
* @Date Changed:
*/
function update_byId($ibd_id,$ibd_Itemvalue,$ibd_ItemType,$ibd_ItemDescription){
5 years ago
$sql = "
UPDATE [infoBokunData]
SET [ibd_Itemvalue] = ?
,[ibd_ItemType] = ?
,[ibd_ItemDescription] = ?
WHERE ibd_id=?
";
$query = $this->HT->query($sql,array(
$ibd_Itemvalue,
$ibd_ItemType,
$ibd_ItemDescription,
5 years ago
$ibd_id
));
return $query;
}
/**
* @description: 根据ic_idibd_ItemName 及ibd_ItemType由于图片等可能多个key名称相同所以加个类别
* @param {type}
* @return:
* @Date Changed:
*/
function update(){
}
/**
* @description: 根据ID删除
* @param {type}
* @return:
* @Date Changed:
*/
function delete_byid($ibd_id){
$sql =" delete from infoBokunData where ibd_id =?";
return $this->HT->query($sql,array($ibd_id));
}
/**
* @description: 根据ic_id获取所有的附加属性
* @param {type}
* @return:
* @Date Changed:
*/
function getList($ic_id){
$sql = " select * from infobokundata
where ibd_ic_id = ?
order by case when CHARINDEX('Photo',ibd_itemName)>0 then 999 else 1 end ,ibd_id ";
$query = $this->HT->query($sql,array($ic_id));
return $query->result();
}
5 years ago
}
/* End of file InfoBokunData.php */