CouponModel.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Author: luzheng.liu
  4. * Time: 2020/9/18 18:01
  5. */
  6. namespace app\common\model\sqlsev;
  7. use app\common\service\HelperService;
  8. use app\cron\controller\MigrateData;
  9. class CouponModel extends sqlSerModel {
  10. protected $table = 'tabPromoConfig';
  11. //select * from tabPromoConfig where strHQCode='126' and blnState=0 and strPromoMode='Coupon' and strCouponTypeCode='1001'
  12. /**
  13. * 获取现金券
  14. * @return mixed
  15. * @throws \think\db\exception\DataNotFoundException
  16. * @throws \think\db\exception\ModelNotFoundException
  17. * @throws \think\exception\DbException
  18. */
  19. public function getCoupon() {
  20. $rs = $this->where(['strHQCode' => MigrateData::BX, 'blnState' => 0, 'strPromoMode' => 'Coupon', 'strCouponTypeCode' => 1001,
  21. ])->order(['intPromoConfigID' => 'asc'])->select();
  22. return HelperService::object2Arr($rs);
  23. }
  24. /**
  25. * 获取产品券
  26. * @return mixed
  27. * @throws \think\db\exception\DataNotFoundException
  28. * @throws \think\db\exception\ModelNotFoundException
  29. * @throws \think\exception\DbException
  30. */
  31. public function getProductCoupon() {
  32. $rs = $this->where(['strHQCode' => MigrateData::BX, 'blnState' => 0, 'strPromoMode' => 'Coupon', 'strCouponTypeCode' => 1002,
  33. ])->order(['intPromoConfigID' => 'asc'])->select();
  34. return HelperService::object2Arr($rs);
  35. }
  36. }