Partner.class.php
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
class Service_Partner extends Lib_Service
{
const ROUTER = 'partner.yohood.partner';
private static $_tag = 'tag_yohood_partner_';
private static $_key = 'key_yohood_partner_';
/**
* 获取所有合作伙伴
*
* @return array
*/
public function getPartner()
{
return self::service(self::ROUTER)->tag(self::$_tag)->fetchAssoc('getPartner');
}
/**
* 增加合作伙伴
*
* @param int $type
* @param string $name
* @param string $pic
* @param string $url
* @param string $description
* @return int
*/
public function setPartner($type, $name, $pic, $url, $description)
{
$params = array('name' => $name, 'pic' => $pic, 'url' => $url, 'description'=> $description,'type' => $type);
$status = self::service(self::ROUTER)->cache(false)->insert('setPartner', $params)->lastInsertId();
if($status)
{
self::service(self::ROUTER)->delTags(self::$_tag);
}
return $status;
}
/**
* 修改合作伙伴
*
* @param int $id
* @param int $type
* @param string $name
* @param string $pic
* @param string $url
* @param string $description
* @return boolean
*/
public function setPartnerById($id, $type, $name, $pic, $url, $description)
{
$params = array('name' => $name, 'type'=> $type,'pic' => $pic, 'url' => $url, 'description'=> $description, 'id'=> $id);
$status = self::service(self::ROUTER)->cache(false)->update('setPartnerById', $params)->status();
if($status)
{
self::service(self::ROUTER)->delTags(self::$_tag);
}
return $status;
}
/**
* 删除合作伙伴
*
* @param int $id
* @return boolean
*/
public function delPartner($id)
{
$status = self::service(self::ROUTER)->cache(false)->delete('delPartner', array('id'=> $id))->status();
if($status)
{
self::service(self::ROUTER)->delTags(self::$_tag);
}
return $status;
}
}