12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace app\common\dao\wechat;
- use app\common\dao\BaseDao;
- use app\common\model\BaseModel;
- use app\common\model\wechat\WechatQrcode;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\Model;
- /**
- * Class WechatQrcodeDao
- * @package app\common\dao\wechat
- * @author zfy
- * @day 2020-04-28
- */
- class WechatQrcodeDao extends BaseDao
- {
- /**
- * @return BaseModel
- * @author zfy
- * @day 2020-03-30
- */
- protected function getModel(): string
- {
- return WechatQrcode::class;
- }
- /**
- * @param $ticket
- * @return array|Model|null
- * @throws DataNotFoundException
- * @throws DbException
- * @throws ModelNotFoundException
- * @author zfy
- * @day 2020-04-28
- */
- public function ticketByQrcode($ticket)
- {
- return WechatQrcode::getDB()->where('ticket', $ticket)->find();
- }
- /**
- * @param $type
- * @param $id
- * @return array|Model|null
- * @throws DataNotFoundException
- * @throws DbException
- * @throws ModelNotFoundException
- * @author zfy
- * @day 2020-04-28
- */
- public function getForeverQrcode($type, $id)
- {
- return WechatQrcode::getDB()->where('third_id', $id)->where('third_type', $type)->where('expire_seconds', 0)->find();
- }
- /**
- * @param $type
- * @param $id
- * @return array|Model|null
- * @throws DataNotFoundException
- * @throws DbException
- * @throws ModelNotFoundException
- * @author zfy
- * @day 2020-04-28
- */
- public function getTemporaryQrcode($type, $id)
- {
- return WechatQrcode::getDB()->where('third_id', $id)->where('third_type', $type)->where('expire_seconds', '>', 0)->find();
- }
- }
|