PrizeWin.php 2.3 KB
<?php
namespace app\common\model\serviceapi;
use app\common\model\ServiceApi;

/**
 * 功能描述 华安车险订单信息
 * Class CarOrder
 * @package app\common\model\commapi
 * Date: 2020/7/21
 * Time: 16:33
 * @author nyq
 */
class PrizeWin extends ServiceApi
{
    protected $table = "sos_prize_win";
    protected $pk = "id";

    /**
     * 函数功能描述  获取中奖列表
     * Date: 2020/8/25
     * Time: 16:40
     * @author nyq
     */

    public function getPrizeWin($code,$offset,$rows)
    {

        $user = static::where($code)->limit($offset,$rows)->order('addTime desc')->select();

        return $user;
    }
    /**
     * 函数功能描述  导出数据
     * Date: 2020/8/28
     * Time: 16:40
     * @author nyq
     */

    public function getPrizeWinToExcel($code)
    {
        $user = static::where($code)->select();
        return $user;
    }

    /**
     * 函数功能描述  统计数量
     * Date: 2020/8/25
     * Time: 16:40
     * @author nyq
     */

    public function getPrizeWinCount($code)
    {
        $user = static::where($code)->count();
        return $user;
    }

    /**
     * 函数功能描述 添加奖品
     * Date: 2020/8/25
     * Time: 16:40
     * @author nyq
     */

    public function prizeAdd($data)
    {
        $res = static::insertGetId($data);
        return $res;
    }

    /**
     * 函数功能描述  获取中奖列表 20 条
     * Date: 2020/8/25
     * Time: 16:40
     * @author nyq
     */

    public function getPrizeWinlist($where)
    {
        if (isset($where) && !empty($where)) {
            $user = static::where($where)->select();
        }else{
            $user = static::limit(20)->order('id asc' )->select();
        }
        return $user;
    }
    /**
     * 函数功能描述  兑奖接口
     * @param $where
     * @param $data
     * Date: 2020/8/26
     * Time: 16:47
     * @author nyq
     */

    public function winReset($wheres,$data) {
        $res = static::where($wheres)->update($data);
        return $res;
    }
    /**
     * 函数功能描述  删除抽奖记录
     * @param $where
     * @param $data
     * Date: 2020/8/26
     * Time: 16:47
     * @author nyq
     */

    public function delUser($wheres) {
        $res = static::where($wheres)->delete();
        return $res;
    }


}