1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\api\model\coupon;
- use app\common\library\helper;
- use app\common\model\coupon\CouponRedeemCodes as RedeemCodesModel;
- /**
- * 优惠券生成兑换码记录模型
- * @package app\common\model
- */
- class CouponRedeemCodes extends RedeemCodesModel
- {
- /**
- * 批量添加兑换码
- * @param $data
- * @return bool
- * @throws \Exception
- */
- public function addBatch($data){
- $m = new self();
- $m->saveAll($data);
- return true;
- }
- /**
- * 校验码是否用过
- * @param $code
- * @return bool
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function checkExistedCode($code){
- $m = new self();
- if ($m->where('redeem_code',$code)->find()){
- return true;
- }
- return false;
- }
- }
|