文件
mashangyoujiu/Application/Common/Model/WxSourceModel.class.php

73 行
1.9 KiB
PHP
可执行文件

<?php
/**
* 微信素材模型 - 数据对象模型
* @version LV1.0
*/
namespace Common\Model;
use Think\Model;
class WxSourceModel extends Model {
protected $tableName = 'wxsource';
protected $fields = array (
0 => "id",//int(11) NOT NULL AUTO_INCREMENT,
1 => "media_id",//varchar(32) DEFAULT NULL COMMENT '文章素材id',
2 => "create_time",// varchar(11) DEFAULT 创建时间,
3 => "update_time",// varchar(11) DEFAULT 修改时间,
4 => "addtime",// varchar(11) DEFAULT 服务器创建时间,
5 => "merchantid",// varchar(11) DEFAULT 商户id,
6 => "type",// smallint(1) DEFAULT NULL COMMENT '类型 1:微信素材 2:服务器素材文件',
);
/** 删除素材模型
* @param $map
* @return mixed
*/
public function del_source($map){
$re = $this->where($map)->delete();
return $re;
}
/** 获取素材列表信息
* @param $where
*/
public function getList($where){
$re = $this->alias('s')
->where($where)
->order('update_time desc')
->select();
return $re;
}
/**
* 从微信服务器添加微信素材
*/
public function addsource($data){
$re = $this->add($data);
return $re;
}
/**
* 修改本地素材参数
*/
public function saveSource($where,$data){
$re = $this->where($where)->save($data);
return $re;
}
/** 通过id 寻找微信素材信息
* @param $media_id
*/
public function getSource($media_id){
$map['media_id'] = $media_id;
$cache = $this->where($map)->find();
return $cache;
}
/** 通过条件寻找微信素材信息
* @param $media_id
*/
public function getSourceInfo($map){
$cache = $this->where($map)->find();
return $cache;
}
}