123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <?php
- namespace Cas\Dao;
- use KIF\Dao\DBAgileDev;
- /**
- *
- * 抽奖奖品表
- *
- * @author lihuanchun@qq.com
- *
- */
- class LotteryPrize extends DBAgileDev {
- protected $tableName = 'lottery_prize';
-
- /**
- * 数据库里的真实字段
- * @var array
- */
- protected $other_field = array(
- 'events_id',// 所属活动
- 'prize_name',//奖品名称
- 'prize_num',// 奖品数量
- 'prize_winning_num',// 已经抽中的数量
- 'type',// 实物类:1 虚拟类:2
- 'display' // 0 :不显示【关闭】 1:显示【正常】
-
- );
-
- /**
- * PRIZE_DISPLAY_SHOW 显示
- * @var int
- */
- const PRIZE_DISPLAY_SHOW = 1;
- /**
- * PRIZE_DISPLAY_HIDE 隐藏
- * @var int
- */
- const PRIZE_DISPLAY_HIDE = 0;
-
-
- public static $display= array(
- self::PRIZE_DISPLAY_SHOW => array(
- 'desc' => '正常',
- 'kw' => 'PRIZE_DISPLAY_SHOW',
- ),
- self::PRIZE_DISPLAY_HIDE => array(
- 'desc' => '关闭',
- 'kw' => 'PRIZE_DISPLAY_HIDE',
- ),
- );
-
- /**
- * 奖项显示状态
- * @return array
- */
- public static function getDisplay() {
- return self::$display;
- }
-
- /**
- * EXPRESS_TRUE 需要快递
- * @var int
- */
- const EXPRESS_TRUE = 1;
-
- /**
- * EXPRESS_FALSE 不需要快递
- * @var int
- */
- const EXPRESS_FALSE = 2;
-
-
- public static $express= array(
- self::EXPRESS_TRUE => array(
- 'desc' => '需要',
- 'kw' => 'EXPRESS_TRUE',
- ),
- self::EXPRESS_FALSE => array(
- 'desc' => '不需要',
- 'kw' => 'EXPRESS_FALSE',
- ),
- );
- /**
- * 获取是否需要快递
- * @return array
- */
- public static function getExpress(){
- return self::$express;
- }
-
-
-
- /**
- * TYPE_VIRTUAL 实物类
- * @var int
- */
- const TYPE_VIRTUAL = 1;
-
- /**
- * TYPE_ENTITY 虚拟类
- * @var int
- */
- const TYPE_ENTITY = 2;
-
-
- public static $type = array(
- self::TYPE_VIRTUAL => array(
- 'desc' => '实物',
- 'kw' => 'TYPE_VIRTUAL',
- ),
- self::TYPE_ENTITY => array(
- 'desc' => '虚拟',
- 'kw' => 'TYPE_ENTITY',
- )
- );
-
- /**
- * 获取奖项类型:实物类:1 虚拟类:2
- * @return array
- */
- public static function getType() {
- return self::$type;
- }
-
-
- /**
- * 对已抽中的数量进行修改
- */
- public function upPrizeWinningNum($id ,$num){
- $data = $this->get($id);
- $info = array(
- 'prize_winning_num' => $data['prize_winning_num'] + $num
- );
- return $this->modify($info,array('id' => $id));
-
- }
-
- /**
- * 对总数量进行修改
- */
- public function upPrizeNum($id ,$num){
-
- $data = $this->get($id);
- $info = array(
- 'prize_num' => $data['prize_num'] + $num
- );
- return $this->modify($info,array('id' => $id));
- }
-
-
-
- }
|